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

Public Types

using value_type = T
 
using sender_type = text_field_widget<value_type>
 

Public Member Functions

size_t text_width (sender_type &sender) const noexcept
 The width of the text field in characters.
 
std::vector< std::stringsuggestions (sender_type &sender) const noexcept
 The list of suggestions to show in the popup box.
 
virtual std::string to_string (sender_type &sender, value_type const &value) noexcept
 Convert a value to a string.
 
virtual std::optional< value_type > from_string (sender_type &sender, std::string_view text, l10n &error) noexcept
 Convert a string to a value.
 

Member Function Documentation

◆ from_string()

template<typename T >
virtual std::optional< value_type > tt::text_field_delegate< T >::from_string ( sender_type & sender,
std::string_view text,
l10n & error )
inlinevirtualnoexcept

Convert a string to a value.

Parameters
selfThe widget controlled by this delegate.
textThe text string to convert to a value.
[out]errorAn localized error message to inform the user what is wrong.
Returns
value_type The value if the string conversion was successful. empty when the string conversion was NOT successful.

◆ suggestions()

template<typename T >
std::vector< std::string > tt::text_field_delegate< T >::suggestions ( sender_type & sender) const
inlinenoexcept

The list of suggestions to show in the popup box.

Parameters
selfThe widget controlled by this delegate.
Returns
A list of suffestion to show in the popup box.

◆ text_width()

template<typename T >
size_t tt::text_field_delegate< T >::text_width ( sender_type & sender) const
inlinenoexcept

The width of the text field in characters.

Parameters
selfThe widget controlled by this delegate.
Returns
The width of the text field box (excluding prefix and suffix) in characters.

◆ to_string()

template<typename T >
virtual std::string tt::text_field_delegate< T >::to_string ( sender_type & sender,
value_type const & value )
inlinevirtualnoexcept

Convert a value to a string.

Parameters
selfThe widget controlled by this delegate.
valueThe original value before editing.
Returns
The string to be shown inside the text field box.

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