13namespace hi {
inline namespace v1 {
19template<fixed_string Name =
"">
22 using super = abstract_button_widget<Name /
"toolbar-button">;
23 using delegate_type =
typename super::delegate_type;
24 constexpr static auto prefix = super::prefix;
29 button_widget_attribute
auto&&...attributes) noexcept :
32 this->
alignment = alignment::middle_left();
33 this->set_attributes<0>(
hi_forward(attributes)...);
44 _label_constraints = super::update_constraints();
48 hilet extra_size =
extent2{spacing * 2, spacing * 2};
50 auto constraints = _label_constraints + extra_size;
51 constraints.margins = 0;
55 void set_layout(
widget_layout const& context)
noexcept override
59 hilet label_rectangle = aarectangle{spacing, 0, context.width() - spacing * 2, context.height()};
60 this->_on_label_shape = this->_off_label_shape = this->_other_label_shape =
63 super::set_layout(context);
69 draw_toolbar_button(context);
70 this->draw_button(context);
74 [[nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group)
const noexcept override
86 this->layout.rectangle(),
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
Defines abstract_button_widget.
geo::extent< float, 2 > extent2
A 2D extent.
Definition extent.hpp:502
@ partial
A widget is partially enabled.
Definition widget_mode.hpp:67
@ invisible
The widget is invisible.
Definition widget_mode.hpp:35
geometry/margins.hpp
Definition cache.hpp:11
The HikoGUI API version 1.
Definition cache.hpp:11
@ inside
The border is drawn inside the edge of a quad.
Definition widget_draw_context.hpp:29
bool compare_store(T &lhs, U &&rhs) noexcept
Compare then store if there was a change.
Definition utility.hpp:212
auto theme
A tagged global variable to a theme model for a widget's component.
Definition theme_model.hpp:545
virtual void draw(widget_draw_context &context) noexcept
Draw the widget.
Definition widget.hpp:189
widget * parent
Pointer to the parent widget.
Definition widget.hpp:40
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:49
Draw context for drawing using the HikoGUI shaders.
Definition widget_draw_context.hpp:204
The layout of a widget.
Definition widget_layout.hpp:37
2D constraints.
Definition box_constraints.hpp:22
Definition box_shape.hpp:15
observer< hi::alignment > alignment
Definition abstract_button_widget.hpp:58
std::shared_ptr< delegate_type > delegate
Definition abstract_button_widget.hpp:42
A momentary button used as a child in the toolbar.
Definition toolbar_button_widget.hpp:20