12#include "../GUI/theme.hpp"
13#include "../geometry/module.hpp"
14#include "../layout/row_column_layout.hpp"
18namespace hi {
inline namespace v1 {
42 static_assert(Axis == axis::horizontal or Axis == axis::vertical);
74 template<
typename Widget,
typename... Args>
77 auto tmp = std::make_unique<Widget>(
this, std::forward<Args>(args)...);
81 ++global_counter<
"row_column_widget:make_widget:constrain">;
92 ++global_counter<
"row_column_widget:clear:constrain">;
97 [[nodiscard]] generator<widget const &> children(
bool include_invisible)
const noexcept override
99 for (
hilet& child : _children) {
100 co_yield *child.value;
104 [[nodiscard]] box_constraints update_constraints() noexcept
override
108 for (
auto& child : _children) {
109 child.set_constraints(child.value->update_constraints());
112 return _children.constraints(os_settings::left_to_right());
115 void set_layout(widget_layout
const& context)
noexcept override
118 _children.set_layout(context.shape, theme().baseline_adjustment());
120 for (
hilet& child : _children) {
121 child.value->set_layout(context.transform(child.shape, 0.0f));
126 void draw(draw_context
const& context)
noexcept override
129 for (
hilet& child : _children) {
130 child.value->draw(context);
135 hitbox hitbox_test(point2i position)
const noexcept override
141 for (
hilet& child : _children) {
142 r = child.value->hitbox_test_from_parent(position, r);
151 row_column_layout<Axis, std::unique_ptr<widget>> _children;
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:238
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
axis
An enumeration of the 3 axis for 3D geometry.
Definition axis.hpp:18
@ window_reconstrain
Request that widget get constraint on the next frame.
@ partial
A widget is partially enabled.
@ invisible
The widget is invisible.
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11
bool compare_store(T &lhs, U &&rhs) noexcept
Compare then store if there was a change.
Definition utility.hpp:212
A row/column widget lays out child widgets along a row or column.
Definition row_column_widget.hpp:40
Widget & make_widget(Args &&...args)
Add a widget directly to this grid-widget.
Definition row_column_widget.hpp:75
void clear() noexcept
Remove and deallocate all child widgets.
Definition row_column_widget.hpp:88
row_column_widget(widget *parent) noexcept
Constructs an empty row/column widget.
Definition row_column_widget.hpp:53
An interactive graphical object as part of the user-interface.
Definition widget.hpp:46
int semantic_layer
The draw layer of the widget.
Definition widget.hpp:86
widget(widget *parent) noexcept
widget * parent
Pointer to the parent widget.
Definition widget.hpp:51
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:62