AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ACursorSelectable Class Referenceabstract

Classes

struct  Selection
 

Public Member Functions

virtual const AStringtext () const =0
 
virtual size_t length () const =0
 
AString selectedText () const
 
Selection selection () const
 
bool hasSelection () const
 
virtual unsigned cursorIndexByPos (glm::ivec2 pos)=0
 
virtual glm::ivec2 getPosByIndex (size_t index)=0
 
virtual glm::ivec2 getCursorPosition ()=0
 
void selectAll ()
 Select whole text in the text field.
 
void clearSelection ()
 Remove selection from the text field.
 
void setSelection (int cursorIndex)
 
void setSelection (Selection selection)
 

Protected Member Functions

virtual bool isLButtonPressed ()=0
 
virtual AString getDisplayText ()=0
 
virtual void cursorSelectableRedraw ()=0
 
virtual void onSelectionChanged ()=0
 
void handleMouseDoubleClicked (const APointerPressedEvent &event)
 
void handleMousePressed (const APointerPressedEvent &event)
 
void handleMouseReleased (const APointerReleasedEvent &event)
 
void handleMouseMove (const glm::ivec2 &pos)
 
template<aui::invocable Callback>
void drawSelectionBeforeAndAfter (IRenderer &render, std::span< ARect< int > > rects, Callback &&drawText)
 

Protected Attributes

unsigned mCursorIndex = 0
 
AOptional< unsigned > mCursorSelection
 

Member Function Documentation

◆ cursorIndexByPos()

virtual unsigned ACursorSelectable::cursorIndexByPos ( glm::ivec2  pos)
pure virtual
Returns
Character index by pixel position.

Implemented in AAbstractTextField, and ATextArea.

◆ getCursorPosition()

virtual glm::ivec2 ACursorSelectable::getCursorPosition ( )
pure virtual
Returns
Cursor position relative to this view.

Returns position relative to top left corner of the view. That is, if implementation supports scrolling (i.e., ATextField) the returned position does not include overflowed contents.

Implemented in AAbstractTextField, and ATextArea.

◆ hasSelection()

bool ACursorSelectable::hasSelection ( ) const
Returns
true if selection is present.

◆ length()

virtual size_t ACursorSelectable::length ( ) const
pure virtual
Returns
Text field text length.

Implemented in AAbstractTextField, and ATextArea.

◆ selection()

ACursorSelectable::Selection ACursorSelectable::selection ( ) const
Returns
Selection.

◆ text()

virtual const AString & ACursorSelectable::text ( ) const
pure virtual
Returns
Text field text.
Performance note
If text length is needed, use textLength() function instead. On some implementations it's faster that text().

Implemented in AAbstractTextField, and ATextArea.


The documentation for this class was generated from the following files:
Inheritance diagram for ACursorSelectable: