guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::components::Bound Class Reference

Size of an entity: the width and height, in dp, of the rectangle that starts at the position of its components::Transform. More...

#include <headers/guillaume/components/bound.hpp>

Inheritance diagram for guillaume::components::Bound:
Collaboration diagram for guillaume::components::Bound:

Public Member Functions

 Bound (void)
 Construct a bound with the default size of utility::graphic::SizeF.
Bound & setWidth (float width) noexcept
 Set the width.
Bound & setHeight (float height) noexcept
 Set the height.
 ~Bound (void)=default
 Default destructor for the Bound component.
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.

Detailed Description

Size of an entity: the width and height, in dp, of the rectangle that starts at the position of its components::Transform.

The bound has no position of its own. Shapes (rectangle, ellipse, ring, arc, line, image) are drawn to fill it, and the input systems hit-test against it.

Who writes it depends on the entity:

Note
In the first three cases a size set by hand is overwritten on the next frame. To force the size of a container use components::Layout::setFixedWidth and setFixedHeight.
getWidth() and getHeight() come from utility::graphic::SizeF. Use the setters of this class, not the base class ones through a SizeF reference: only these mark the component changed.
See also
components::Transform, components::Layout, systems::MeasureText

Definition at line 61 of file bound.hpp.

Constructor & Destructor Documentation

◆ Bound()

guillaume::components::Bound::Bound ( void )

Construct a bound with the default size of utility::graphic::SizeF.

Definition at line 27 of file bound.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ setHeight()

Bound & guillaume::components::Bound::setHeight ( float height)
noexcept

Set the height.

Marks the component changed only when height differs from the current height.

Parameters
heightThe new height, in dp.
Returns
This component, for chaining.

Definition at line 42 of file bound.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWidth()

Bound & guillaume::components::Bound::setWidth ( float width)
noexcept

Set the width.

Hides utility::graphic::SizeF::setWidth to add change tracking: the component is marked changed only when width differs from the current width, so a measure system writing the same size every frame does not keep the entity dirty.

Parameters
widthThe new width, in dp.
Returns
This component, for chaining.

Definition at line 33 of file bound.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: