11#include "../macros.hpp"
15namespace hi {
inline namespace v1 {
24 using notifier_type = notifier<>;
25 using callback_token = notifier_type::callback_token;
26 using callback_proto = notifier_type::callback_proto;
29 virtual void init(
tab_widget& sender)
noexcept {}
30 virtual void deinit(
tab_widget& sender)
noexcept {}
44 return _notifier.subscribe(hi_forward(callback), flags);
48 notifier_type _notifier;
61 observer<value_type> value;
70 _value_cbt = this->value.subscribe([&](
auto...) {
78 hi_assert(not tab_indices.contains(key));
79 tab_indices[key] = index;
84 auto it = tab_indices.
find(*value);
85 if (it == tab_indices.
end()) {
88 return static_cast<ssize_t>(it->second);
93 typename decltype(value)::callback_token _value_cbt;
108 using value_type = observer_decay_t<
decltype(value)>;
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:103
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
The HikoGUI API version 1.
Definition lookahead_iterator.hpp:6
std::ptrdiff_t ssize_t
Signed size/index into an array.
Definition misc.hpp:33
A delegate that controls the state of a tab_widget.
Definition tab_delegate.hpp:22
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:42
A delegate that control the state of a tab_widget.
Definition tab_delegate.hpp:57
default_tab_delegate(forward_of< observer< value_type > > auto &&value) noexcept
Construct a default tab delegate.
Definition tab_delegate.hpp:68
A graphical element that shows only one of a predefined set of mutually exclusive child widgets.
Definition tab_widget.hpp:37
True if T is a forwarded type of Forward.
Definition concepts.hpp:131