Kate
#include <foldinginterface.h>
Public Types | |
enum | FoldingRangeFlag { Persistent = 0x1, Folded = 0x2 } |
Public Slots | |
void | clear () |
Signals | |
void | foldingRangesChanged () |
Public Member Functions | |
FoldingInterface () | |
virtual | ~FoldingInterface () |
Q_DECLARE_FLAGS (FoldingRangeFlags, FoldingRangeFlag) | |
Creation, Folding and Unfolding | |
The following functions provide access and manipulation of the range's position. | |
qint64 | newFoldingRange (const KTextEditor::Range &range, FoldingRangeFlags flags=FoldingRangeFlags()) |
virtual bool | foldRange (qint64 id)=0 |
virtual bool | unfoldRange (qint64 id, bool remove=false)=0 |
virtual QVector< QPair< qint64, FoldingRangeFlags > > | foldingRangesStartingOnLine (int line) const =0 |
virtual bool | lineContainsStartFoldingRanges (int line) const =0 |
virtual qint64 | foldLine (int line) const =0 |
virtual bool | unfoldLine (int line) const =0 |
Line Visibility | |
The following functions provide access and manipulation of the range's position. | |
virtual bool | isLineVisible (int line, qint64 *foldedRangeId=0) const =0 |
virtual void | ensureLineIsVisible (int line)=0 |
virtual int | visibleLines () const =0 |
virtual int | lineToVisibleLine (int line) const =0 |
virtual int | visibleLineToLine (int visibleLine) const =0 |
Detailed Description
KTextEditor interface for code folding of a KTextEditor::View.
The interface allows to arbitrary fold given regions of a buffer as long as they are well nested. Multiple instances of this class can exist for the same buffer.
Definition at line 38 of file foldinginterface.h.
Member Enumeration Documentation
Folding state of a range.
Enumerator | |
---|---|
Persistent |
Range is persistent, e.g. it should not auto-delete after unfolding! |
Folded |
Range is folded away. |
Definition at line 55 of file foldinginterface.h.
Constructor & Destructor Documentation
KTextEditor::FoldingInterface::FoldingInterface | ( | ) |
Create folding object for given buffer.
- Parameters
-
buffer text buffer we want to provide folding info for
|
virtual |
Cleanup.
Member Function Documentation
|
slot |
Clear the complete folding.
This is automatically triggered if the buffer is cleared.
|
pure virtual |
Ensure that a given line will be visible.
Potentially unfold recursively all folds hiding this line, else just returns.
- Parameters
-
line line to make visible
|
signal |
If the folding state of existing ranges changes or ranges are added/removed, this signal is emitted.
|
pure virtual |
Queries which folding ranges start at the given line and returns the id + flags for all of them.
Very fast if nothing is folded, else binary search.
- Parameters
-
line line to query starting folding ranges
- Returns
- vector of id's + flags
|
pure virtual |
Fold the first folding range starting on this line, if applicable.
- Parameters
-
line line to fold
- Returns
- id of folded range (>= 0) or -1, if no folding range starts at line
Fold the given range.
- Parameters
-
id id of the range to fold
- Returns
- success
|
pure virtual |
Query if a given line is visible.
Very fast, if nothing is folded, else does binary search log(n) for n == number of folded ranges
- Parameters
-
line line to query foldedRangeId if the line is not visible and that pointer is not 0, will be filled with id of range hiding the line or -1
- Returns
- is that line visible?
|
pure virtual |
Check whether on this line starts a folding range.
- Parameters
-
line line to query starting folding ranges
- Returns
- true, if a folding range starts, otherwise false
|
pure virtual |
Convert a text buffer line to a visible line number.
Very fast, if nothing is folded, else walks over all folded regions O(n) for n == number of folded ranges
- Parameters
-
line line index in the text buffer
- Returns
- index in visible lines
qint64 KTextEditor::FoldingInterface::newFoldingRange | ( | const KTextEditor::Range & | range, |
FoldingRangeFlags | flags = FoldingRangeFlags() |
||
) |
Create a new folding range.
- Parameters
-
range folding range flags initial flags for the new folding range
- Returns
- on success, id of new range >= 0, else -1, we return no pointer as folding ranges might be auto-deleted internally! the ids are stable for one KTextEditor::FoldingInterface, e.g. you can rely in unit tests that you get 0,1,.... for successfully created ranges!
KTextEditor::FoldingInterface::Q_DECLARE_FLAGS | ( | FoldingRangeFlags | , |
FoldingRangeFlag | |||
) |
|
pure virtual |
Unfolds all folding range starting on this line, if applicable.
- Parameters
-
line line to unfold
- Returns
- id of folded range (>= 0) or -1, if no folding range starts at line
|
pure virtual |
Unfold the given range.
In addition it can be forced to remove the region, even if it is persistent.
- Parameters
-
id id of the range to unfold remove should the range be removed from the folding after unfolding? ranges that are not persistent auto-remove themself on unfolding
- Returns
- success
|
pure virtual |
Query number of visible lines.
Very fast, if nothing is folded, else walks over all folded regions O(n) for n == number of folded ranges
|
pure virtual |
Convert a visible line number to a line number in the text buffer.
Very fast, if nothing is folded, else walks over all folded regions O(n) for n == number of folded ranges
- Parameters
-
visibleLine visible line index
- Returns
- index in text buffer lines
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:31:55 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.