Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ButtonEffectColor.c
Go to the documentation of this file.
1
2[BaseContainerProps(configRoot : true), SCR_ButtonEffectTitleAttribute("Color", "m_sWidgetName")]
3class SCR_ButtonEffectColor : SCR_ButtonEffectWidgetBase
4{
5 // Attributes
6
7 [Attribute(defvalue: "0.2", UIWidgets.EditBox, "How fast each animation proceeds")]
8 protected float m_fAnimationTime;
9
10 [Attribute()]
12
13 [Attribute()]
15
16 [Attribute()]
18
19 [Attribute()]
21
22 [Attribute()]
24
25 [Attribute()]
27
28 [Attribute()]
30
31 [Attribute()]
33
34 [Attribute()]
36
37 [Attribute()]
39
40 [Attribute()]
42
43 //TODO: focus should probably be a state, not events
44 //TODO: Fix colors not matching the button's current state
45
46 //------------------------------------------------------------------------------------------------
47 override void OnStateDefault(bool instant)
48 {
49 // This can get triggered on mouse leave while the button remains focused. The focus color must then have priority, as it is integral to gamepad navigation
50 Color color = m_cDefault;
51 if ((m_eEvents & EModularButtonEventFlag.EVENT_FOCUS_GAINED) && m_Button.GetFocused())
52 color = m_cFocusGained;
53
54 Apply(color, instant);
55 }
56
57 //------------------------------------------------------------------------------------------------
58 override void OnStateHovered(bool instant)
59 {
60 Apply(m_cHovered, instant);
61 }
62
63 //------------------------------------------------------------------------------------------------
64 override void OnStateActivated(bool instant)
65 {
66 // If the modular button is toggled while focused, the focus state must have priority, as it is integral to gamepad navigation
67 Color color = m_cActivated;
68 if ((m_eEvents & EModularButtonEventFlag.EVENT_FOCUS_GAINED) && m_Button.GetFocused())
69 color = m_cFocusGained;
70
71 Apply(color, instant);
72 }
73
74 //------------------------------------------------------------------------------------------------
75 override void OnStateDisabled(bool instant)
76 {
77 Apply(m_cDisabled, instant);
78 }
79
80 //------------------------------------------------------------------------------------------------
81 override void OnStateDisabledActivated(bool instant)
82 {
84 }
85
86 //------------------------------------------------------------------------------------------------
87 override void OnStateActivatedHovered(bool instant)
88 {
89 Apply(m_cActivatedHovered, instant);
90 }
91
92 //------------------------------------------------------------------------------------------------
93 override void OnClicked(bool instant)
94 {
95 Apply(m_cClicked, instant);
96 }
97
98 //------------------------------------------------------------------------------------------------
99 override void OnFocusGained(bool instant)
100 {
101 Apply(m_cFocusGained, instant);
102 }
103
104 //------------------------------------------------------------------------------------------------
105 override void OnFocusLost(bool instant)
106 {
107 // Focusing away from an activated modular button must give priority to it's activated state color
108 Color color = m_cFocusLost;
109 if ((m_eEvents & EModularButtonEventFlag.STATE_ACTIVATED) && m_Button.GetToggled())
110 color = m_cActivated;
111
112 //TODO: handle focus lost on activated hovered
113 Apply(color, instant);
114 }
115
116 //------------------------------------------------------------------------------------------------
117 override void OnToggledOn(bool instant)
118 {
119 Apply(m_cToggledOn, instant);
120 }
121
122 //------------------------------------------------------------------------------------------------
123 override void OnToggledOff(bool instant)
124 {
125 Apply(m_cToggledOff, instant);
126 }
127
128 //------------------------------------------------------------------------------------------------
129 // Called when effect is disabled. Here you should stop all running effects.
130 override void OnDisabled()
131 {
133 }
134
135 //------------------------------------------------------------------------------------------------
136 protected void Apply(Color color, bool instant)
137 {
138 if (color && m_wTarget)
139 {
140 if (!instant && m_fAnimationTime != 0)
141 {
142 AnimateWidget.Color(m_wTarget, color, 1 / m_fAnimationTime);
143 }
144 else
145 {
147 m_wTarget.SetColor(color);
148 }
149 }
150 }
151}
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
EModularButtonEventFlag
static bool StopAnimation(Widget w, typename typeName)
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition Color.c:13
Effect which colorizes a widget with given name.
override void OnToggledOn(bool instant)
override void OnStateDefault(bool instant)
override void OnStateActivatedHovered(bool instant)
override void OnStateHovered(bool instant)
void Apply(Color color, bool instant)
override void OnStateDisabledActivated(bool instant)
override void OnFocusGained(bool instant)
override void OnToggledOff(bool instant)
override void OnStateDisabled(bool instant)
override void OnClicked(bool instant)
override void OnFocusLost(bool instant)
override void OnStateActivated(bool instant)
SCR_FieldOfViewSettings Attribute