LeechCraft 0.6.70-17609-g3dde4097dd
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 {
28
32 };
33
41 enum class EditorAction
42 {
46
50 };
51}
52
75class Q_DECL_EXPORT IEditorWidget
76{
77public:
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;
180protected:
186 virtual void textChanged () = 0;
187};
188
198class Q_DECL_EXPORT ITextEditor
199{
200public:
201 virtual ~ITextEditor () {}
202
212 virtual bool SupportsEditor (LC::ContentType type) const = 0;
213
228 virtual QWidget* GetTextEditor (LC::ContentType type) = 0;
229};
230
231Q_DECLARE_INTERFACE (IEditorWidget, "org.Deviant.LeechCraft.IEditorWidget/1.0")
232Q_DECLARE_INTERFACE (ITextEditor, "org.Deviant.LeechCraft.ITextEditor/1.0")
Interface to be implemented by editor widgets returned from ITextEditor::GetTextEditor().
Definition itexteditor.h:76
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:78
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.
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 constants.h:15
ContentType
Definition itexteditor.h:23
EditorAction
Enumeration for some standard editor actions.
Definition itexteditor.h:42
@ Replace
Open "Replace" dialog.
Definition itexteditor.h:49
@ Find
Open "Find" dialog.
Definition itexteditor.h:45