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 {
32 virtual void init(
widget_intf const& sender)
noexcept {}
33 virtual void deinit(
widget_intf const& sender)
noexcept {}
44 template<forward_of<
void()> Func>
45 [[nodiscard]]
callback<void()>
subscribe(Func&& func, callback_flags flags = callback_flags::synchronous)
noexcept
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>
111 using value_type = observer_decay_t<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
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
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