Skip to main content

UiStyleComponent.ixx File

Component for managing UI element visual styles. More...

Included Headers

#include <helios.math.types>

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

classUiStyleComponent

Stores color styles for different UI widget states. More...

Description

Component for managing UI element visual styles.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file UiStyleComponent.ixx
3 * @brief Component for managing UI element visual styles.
4 */
5export module helios.engine.modules.ui.widgets.components.UiStyleComponent;
6
7import helios.math.types;
8
10
11 /**
12 * @class UiStyleComponent
13 * @brief Stores color styles for different UI widget states.
14 *
15 * Defines colors for normal, selected, and disabled states
16 * of UI elements.
17 */
19
20 bool isEnabled_ = true;
21
22 helios::math::vec4f normalColor_{1.0f, 1.0f, 1.0f, 1.0f};
23 helios::math::vec4f selectedColor_{0.8f, 0.8f, 1.0f, 1.0f};
24 helios::math::vec4f disabledColor_{0.5f, 0.5f, 0.5f, 1.0f};
25
26 float normalScale_ = 1.0f;
27 float selectedScale_ = 1.0f;
28
29 public:
30
31 /**
32 * @brief Returns the enabled state.
33 */
34 [[nodiscard]] bool isEnabled() const noexcept {
35 return isEnabled_;
36 }
37
38 /**
39 * @brief Enables this component.
40 */
41 void enable() noexcept {
42 isEnabled_ = true;
43 }
44
45 /**
46 * @brief Disables this component.
47 */
48 void disable() noexcept {
49 isEnabled_ = false;
50 }
51
52 /**
53 * @brief Sets the scale for normal state.
54 *
55 * @param scale The scale factor.
56 */
57 void setNormalScale(const float scale) noexcept {
58 normalScale_ = scale;
59 }
60
61 /**
62 * @brief Sets the scale for selected state.
63 *
64 * @param scale The scale factor.
65 */
66 void setSelectedScale(const float scale) noexcept {
67 selectedScale_ = scale;
68 }
69
70 /**
71 * @brief Sets the color for normal state.
72 *
73 * @param color The RGBA color.
74 */
75 void setNormalColor(const helios::math::vec4f color) noexcept {
76 normalColor_ = color;
77 }
78
79 /**
80 * @brief Returns the normal state color.
81 */
82 [[nodiscard]] const helios::math::vec4f normalColor() const noexcept {
83 return normalColor_;
84 }
85
86 /**
87 * @brief Sets the color for selected state.
88 *
89 * @param color The RGBA color.
90 */
91 void setSelectedColor(const helios::math::vec4f color) noexcept {
92 selectedColor_ = color;
93 }
94
95 /**
96 * @brief Returns the selected state color.
97 */
98 [[nodiscard]] const helios::math::vec4f selectedColor() const noexcept {
99 return selectedColor_;
100 }
101
102 /**
103 * @brief Sets the color for disabled state.
104 *
105 * @param color The RGBA color.
106 */
107 void setDisabledColor(const helios::math::vec4f color) noexcept {
108 disabledColor_ = color;
109 }
110
111 /**
112 * @brief Returns the disabled state color.
113 */
114 [[nodiscard]] const helios::math::vec4f disabledColor() const noexcept {
115 return disabledColor_;
116 }
117
118 /**
119 * @brief Returns the selected state scale.
120 */
121 [[nodiscard]] float selectedScale() const noexcept {
122 return selectedScale_;
123 }
124
125 /**
126 * @brief Returns the normal state scale.
127 */
128 [[nodiscard]] float normalScale() const noexcept {
129 return normalScale_;
130 }
131 };
132
133} // namespace helios::engine::modules::ui::widgets::components

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.