11#include "../l10n/l10n.hpp"
12#include "../unicode/unicode.hpp"
13#include "../l10n/l10n.hpp"
14#include "../macros.hpp"
19namespace hi {
inline namespace v1 {
29 using callback_token = notifier_type::callback_token;
30 using callback_proto = notifier_type::callback_proto;
50 return _notifier.subscribe(hi_forward(callback), flags);
54 notifier_type _notifier;
72 using value_type =
char const *;
82 _value_cbt = this->value.subscribe([&](
auto...) {
98 typename decltype(value)::callback_token _value_cbt;
118 _value_cbt = this->value.subscribe([&](
auto...) {
125 return to_gstring(*value);
130 *value.copy() = to_string(text);
134 typename decltype(value)::callback_token _value_cbt;
144 using value_type = gstring;
154 _value_cbt = this->value.subscribe([&](
auto...) {
166 *value.copy() = text;
170 typename decltype(value)::callback_token _value_cbt;
180 using value_type =
txt;
190 _value_cbt = this->value.subscribe([&](
auto...) {
197 return value.read()->translate();
206 typename decltype(value)::callback_token _value_cbt;
221 return std::make_shared<default_text_delegate<observer_decay_t<
decltype(value)>>>(hi_forward(value));
std::shared_ptr< text_delegate > make_default_text_delegate(auto &&value) noexcept
Create a shared pointer to a default text delegate.
Definition text_delegate.hpp:216
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A localizable message.
Definition txt.hpp:100
A delegate that controls the state of a text_widget.
Definition text_delegate.hpp:26
virtual gstring read(text_widget &sender) noexcept=0
Read text as a string of graphemes.
callback_token subscribe(forward_of< callback_proto > auto &&callback, callback_flags flags=callback_flags::synchronous) noexcept
Subscribe a callback for notifying the widget of a data change.
Definition text_delegate.hpp:48
virtual void write(text_widget &sender, gstring const &text) noexcept=0
Write text from a string of graphemes.
A default text delegate.
Definition text_delegate.hpp:63
void write(text_widget &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:92
default_text_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:80
gstring read(text_widget &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:87
default_text_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:116
gstring read(text_widget &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:123
void write(text_widget &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:128
default_text_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:152
void write(text_widget &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:164
gstring read(text_widget &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:159
gstring read(text_widget &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:195
void write(text_widget &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:200
default_text_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:188
A text widget.
Definition text_widget.hpp:60
True if T is a forwarded type of Forward.
Definition concepts.hpp:131