guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
placement_helpers.hpp File Reference

Placement helpers for the children systems::Layout does not arrange. More...

#include <cstdint>
#include <utility/graphic/pose.hpp>
#include <utility/graphic/position.hpp>
#include "guillaume/ecs/component_registry.hpp"
#include "guillaume/ecs/entity.hpp"
#include "guillaume/components/bound.hpp"
#include "guillaume/components/layout_extent.hpp"
#include "guillaume/components/transform.hpp"
#include "guillaume/systems/layout.hpp"
Include dependency graph for placement_helpers.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  guillaume::systems::placement
 Helpers that position a child relative to its parent by writing the child's components::Transform.
namespace  guillaume
 A C++20 UI framework for desktop and XR, built as an entity-component-system.
namespace  guillaume::systems
 Rules. Every class here runs each frame on the entities that have the components it declares.

Functions

utility::graphic::PoseF guillaume::systems::placement::poseOf (ecs::ComponentRegistry &registry, const ecs::Entity::Identifier &identifier)
 Read the pose (position and orientation) of an entity.
void guillaume::systems::placement::placeChild (ecs::ComponentRegistry &registry, const ecs::Entity::Identifier &parentIdentifier, const ecs::Entity::Identifier &childIdentifier, const utility::graphic::PositionF &offset, std::uint32_t parentLayer)
 Place a child at an offset from the position of its parent.
void guillaume::systems::placement::centerChild (ecs::ComponentRegistry &registry, const ecs::Entity::Identifier &parentIdentifier, const ecs::Entity::Identifier &childIdentifier, std::uint32_t parentLayer)
 Center a child inside the bound of its parent, on both axes.
void guillaume::systems::placement::placeNormalized (ecs::ComponentRegistry &registry, const ecs::Entity::Identifier &parentIdentifier, const ecs::Entity::Identifier &childIdentifier, float normalized, float inset, std::uint32_t parentLayer)
 Place a child along the width of its parent from a 0 to 1 value, vertically centered.
void guillaume::systems::placement::reserveTrailingWidth (ecs::ComponentRegistry &registry, const ecs::Entity::Identifier &identifier, float width)
 Reserve layout room after an entity's Bound.

Detailed Description

Placement helpers for the children systems::Layout does not arrange.

Some widgets position a child by hand instead of through a components::Layout: the label beside a checkbox or a radio button, the handle of a switch, the badge of a navigation bar destination, the supporting text of a text field, the parts of a progress or a loading indicator. Their systems call the inline functions of guillaume::systems::placement from apply, in the Layout phase, once systems::Layout has resolved the bound of the parent. guillaume/entities/placement_helpers.hpp re-exports the same names in guillaume::entities for the widget classes.

Every function writes the components::Transform of the child and nothing else, and does nothing when a component it needs is missing, so an optional child can be passed as ecs::Entity::InvalidIdentifier. Offsets are in dp, measured from the position of the parent's components::Transform.

Definition in file placement_helpers.hpp.