14namespace hi {
inline namespace v1 {
23 using notifier_type = notifier<>;
24 using callback_token = notifier_type::callback_token;
25 using callback_proto = notifier_type::callback_proto;
28 virtual void init(
tab_widget& sender)
noexcept {}
29 virtual void deinit(
tab_widget& sender)
noexcept {}
41 subscribe(forward_of<callback_proto>
auto&& callback, callback_flags flags = callback_flags::synchronous)
noexcept
43 return _notifier.subscribe(
hi_forward(callback), flags);
47 notifier_type _notifier;
60 observer<value_type> value;
69 _value_cbt = this->value.subscribe([&](
auto...) {
78 tab_indices[key] = index;
83 auto it = tab_indices.
find(*value);
84 if (it == tab_indices.
end()) {
87 return static_cast<ssize_t>(it->second);
92 typename decltype(value)::callback_token _value_cbt;
107 using value_type = observer_decay_t<
decltype(value)>;
108 return std::make_shared<default_tab_delegate<value_type>>(
hi_forward(value));
#define hi_assert(expression,...)
Assert if expression is true.
Definition assert.hpp:87
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
std::shared_ptr< tab_delegate > make_default_tab_delegate(auto &&value) noexcept
Create a shared pointer to a default tab delegate.
Definition tab_delegate.hpp:102
DOXYGEN BUG.
Definition algorithm.hpp:15
geometry/margins.hpp
Definition assert.hpp:18
std::ptrdiff_t ssize_t
Signed size/index into an array.
Definition utility.hpp:173
A delegate that controls the state of a tab_widget.
Definition tab_delegate.hpp:21
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 tab_delegate.hpp:41
A delegate that control the state of a tab_widget.
Definition tab_delegate.hpp:56
default_tab_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a default tab delegate.
Definition tab_delegate.hpp:67
A graphical element that shows only one of a predefined set of mutually exclusive child widgets.
Definition tab_widget.hpp:36