11#include "../GUI/module.hpp"
12#include "../geometry/module.hpp"
13#include "../layout/row_column_layout.hpp"
17namespace hi {
inline namespace v1 {
38template<fixed_
string Prefix, axis Axis>
41 static_assert(Axis == axis::horizontal or Axis == axis::vertical);
45 constexpr static auto prefix = Prefix;
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
106 for (
auto& child : _children) {
107 child.set_constraints(child.value->update_constraints());
110 return _children.constraints(os_settings::left_to_right());
113 void set_layout(widget_layout
const& context)
noexcept override
116 _children.set_layout(context.shape, theme<prefix>.cap_height(
this));
118 for (
hilet& child : _children) {
119 child.value->set_layout(context.transform(child.shape, 0.0f));
124 void draw(widget_draw_context& context)
noexcept override
127 for (
hilet& child : _children) {
128 child.value->draw(context);
133 hitbox hitbox_test(point2 position)
const noexcept override
139 for (
hilet& child : _children) {
140 r = child.value->hitbox_test_from_parent(position, r);
149 row_column_layout<Axis, std::unique_ptr<widget>> _children;
155template<fixed_string Name =
"">
161template<fixed_string Name =
"">
#define hi_axiom(expression,...)
Specify an axiom; an expression that is true.
Definition assert.hpp:253
#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
widget * parent
Pointer to the parent widget.
Definition widget.hpp:40
observer< widget_mode > mode
The widget mode.
Definition widget.hpp:49
size_t semantic_layer
The draw layer of the widget.
Definition widget.hpp:81
A row/column widget lays out child widgets along a row or column.
Definition row_column_widget.hpp:39
void clear() noexcept
Remove and deallocate all child widgets.
Definition row_column_widget.hpp:88
Widget & make_widget(Args &&...args)
Add a widget directly to this grid-widget.
Definition row_column_widget.hpp:75
row_column_widget(widget *parent) noexcept
Constructs an empty row/column widget.
Definition row_column_widget.hpp:53