KTextEditor
KTextEditor::Editor Class Reference
Accessor interface for Editor part. More...
#include <editor.h>

Signals | |
void | documentCreated (KTextEditor::Editor *editor, KTextEditor::Document *document) |
Public Member Functions | |
virtual const KAboutData * | aboutData () const =0 |
virtual void | configDialog (QWidget *parent)=0 |
virtual bool | configDialogSupported () const =0 |
virtual ConfigPage * | configPage (int number, QWidget *parent)=0 |
virtual QString | configPageFullName (int number) const =0 |
virtual KIcon | configPageIcon (int number) const =0 |
virtual QString | configPageName (int number) const =0 |
virtual int | configPages () const =0 |
virtual Document * | createDocument (QObject *parent)=0 |
virtual const QList< Document * > & | documents ()=0 |
Editor (QObject *parent) | |
virtual void | readConfig (KConfig *config=0)=0 |
void | setSimpleMode (bool on) |
bool | simpleMode () const |
virtual void | writeConfig (KConfig *config=0)=0 |
virtual | ~Editor () |
Detailed Description
Accessor interface for Editor part.
Topics:
Introduction
The Editor part can be accessed via the KTextEditor::Factory or the KTextEditor::EditorChooser and provides general information and configuration methods for the Editor implementation, for example KAboutData by using aboutData().
The Editor implementation has a list of all opened documents. Get this list with documents(). To create a new Document call createDocument(). The signal documentCreated() is emitted whenever the Editor created a new document.
Editor Configuration
If the Editor implementation supports a config dialog configDialogSupported() returns true, then the config dialog can be shown with configDialog(). Instead of using the config dialog, the config pages can be embedded into the application's config dialog. To do this, configPages() returns the number of config pages the Editor implementation provides and configPage() returns the requested page. Further, a config page has a short descriptive name, get it with configPageName(). You can get more detailed name by using configPageFullName(). Also every config page has a pixmap, get it with configPagePixmap(). The configuration can be saved and loaded with readConfig() and writeConfig().
- Note:
- We recommend to embedd the config pages into the main application's config dialog instead of using a separate config dialog, if the config dialog does not look cluttered then. This way, all settings are grouped together in one place.
Implementation Notes
Usually only one instance of the Editor exists. The Kate Part implementation internally uses a static accessor to make sure that only one Kate Part Editor object exists. So several factories still use the same Editor.
readConfig() and writeConfig() should be forwarded to all loaded plugins as well, see KTextEditor::Plugin::readConfig() and KTextEditor::Plugin::writeConfig().
Editor Extension Interfaces
There is only a single extension interface for the Editor: the CommandInterface. With the CommandInterface it is possible to add and remove new command line commands which are valid for all documents. Common use cases are for example commands like find or setting document variables. For further details read the detailed descriptions in the class KTextEditor::CommandInterface.
- See also:
- KTextEditor::Factory, KTextEditor::Document, KTextEditor::ConfigPage KTextEditor::Plugin, KTextEditor::CommandInterface
Definition at line 102 of file editor.h.
Constructor & Destructor Documentation
Editor::Editor | ( | QObject * | parent | ) |
Constructor.
Create the Editor object with parent
.
- Parameters:
-
parent parent object
Definition at line 86 of file ktexteditor.cpp.
Editor::~Editor | ( | ) | [virtual] |
Virtual destructor.
Definition at line 92 of file ktexteditor.cpp.
Member Function Documentation
virtual const KAboutData* KTextEditor::Editor::aboutData | ( | ) | const [pure virtual] |
Get the about data of this Editor part.
- Returns:
- about data
virtual void KTextEditor::Editor::configDialog | ( | QWidget * | parent | ) | [pure virtual] |
Show the editor's config dialog, changes will be applied to the editor, but not saved anywhere automagically, call writeConfig()
to save them.
- Note:
- Instead of using the config dialog, the config pages can be embedded into your own config dialog by using configPages() and configPage().
- Parameters:
-
parent parent widget
- See also:
- configDialogSupported()
virtual bool KTextEditor::Editor::configDialogSupported | ( | ) | const [pure virtual] |
Check, whether this editor has a configuration dialog.
- Returns:
- true, if the editor has a configuration dialog, otherwise false
- See also:
- configDialog()
virtual ConfigPage* KTextEditor::Editor::configPage | ( | int | number, | |
QWidget * | parent | |||
) | [pure virtual] |
Get the config page with the number
, config pages from 0 to configPages()-1 are available if configPages() > 0.
- Parameters:
-
number index of config page parent parent widget for config page
- Returns:
- created config page or NULL, if the number is out of bounds
- See also:
- configPages()
virtual QString KTextEditor::Editor::configPageFullName | ( | int | number | ) | const [pure virtual] |
Get a readable full name for the config page number.
The name should be translated.
Example: If the name is "Filetypes", the full name could be "Filetype Specific Settings". For "Shortcuts" the full name would be something like "Shortcut Configuration".
- Parameters:
-
number index of config page
- Returns:
- full name of given page index
- See also:
- configPageName(), configPagePixmap()
virtual KIcon KTextEditor::Editor::configPageIcon | ( | int | number | ) | const [pure virtual] |
Get a pixmap with size
for the config page number
.
- Parameters:
-
number index of config page
- Returns:
- pixmap for the given page index
- See also:
- configPageName(), configPageFullName()
virtual QString KTextEditor::Editor::configPageName | ( | int | number | ) | const [pure virtual] |
Get a readable name for the config page number
.
The name should be translated.
- Parameters:
-
number index of config page
- Returns:
- name of given page index
- See also:
- configPageFullName(), configPagePixmap()
virtual int KTextEditor::Editor::configPages | ( | ) | const [pure virtual] |
Get the number of available config pages.
If the editor returns a number < 1, it does not support config pages and the embedding application should use configDialog() instead.
- Returns:
- number of config pages
- See also:
- configPage(), configDialog()
Create a new document object with parent
.
- Parameters:
-
parent parent object
- Returns:
- new KTextEditor::Document object
- See also:
- documents()
void KTextEditor::Editor::documentCreated | ( | KTextEditor::Editor * | editor, | |
KTextEditor::Document * | document | |||
) | [signal] |
The editor
emits this signal whenever a document
was successfully created.
- Parameters:
-
editor editor which created the new document document the newly created document instance
- See also:
- createDocument()
Get a list of all documents of this editor.
- Returns:
- list of all existing documents
- See also:
- createDocument()
virtual void KTextEditor::Editor::readConfig | ( | KConfig * | config = 0 |
) | [pure virtual] |
Read editor configuration from KConfig config
.
- Note:
- Implementation Notes: If
config
is NULL you should use kapp->config() as a fallback solution. Additionally the readConfig() call should be forwarded to every loaded plugin.
- Parameters:
-
config config object
- See also:
- writeConfig()
void Editor::setSimpleMode | ( | bool | on | ) |
Switch editor to simple mode for average users.
Switch the editor to a simple mode which will hide advanced stuff from average user or switch it back to normal mode. This mode will only affect documents/views created after the change.
- Parameters:
-
on turn simple mode on or not
Definition at line 97 of file ktexteditor.cpp.
bool Editor::simpleMode | ( | ) | const |
Query the editor whether simple mode is on or not.
- Returns:
- true if simple mode is on, otherwise false
- See also:
- setSimpleMode()
Definition at line 102 of file ktexteditor.cpp.
virtual void KTextEditor::Editor::writeConfig | ( | KConfig * | config = 0 |
) | [pure virtual] |
Write editor configuration to KConfig config
.
- Note:
- Implementation Notes: If
config
is NULL you should use kapp->config() as a fallback solution. Additionally the writeConfig() call should be forwarded to every loaded plugin.
- Parameters:
-
config config object
- See also:
- readConfig()
The documentation for this class was generated from the following files: