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 "../macros.hpp"
21hi_export_module(hikogui.widgets.tab_delegate);
23hi_export
namespace hi {
inline namespace v1 {
44 template<forward_of<
void()> Func>
47 return _notifier.subscribe(std::forward<Func>(
func), flags);
51 notifier<
void()> _notifier;
71 template<forward_of<observer<value_type>> Value>
74 _value_cbt = this->value.
subscribe([&](
auto...) {
82 hi_assert(
not tab_indices.contains(key));
83 tab_indices[key] = index;
88 auto it = tab_indices.
find(*value);
89 if (
it == tab_indices.
end()) {
97 callback<
void(value_type)> _value_cbt;
107template<
typename Value>
112 return std::make_shared<default_tab_delegate<value_type>>(std::forward<Value>(value));
std::shared_ptr< tab_delegate > make_default_tab_delegate(Value &&value) noexcept
Create a shared pointer to a default tab delegate.
Definition tab_delegate.hpp:108
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 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 tab_widget.
Definition tab_delegate.hpp:29
callback< void()> subscribe(Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
Subscribe a callback for notifying the widget of a data change.
Definition tab_delegate.hpp:45
A delegate that control the state of a tab_widget.
Definition tab_delegate.hpp:60
default_tab_delegate(Value &&value) noexcept
Construct a default tab delegate.
Definition tab_delegate.hpp:72