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

Summarizes the input state of an entity into its components::StyleState, the one component widget systems read to choose a look. More...

#include <headers/guillaume/systems/style_state.hpp>

Inheritance diagram for guillaume::systems::StyleState:
Collaboration diagram for guillaume::systems::StyleState:

Public Member Functions

 StyleState (void)
 Create the system, in the Event phase.
 ~StyleState (void) override=default
 Default destructor.
void prepare (void) override
 Does nothing: the system keeps no per-frame state.
void cleanup (void) override
 Does nothing: the system keeps no per-frame state.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Recompute the hovered, pressed and dragged flags of one entity.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::StyleState >
 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().

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.

Detailed Description

Summarizes the input state of an entity into its components::StyleState, the one component widget systems read to choose a look.

Runs in the Event phase on entities with a components::StyleState. Each frame it writes three flags, from the interaction components the entity happens to have:

  • hovered: MouseHoverInteraction or HandHoverInteraction is hovered;
  • pressed: the left mouse button or hand button A is pressed, or a pinch or a poke is in progress;
  • dragged: DragInteraction is dragging.

The focused flag is written by systems::Focus, and the enabled flag by the widget. components::StyleState refuses to raise a flag while it is disabled, so a disabled entity never looks hovered or pressed.

It is registered after the input systems it mirrors, so the flags describe the current frame.

See also
components::StyleState
systems::interaction::stateLayerColor

Definition at line 54 of file style_state.hpp.

Constructor & Destructor Documentation

◆ StyleState()

guillaume::systems::StyleState::StyleState ( void )

Create the system, in the Event phase.

Definition at line 35 of file style_state.cpp.

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

Member Function Documentation

◆ cleanup()

void guillaume::systems::StyleState::cleanup ( void )
overridevirtual

Does nothing: the system keeps no per-frame state.

Reimplemented from guillaume::ecs::System.

Definition at line 44 of file style_state.cpp.

◆ prepare()

void guillaume::systems::StyleState::prepare ( void )
overridevirtual

Does nothing: the system keeps no per-frame state.

Reimplemented from guillaume::ecs::System.

Definition at line 40 of file style_state.cpp.

◆ update()

void guillaume::systems::StyleState::update ( const ecs::Entity::Identifier & entityIdentifier)
overridevirtual

Recompute the hovered, pressed and dragged flags of one entity.

Parameters
entityIdentifierThe entity holding the components::StyleState.

Implements guillaume::ecs::System.

Definition at line 48 of file style_state.cpp.

Here is the call graph for this function:

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