7#include "text_field_delegate.hpp"
8#include "../observable.hpp"
10#include "../charconv.hpp"
11#include "../type_traits.hpp"
22template<std::
integral T>
29 template<
typename Value>
48 [[maybe_unused]]
auto dummy = from_string<value_type>(text, 10);
50 return {
l10n{
"Invalid integer"}};
58 return to_string(*value);
64 value = from_string<value_type>(text, 10);
72template<
typename Value>
73default_text_field_delegate(Value &&) -> default_text_field_delegate<observable_argument_t<std::remove_cvref_t<Value>>>;
75template<
typename Value,
typename... Args>
78 using value_type = observable_argument_t<std::remove_cvref_t<Value>>;
79 return std::make_unique<default_text_field_delegate<value_type>>(std::forward<Value>(value), std::forward<Args>(args)...);
Exception thrown during parsing on an error.
Definition exception.hpp:26
A localizable message.
Definition l10n.hpp:149
An observable value.
Definition observable.hpp:280
void unsubscribe(callback_ptr_type const &callback_ptr) noexcept
Unsubscribe a callback function.
Definition observable.hpp:468
callback_ptr_type subscribe(Callback &&callback) noexcept
Subscribe a callback function.
Definition observable.hpp:442
Definition default_text_field_delegate.hpp:20
std::string text(text_field_widget &sender) noexcept override
Get the text to show in the text field.
Definition default_text_field_delegate.hpp:56
void set_text(text_field_widget &sender, std::string_view text) noexcept override
Set the text as entered by the user.
Definition default_text_field_delegate.hpp:61
std::optional< label > validate(text_field_widget &sender, std::string_view text) noexcept override
Validate the text field.
Definition default_text_field_delegate.hpp:45
Definition text_field_delegate.hpp:15
A single line text field.
Definition text_field_widget.hpp:55