• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • interfaces
  • ktexteditor
commandinterface.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 2005 Christoph Cullmann (cullmann@kde.org)
3 Copyright (C) 2005-2006 Dominik Haumann (dhdev@gmx.de)
4 Copyright (C) 2008 Erlend Hamberg (ehamberg@gmail.com)
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H
23#define KDELIBS_KTEXTEDITOR_COMMANDINTERFACE_H
24
25#include <ktexteditor/ktexteditor_export.h>
26#include <ktexteditor/range.h>
27#include <QtCore/QObject>
28
29class QStringList;
30class KCompletion;
31
32namespace KTextEditor
33{
34
35class Editor;
36class View;
37
76class KTEXTEDITOR_EXPORT Command
77{
78 public:
82 virtual ~Command () {}
83
84 public:
92 virtual const QStringList &cmds () = 0;
93
104 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg) = 0;
105
113 virtual bool help (KTextEditor::View *view, const QString &cmd, QString &msg) = 0;
114};
115
138class KTEXTEDITOR_EXPORT CommandExtension
139{
140 public:
144 virtual ~CommandExtension() {}
145 //### this is yet to be tried
157 virtual void flagCompletions( QStringList&list ) = 0;
158
171 virtual KCompletion *completionObject( KTextEditor::View *view,
172 const QString & cmdname ) = 0;
173
188 virtual bool wantsToProcessText( const QString &cmdname ) = 0;
189 // ### yet to be tested. The obvious candidate is isearch.
197 virtual void processText( KTextEditor::View *view, const QString &text ) = 0;
198};
199
233class KTEXTEDITOR_EXPORT CommandInterface
234{
235 public:
239 virtual ~CommandInterface () {}
240
241 public:
250 virtual bool registerCommand (Command *cmd) = 0;
251
260 virtual bool unregisterCommand (Command *cmd) = 0;
261
269 virtual Command *queryCommand (const QString &cmd) const = 0;
270
276 virtual QList<Command*> commands() const = 0;
277
283 virtual QStringList commandList() const = 0;
284};
285
306class KTEXTEDITOR_EXPORT RangeCommand
307{
308 public:
312 virtual ~RangeCommand() {}
313
320 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg,
321 const KTextEditor::Range &range) = 0;
322
331 virtual bool supportsRange (const QString &cmd) = 0;
332};
333
334}
335
336Q_DECLARE_INTERFACE(KTextEditor::CommandInterface, "org.kde.KTextEditor.CommandInterface")
337
338#endif
339
340// kate: space-indent on; indent-width 2; replace-tabs on;
KCompletion
KTextEditor::CommandExtension
Extension interface for a Command.
Definition: commandinterface.h:139
KTextEditor::CommandExtension::processText
virtual void processText(KTextEditor::View *view, const QString &text)=0
This is called by the command line each time the argument text for the command changed,...
KTextEditor::CommandExtension::completionObject
virtual KCompletion * completionObject(KTextEditor::View *view, const QString &cmdname)=0
Return a KCompletion object that will substitute the command line default one while typing the first ...
KTextEditor::CommandExtension::wantsToProcessText
virtual bool wantsToProcessText(const QString &cmdname)=0
Check, whether the command wants to process text interactively for the given command with name cmdnam...
KTextEditor::CommandExtension::~CommandExtension
virtual ~CommandExtension()
Virtual destructor.
Definition: commandinterface.h:144
KTextEditor::CommandExtension::flagCompletions
virtual void flagCompletions(QStringList &list)=0
Fill in a list of flags to complete from.
KTextEditor::CommandInterface
Command extension interface for the Editor.
Definition: commandinterface.h:234
KTextEditor::CommandInterface::~CommandInterface
virtual ~CommandInterface()
Virtual destructor.
Definition: commandinterface.h:239
KTextEditor::CommandInterface::commands
virtual QList< Command * > commands() const =0
Get a list of all registered commands.
KTextEditor::CommandInterface::queryCommand
virtual Command * queryCommand(const QString &cmd) const =0
Query for the command cmd.
KTextEditor::CommandInterface::unregisterCommand
virtual bool unregisterCommand(Command *cmd)=0
Unregister the command cmd.
KTextEditor::CommandInterface::registerCommand
virtual bool registerCommand(Command *cmd)=0
Register a the new command cmd.
KTextEditor::CommandInterface::commandList
virtual QStringList commandList() const =0
Get a list of available command line strings.
KTextEditor::Command
An Editor command line command.
Definition: commandinterface.h:77
KTextEditor::Command::help
virtual bool help(KTextEditor::View *view, const QString &cmd, QString &msg)=0
Shows help for the given view and cmd string.
KTextEditor::Command::~Command
virtual ~Command()
Virtual destructor.
Definition: commandinterface.h:82
KTextEditor::Command::cmds
virtual const QStringList & cmds()=0
Return a list of strings a command may begin with.
KTextEditor::Command::exec
virtual bool exec(KTextEditor::View *view, const QString &cmd, QString &msg)=0
Execute the command for the given view and cmd string.
KTextEditor::RangeCommand
Extension interface for a Command making the exec method take a line range.
Definition: commandinterface.h:307
KTextEditor::RangeCommand::exec
virtual bool exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &range)=0
Execute the command for the given range on the given view and cmd string.
KTextEditor::RangeCommand::supportsRange
virtual bool supportsRange(const QString &cmd)=0
Find out if a given command can act on a range.
KTextEditor::RangeCommand::~RangeCommand
virtual ~RangeCommand()
Virtual destructor.
Definition: commandinterface.h:312
KTextEditor::Range
An object representing a section of text, from one Cursor to another.
Definition: range.h:55
KTextEditor::View
A text widget with KXMLGUIClient that represents a Document.
Definition: view.h:146
QList
ktexteditor_export.h
KTextEditor
Namespace for the KDE Text Editor Interfaces.
Definition: annotationinterface.h:31
range.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal