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

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

Detailed Description

Base class for AAbstractTypeableView which is template class.

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. More...
 
void paste (AString content)
 Performs paste operation (CTRL+V). More...
 
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 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)
 

Signals and public fields

emits< AStringtextChanged
 
emits< AStringtextChanging
 
emits< SelectionselectionChanged
 
emits actionButtonPressed
 

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
 

Friends

template<aui::derived_from< AView > Super>
class AAbstractTypeableView
 

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
pure 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
inlinenoexcept
Returns
text input type of this typeable.
See also
ATextInputActionIcon

◆ textInputType()

virtual ATextInputType AAbstractTypeable::textInputType ( ) const
pure 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 
)
protectedpure 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 
)
protectedpure 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.

Member Data Documentation

◆ actionButtonPressed

emits AAbstractTypeable::actionButtonPressed
Emits
When action button of touchscreen keyboard or AInput::RETURN is pressed.

◆ selectionChanged

emits<Selection> AAbstractTypeable::selectionChanged
Emits
When selection is changed due to user operation or code operation.

◆ textChanged

emits<AString> AAbstractTypeable::textChanged
Emits
When the user changed text and focused another view. When AAbstractTextField::updateText is called.

◆ textChanging

emits<AString> AAbstractTypeable::textChanging
Emits
When the user added/removed one or more symbols.

#include <AUI/View/AAbstractTypeable.h>


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