AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AAbstractTypeable Class Referenceabstract

Base class for AAbstractTypeableView which is template class. More...

#include <AUI/View/AAbstractTypeable.h>

Public Member Functions

void clear ()
 
void setMaxTextLength (size_t newTextLength)
 
void trimText ()
 
void setCopyable (bool isCopyable)
 
virtual void setText (const AString &t)
 
virtual bool isPasswordField () const noexcept=0
 
virtual ATextInputType textInputType () const noexcept=0
 
void setTextInputActionIcon (ATextInputActionIcon textInputActionIcon) noexcept
 
ATextInputActionIcon textInputActionIcon () const noexcept
 
void copyToClipboard () const
 Performs copy operation (CTRL+C) to system clipboard.
 
void cutToClipboard ()
 Performs cut operation (CTRL+X) to system clipboard.
 
void pasteFromClipboard ()
 Performs paste operation (CTRL+V) from system clipboard.
 
void paste (AString content)
 Performs paste operation (CTRL+V).
 
void moveCursorLeft ()
 Performs move left operation (like AInput::LEFT)
 
void moveCursorRight ()
 Performs move right operation (like AInput::RIGHT)
 
virtual void emitTextChanged (const AString &text)=0
 
virtual void emitTextChanging (const AString &text)=0
 
virtual void emitActionButtonPressed ()=0
 
- Public Member Functions inherited from ACursorSelectable
virtual const AStringgetText () 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)
 

Signals and public fields

emits< AStringtextChanged
 The user changed text and focused another view or AAbstractTextField::updateText is called.
 
emits< AStringtextChanging
 When the user changed one or more symbols.
 
emits< SelectionselectionChanged
 Selection is changed due to user's action or code operation.
 
emits actionButtonPressed
 When action button of touchscreen keyboard or AInput::RETURN is pressed.
 

Protected Member Functions

bool isCursorBlinkVisible () const
 
void updateCursorBlinking ()
 
virtual void typeableErase (size_t begin, size_t end)=0
 
virtual bool typeableInsert (size_t at, const AString &toInsert)=0
 
virtual bool typeableInsert (size_t at, char16_t toInsert)=0
 
virtual size_t typeableFind (char16_t c, size_t startPos=-1)=0
 
virtual size_t typeableReverseFind (char16_t c, size_t startPos=-1)=0
 
virtual void updateSelectionOnTextSet (const AString &t)
 
virtual void onCursorIndexChanged ()=0
 
void enterChar (char16_t c)
 
AString getDisplayText () override
 
AMenuModel composeContextMenuImpl ()
 
void handleKey (AInput::Key key)
 
- Protected Member Functions inherited from ACursorSelectable
virtual bool isLButtonPressed ()=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

size_t mMaxTextLength = 0x200
 
bool mIsMultiline = false
 
- Protected Attributes inherited from ACursorSelectable
unsigned mCursorIndex = 0
 
AOptional< unsigned > mCursorSelection
 

Detailed Description

Base class for AAbstractTypeableView which is template class.

Member Function Documentation

◆ enterChar()

void AAbstractTypeable::enterChar ( char16_t c)
protected

Char enter implementation. Should be called in onCharEntered.

Parameters
c

◆ getDisplayText()

AString AAbstractTypeable::getDisplayText ( )
overrideprotectedvirtual

Implements ACursorSelectable.

◆ isPasswordField()

virtual bool AAbstractTypeable::isPasswordField ( ) const
nodiscardpure virtualnoexcept
Returns
true if this typeable should be treated as password.

Implemented in AAbstractTextField, and ATextArea.

◆ paste()

void AAbstractTypeable::paste ( AString content)

Performs paste operation (CTRL+V).

Parameters
contentstring to insert

Performs paste operation at cursor's position. If the view has selection, the selected contents are removed before insertion.

After operation, selection is reset and cursor is set to the end of inserted contents.

◆ pasteFromClipboard()

void AAbstractTypeable::pasteFromClipboard ( )

Performs paste operation (CTRL+V) from system clipboard.

Effectively:

paste(AClipboard::pasteFromClipboard());
void paste(AString content)
Performs paste operation (CTRL+V).
Definition AAbstractTypeable.cpp:159

◆ setTextInputActionIcon()

void AAbstractTypeable::setTextInputActionIcon ( ATextInputActionIcon textInputActionIcon)
inlinenoexcept

◆ textInputActionIcon()

ATextInputActionIcon AAbstractTypeable::textInputActionIcon ( ) const
inlinenodiscardnoexcept
Returns
text input type of this typeable.
See also
ATextInputActionIcon

◆ textInputType()

virtual ATextInputType AAbstractTypeable::textInputType ( ) const
nodiscardpure virtualnoexcept
Returns
text input type of this typeable.
See also
ATextInputType

Implemented in AAbstractTextField, and ATextArea.

◆ typeableInsert() [1/2]

virtual bool AAbstractTypeable::typeableInsert ( size_t at,
char16_t toInsert )
nodiscardprotectedpure virtual

Inserts string.

Returns
true, if successfully inserted; false otherwise
Note
when insert could not be completed (i.e. isValidText discarded the new string contents), the state is left unchanged as like if typeableInsert have not been called.

Implemented in AAbstractTextField, and ATextArea.

◆ typeableInsert() [2/2]

virtual bool AAbstractTypeable::typeableInsert ( size_t at,
const AString & toInsert )
nodiscardprotectedpure virtual

Inserts string.

Returns
true, if successfully inserted; false otherwise
Note
when insert could not be completed (i.e. isValidText discarded the new string contents), the state is left unchanged as like if typeableInsert have not been called.

Implemented in AAbstractTextField, and ATextArea.


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