KTextEditor
commandinterface.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2005 Christoph Cullmann (cullmann@kde.org) 00003 Copyright (C) 2005-2006 Dominik Haumann (dhdev@gmx.de) 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H 00022 #define KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H 00023 00024 #include <ktexteditor/ktexteditor_export.h> 00025 #include <QtCore/QObject> 00026 00027 class QStringList; 00028 class KCompletion; 00029 00030 namespace KTextEditor 00031 { 00032 00033 class Editor; 00034 class View; 00035 00070 class KTEXTEDITOR_EXPORT Command 00071 { 00072 public: 00076 virtual ~Command () {} 00077 00078 public: 00086 virtual const QStringList &cmds () = 0; 00087 00098 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg) = 0; 00099 00107 virtual bool help (KTextEditor::View *view, const QString &cmd, QString &msg) = 0; 00108 }; 00109 00132 class KTEXTEDITOR_EXPORT CommandExtension 00133 { 00134 public: 00138 virtual ~CommandExtension() {} 00139 //### this is yet to be tried 00151 virtual void flagCompletions( QStringList&list ) = 0; 00152 00165 virtual KCompletion *completionObject( KTextEditor::View *view, 00166 const QString & cmdname ) = 0; 00167 00182 virtual bool wantsToProcessText( const QString &cmdname ) = 0; 00183 // ### yet to be tested. The obvious candidate is isearch. 00191 virtual void processText( KTextEditor::View *view, const QString &text ) = 0; 00192 }; 00193 00227 class KTEXTEDITOR_EXPORT CommandInterface 00228 { 00229 public: 00233 virtual ~CommandInterface () {} 00234 00235 public: 00244 virtual bool registerCommand (Command *cmd) = 0; 00245 00254 virtual bool unregisterCommand (Command *cmd) = 0; 00255 00263 virtual Command *queryCommand (const QString &cmd) const = 0; 00264 00270 virtual QList<Command*> commands() const = 0; 00271 00277 virtual QStringList commandList() const = 0; 00278 }; 00279 00280 } 00281 00282 Q_DECLARE_INTERFACE(KTextEditor::CommandInterface, "org.kde.KTextEditor.CommandInterface") 00283 00284 #endif 00285 00286 // kate: space-indent on; indent-width 2; replace-tabs on;