LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
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  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <QVariantMap>
33 
34 class QWidget;
35 class QString;
36 class QAction;
37 class QColor;
38 
39 namespace LeechCraft
40 {
43  enum class ContentType
44  {
48  HTML,
49 
52  PlainText
53  };
54 
62  enum class EditorAction
63  {
66  Find,
67 
70  Replace,
71 
74  Bold,
75 
78  Italic,
79 
82  Underline,
83 
86  InsertLink,
87 
91 
95  };
96 }
97 
120 class Q_DECL_EXPORT IEditorWidget
121 {
122 public:
123  virtual ~IEditorWidget () {}
124 
140  virtual QString GetContents (LeechCraft::ContentType type) const = 0;
141 
162  virtual void SetContents (QString contents, LeechCraft::ContentType type) = 0;
163 
172  virtual QAction* GetEditorAction (LeechCraft::EditorAction action) = 0;
173 
184  virtual void AppendAction (QAction *action) = 0;
185 
188  virtual void AppendSeparator () = 0;
189 
199  virtual void RemoveAction (QAction *action) = 0;
200 
212  virtual void SetBackgroundColor (const QColor& color, LeechCraft::ContentType editor) = 0;
213 
218  virtual QWidget* GetWidget () = 0;
219 
224  virtual QObject* GetQObject () = 0;
225 protected:
231  virtual void textChanged () = 0;
232 };
233 
243 class Q_DECL_EXPORT ITextEditor
244 {
245 public:
246  virtual ~ITextEditor () {}
247 
257  virtual bool SupportsEditor (LeechCraft::ContentType type) const = 0;
258 
273  virtual QWidget* GetTextEditor (LeechCraft::ContentType type) = 0;
274 };
275 
276 Q_DECLARE_INTERFACE (IEditorWidget, "org.Deviant.LeechCraft.IEditorWidget/1.0")
277 Q_DECLARE_INTERFACE (ITextEditor, "org.Deviant.LeechCraft.ITextEditor/1.0")
Toggle underlining of the selected text&#39;s font.
Open "Find" dialog.
virtual ~ITextEditor()
Definition: itexteditor.h:246
Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor().
Definition: itexteditor.h:120
Open the dialog for inserting a hyperlink.
EditorAction
Enumeration for some standard editor actions.
Definition: itexteditor.h:62
Toggle the italicness of the selected text&#39;s font.
Open "Replace" dialog.
Interface for plugins implementing a text editor component.
Definition: itexteditor.h:243
virtual ~IEditorWidget()
Definition: itexteditor.h:123
Toggle between WYSIWYG and source view, if applicable.
Open the dialog for inserting an image.
Toggle the boldness of the selected text&#39;s font.