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"
20hi_export_module(hikogui.widgets.button_delegate);
22hi_export
namespace hi {
32 virtual void init(
widget_intf const& sender)
noexcept {}
34 virtual void deinit(
widget_intf const& sender)
noexcept {}
44 return widget_value::off;
49 template<forward_of<
void()> Func>
50 [[nodiscard]]
callback<void()>
subscribe(Func&& func, callback_flags flags = callback_flags::synchronous)
noexcept
52 return _notifier.subscribe(std::forward<Func>(func), flags);
56 notifier<void()> _notifier;
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 button delegate controls the state of a button widget.
Definition button_delegate.hpp:28
virtual void activate(widget_intf const &sender) noexcept
Called when the button is pressed by the user.
Definition button_delegate.hpp:38
virtual widget_value state(widget_intf const &sender) const noexcept
Used by the widget to check the state of the button.
Definition button_delegate.hpp:42
callback< void()> subscribe(Func &&func, callback_flags flags=callback_flags::synchronous) noexcept
Subscribe a callback for notifying the widget of a data change.
Definition button_delegate.hpp:50