13#include "../l10n/l10n.hpp"
14#include "../macros.hpp"
19namespace hi {
inline namespace v1 {
37 _icon_widget = std::make_unique<icon_widget>(
this, icon);
43 this->icon = hi_forward(icon);
49 co_yield *_icon_widget;
54 hi_assert_not_null(_icon_widget);
57 _icon_constraints = _icon_widget->update_constraints();
59 hilet size =
extent2{theme().large_size(), theme().large_size()};
60 return {size, size, size};
72 theme().margin<
float>(),
74 context.width() - theme().margin<
float>(),
75 context.height() - theme().margin<
float>()};
78 _icon_widget->set_layout(
context.transform(_icon_shape));
88 [[
nodiscard]] hitbox hitbox_test(point2 position)
const noexcept override
90 hi_axiom(loop::main().on_thread());
95 return {
id, _layout.elevation, hitbox_type::application_icon};
@ 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
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
Class which represents an axis-aligned rectangle.
Definition aarectangle.hpp:29
A high-level geometric extent.
Definition extent2.hpp:29
Draw context for drawing using the HikoGUI shaders.
Definition draw_context.hpp:208
widget_id id
The numeric identifier of a widget.
Definition widget_intf.hpp:23
widget_intf * parent
Pointer to the parent widget.
Definition widget_intf.hpp:28
The layout of a widget.
Definition widget_layout.hpp:38
2D constraints.
Definition box_constraints.hpp:25
Definition box_shape.hpp:18
The system menu widget.
Definition system_menu_widget.hpp:27
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
widget(widget *parent) noexcept
Definition widget.hpp:87
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:42