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

Text field implementation. More...

Detailed Description

Text field implementation.

ATextField is separated into the different class in order to simplify styling.

Public Member Functions

int getContentMinimumHeight () override
 
void setText (const AString &t) override
 
void setSuffix (const AString &s)
 
void render (ARenderContext ctx) override
 
AString toString () const override
 
void setTextInputType (ATextInputType textInputType) noexcept
 
ATextInputType textInputType () const noexcept override
 
void setPasswordMode (bool isPasswordField)
 
bool isPasswordField () const noexcept override
 
bool handlesNonMouseNavigation () override
 
const AStringtext () const override
 
void onCharEntered (char16_t c) override
 
void setSize (glm::ivec2 size) override
 
glm::ivec2 getCursorPosition () override
 
- Public Member Functions inherited from AAbstractTypeableView< AView >
void onKeyDown (AInput::Key key) override
 
void onKeyRepeat (AInput::Key key) override
 
void onFocusLost () override
 
void onPointerPressed (const APointerPressedEvent &event) override
 
void onPointerDoubleClicked (const APointerPressedEvent &event) override
 
void onPointerMove (glm::vec2 pos, const APointerMoveEvent &event) override
 
void onPointerReleased (const APointerReleasedEvent &event) override
 
bool wantsTouchscreenKeyboard () override
 
bool handlesNonMouseNavigation () override
 
void onFocusAcquired () override
 
void invalidateAllStyles () override
 
bool isLButtonPressed () override
 
void drawCursor (IRenderer &renderer, glm::ivec2 position)
 
- Public Member Functions inherited from AAbstractTypeable
void clear ()
 
void setMaxTextLength (size_t newTextLength)
 
void trimText ()
 
void setCopyable (bool isCopyable)
 
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)
 
- Public Member Functions inherited from ACursorSelectable
AString selectedText () const
 
Selection selection () const
 
bool hasSelection () const
 
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 isValidText (const AString &text)
 
void prerenderStringIfNeeded (IRenderer &render)
 
void typeableErase (size_t begin, size_t end) override
 
bool typeableInsert (size_t at, const AString &toInsert) override
 
size_t typeableFind (char16_t c, size_t startPos) override
 
size_t typeableReverseFind (char16_t c, size_t startPos) override
 
size_t length () const override
 
bool typeableInsert (size_t at, char16_t toInsert) override
 
AString getDisplayText () override
 
void cursorSelectableRedraw () override
 
unsigned cursorIndexByPos (glm::ivec2 pos) override
 
glm::ivec2 getPosByIndex (size_t index) override
 
void doDrawString (IRenderer &render)
 
void onCursorIndexChanged () override
 
void commitStyle () override
 
- Protected Member Functions inherited from AAbstractTypeableView< AView >
AMenuModel composeContextMenu () override
 
void commitStyle () override
 
int getVerticalAlignmentOffset () noexcept
 
void cursorSelectableRedraw () override
 
void onSelectionChanged () override
 
- Protected Member Functions inherited from AAbstractTypeable
bool isCursorBlinkVisible () const
 
void updateCursorBlinking ()
 
virtual void updateSelectionOnTextSet (const AString &t)
 
void enterChar (char16_t c)
 
AString getDisplayText () override
 
AMenuModel composeContextMenuImpl ()
 
void handleKey (AInput::Key key)
 
- Protected Member Functions inherited from ACursorSelectable
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

_< IRenderer::IPrerenderedStringmPrerenderedString
 
AString mContents
 
AString mSuffix
 
- Protected Attributes inherited from AAbstractTypeable
size_t mMaxTextLength = 0x200
 
bool mIsMultiline = false
 
- Protected Attributes inherited from ACursorSelectable
unsigned mCursorIndex = 0
 
AOptional< unsigned > mCursorSelection
 

Additional Inherited Members

- Static Public Member Functions inherited from IStringable
template<typename T >
static AString toString (const T *t)
 
template<typename T >
static AString toString (const _< T > &t)
 
- Signals and public fields inherited from AAbstractTypeable
emits< AStringtextChanged
 
emits< AStringtextChanging
 
emits< SelectionselectionChanged
 
emits actionButtonPressed
 

Member Function Documentation

◆ cursorIndexByPos()

unsigned AAbstractTextField::cursorIndexByPos ( glm::ivec2  pos)
overrideprotectedvirtual
Returns
Character index by pixel position.

Implements ACursorSelectable.

◆ cursorSelectableRedraw()

void AAbstractTextField::cursorSelectableRedraw ( )
overrideprotectedvirtual

Implements ACursorSelectable.

◆ getCursorPosition()

glm::ivec2 AAbstractTextField::getCursorPosition ( )
overridevirtual
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.

Implements ACursorSelectable.

◆ getDisplayText()

AString AAbstractTextField::getDisplayText ( )
overrideprotectedvirtual

Implements ACursorSelectable.

◆ getPosByIndex()

glm::ivec2 AAbstractTextField::getPosByIndex ( size_t  index)
overrideprotectedvirtual

Implements ACursorSelectable.

◆ isPasswordField()

bool AAbstractTextField::isPasswordField ( ) const
inlineoverridevirtualnoexcept
Returns
true if this typeable should be treated as password.

Implements AAbstractTypeable.

◆ length()

size_t AAbstractTextField::length ( ) const
overrideprotectedvirtual
Returns
Text field text length.

Implements ACursorSelectable.

◆ onCursorIndexChanged()

void AAbstractTextField::onCursorIndexChanged ( )
overrideprotectedvirtual

Implements AAbstractTypeable.

◆ setText()

void AAbstractTextField::setText ( const AString t)
overridevirtual

Reimplemented from AAbstractTypeable.

◆ text()

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

Implements ACursorSelectable.

◆ textInputType()

ATextInputType AAbstractTextField::textInputType ( ) const
inlineoverridevirtualnoexcept
Returns
text input type of this typeable.
See also
ATextInputType

Implements AAbstractTypeable.

◆ toString()

AString AAbstractTextField::toString ( ) const
overridevirtual
Returns
string representation of the object

Implements IStringable.

◆ typeableErase()

void AAbstractTextField::typeableErase ( size_t  begin,
size_t  end 
)
overrideprotectedvirtual

Implements AAbstractTypeable.

◆ typeableFind()

size_t AAbstractTextField::typeableFind ( char16_t  c,
size_t  startPos 
)
overrideprotectedvirtual

Implements AAbstractTypeable.

◆ typeableInsert() [1/2]

bool AAbstractTextField::typeableInsert ( size_t  at,
char16_t  toInsert 
)
overrideprotectedvirtual

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.

Implements AAbstractTypeable.

◆ typeableInsert() [2/2]

bool AAbstractTextField::typeableInsert ( size_t  at,
const AString toInsert 
)
overrideprotectedvirtual

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.

Implements AAbstractTypeable.

◆ typeableReverseFind()

size_t AAbstractTextField::typeableReverseFind ( char16_t  c,
size_t  startPos 
)
overrideprotectedvirtual

Implements AAbstractTypeable.

#include <AUI/View/AAbstractTextField.h>


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