Kate
#include <katetemplatehandler.h>
Classes | |
class | MirrorBehaviour |
Public Member Functions | |
KateTemplateHandler (KateView *view, const KTextEditor::Cursor &position, const QString &templateString, const QMap< QString, QString > &initialValues, KateUndoManager *undoManager, KateTemplateScript *templateScript) | |
virtual | ~KateTemplateHandler () |
KateView * | view () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Protected Member Functions | |
virtual bool | eventFilter (QObject *object, QEvent *event) |
Protected Member Functions inherited from QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Static Public Member Functions inherited from QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Properties inherited from QObject | |
objectName | |
Detailed Description
Inserts a template and offers advanced snippet features, like navigation and mirroring.
For each template inserted a new KateTemplateHandler will be created.
The handler has the following features:
- It inserts the template string into the document at the requested position.
- When the template contains at least one variable, the cursor will be placed at the start of the first variable and its range gets selected.
- When more than one variable exists,TAB and SHIFT TAB can be used to navigate to the next/previous variable.
- When a variable occurs more than once in the template, edits to any of the occurrences will be mirroed to the other ones.
- When ESC is pressed, the template handler closes.
- When ALT + RETURN is pressed and a
%{cursor}
variable exists in the template,the cursor will be placed there. Else the cursor will be placed at the end of the template.
- See also
- KateDocument::insertTemplateTextImplementation(), KTextEditor::TemplateInterface
Definition at line 73 of file katetemplatehandler.h.
Constructor & Destructor Documentation
KateTemplateHandler::KateTemplateHandler | ( | KateView * | view, |
const KTextEditor::Cursor & | position, | ||
const QString & | templateString, | ||
const QMap< QString, QString > & | initialValues, | ||
KateUndoManager * | undoManager, | ||
KateTemplateScript * | templateScript | ||
) |
Setup the template handler, insert the template string.
NOTE: The handler deletes itself when required, you do not need to keep track of it.
we always need a view
TODO: maybe use Kate::CutCopyPasteEdit or similar?
bail out if we can't insert text
now there must be a range
TODO: maybe support delayed actions, i.e.:
- create doc
- insert template
- create view => ranges are added for now simply "just insert" the code when we have no active view
Definition at line 60 of file katetemplatehandler.cpp.
|
virtual |
Cancels the template handler and cleans everything up.
Definition at line 175 of file katetemplatehandler.cpp.
Member Function Documentation
Provide keyboard interaction for the template handler.
The event filter handles the following shortcuts:
TAB: jump to next editable (i.e. not mirrored) range. NOTE: this prevents indenting via TAB. SHIFT + TAB: jump to previous editable (i.e. not mirrored) range. NOTE: this prevents un-indenting via SHIFT + TAB. ESC: terminate template handler (only when no completion is active). ALT + RETURN: accept template and jump to the end-cursor. if %{cursor} was given in the template, that will be the end-cursor. else just jump to the end of the inserted text.
Reimplemented from QObject.
Definition at line 263 of file katetemplatehandler.cpp.
KateView * KateTemplateHandler::view | ( | ) |
Definition at line 1018 of file katetemplatehandler.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:57:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.