KTextEditor
Classes | |
class | KTextEditor::SmartCursor |
class | KTextEditor::SmartCursorNotifier |
class | KTextEditor::SmartCursorWatcher |
class | KTextEditor::SmartRange |
class | KTextEditor::SmartRangeNotifier |
class | KTextEditor::SmartRangeWatcher |
Enumerations | |
enum | KTextEditor::SmartRange::InsertBehavior { KTextEditor::SmartRange::DoNotExpand = 0, KTextEditor::SmartRange::ExpandLeft = 0x1, KTextEditor::SmartRange::ExpandRight = 0x2 } |
Document-related functions | |
The following functions are provided for convenient access to the associated Document. | |
enum | KTextEditor::SmartCursor::AdvanceMode { KTextEditor::SmartCursor::ByCharacter, KTextEditor::SmartCursor::ByCursorPosition } |
Document * | KTextEditor::SmartCursor::document () const |
virtual bool | KTextEditor::SmartCursor::atEndOfLine () const |
virtual bool | KTextEditor::SmartCursor::atEndOfDocument () const |
virtual bool | KTextEditor::SmartCursor::isValid () const |
QChar | KTextEditor::SmartCursor::character () const |
virtual bool | KTextEditor::SmartCursor::insertText (const QStringList &text, bool block=false) |
virtual bool | KTextEditor::SmartCursor::advance (int distance, AdvanceMode mode=ByCharacter) |
Behavior | |
The following functions relate to the behavior of this SmartCursor. | |
enum | KTextEditor::SmartCursor::InsertBehavior { KTextEditor::SmartCursor::StayOnInsert = 0, KTextEditor::SmartCursor::MoveOnInsert } |
InsertBehavior | KTextEditor::SmartCursor::insertBehavior () const |
void | KTextEditor::SmartCursor::setInsertBehavior (InsertBehavior insertBehavior) |
Detailed Description
If the KTextEditor implementation supports the KTextEditor::SmartInterface, there are several smart classes available.
In general, instances of the smart classes are bound to a specific document, and maintain their position in that document regardless of changes to the text. They also provide:
- feedback on changes to their position and changes to text related to their position,
- support for the other smart interfaces, such as arbitrary highlighting, action binding, etc.
The following is a list of all classes that are available when the document supports the KTextEditor::SmartInterface:
- Warning
- All Smart interfaces were deprecated and not implemented anymore in KDE >= 4.6. They were replaced by the MovingCursors and MovingRanges
Enumeration Type Documentation
Defines the ways in which the cursor can be advanced.
Important for languages where multiple characters are required to form one letter.
Definition at line 149 of file smartcursor.h.
Determine how the range reacts to characters inserted immediately outside the range.
Definition at line 100 of file smartrange.h.
Enumerator | |
---|---|
StayOnInsert | |
MoveOnInsert |
Definition at line 187 of file smartcursor.h.
Function Documentation
|
virtual |
Move cursor by specified distance along the document buffer.
E.g.:
will move the cursor forward by one character, or, if the cursor is already on the end of the line, will move it to the start of the next line.
- Note
- Negative numbers should be accepted, and move backwards.
- Not all modes are required to be supported.
- Parameters
-
distance distance to advance (or go back if distance is negative) mode whether to move by character, or by number of valid cursor positions
- Returns
- true if the position could be reached within the document, otherwise false (the cursor should not move if distance is beyond the end of the document).
Definition at line 93 of file smartcursor.cpp.
|
virtual |
Determine if this cursor is located at the end of the document.
- Returns
- true if the cursor is situated at the end of the document, otherwise false.
Definition at line 43 of file smartcursor.cpp.
|
virtual |
Determine if this cursor is located at the end of the current line.
- Returns
- true if the cursor is situated at the end of the line, otherwise false.
Definition at line 73 of file smartcursor.cpp.
QChar SmartCursor::character | ( | ) | const |
Returns the character in the document immediately after this position, ie.
from this position to this position plus Cursor(0,1).
Definition at line 58 of file smartcursor.cpp.
Document * SmartCursor::document | ( | ) | const |
Returns the document to which this cursor is attached.
Definition at line 68 of file smartcursor.cpp.
SmartCursor::InsertBehavior SmartCursor::insertBehavior | ( | ) | const |
Returns how this cursor behaves when text is inserted at the cursor.
Defaults to moving on insert.
Definition at line 78 of file smartcursor.cpp.
|
virtual |
Insert text
into the associated Document.
- Parameters
-
text text to insert block insert this text as a visual block of text rather than a linear sequence
- Returns
- true on success, otherwise false
Definition at line 53 of file smartcursor.cpp.
|
virtual |
- Reimplemented from superclass.
- See also
- Document::cursorInText()
Reimplemented from KTextEditor::Cursor.
Definition at line 38 of file smartcursor.cpp.
void SmartCursor::setInsertBehavior | ( | InsertBehavior | insertBehavior | ) |
Change the behavior of the cursor when text is inserted at the cursor.
If moveOnInsert
is true, the cursor will end up at the end of the insert.
Definition at line 83 of file smartcursor.cpp.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Sep 22 2015 14:09:07 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.