![]() |
LeechCraft
%{LEECHCRAFT_VERSION}
Modular cross-platform feature rich live environment.
|
Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor(). More...
#include "itexteditor.h"
Public Member Functions | |
virtual | ~IEditorWidget () |
virtual QString | GetContents (LeechCraft::ContentType type) const =0 |
Returns the editor contents for the given type. More... | |
virtual void | SetContents (QString contents, LeechCraft::ContentType type)=0 |
Sets contents of this widget interpreted as of the given type. More... | |
virtual QAction * | GetEditorAction (LeechCraft::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 |
virtual void | RemoveAction (QAction *action)=0 |
Removes a custom action from the editor. More... | |
virtual void | SetBackgroundColor (const QColor &color, LeechCraft::ContentType editor)=0 |
Sets the background color of the editor to color. More... | |
Protected Member Functions | |
virtual void | textChanged ()=0 |
Notifies about contents changes. More... | |
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 if it supports the functionality required by that interface.
Definition at line 90 of file itexteditor.h.
|
inlinevirtual |
Definition at line 93 of file itexteditor.h.
|
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().
[in] | action | The custom action to add. |
|
pure virtual |
|
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
this function should return
for ContentType::PlainText (prerendering the text in a sense) and
for ContentType::HTML.
[in] | type | How contents should be interpreted and returned. |
|
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.
[in] | action | The standard action to return. |
|
pure virtual |
Removes a custom action from the editor.
This function removes a custom action previously added by AppendAction().
[in] | action | An action previously added by AppendAction(). |
|
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.
[in] | color | The new background color. |
[in] | editor | The editor to change color of. |
|
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,
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
, which should be kept as is by an HTML editor if the type is ContentType::HTML, but converted to
if the type is ContentType::PlainText.
[in] | contents | The new contents of this widget. |
[in] | type | The type of the contents. |
|
protectedpure virtual |
Notifies about contents changes.
This signal is emitted each time contents of this editor widget change.