HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields
hi::v1::default_text_field_delegate< T > Class Template Reference

#include <hikogui/widgets/text_field_delegate.hpp>

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

Public Types

using value_type = T
 
using value_type = T
 
- Public Types inherited from hi::v1::text_field_delegate
using notifier_type = notifier<>
 
using callback_token = notifier_type::callback_token
 
using callback_proto = notifier_type::callback_proto
 

Public Member Functions

 default_text_field_delegate (forward_of< observer< value_type > > auto &&value) noexcept
 
std::optional< label > validate (widget &sender, hi::text_view text) noexcept override
 Validate the text field.
 
hi::text text (widget &sender) noexcept override
 Get the text to show in the text field.
 
void set_text (widget &sender, hi::text_view text) noexcept override
 Set the text as entered by the user.
 
 default_text_field_delegate (forward_of< observer< value_type > > auto &&value) noexcept
 
std::optional< label > validate (widget &sender, text_view text) noexcept override
 Validate the text field.
 
hi::text text (widget &sender) noexcept override
 Get the text to show in the text field.
 
void set_text (widget &sender, hi::text_view text) noexcept override
 Set the text as entered by the user.
 
- Public Member Functions inherited from hi::v1::text_field_delegate
virtual void init (widget const &sender) noexcept
 
virtual void deinit (widget const &sender) noexcept
 
callback_token subscribe (forward_of< callback_proto > auto &&callback, callback_flags flags=callback_flags::synchronous) noexcept
 

Data Fields

observer< value_type > value
 

Detailed Description

template<std::integral T>
class hi::v1::default_text_field_delegate< T >

A default text delegate specialization for std::integral<T>.

A default text delegate specialization for std::floating_point<T>.

This delegate makes it possible for a text-field to edit an integral value. It will automatically validate and convert between the integral value and the text representation.

Template Parameters
TAn integral type

This delegate makes it possible for a text-field to edit an floating point value. It will automatically validate and convert between the floating point value and the text representation.

Template Parameters
TAn floating point type

Member Function Documentation

◆ set_text() [1/2]

template<std::integral T>
void hi::v1::default_text_field_delegate< T >::set_text ( widget & sender,
hi::text_view text )
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.

◆ set_text() [2/2]

template<std::integral T>
void hi::v1::default_text_field_delegate< T >::set_text ( widget & sender,
hi::text_view text )
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.

◆ text() [1/2]

template<std::integral T>
hi::text hi::v1::default_text_field_delegate< T >::text ( widget & sender)
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.

◆ text() [2/2]

template<std::integral T>
hi::text hi::v1::default_text_field_delegate< T >::text ( widget & sender)
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.

◆ validate() [1/2]

template<std::integral T>
std::optional< label > hi::v1::default_text_field_delegate< T >::validate ( widget & sender,
hi::text_view text )
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.

◆ validate() [2/2]

template<std::integral T>
std::optional< label > hi::v1::default_text_field_delegate< T >::validate ( widget & sender,
text_view text )
inlineoverridevirtualnoexcept

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 from hi::v1::text_field_delegate.


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