KTextEditor
commandinterface.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H
00023 #define KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H
00024
00025 #include <ktexteditor/ktexteditor_export.h>
00026 #include <ktexteditor/range.h>
00027 #include <QtCore/QObject>
00028
00029 class QStringList;
00030 class KCompletion;
00031
00032 namespace KTextEditor
00033 {
00034
00035 class Editor;
00036 class View;
00037
00076 class KTEXTEDITOR_EXPORT Command
00077 {
00078 public:
00082 virtual ~Command () {}
00083
00084 public:
00092 virtual const QStringList &cmds () = 0;
00093
00104 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg) = 0;
00105
00113 virtual bool help (KTextEditor::View *view, const QString &cmd, QString &msg) = 0;
00114 };
00115
00138 class KTEXTEDITOR_EXPORT CommandExtension
00139 {
00140 public:
00144 virtual ~CommandExtension() {}
00145
00157 virtual void flagCompletions( QStringList&list ) = 0;
00158
00171 virtual KCompletion *completionObject( KTextEditor::View *view,
00172 const QString & cmdname ) = 0;
00173
00188 virtual bool wantsToProcessText( const QString &cmdname ) = 0;
00189
00197 virtual void processText( KTextEditor::View *view, const QString &text ) = 0;
00198 };
00199
00233 class KTEXTEDITOR_EXPORT CommandInterface
00234 {
00235 public:
00239 virtual ~CommandInterface () {}
00240
00241 public:
00250 virtual bool registerCommand (Command *cmd) = 0;
00251
00260 virtual bool unregisterCommand (Command *cmd) = 0;
00261
00269 virtual Command *queryCommand (const QString &cmd) const = 0;
00270
00276 virtual QList<Command*> commands() const = 0;
00277
00283 virtual QStringList commandList() const = 0;
00284 };
00285
00306 class KTEXTEDITOR_EXPORT RangeCommand
00307 {
00308 public:
00312 virtual ~RangeCommand() {}
00313
00320 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg,
00321 const KTextEditor::Range &range) = 0;
00322
00331 virtual bool supportsRange (const QString &cmd) = 0;
00332 };
00333
00334 }
00335
00336 Q_DECLARE_INTERFACE(KTextEditor::CommandInterface, "org.kde.KTextEditor.CommandInterface")
00337
00338 #endif
00339
00340