12#include "../macros.hpp"
14namespace hi {
inline namespace v1 {
112 _label_constraints = super::update_constraints();
115 hilet
extra_size =
extent2{theme().margin<
float>() * 2.0f, theme().margin<
float>()};
119 void set_layout(widget_layout
const&
context)
noexcept override
123 theme().margin<
float>(),
125 context.width() - theme().margin<
float>() * 2.0f,
126 context.height() - theme().margin<
float>()};
127 _on_label_shape = _off_label_shape = _other_label_shape =
128 box_shape{_label_constraints,
label_rectangle, theme().baseline_adjustment()};
133 void draw(draw_context
const&
context)
noexcept override
136 draw_toolbar_tab_button(
context);
141 [[
nodiscard]]
bool accepts_keyboard_focus(keyboard_focus_group group)
const noexcept override
147 box_constraints _label_constraints;
149 void draw_toolbar_tab_button(draw_context
const&
context)
noexcept
153 hilet offset = theme().margin<
float>() + theme().border_width();
157 hilet
button_z = *
focus ? translate_z(0.6f) : translate_z(0.0f);
172 theme().border_width(),
Defines abstract_button_widget.
std::shared_ptr< button_delegate > make_default_radio_button_delegate(auto &&value, auto &&on_value) noexcept
Make a shared pointer to a radio-button delegate.
Definition button_delegate.hpp:227
@ on
The 'on' state of a button.
@ partial
A widget is partially enabled.
@ invisible
The widget is invisible.
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
border_side
The side where the border is drawn.
Definition draw_context.hpp:27
@ inside
The border is drawn inside the edge of a quad.
bool compare_store(T &lhs, U &&rhs) noexcept
Compare then store if there was a change.
Definition misc.hpp:56
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
Horizontal/Vertical alignment combination.
Definition alignment.hpp:242
The 4 radii of the corners of a quad or rectangle.
Definition corner_radii.hpp:19
A high-level geometric extent.
Definition extent2.hpp:29
virtual void request_redraw() const noexcept=0
Request the widget to be redrawn on the next frame.
widget_intf * parent
Pointer to the parent widget.
Definition widget_intf.hpp:28
2D constraints.
Definition box_constraints.hpp:25
Base class for implementing button widgets.
Definition abstract_button_widget.hpp:33
std::shared_ptr< delegate_type > delegate
The delegate that controls the button widget.
Definition abstract_button_widget.hpp:40
button_state state() const noexcept
Get the current state of the button.
Definition abstract_button_widget.hpp:88
A button delegate controls the state of a button widget.
Definition button_delegate.hpp:45
A graphical control element that allows the user to choose only one of a predefined set of mutually e...
Definition toolbar_tab_button_widget.hpp:47
toolbar_tab_button_widget(widget *parent, Value &&value, OnValue &&on_value, Attributes &&...attributes) noexcept
Construct a toolbar tab button widget with a default button delegate.
Definition toolbar_tab_button_widget.hpp:87
void request_redraw() const noexcept override
Request the widget to be redrawn on the next frame.
Definition toolbar_tab_button_widget.hpp:97
toolbar_tab_button_widget(widget *parent, std::shared_ptr< delegate_type > delegate, button_widget_attribute auto &&...attributes) noexcept
Construct a toolbar tab button widget.
Definition toolbar_tab_button_widget.hpp:61
An interactive graphical object as part of the user-interface.
Definition widget.hpp:37
widget_layout const & layout() const noexcept override
Get the current layout for this widget.
Definition widget.hpp:169
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:66
observer< bool > hover
Mouse cursor is hovering over the widget.
Definition widget.hpp:46
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:42
observer< bool > focus
The widget has keyboard focus.
Definition widget.hpp:50
Definition concepts.hpp:54
True if T is a forwarded type of Forward.
Definition concepts.hpp:131
Definition abstract_button_widget.hpp:27