LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
itexteditor.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QVariantMap>
12
13class QWidget;
14class QString;
15class QAction;
16class QColor;
17
18namespace LC
19{
22 enum class ContentType
23 {
27 HTML,
28
32 };
33
41 enum class EditorAction
42 {
45 Find,
46
49 Replace,
50
53 Bold,
54
57 Italic,
58
62
66
70
74 };
75}
76
99class Q_DECL_EXPORT IEditorWidget
100{
101public:
102 virtual ~IEditorWidget () {}
103
119 virtual QString GetContents (LC::ContentType type) const = 0;
120
141 virtual void SetContents (QString contents, LC::ContentType type) = 0;
142
151 virtual QAction* GetEditorAction (LC::EditorAction action) = 0;
152
163 virtual void AppendAction (QAction *action) = 0;
164
167 virtual void AppendSeparator () = 0;
168
178 virtual void RemoveAction (QAction *action) = 0;
179
191 virtual void SetBackgroundColor (const QColor& color, LC::ContentType editor) = 0;
192
197 virtual QWidget* GetWidget () = 0;
198
203 virtual QObject* GetQObject () = 0;
204protected:
210 virtual void textChanged () = 0;
211};
212
222class Q_DECL_EXPORT ITextEditor
223{
224public:
225 virtual ~ITextEditor () {}
226
236 virtual bool SupportsEditor (LC::ContentType type) const = 0;
237
252 virtual QWidget* GetTextEditor (LC::ContentType type) = 0;
253};
254
255Q_DECLARE_INTERFACE (IEditorWidget, "org.Deviant.LeechCraft.IEditorWidget/1.0")
256Q_DECLARE_INTERFACE (ITextEditor, "org.Deviant.LeechCraft.ITextEditor/1.0")
Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor().
Definition: itexteditor.h:100
virtual QAction * GetEditorAction(LC::EditorAction action)=0
Returns a standard editor action.
virtual QWidget * GetWidget()=0
Returns this editor as a QWidget.
virtual void AppendAction(QAction *action)=0
Adds a custom action to the editor toolbar, if any.
virtual QObject * GetQObject()=0
Returns this editor as a QObject.
virtual void RemoveAction(QAction *action)=0
Removes a custom action from the editor.
virtual void textChanged()=0
Notifies about contents changes.
virtual void AppendSeparator()=0
Appens an empty separator action to the editor toolbar.
virtual ~IEditorWidget()
Definition: itexteditor.h:102
virtual QString GetContents(LC::ContentType type) const =0
Returns the editor contents for the given type.
virtual void SetContents(QString contents, LC::ContentType type)=0
Sets contents of this widget interpreted as of the given type.
virtual void SetBackgroundColor(const QColor &color, LC::ContentType editor)=0
Sets the background color of the editor to color.
Interface for plugins implementing a text editor component.
Definition: itexteditor.h:223
virtual QWidget * GetTextEditor(LC::ContentType type)=0
Creates and returns a new text editor for the given type.
virtual bool SupportsEditor(LC::ContentType type) const =0
Whether this editor plugin supports editing the content type.
virtual ~ITextEditor()
Definition: itexteditor.h:225
Definition: constants.h:15
ContentType
Definition: itexteditor.h:23
EditorAction
Enumeration for some standard editor actions.
Definition: itexteditor.h:42
@ Replace
Open "Replace" dialog.
@ Bold
Toggle the boldness of the selected text's font.
@ Italic
Toggle the italicness of the selected text's font.
@ ToggleView
Toggle between WYSIWYG and source view, if applicable.
@ Find
Open "Find" dialog.
@ Underline
Toggle underlining of the selected text's font.
@ InsertLink
Open the dialog for inserting a hyperlink.
@ InsertImage
Open the dialog for inserting an image.