|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Sizes and colors a badge (the small dot or counter drawn over another widget) and fades it in and out. More...
#include <headers/guillaume/systems/badge.hpp>


Public Member Functions | |
| Badge (void) | |
| Create the system in the Layout phase. | |
| ~Badge (void) override=default | |
| Default destructor. | |
| void | update (const ecs::Entity::Identifier &entityIdentifier) override |
| Run apply() on one badge; called by the frame loop. | |
| Public Member Functions inherited from guillaume::ecs::SystemFiller< components::Badge > | |
| SystemFiller (Phase phase) | |
| Create the system and set its signature from ComponentTypes. | |
| virtual | ~SystemFiller (void)=default |
| Virtual destructor. | |
| Public Member Functions inherited from guillaume::ecs::System | |
| System (Phase phase) | |
| Create a system that runs in a given phase, with an empty signature. | |
| virtual | ~System (void)=default |
| Virtual destructor. | |
| Phase | getPhase (void) const noexcept |
| Get the phase of the frame in which the system runs. | |
| Entity::Signature | getSignature (void) const noexcept |
| Get the component types an entity must declare to be visited by this system. | |
| void | routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler) |
| Run the system once over a scene: prepare(), update() on each matching entity, cleanup(). | |
| void | bindComponentRegistry (ecs::ComponentRegistry &componentRegistry) |
| Bind a component registry so update() can be called directly, without routine(). | |
| void | unbindComponentRegistry (void) |
| Drop the binding made by bindComponentRegistry(). | |
| virtual void | prepare (void) |
| Called once per pass, before the first update(). | |
| virtual void | cleanup (void) |
| Called once per pass, after the last update(). | |
Static Public Member Functions | |
| static void | install (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier) |
| Prepare the visibility fade of a badge. | |
| static void | apply (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier) |
| Size and color one badge and its label. | |
| static float | sizeOf (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier) |
| Get the height of a badge, in dp. | |
| static bool | needsLabel (const ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier) |
| Whether the badge should have a label child. | |
| static void | setVisible (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, bool visible) |
| Show or hide the badge with a fade. | |
| static void | fade (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, float progress) |
| Move the visibility fade to a given progress and restyle. | |
Additional Inherited Members | |
| Protected Member Functions inherited from guillaume::ecs::System | |
| template<InheritFromComponent... ComponentTypes> | |
| void | setSignature (void) |
| Replace the signature by the one made of the given component types. | |
| ecs::EntityRegistry & | getEntityRegistry (void) |
| Get the entity registry of the scene being processed. | |
| const ecs::EntityRegistry & | getEntityRegistry (void) const |
| Get the entity registry of the scene being processed, read-only. | |
| ecs::ComponentRegistry & | getComponentRegistry (void) |
| Get the component registry of the scene being processed. | |
| const ecs::ComponentRegistry & | getComponentRegistry (void) const |
| Get the component registry of the scene being processed, read-only. | |
| template<InheritFromComponent ComponentType> | |
| bool | hasComponent (const ecs::Entity::Identifier &entityIdentifier) const |
| Tell whether an entity has a component, in the bound registry. | |
| template<InheritFromComponent ComponentType> | |
| ComponentType & | getComponent (const ecs::Entity::Identifier &entityIdentifier) |
| Get a component of an entity from the bound registry, to read or modify it. | |
| template<InheritFromComponent ComponentType> | |
| const ComponentType & | getComponent (const ecs::Entity::Identifier &entityIdentifier) const |
| Get a component of an entity from the bound registry, read-only. | |
| template<InheritFromComponent ComponentType> | |
| bool | requireComponent (const ecs::Entity::Identifier &entityIdentifier) |
| Tell whether an entity has a component, and log a warning naming the entity and the component when it does not. | |
Sizes and colors a badge (the small dot or counter drawn over another widget) and fades it in and out.
Runs in the Layout phase on every entity that has a components::Badge. It is registered after systems::Layout, so the label is already measured when the badge is sized around it.
Visibility is an opacity from 0 to 1 stored in components::Badge and multiplied into the alpha of both colors. setVisible() starts the badge's components::Animation, whose samples call fade().
| guillaume::systems::Badge::Badge | ( | void | ) |
|
static |
Size and color one badge and its label.
This is what update() runs each frame. Call it directly after changing components::Badge to see the result before the next frame, which is what the setters of entities::Badge do.
The badge is sizeOf() high. It is as wide as it is high, except that a label wider than that grows it into a pill with components::Badge::HorizontalPadding on each side. The label font size is half the badge height. The colors default to the theme's error and onError roles.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The badge entity. |
| ecs::EntityComponentNotFoundException | When the entity lacks components::Badge, Layout, Borders or Color. |
Definition at line 166 of file badge.cpp.


|
static |
Move the visibility fade to a given progress and restyle.
Called by the animation sample handler wired by install(). Sets the opacity between the value recorded by setVisible() and the target (1 when visible, 0 when hidden), then calls apply().
| componentRegistry | The registry holding the components. |
| entityIdentifier | The badge entity. |
| progress | Eased progress of the fade, from 0 (start) to 1 (target reached). |
Definition at line 153 of file badge.cpp.


|
static |
Prepare the visibility fade of a badge.
Sets the duration and easing of the entity's components::Animation from the theme and makes each of its samples call fade(). Call it once, after the entity has its components::Badge and components::Animation and before the first setVisible().
| componentRegistry | The registry holding the components. It is captured by the sample handler and must outlive the entity. |
| entityIdentifier | The badge entity. |
| ecs::EntityComponentNotFoundException | When the entity has no components::Animation. |
Definition at line 95 of file badge.cpp.

|
static |
Whether the badge should have a label child.
entities::Badge uses it to decide whether to create the label entity.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The badge entity. |
Definition at line 129 of file badge.cpp.

|
static |
Show or hide the badge with a fade.
Records the target visibility and the opacity the fade starts from, then plays the badge's components::Animation. Starting from the current opacity keeps a fade that is reversed half-way continuous. Does nothing when the visibility is already the requested one. Call install() first: it is what makes the animation change the opacity.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The badge entity. |
| visible | True to fade in, false to fade out. |
Definition at line 138 of file badge.cpp.


|
static |
Get the height of a badge, in dp.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The badge entity. |
Definition at line 109 of file badge.cpp.


|
overridevirtual |
Run apply() on one badge; called by the frame loop.
Logs a warning and does nothing when the entity has no components::Badge.
| entityIdentifier | The badge entity. |
Implements guillaume::ecs::System.
Definition at line 210 of file badge.cpp.
