Envision
A visual programming IDE for object-oriented languages
|
Public Member Functions | |
TextCursor (TextRenderer *owner) | |
int | caretPosition () |
virtual TextCursor * | clone () const override |
int | cursorAtX (int x) const |
bool | hasSelection () |
virtual bool | isAtBoundary () const override |
bool | isCursorBeforeSelection () |
virtual bool | isSame (Cursor *c) override |
Returns true if this cursor is the same as the cursor other. More... | |
TextRenderer * | owner () const override |
void | selectAll () |
int | selectionBegin () |
int | selectionEnd () |
int | selectionFirstIndex () |
int | selectionLastIndex () |
void | setCaretPosition (int beforeCharacter) |
void | setSelectedByDrag (int xBegin, int xEnd) |
void | setSelectedCharacters (int first, int last) |
void | setSelection (int selectionBegin, int selectionEnd) |
void | setVisualizationSize (const QSize &size) |
void | setX (int xBegin, int xEnd) |
virtual void | update () override |
Called on every scene update to update the cursor. More... | |
void | update (const QFontMetrics &qfm) |
int | xBegin () |
int | xEnd () |
Public Member Functions inherited from Visualization::Cursor | |
Cursor (const Cursor &other) | |
Cursor (Item *owner, CursorType type, Item *visualization=nullptr) | |
virtual | ~Cursor () |
virtual bool | isLocationEquivalent (bool otherNotLocationEquivalent, CursorType otherType, bool otherIsAtBoundary, Item *otherOwner) |
virtual bool | isLocationEquivalent (Cursor *c) |
Returns true if this cursor is equivalent with respect to its location to the cursor c. More... | |
bool | notLocationEquivalent () const |
Cursor & | operator= (const Cursor &other)=delete |
const QPoint & | position () |
Returns the position of this cursor in corrdinates local to owner() More... | |
const QRect & | region () |
Returns the region of this cursor in corrdinates local to owner() More... | |
QRect | sceneRegion () |
Returns the region of this cursor in scene coordinates. More... | |
void | setNotLocationEquivalent (bool notEquivalent) |
void | setPosition (const QPoint &pos) |
void | setRegion (const QRect ®ion) |
CursorType | type () const |
Item * | visualization () |
Private Attributes | |
int | selectionBegin_ |
selectionBegin_ and selectionEnd_ indicate the currently selected characters in a text. More... | |
int | selectionEnd_ |
int | xBegin_ |
xBegin_ and xEnd_ indicate the beginning and end (along the X coordinate) where the selection background must be drawn. More... | |
int | xEnd_ |
Additional Inherited Members | |
Public Types inherited from Visualization::Cursor | |
enum | CursorType { VerticalCursor , HorizontalCursor , BoxCursor } |
Protected Member Functions inherited from Visualization::Cursor | |
void | setVisualization (Item *visualization) |
Visualization::TextCursor::TextCursor | ( | TextRenderer * | owner | ) |
|
inline |
|
overridevirtual |
Reimplemented from Visualization::Cursor.
int Visualization::TextCursor::cursorAtX | ( | int | x | ) | const |
|
inline |
|
overridevirtual |
Reimplemented from Visualization::Cursor.
|
inline |
|
overridevirtual |
Returns true if this cursor is the same as the cursor other.
Two cursors are the same if they have the same owner and if they represent the same location within that owner.
Reimplemented from Visualization::Cursor.
|
overridevirtual |
Reimplemented from Visualization::Cursor.
void Visualization::TextCursor::selectAll | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void Visualization::TextCursor::setSelectedByDrag | ( | int | xBegin, |
int | xEnd | ||
) |
void Visualization::TextCursor::setSelectedCharacters | ( | int | first, |
int | last | ||
) |
|
inline |
void Visualization::TextCursor::setVisualizationSize | ( | const QSize & | size | ) |
void Visualization::TextCursor::setX | ( | int | xBegin, |
int | xEnd | ||
) |
|
overridevirtual |
Called on every scene update to update the cursor.
The default implementation checks if this is a BoxCursor and if so it assumes it is a whole item cursor to update its position and size. Otherwise it does nothing.
Reimplement this in derived classes to update the cursor's position and size appropriately.
Reimplemented from Visualization::Cursor.
void Visualization::TextCursor::update | ( | const QFontMetrics & | qfm | ) |
|
inline |
|
inline |
|
private |
selectionBegin_ and selectionEnd_ indicate the currently selected characters in a text.
If the text has been selected from right to left then selectionEnd_ < selectionBegin_. If the entire text is selected then selectionBegin_ and selectionEnd_ will have the values 0 and text.length().
|
private |
|
private |
xBegin_ and xEnd_ indicate the beginning and end (along the X coordinate) where the selection background must be drawn.
|
private |