LeechCraft  0.6.70-15082-g543737046d
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  * 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 
13 class QWidget;
14 class QString;
15 class QAction;
16 class QColor;
17 
18 namespace LC
19 {
22  enum class ContentType
23  {
27  HTML,
28 
31  PlainText
32  };
33 
41  enum class EditorAction
42  {
45  Find,
46 
49  Replace,
50  };
51 }
52 
75 class Q_DECL_EXPORT IEditorWidget
76 {
77 public:
78  virtual ~IEditorWidget () {}
79 
95  virtual QString GetContents (LC::ContentType type) const = 0;
96 
117  virtual void SetContents (QString contents, LC::ContentType type) = 0;
118 
127  virtual QAction* GetEditorAction (LC::EditorAction action) = 0;
128 
139  virtual void AppendAction (QAction *action) = 0;
140 
143  virtual void AppendSeparator () = 0;
144 
154  virtual void RemoveAction (QAction *action) = 0;
155 
167  virtual void SetBackgroundColor (const QColor& color, LC::ContentType editor) = 0;
168 
173  virtual QWidget* GetWidget () = 0;
174 
179  virtual QObject* GetQObject () = 0;
180 protected:
186  virtual void textChanged () = 0;
187 };
188 
198 class Q_DECL_EXPORT ITextEditor
199 {
200 public:
201  virtual ~ITextEditor () {}
202 
212  virtual bool SupportsEditor (LC::ContentType type) const = 0;
213 
228  virtual QWidget* GetTextEditor (LC::ContentType type) = 0;
229 };
230 
231 Q_DECLARE_INTERFACE (IEditorWidget, "org.Deviant.LeechCraft.IEditorWidget/1.0")
232 Q_DECLARE_INTERFACE (ITextEditor, "org.Deviant.LeechCraft.ITextEditor/1.0")
ITextEditor
Interface for plugins implementing a text editor component.
Definition: itexteditor.h:198
LC::EditorAction
EditorAction
Enumeration for some standard editor actions.
Definition: itexteditor.h:41
LC::EditorAction::Find
@ Find
Open "Find" dialog.
IEditorWidget::~IEditorWidget
virtual ~IEditorWidget()
Definition: itexteditor.h:78
LC::EditorAction::Replace
@ Replace
Open "Replace" dialog.
ITextEditor::~ITextEditor
virtual ~ITextEditor()
Definition: itexteditor.h:201
LC::ContentType::PlainText
@ PlainText
IEditorWidget
Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor().
Definition: itexteditor.h:75
LC::ContentType
ContentType
Definition: itexteditor.h:22
LC
Definition: constants.h:14
LC::ContentType::HTML
@ HTML