HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Data Fields
tt::default_text_field_delegate< T > Class Template Reference
Inheritance diagram for tt::default_text_field_delegate< T >:
tt::text_field_delegate tt::text_field_delegate

Public Types

using value_type = T
 
using value_type = T
 
- Public Types inherited from tt::text_field_delegate
using callback_ptr_type = std::shared_ptr<std::function<void()>>
 

Public Member Functions

template<typename Value >
 default_text_field_delegate (Value &&value) noexcept
 
callback_ptr_type subscribe (text_field_widget &sender, callback_ptr_type const &callback_ptr) noexcept override
 
void unsubscribe (text_field_widget &sender, callback_ptr_type const &callback_ptr) noexcept override
 
std::optional< labelvalidate (text_field_widget &sender, std::string_view text) noexcept override
 Validate the text field.
 
std::string text (text_field_widget &sender) noexcept override
 Get the text to show in the text field.
 
void set_text (text_field_widget &sender, std::string_view text) noexcept override
 Set the text as entered by the user.
 
template<typename Value >
 default_text_field_delegate (Value &&value) noexcept
 
callback_ptr_type subscribe (text_field_widget &sender, callback_ptr_type const &callback_ptr) noexcept override
 
void unsubscribe (text_field_widget &sender, callback_ptr_type const &callback_ptr) noexcept override
 
std::optional< labelvalidate (text_field_widget &sender, std::string_view text) noexcept override
 Validate the text field.
 
std::string text (text_field_widget &sender) noexcept override
 Get the text to show in the text field.
 
void set_text (text_field_widget &sender, std::string_view text) noexcept override
 Set the text as entered by the user.
 
- Public Member Functions inherited from tt::text_field_delegate
virtual void init (text_field_widget const &sender) noexcept
 
virtual void deinit (text_field_widget const &sender) noexcept
 
template<typename Callback >
requires (std::is_invocable_v<Callback>)
callback_ptr_type subscribe (text_field_widget &sender, Callback &&callback) noexcept
 Subscribe a callback for notifying the widget of a data change.
 

Data Fields

observable< value_type > value
 

Member Function Documentation

◆ set_text() [1/2]

template<std::integral T>
void tt::default_text_field_delegate< T >::set_text ( text_field_widget & sender,
std::string_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
textThe text entered by the user.

Reimplemented from tt::text_field_delegate.

◆ set_text() [2/2]

template<std::integral T>
void tt::default_text_field_delegate< T >::set_text ( text_field_widget & sender,
std::string_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
textThe text entered by the user.

Reimplemented from tt::text_field_delegate.

◆ subscribe() [1/2]

template<std::integral T>
callback_ptr_type tt::default_text_field_delegate< T >::subscribe ( text_field_widget & sender,
callback_ptr_type const & callback_ptr )
inlineoverridevirtualnoexcept

Reimplemented from tt::text_field_delegate.

◆ subscribe() [2/2]

template<std::integral T>
callback_ptr_type tt::default_text_field_delegate< T >::subscribe ( text_field_widget & sender,
callback_ptr_type const & callback_ptr )
inlineoverridevirtualnoexcept

Reimplemented from tt::text_field_delegate.

◆ text() [1/2]

template<std::integral T>
std::string tt::default_text_field_delegate< T >::text ( text_field_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.

Returns
The text to show in the text field.

Reimplemented from tt::text_field_delegate.

◆ text() [2/2]

template<std::integral T>
std::string tt::default_text_field_delegate< T >::text ( text_field_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.

Returns
The text to show in the text field.

Reimplemented from tt::text_field_delegate.

◆ unsubscribe() [1/2]

template<std::integral T>
void tt::default_text_field_delegate< T >::unsubscribe ( text_field_widget & sender,
callback_ptr_type const & callback_ptr )
inlineoverridevirtualnoexcept

Reimplemented from tt::text_field_delegate.

◆ unsubscribe() [2/2]

template<std::integral T>
void tt::default_text_field_delegate< T >::unsubscribe ( text_field_widget & sender,
callback_ptr_type const & callback_ptr )
inlineoverridevirtualnoexcept

Reimplemented from tt::text_field_delegate.

◆ validate() [1/2]

template<std::integral T>
std::optional< label > tt::default_text_field_delegate< T >::validate ( text_field_widget & sender,
std::string_view text )
inlineoverridevirtualnoexcept

Validate the text field.

Parameters
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 tt::text_field_delegate.

◆ validate() [2/2]

template<std::integral T>
std::optional< label > tt::default_text_field_delegate< T >::validate ( text_field_widget & sender,
std::string_view text )
inlineoverridevirtualnoexcept

Validate the text field.

Parameters
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 tt::text_field_delegate.


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