LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
IEditorWidget Class Referenceabstract

Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor(). More...

#include "itexteditor.h"

Public Member Functions

virtual ~IEditorWidget ()
 
virtual QString GetContents (LC::ContentType type) const =0
 Returns the editor contents for the given type. More...
 
virtual void SetContents (QString contents, LC::ContentType type)=0
 Sets contents of this widget interpreted as of the given type. More...
 
virtual QAction * GetEditorAction (LC::EditorAction action)=0
 Returns a standard editor action. More...
 
virtual void AppendAction (QAction *action)=0
 Adds a custom action to the editor toolbar, if any. More...
 
virtual void AppendSeparator ()=0
 Appens an empty separator action to the editor toolbar. More...
 
virtual void RemoveAction (QAction *action)=0
 Removes a custom action from the editor. More...
 
virtual void SetBackgroundColor (const QColor &color, LC::ContentType editor)=0
 Sets the background color of the editor to color. More...
 
virtual QWidget * GetWidget ()=0
 Returns this editor as a QWidget. More...
 
virtual QObject * GetQObject ()=0
 Returns this editor as a QObject. More...
 

Protected Member Functions

virtual void textChanged ()=0
 Notifies about contents changes. More...
 

Detailed Description

Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor().

HTML content can be considered as either HTML (taking all the markup into account) or just plain text (without all the markup, just the user-visible characters). The type parameter to GetContents() and SetContents() methods toggles the way HTML content is considered.

In general, ContentType::HTML type is used when the caller considers the contents as HTML-enabled, and ContentType::PlainText otherwise.

A text editor widget may also implement IAdvancedHTMLEditor and IAdvancedPlainTextEditor if it supports the functionality required by those interfaces.

For an HTML editor to expose configurable fonts, it should implement IWkFontsSettable.

See also
IAdvancedHTMLEditor
IAdvancedPlainTextEditor
IWkFontsSettable

Definition at line 75 of file itexteditor.h.

Constructor & Destructor Documentation

◆ ~IEditorWidget()

virtual IEditorWidget::~IEditorWidget ( )
inlinevirtual

Definition at line 78 of file itexteditor.h.

Member Function Documentation

◆ AppendAction()

virtual void IEditorWidget::AppendAction ( QAction *  action)
pure virtual

Adds a custom action to the editor toolbar, if any.

This function adds a custom action to the editor toolbar, if the widget has any. Ownershit is not passed to the editor. The action can be later removed by RemoveAction().

Parameters
[in]actionThe custom action to add.
See also
RemoveAction()

◆ AppendSeparator()

virtual void IEditorWidget::AppendSeparator ( )
pure virtual

Appens an empty separator action to the editor toolbar.

◆ GetContents()

virtual QString IEditorWidget::GetContents ( LC::ContentType  type) const
pure virtual

Returns the editor contents for the given type.

Returns the contents of this widget according to type.

For example, for a WYSIWYG text editor widget with HTML contents

<h1>header</h1>

this function should return

header

for ContentType::PlainText (prerendering the text in a sense) and

<h1>header</h1>

for ContentType::HTML.

Parameters
[in]typeHow contents should be interpreted and returned.
Returns
The editor contents interpreted according to type.
See also
SetContents()

◆ GetEditorAction()

virtual QAction* IEditorWidget::GetEditorAction ( LC::EditorAction  action)
pure virtual

Returns a standard editor action.

Returns the given standard editor action or null if no such action is available. Ownership is not passed to the caller.

Parameters
[in]actionThe standard action to return.
Returns
The action or null if not available.

◆ GetQObject()

virtual QObject* IEditorWidget::GetQObject ( )
pure virtual

Returns this editor as a QObject.

Returns
This editor as a QObject.

◆ GetWidget()

virtual QWidget* IEditorWidget::GetWidget ( )
pure virtual

Returns this editor as a QWidget.

Returns
This editor as a QWidget.

◆ RemoveAction()

virtual void IEditorWidget::RemoveAction ( QAction *  action)
pure virtual

Removes a custom action from the editor.

This function removes a custom action previously added by AppendAction().

Parameters
[in]actionAn action previously added by AppendAction().
See also
AppendAction()

◆ SetBackgroundColor()

virtual void IEditorWidget::SetBackgroundColor ( const QColor &  color,
LC::ContentType  editor 
)
pure virtual

Sets the background color of the editor to color.

This function sets the background color of the editor of the given content-type to the given color.

If the widget doesn't support the given content-type, this function does nothing.

Parameters
[in]colorThe new background color.
[in]editorThe editor to change color of.

◆ SetContents()

virtual void IEditorWidget::SetContents ( QString  contents,
LC::ContentType  type 
)
pure virtual

Sets contents of this widget interpreted as of the given type.

Sets the contents of this widget to contents according to contents. If type is ContentType::HTML the contents should be interpreted as rich text, while if type is ContentType::PlainText the contents should be interpreted as plain text. That is,

<h1>header</h1>

should be shown as a big h1 header in the first case and as is, with tags, in the second.

Another example is a string like

<p>

, which should be kept as is by an HTML editor if the type is ContentType::HTML, but converted to

&lt;p>

if the type is ContentType::PlainText.

Parameters
[in]contentsThe new contents of this widget.
[in]typeThe type of the contents.
See also
GetContents()

◆ textChanged()

virtual void IEditorWidget::textChanged ( )
protectedpure virtual

Notifies about contents changes.

This signal is emitted each time contents of this editor widget change.


The documentation for this class was generated from the following file: