KTextEditor
KTextEditor::CommandInterface Class Reference
[Editor Extension Interfaces]
Command extension interface for the Editor.
More...
#include <commandinterface.h>
Public Member Functions | |
virtual QStringList | commandList () const =0 |
virtual QList< Command * > | commands () const =0 |
virtual Command * | queryCommand (const QString &cmd) const =0 |
virtual bool | registerCommand (Command *cmd)=0 |
virtual bool | unregisterCommand (Command *cmd)=0 |
virtual | ~CommandInterface () |
Detailed Description
Command extension interface for the Editor.
Introduction
The CommandInterface extends the Editor to support command line commands. An application or a Plugin can register new commands by using registerCommand(). To unregister a command call unregisterCommand(). To check, whether a command with a given name exists use queryCommand().Accessing the CommandInterface
The CommandInterface is supposed to be an extension interface for the Editor, i.e. the Editor inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:// editor is of type KTextEditor::Editor* KTextEditor::CommandInterface *iface = qobject_cast<KTextEditor::CommandInterface*>( editor ); if( iface ) { // the implementation supports the interface // do stuff }
Definition at line 233 of file commandinterface.h.
Constructor & Destructor Documentation
virtual KTextEditor::CommandInterface::~CommandInterface | ( | ) | [inline, virtual] |
Member Function Documentation
virtual QStringList KTextEditor::CommandInterface::commandList | ( | ) | const [pure virtual] |
Get a list of all registered commands.
- Returns:
- list of all commands
- See also:
- queryCommand(), commandList()
virtual Command* KTextEditor::CommandInterface::queryCommand | ( | const QString & | cmd | ) | const [pure virtual] |
Query for the command cmd
.
If the command cmd
does not exist the return value is NULL.
- Parameters:
-
cmd name of command to query for
- Returns:
- the found command or NULL if no such command exists
virtual bool KTextEditor::CommandInterface::registerCommand | ( | Command * | cmd | ) | [pure virtual] |
Register a the new command cmd
.
The command will be registered for all documents, i.e. every command is global.
- Parameters:
-
cmd command to register
- Returns:
- true on success, otherwise false
- See also:
- unregisterCommand()
virtual bool KTextEditor::CommandInterface::unregisterCommand | ( | Command * | cmd | ) | [pure virtual] |
Unregister the command cmd
.
The command will be unregistered for all documents.
- Parameters:
-
cmd command to unregister
- Returns:
- true on success, otherwise false
- See also:
- registerCommand()
The documentation for this class was generated from the following file: