11#include "../notifier.hpp"
12#include "../observer.hpp"
13#include "../GUI/module.hpp"
17namespace hi {
inline namespace v1 {
25 using notifier_type = notifier<>;
26 using callback_token = notifier_type::callback_token;
27 using callback_proto = notifier_type::callback_proto;
31 virtual void init(
widget& sender)
noexcept {}
33 virtual void deinit(
widget& sender)
noexcept {}
48 [[nodiscard]] callback_token
49 subscribe(forward_of<callback_proto>
auto&& callback, callback_flags flags = callback_flags::synchronous)
noexcept
51 return _notifier.subscribe(
hi_forward(callback), flags);
55 notifier_type _notifier;
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
widget_state
Definition widget_state.hpp:14
@ off
The widget in the off-state.
A button delegate controls the state of a button widget.
Definition button_delegate.hpp:23
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 button_delegate.hpp:49
virtual widget_state state(widget const &sender) const noexcept
Used by the widget to check the state of the button.
Definition button_delegate.hpp:41
virtual void activate(widget &sender) noexcept
Called when the button is pressed by the user.
Definition button_delegate.hpp:37