HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions
hi::v1::text_field_delegate Class Reference

#include <hikogui/widgets/text_field_delegate.hpp>

Inheritance diagram for hi::v1::text_field_delegate:
hi::v1::default_text_field_delegate< T > hi::v1::default_text_field_delegate< T >

Public Types

using notifier_type = notifier<void()>
 

Public Member Functions

virtual void init (widget_intf const &sender) noexcept
 
virtual void deinit (widget_intf const &sender) noexcept
 
virtual label validate (widget_intf const &sender, gstring const &text) noexcept
 Validate the text field.
 
virtual gstring text (widget_intf const &sender) noexcept
 Get the text to show in the text field.
 
virtual void set_text (widget_intf const &sender, gstring const &text) noexcept
 Set the text as entered by the user.
 
template<forward_of< void()> Func>
callback< void()> subscribe (Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
 

Detailed Description

A delegate that controls the state of a text_field_widget.

Member Function Documentation

◆ set_text()

virtual void hi::v1::text_field_delegate::set_text ( widget_intf const & sender,
gstring const & text )
inlinevirtualnoexcept

Set the text as entered by the user.

When the user causes a text field to commit, by pressing enter, tab, or clicking outside the field and when the text was validated the widget will call this function to commit the text with the delegate.

Precondition
text Must have been validated as correct.
Parameters
senderThe widget that called this function.
textThe text entered by the user.

Reimplemented in hi::v1::default_text_field_delegate< T >, and hi::v1::default_text_field_delegate< T >.

◆ text()

virtual gstring hi::v1::text_field_delegate::text ( widget_intf const & sender)
inlinevirtualnoexcept

Get the text to show in the text field.

When the user is not editing the text the text-field will request what to show using this function.

Parameters
senderThe widget that called this function.
Returns
The text to show in the text field.

Reimplemented in hi::v1::default_text_field_delegate< T >, and hi::v1::default_text_field_delegate< T >.

◆ validate()

virtual label hi::v1::text_field_delegate::validate ( widget_intf const & sender,
gstring const & text )
inlinevirtualnoexcept

Validate the text field.

Parameters
senderThe widget that called this function.
textThe text entered by the user into the text field.
Returns
no-value when valid, or a label to display to the user when invalid.

Reimplemented in hi::v1::default_text_field_delegate< T >, and hi::v1::default_text_field_delegate< T >.


The documentation for this class was generated from the following file: