23#include "guillaume/components/style_state.hpp"
27 void StyleState::setFlag(
bool &flag,
bool value)
43 setFlag(_enabled, enabled);
45 setFlag(_hovered,
false);
46 setFlag(_pressed,
false);
47 setFlag(_focused,
false);
48 setFlag(_dragged,
false);
60 setFlag(_hovered, hovered && _enabled);
71 setFlag(_pressed, pressed && _enabled);
82 setFlag(_focused, focused && _enabled);
93 setFlag(_dragged, dragged && _enabled);
StyleState(void)=default
Construct an enabled, idle state.
bool isHovered(void) const
Check whether the mouse pointer or a hand ray is over the entity.
bool isDragged(void) const
Check whether a drag gesture is in progress on the entity.
bool isFocused(void) const
Check whether the entity owns the input focus.
StyleState & setFocused(bool focused)
Record whether the entity owns the input focus.
std::optional< theme::StateLayer > getActiveLayer(void) const
Get the Material 3 state layer to paint over the entity.
bool isEnabled(void) const
Check whether the entity accepts interaction.
StyleState & setEnabled(bool enabled)
Enable or disable the entity.
bool isPressed(void) const
Check whether the entity is pressed: the left mouse button or hand button A is held on it,...
StyleState & setPressed(bool pressed)
Record whether the entity is pressed.
StyleState & setDragged(bool dragged)
Record whether the entity is being dragged.
StyleState & setHovered(bool hovered)
Record whether the entity is hovered.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.
@ Hovered
0.08 overlay of the content color.
@ Dragged
0.16 overlay of the content color.
@ Focused
0.12 overlay of the content color.
@ Pressed
0.12 overlay of the content color.