Skip to main content

UiStateComponent.ixx File

Component for managing UI element interaction states. More...

Namespaces Index

namespacehelios
namespaceengine

Main engine module aggregating core infrastructure and game systems. More...

namespacemodules

Domain-specific components and systems. More...

namespaceui

User interface components and systems for game entities. More...

namespacewidgets

UI widget components and systems. More...

namespacecomponents

UI widget state components. More...

Classes Index

classUiStateComponent

Tracks interaction state for UI widgets. More...

Description

Component for managing UI element interaction states.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file UiStateComponent.ixx
3 * @brief Component for managing UI element interaction states.
4 */
5export module helios.engine.modules.ui.widgets.components.UiStateComponent;
6
8
9/**
10 * @class UiStateComponent
11 * @brief Tracks interaction state for UI widgets.
12 *
13 * Manages common UI states such as selection, hover, focus,
14 * enabled/disabled, and pressed states.
15 */
17
18 private:
19 bool isEnabled_ = true;
20
21 bool isSelected_ = false;
22
23 bool isHovered_ = false;
24
25 bool isFocused_ = false;
26
27 bool isPressed_ = false;
28
29 public:
30
31 /**
32 * @brief Sets the selected state.
33 *
34 * @param selected True if selected.
35 */
36 void setSelected(const bool selected) noexcept {
37 isSelected_ = selected;
38 }
39
40 /**
41 * @brief Returns the selected state.
42 */
43 [[nodiscard]] bool isSelected() const noexcept {
44 return isSelected_;
45 }
46
47 /**
48 * @brief Sets the hovered state.
49 *
50 * @param hovered True if hovered.
51 */
52 void setHovered(bool hovered) noexcept {
53 isHovered_ = hovered;
54 }
55
56 /**
57 * @brief Returns the hovered state.
58 */
59 [[nodiscard]] bool isHovered() const noexcept {
60 return isHovered_;
61 }
62
63 /**
64 * @brief Sets the focused state.
65 *
66 * @param focused True if focused.
67 */
68 void setFocused(bool focused) noexcept {
69 isFocused_ = focused;
70 }
71
72 /**
73 * @brief Returns the focused state.
74 */
75 [[nodiscard]] bool isFocused() const noexcept {
76 return isFocused_;
77 }
78
79 /**
80 * @brief Sets the enabled state.
81 *
82 * @param enabled True if enabled.
83 */
84 void setEnabled(bool enabled) noexcept {
85 isEnabled_ = enabled;
86 }
87
88 /**
89 * @brief Returns the enabled state.
90 */
91 [[nodiscard]] bool isEnabled() const noexcept {
92 return isEnabled_;
93 }
94
95 /**
96 * @brief Sets the pressed state.
97 *
98 * @param pressed True if pressed.
99 */
100 void setPressed(bool pressed) noexcept {
101 isPressed_ = pressed;
102 }
103
104 /**
105 * @brief Returns the pressed state.
106 */
107 [[nodiscard]] bool isPressed() const noexcept {
108 return isPressed_;
109 }
110 };
111
112} // namespace helios::engine::modules::ui::widgets::components

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.