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<>
 
using callback_token = notifier_type::callback_token
 
using callback_proto = notifier_type::callback_proto
 

Public Member Functions

virtual void init (widget const &sender) noexcept
 
virtual void deinit (widget const &sender) noexcept
 
virtual std::optional< label > validate (widget &sender, hi::text_view text) noexcept
 Validate the text field.
 
virtual hi::text text (widget &sender) noexcept
 Get the text to show in the text field.
 
virtual void set_text (widget &sender, hi::text_view text) noexcept
 Set the text as entered by the user.
 
callback_token subscribe (forward_of< callback_proto > auto &&callback, 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 & sender,
hi::text_view 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 hi::text hi::v1::text_field_delegate::text ( widget & 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 std::optional< label > hi::v1::text_field_delegate::validate ( widget & sender,
hi::text_view 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: