|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
The interaction state of an entity in one place: enabled or disabled, and whether it is hovered, pressed, focused or dragged. More...
#include <headers/guillaume/components/style_state.hpp>


Public Member Functions | |
| StyleState (void)=default | |
| Construct an enabled, idle state. | |
| ~StyleState (void)=default | |
| Default destructor. | |
| bool | isEnabled (void) const |
| Check whether the entity accepts interaction. | |
| StyleState & | setEnabled (bool enabled) |
| Enable or disable the entity. | |
| bool | isHovered (void) const |
| Check whether the mouse pointer or a hand ray is over the entity. | |
| StyleState & | setHovered (bool hovered) |
| Record whether the entity is hovered. | |
| bool | isPressed (void) const |
| Check whether the entity is pressed: the left mouse button or hand button A is held on it, or a hand pinches or pokes it. | |
| StyleState & | setPressed (bool pressed) |
| Record whether the entity is pressed. | |
| bool | isFocused (void) const |
| Check whether the entity owns the input focus. | |
| StyleState & | setFocused (bool focused) |
| Record whether the entity owns the input focus. | |
| bool | isDragged (void) const |
| Check whether a drag gesture is in progress on the entity. | |
| StyleState & | setDragged (bool dragged) |
| Record whether the entity is being dragged. | |
| std::optional< theme::StateLayer > | getActiveLayer (void) const |
| Get the Material 3 state layer to paint over the entity. | |
| 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. | |
The interaction state of an entity in one place: enabled or disabled, and whether it is hovered, pressed, focused or dragged.
The enabled flag is set by user code or a widget (systems::interaction::setEnabled). The four other flags are derived: systems::StyleState rewrites hovered, pressed and dragged every frame in the Event phase from the hover, button, pinch, poke and drag interaction components of the entity, and systems::Focus writes focused. Widget systems read getActiveLayer() to tint the entity, systems::FocusRingRender draws a ring around a focused entity, and the input systems ignore a disabled entity.
A value written with setHovered(), setPressed() or setDragged() is overwritten on the next frame. An entity without StyleState is treated as enabled.
Definition at line 59 of file style_state.hpp.
| std::optional< theme::StateLayer > guillaume::components::StyleState::getActiveLayer | ( | void | ) | const |
Get the Material 3 state layer to paint over the entity.
When several flags are set the strongest one wins: dragged, then pressed, then focused, then hovered.
Definition at line 97 of file style_state.cpp.
| bool guillaume::components::StyleState::isDragged | ( | void | ) | const |
Check whether a drag gesture is in progress on the entity.
Definition at line 86 of file style_state.cpp.
| bool guillaume::components::StyleState::isEnabled | ( | void | ) | const |
Check whether the entity accepts interaction.
Definition at line 36 of file style_state.cpp.

| bool guillaume::components::StyleState::isFocused | ( | void | ) | const |
Check whether the entity owns the input focus.
Definition at line 75 of file style_state.cpp.
| bool guillaume::components::StyleState::isHovered | ( | void | ) | const |
Check whether the mouse pointer or a hand ray is over the entity.
Definition at line 53 of file style_state.cpp.
| bool guillaume::components::StyleState::isPressed | ( | void | ) | const |
Check whether the entity is pressed: the left mouse button or hand button A is held on it, or a hand pinches or pokes it.
Definition at line 64 of file style_state.cpp.
| StyleState & guillaume::components::StyleState::setDragged | ( | bool | dragged | ) |
Record whether the entity is being dragged.
Called every frame by systems::StyleState from DragInteraction::isDragging. Stores false when the entity is disabled; marks the component changed only when the flag differs.
| dragged | True when a drag is in progress on the entity. |
Definition at line 91 of file style_state.cpp.

| StyleState & guillaume::components::StyleState::setEnabled | ( | bool | enabled | ) |
Enable or disable the entity.
Disabling also clears the hovered, pressed, focused and dragged flags, and they stay false while the entity is disabled. Marks the component changed only when a flag differs.
| enabled | False to make the input systems ignore the entity. |
Definition at line 41 of file style_state.cpp.

| StyleState & guillaume::components::StyleState::setFocused | ( | bool | focused | ) |
Record whether the entity owns the input focus.
Called by systems::Focus when the focus moves. Stores false when the entity is disabled; marks the component changed only when the flag differs.
| focused | True when the entity owns the focus. |
Definition at line 80 of file style_state.cpp.

| StyleState & guillaume::components::StyleState::setHovered | ( | bool | hovered | ) |
Record whether the entity is hovered.
Called every frame by systems::StyleState. Stores false when the entity is disabled; marks the component changed only when the flag differs.
| hovered | True when a pointer or a hand ray is over the entity. |
Definition at line 58 of file style_state.cpp.

| StyleState & guillaume::components::StyleState::setPressed | ( | bool | pressed | ) |
Record whether the entity is pressed.
Called every frame by systems::StyleState. Stores false when the entity is disabled; marks the component changed only when the flag differs.
| pressed | True when the entity is pressed. |
Definition at line 69 of file style_state.cpp.
