7#include "abstract_button_widget.hpp"
20 value_type
const false_value;
22 template<
typename Value = observable<value_type>>
26 value_type true_value,
27 value_type false_value,
28 Value &&value = {})
noexcept :
32 _value_callback = this->value.subscribe([
this](
auto...) {
33 ttlet lock = std::scoped_lock(gui_system_mutex);
41 void toggle()
noexcept
43 ttlet lock = std::scoped_lock(gui_system_mutex);
45 if (compare_then_assign(this->value, this->value == this->false_value ? this->true_value : this->false_value)) {
51 typename decltype(super::value)::callback_ptr_type _value_callback;
52 typename super::callback_ptr_type _callback;
Definition gui_window.hpp:39
void request_redraw(aarect rectangle=aarect::infinity()) noexcept
Request a rectangle on the window to be redrawn.
Definition gui_window.hpp:115
An abstract button widget.
Definition abstract_button_widget.hpp:16
callback_ptr_type subscribe(Callback &&callback) noexcept
Subscribe a callback to call when the button is activated.
Definition abstract_button_widget.hpp:109
An abstract toggle button widget.
Definition abstract_toggle_button_widget.hpp:15
gui_window & window
Convenient reference to the Window.
Definition widget.hpp:100
abstract_container_widget const & parent() const noexcept
Get a reference to the parent.
virtual aarect window_clipping_rectangle() const noexcept
Get the clipping-rectangle in window coordinates.
Definition widget.hpp:320