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

State of a divider: a thin horizontal line separating content. More...

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

Inheritance diagram for guillaume::components::Divider:
Collaboration diagram for guillaume::components::Divider:

Public Types

enum class  Variant { FullWidth , Inset , Middle }
 Which ends of the divider are inset. More...

Public Member Functions

 Divider (void)=default
 Create the state of a full-width hairline divider, 100 dp long.
 ~Divider (void)=default
 Default destructor.
Variant getVariant (void) const
 Get which ends are inset.
Divider & setVariant (Variant variant)
 Choose which ends are inset.
float getLength (void) const
 Get the total length, insets included.
Divider & setLength (float length)
 Set the total length, insets included.
float getThickness (void) const
 Get the stroke thickness.
Divider & setThickness (float thickness)
 Set the stroke thickness.
float getInset (void) const
 Get the inset applied to an inset end.
Divider & setInset (float inset)
 Set the inset applied to an inset end.
const utility::graphic::Color32Bit & getColor (void) const
 Get the stroke color.
Divider & setColor (const utility::graphic::Color32Bit &color)
 Set the stroke color.
const utility::graphic::PoseF & getOriginPose (void) const
 Get the pose of the divider before the leading inset.
Divider & setOriginPose (const utility::graphic::PoseF &pose)
 Set the pose of the divider before the leading inset.
const utility::graphic::PoseF & getAppliedPose (void) const
 Get the pose systems::Divider last wrote to the Transform.
Divider & setAppliedPose (const utility::graphic::PoseF &pose)
 Record the pose written to the Transform.
float getLeadingInset (void) const
 Get the inset applied on the leading (left) end for the current variant.
float getTrailingInset (void) const
 Get the inset applied on the trailing (right) end for the current variant.
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.

Static Public Attributes

static constexpr float HairlineThickness = 0.5f
 Default stroke thickness, in dp.
static constexpr float BoldThickness = 1.0f
 Thickness of a bold stroke, in dp.

Detailed Description

State of a divider: a thin horizontal line separating content.

It holds the variant, the length, the thickness, the inset, the color and the pose of the divider.

Role in the frame:

registry.getComponent<components::Divider>(identifier)
.setVariant(components::Divider::Variant::Inset)
.setLength(320.0f);
// Drawn 304 dp long, starting 16 dp to the right of the origin.
State of a divider: a thin horizontal line separating content.
Definition divider.hpp:59
Divider & setVariant(Variant variant)
Choose which ends are inset.
Definition divider.cpp:32
Divider & setLength(float length)
Set the total length, insets included.
Definition divider.cpp:47

Watch out: the Transform, Bound, Line thickness and Color of the entity are overwritten every frame from this component, so change the divider here. Moving the entity through its Transform is supported: the system notices the move and adopts it as the new origin pose.

See also
systems::Divider, components::Line

Definition at line 58 of file divider.hpp.

Member Enumeration Documentation

◆ Variant

Which ends of the divider are inset.

FullWidth: none. Inset: the leading (left) end. Middle: both ends.

Definition at line 67 of file divider.hpp.

Member Function Documentation

◆ getAppliedPose()

const utility::graphic::PoseF & guillaume::components::Divider::getAppliedPose ( void ) const

Get the pose systems::Divider last wrote to the Transform.

Returns
The applied pose.

Definition at line 114 of file divider.cpp.

Here is the caller graph for this function:

◆ getColor()

const utility::graphic::Color32Bit & guillaume::components::Divider::getColor ( void ) const

Get the stroke color.

Returns
The color.

Definition at line 87 of file divider.cpp.

◆ getInset()

float guillaume::components::Divider::getInset ( void ) const

Get the inset applied to an inset end.

Returns
The inset, in dp (16 by default), whatever the variant.

Definition at line 72 of file divider.cpp.

◆ getLeadingInset()

float guillaume::components::Divider::getLeadingInset ( void ) const

Get the inset applied on the leading (left) end for the current variant.

Returns
The inset, in dp, for Inset and Middle; 0 for FullWidth.

Definition at line 125 of file divider.cpp.

◆ getLength()

float guillaume::components::Divider::getLength ( void ) const

Get the total length, insets included.

Returns
The length, in dp (100 by default).

Definition at line 42 of file divider.cpp.

◆ getOriginPose()

const utility::graphic::PoseF & guillaume::components::Divider::getOriginPose ( void ) const

Get the pose of the divider before the leading inset.

Returns
The pose of the left end of a full-width divider.

Definition at line 99 of file divider.cpp.

◆ getThickness()

float guillaume::components::Divider::getThickness ( void ) const

Get the stroke thickness.

Returns
The thickness, in dp (HairlineThickness by default).

Definition at line 57 of file divider.cpp.

◆ getTrailingInset()

float guillaume::components::Divider::getTrailingInset ( void ) const

Get the inset applied on the trailing (right) end for the current variant.

Returns
The inset, in dp, for Middle; 0 otherwise.

Definition at line 130 of file divider.cpp.

◆ getVariant()

Divider::Variant guillaume::components::Divider::getVariant ( void ) const

Get which ends are inset.

Returns
The variant (FullWidth by default).

Definition at line 27 of file divider.cpp.

◆ setAppliedPose()

Divider & guillaume::components::Divider::setAppliedPose ( const utility::graphic::PoseF & pose)

Record the pose written to the Transform.

Bookkeeping of systems::Divider: when the Transform differs from it, something else moved the entity. It does not mark the component changed.

Parameters
poseThe applied pose.
Returns
This component, for chaining.

Definition at line 119 of file divider.cpp.

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

◆ setColor()

Divider & guillaume::components::Divider::setColor ( const utility::graphic::Color32Bit & color)

Set the stroke color.

Unlike the other setters, it marks the component changed on every call, even when the color is the same.

Parameters
colorThe stroke color.
Returns
This component, for chaining.

Definition at line 92 of file divider.cpp.

Here is the call graph for this function:

◆ setInset()

Divider & guillaume::components::Divider::setInset ( float inset)

Set the inset applied to an inset end.

It has no visible effect on a FullWidth divider. Marks the component changed when the inset differs.

Parameters
insetThe inset, in dp.
Returns
This component, for chaining.

Definition at line 77 of file divider.cpp.

Here is the call graph for this function:

◆ setLength()

Divider & guillaume::components::Divider::setLength ( float length)

Set the total length, insets included.

The stroke drawn is this length minus the insets of the variant, and never negative. Marks the component changed when the length differs.

Parameters
lengthThe length, in dp.
Returns
This component, for chaining.

Definition at line 47 of file divider.cpp.

Here is the call graph for this function:

◆ setOriginPose()

Divider & guillaume::components::Divider::setOriginPose ( const utility::graphic::PoseF & pose)

Set the pose of the divider before the leading inset.

The system writes this pose, shifted right by the leading inset, to the Transform. Marks the component changed when the pose differs.

Parameters
poseThe pose of the left end of the full-width divider.
Returns
This component, for chaining.

Definition at line 104 of file divider.cpp.

Here is the call graph for this function:

◆ setThickness()

Divider & guillaume::components::Divider::setThickness ( float thickness)

Set the stroke thickness.

Marks the component changed when the thickness differs.

Parameters
thicknessThe thickness, in dp, for example HairlineThickness or BoldThickness.
Returns
This component, for chaining.

Definition at line 62 of file divider.cpp.

Here is the call graph for this function:

◆ setVariant()

Divider & guillaume::components::Divider::setVariant ( Variant variant)

Choose which ends are inset.

Marks the component changed when the variant differs.

Parameters
variantFullWidth, Inset or Middle.
Returns
This component, for chaining.

Definition at line 32 of file divider.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ BoldThickness

float guillaume::components::Divider::BoldThickness = 1.0f
staticconstexpr

Thickness of a bold stroke, in dp.

Definition at line 73 of file divider.hpp.

◆ HairlineThickness

float guillaume::components::Divider::HairlineThickness = 0.5f
staticconstexpr

Default stroke thickness, in dp.

Definition at line 70 of file divider.hpp.


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