11#include "../observer/observer.hpp"
12#include "../utility/utility.hpp"
13#include "../concurrency/concurrency.hpp"
14#include "../dispatch/dispatch.hpp"
15#include "../GUI/GUI.hpp"
16#include "../macros.hpp"
17#include "../unicode/unicode.hpp"
18#include "../l10n/l10n.hpp"
19#include "../macros.hpp"
24hi_export_module(hikogui.widgets.text_delegate);
26hi_export
namespace hi {
inline namespace v1 {
54 notifier<
void()> _notifier;
72 using value_type =
char const *;
80 template<forward_of<observer<value_type>> Value>
83 _value_cbt = this->value.
subscribe([&](
auto...) {
117 template<forward_of<observer<value_type>> Value>
120 _value_cbt = this->value.
subscribe([&](
auto...) {
127 return to_gstring(*value);
132 value = to_string(text);
146 using value_type = gstring;
154 template<forward_of<observer<value_type>> Value>
157 _value_cbt = this->value.
subscribe([&](
auto...) {
183 using value_type =
txt;
191 template<forward_of<observer<value_type>> Value>
194 _value_cbt = this->value.
subscribe([&](
auto...) {
201 return value->translate();
220template<
typename Value>
224 return std::make_shared<default_text_delegate<observer_decay_t<Value>>>(std::forward<Value>(value));
std::shared_ptr< text_delegate > make_default_text_delegate(Value &&value) noexcept
Create a shared pointer to a default text delegate.
Definition text_delegate.hpp:221
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378
Definition callback.hpp:77
Definition widget_intf.hpp:24
A localizable message.
Definition txt.hpp:100
A observer pointing to the whole or part of a observed_base.
Definition observer_intf.hpp:32
callback< void(value_type)> subscribe(Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
Subscribe a callback to this observer.
Definition observer_intf.hpp:456
A delegate that controls the state of a text_widget.
Definition text_delegate.hpp:33
virtual gstring read(widget_intf const &sender) noexcept=0
Read text as a string of graphemes.
virtual void write(widget_intf const &sender, gstring const &text) noexcept=0
Write text from a string of graphemes.
A default text delegate.
Definition text_delegate.hpp:63
gstring read(widget_intf const &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:88
default_text_delegate(Value &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:81
void write(widget_intf const &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:93
gstring read(widget_intf const &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:125
default_text_delegate(Value &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:118
void write(widget_intf const &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:130
default_text_delegate(Value &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:155
gstring read(widget_intf const &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:162
void write(widget_intf const &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:167
default_text_delegate(Value &&value) noexcept
Construct a delegate.
Definition text_delegate.hpp:192
void write(widget_intf const &sender, gstring const &text) noexcept override
Write text from a string of graphemes.
Definition text_delegate.hpp:204
gstring read(widget_intf const &sender) noexcept override
Read text as a string of graphemes.
Definition text_delegate.hpp:199