48 template<
typename Label>
51 hi_axiom(is_gui_thread());
62 hi_axiom(is_gui_thread());
63 if (
auto delegate = _delegate.lock()) {
64 return delegate->state(*
this);
66 return button_state::off;
73 co_yield _on_label_widget.get();
74 co_yield _off_label_widget.get();
75 co_yield _other_label_widget.get();
78 [[nodiscard]] color background_color() const noexcept override;
79 [[nodiscard]] hitbox hitbox_test(point3 position) const noexcept final;
80 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group) const noexcept override;
81 void activate() noexcept;
82 [[nodiscard]]
bool handle_event(command command) noexcept override;
83 [[nodiscard]]
bool handle_event(mouse_event const &event) noexcept final;
86 aarectangle _label_rectangle;
87 std::unique_ptr<label_widget> _on_label_widget;
88 std::unique_ptr<label_widget> _off_label_widget;
89 std::unique_ptr<label_widget> _other_label_widget;
91 bool _pressed = false;
92 weak_or_unique_ptr<delegate_type> _delegate;
93 notifier<>::token_type _delegate_cbt;
95 ~abstract_button_widget();
96 abstract_button_widget(gui_window &window, widget *parent, weak_or_unique_ptr<delegate_type> delegate) noexcept;
98 widget_constraints set_constraints_button() const noexcept;
99 void set_layout_button(widget_layout const &context) noexcept;
100 void draw_button(draw_context const &context) noexcept;