|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
How a container arranges its children: in a row or a column, with which alignment, spacing and padding, and at which size. More...
#include <headers/guillaume/components/layout.hpp>


Public Types | |
| enum class | Axis { Horizontal , Vertical } |
| Direction along which children are arranged. More... | |
| enum class | MainAxisAlignment { Start , Center , End , SpaceBetween } |
| Where the children go along the main axis when the container is larger than them. More... | |
| enum class | CrossAxisAlignment { Start , Center , End } |
| Where each child goes along the cross axis, inside the padding. In a container that wraps its children, the reference is the largest child. More... | |
Public Member Functions | |
| Layout (void)=default | |
| Default constructor for the Layout component. | |
| ~Layout (void)=default | |
| Default destructor for the Layout component. | |
| Axis | getAxis (void) const |
| Get the main axis. | |
| Layout & | setAxis (Axis axis) |
| Choose between a row and a column. | |
| MainAxisAlignment | getMainAxisAlignment (void) const |
| Get the alignment along the main axis. | |
| Layout & | setMainAxisAlignment (MainAxisAlignment alignment) |
| Set where the children go along the main axis. | |
| CrossAxisAlignment | getCrossAxisAlignment (void) const |
| Get the alignment along the cross axis. | |
| Layout & | setCrossAxisAlignment (CrossAxisAlignment alignment) |
| Set where each child goes along the cross axis. | |
| float | getSpacing (void) const |
| Get the gap between two consecutive children. | |
| Layout & | setSpacing (float spacing) |
| Set the gap between two consecutive children. | |
| float | getPadding (void) const |
| Get the inset between the container's edges and its children. | |
| Layout & | setPadding (float padding) |
| Set the inset between the container's edges and its children. | |
| bool | hasFixedWidth (void) const |
| Check whether the container width is forced. | |
| float | getFixedWidth (void) const |
| Get the forced container width. | |
| Layout & | setFixedWidth (float width) |
| Force the container width instead of wrapping the children. | |
| Layout & | clearFixedWidth (void) |
| Let the width wrap the children again. | |
| bool | hasFixedHeight (void) const |
| Check whether the container height is forced. | |
| float | getFixedHeight (void) const |
| Get the forced container height. | |
| Layout & | setFixedHeight (float height) |
| Force the container height instead of wrapping the children. | |
| Layout & | clearFixedHeight (void) |
| Let the height wrap the children again. | |
| const std::vector< ecs::Entity::Identifier > & | getChildren (void) const |
| Get the children systems::Layout arranges, in order. | |
| Layout & | setChildren (const std::vector< ecs::Entity::Identifier > &children) |
| Replace the list of children to arrange. | |
| Layout & | addChild (ecs::Entity::Identifier child) |
| Add a child at the end of the list. | |
| Layout & | clearChildren (void) |
| Empty the list of children; the entities themselves are left untouched. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
How a container arranges its children: in a row or a column, with which alignment, spacing and padding, and at which size.
The container's widget class (entities::View and the widgets built on it) or the application writes it. systems::Layout reads it every frame in the Layout phase and then:
Definition at line 68 of file layout.hpp.
|
strong |
Direction along which children are arranged.
| Enumerator | |
|---|---|
| Horizontal | Row: children placed left to right. |
| Vertical | Column: children placed top to bottom. |
Definition at line 74 of file layout.hpp.
|
strong |
Where each child goes along the cross axis, inside the padding. In a container that wraps its children, the reference is the largest child.
| Enumerator | |
|---|---|
| Start | At the top (row) or left (column). |
| Center | In the middle. |
| End | At the bottom (row) or right (column). |
Definition at line 99 of file layout.hpp.
|
strong |
Where the children go along the main axis when the container is larger than them.
It only shows with a fixed size on the main axis: a container that wraps its children has no room left to distribute.
Definition at line 86 of file layout.hpp.
| Layout & guillaume::components::Layout::addChild | ( | ecs::Entity::Identifier | child | ) |
Add a child at the end of the list.
Always marks the component changed. The identifier is not checked: adding the same child twice lists it twice.
| child | The identifier of the child to arrange last. |
Definition at line 182 of file layout.cpp.

| Layout & guillaume::components::Layout::clearChildren | ( | void | ) |
Empty the list of children; the entities themselves are left untouched.
Marks the component changed only when the list was not empty.
Definition at line 189 of file layout.cpp.

| Layout & guillaume::components::Layout::clearFixedHeight | ( | void | ) |
Let the height wrap the children again.
Marks the component changed only when a height was forced.
Definition at line 155 of file layout.cpp.

| Layout & guillaume::components::Layout::clearFixedWidth | ( | void | ) |
Let the width wrap the children again.
Marks the component changed only when a width was forced.
Definition at line 123 of file layout.cpp.

| Layout::Axis guillaume::components::Layout::getAxis | ( | void | ) | const |
Get the main axis.
Definition at line 27 of file layout.cpp.
| const std::vector< ecs::Entity::Identifier > & guillaume::components::Layout::getChildren | ( | void | ) | const |
Get the children systems::Layout arranges, in order.
Children the container's own system places (a switch thumb, a slider fill, ...) are left out of this list on purpose and keep the pose that system gives them.
Definition at line 166 of file layout.cpp.
| Layout::CrossAxisAlignment guillaume::components::Layout::getCrossAxisAlignment | ( | void | ) | const |
Get the alignment along the cross axis.
Definition at line 57 of file layout.cpp.
| float guillaume::components::Layout::getFixedHeight | ( | void | ) | const |
Get the forced container height.
Definition at line 139 of file layout.cpp.
| float guillaume::components::Layout::getFixedWidth | ( | void | ) | const |
Get the forced container width.
Definition at line 107 of file layout.cpp.

| Layout::MainAxisAlignment guillaume::components::Layout::getMainAxisAlignment | ( | void | ) | const |
Get the alignment along the main axis.
Definition at line 42 of file layout.cpp.
| float guillaume::components::Layout::getPadding | ( | void | ) | const |
Get the inset between the container's edges and its children.
Definition at line 87 of file layout.cpp.

| float guillaume::components::Layout::getSpacing | ( | void | ) | const |
Get the gap between two consecutive children.
Definition at line 72 of file layout.cpp.
| bool guillaume::components::Layout::hasFixedHeight | ( | void | ) | const |
Check whether the container height is forced.
Definition at line 134 of file layout.cpp.
| bool guillaume::components::Layout::hasFixedWidth | ( | void | ) | const |
Check whether the container width is forced.
Definition at line 102 of file layout.cpp.

Choose between a row and a column.
Marks the component changed only when the value differs.
| axis | Horizontal for a row, Vertical for a column. |
Definition at line 32 of file layout.cpp.


| Layout & guillaume::components::Layout::setChildren | ( | const std::vector< ecs::Entity::Identifier > & | children | ) |
Replace the list of children to arrange.
Marks the component changed only when the list differs.
| children | The child identifiers, first to last along the main axis. |
Definition at line 171 of file layout.cpp.


| Layout & guillaume::components::Layout::setCrossAxisAlignment | ( | CrossAxisAlignment | alignment | ) |
Set where each child goes along the cross axis.
Marks the component changed only when the value differs.
| alignment | The alignment of every child. |
Definition at line 62 of file layout.cpp.


| Layout & guillaume::components::Layout::setFixedHeight | ( | float | height | ) |
Force the container height instead of wrapping the children.
systems::Layout then writes this height into the container's Bound, whatever the children need. Marks the component changed unless the same height was already forced.
| height | The height of the container, in dp, padding included. |
Definition at line 144 of file layout.cpp.


| Layout & guillaume::components::Layout::setFixedWidth | ( | float | width | ) |
Force the container width instead of wrapping the children.
systems::Layout then writes this width into the container's Bound, whatever the children need: children that do not fit overflow. Marks the component changed unless the same width was already forced.
| width | The width of the container, in dp, padding included. |
Definition at line 112 of file layout.cpp.


| Layout & guillaume::components::Layout::setMainAxisAlignment | ( | MainAxisAlignment | alignment | ) |
Set where the children go along the main axis.
Marks the component changed only when the value differs.
| alignment | The alignment; see MainAxisAlignment for when it has a visible effect. |
Definition at line 47 of file layout.cpp.


| Layout & guillaume::components::Layout::setPadding | ( | float | padding | ) |
Set the inset between the container's edges and its children.
Marks the component changed only when the value differs.
| padding | The padding, in dp, applied to the four sides. |
Definition at line 92 of file layout.cpp.


| Layout & guillaume::components::Layout::setSpacing | ( | float | spacing | ) |
Set the gap between two consecutive children.
Marks the component changed only when the value differs.
| spacing | The gap along the main axis, in dp. Ignored with MainAxisAlignment::SpaceBetween. |
Definition at line 77 of file layout.cpp.

