DayZ 1.24
Loading...
Searching...
No Matches
OptionSelectorBase.c
Go to the documentation of this file.
2{
3 protected int m_SelectorType = 0;
4 protected Widget m_Parent;
5 protected Widget m_Root;
6
7 protected bool m_Enabled;
8
10
11 ref ScriptInvoker m_OptionFocused = new ScriptInvoker;
12 ref ScriptInvoker m_OptionUnfocused = new ScriptInvoker;
13 ref ScriptInvoker m_AttemptOptionChange = new ScriptInvoker;
14 ref ScriptInvoker m_OptionChanged = new ScriptInvoker;
15
17 {
18 delete m_Root;
19 }
20
22 {
23 return m_Parent;
24 }
25
27 {
28 if (w)
29 return w == m_Parent;
30 return false;
31 }
32
33 override bool OnMouseEnter(Widget w, int x, int y)
34 {
35 if (!IsFocusable(w))
36 return true;
37
38 if (m_ParentClass)
39 {
40 m_ParentClass.OnFocus(m_Root.GetParent(), -1, m_SelectorType);
41#ifndef PLATFORM_CONSOLE
42 m_ParentClass.OnMouseEnter(m_Root.GetParent().GetParent(), x, y);
43#endif
44 }
45
46 UIScriptedMenu menu = GetGame().GetUIManager().GetMenu();
47
48 if (menu && menu.IsInherited(CharacterCreationMenu))
49 {
50 menu.OnFocus(m_Root.GetParent(), -1, m_SelectorType);
51 menu.OnMouseEnter(m_Root.GetParent().GetParent(), x, y);
52 }
53
54#ifndef PLATFORM_CONSOLE
56#else
57 ColorHighlightConsole(w);
58 if (m_ParentClass)
59 m_ParentClass.OnFocus(m_Root.GetParent(), -1, m_SelectorType);
60#endif
61
62 return true;
63 }
64
65 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
66 {
67#ifdef PLATFORM_CONSOLE
69 return true;
70#endif
71
72 if (m_ParentClass)
73 {
74 m_ParentClass.OnFocus(null, x, y);
75#ifndef PLATFORM_CONSOLE
76 m_ParentClass.OnMouseLeave(m_Root.GetParent().GetParent(), enterW, x, y);
77#endif
78 }
79
80 UIScriptedMenu menu = GetGame().GetUIManager().GetMenu();
81
82 if (menu && menu.IsInherited(CharacterCreationMenu))
83 {
84 menu.OnFocus(null, x, y);
85 menu.OnMouseLeave(m_Root.GetParent().GetParent(), enterW, x, y);
86 }
87
88#ifndef PLATFORM_CONSOLE
90#else
92 if (m_ParentClass)
93 m_ParentClass.OnFocusLost(w, x, y);
94#endif
95
96 return true;
97 }
98
99 override bool OnFocus(Widget w, int x, int y)
100 {
101 if (IsFocusable(w))
102 {
103 ColorHighlightConsole(w);
104 if (m_ParentClass)
105 m_ParentClass.OnFocus(m_Root.GetParent(), -1, m_SelectorType);
106 return true;
107 }
108 return false;
109 }
110
111 override bool OnFocusLost(Widget w, int x, int y)
112 {
114 if (m_ParentClass)
115 m_ParentClass.OnFocusLost(w, x, y);
116 return true;
117 }
118
119 void Focus()
120 {
121#ifndef PLATFORM_CONSOLE
123#else
125#endif
126 }
127
128 void Enable()
129 {
130 m_Enabled = true;
131
132 m_Parent.ClearFlags(WidgetFlags.IGNOREPOINTER);
133
134#ifdef PLATFORM_CONSOLE
136#else
138#endif
139 }
140
141 void Disable()
142 {
143 m_Enabled = false;
144
145 m_Parent.SetFlags(WidgetFlags.IGNOREPOINTER);
146
147#ifdef PLATFORM_CONSOLE
149#else
150 ColorDisabled(m_Parent);
151#endif
152 }
153
155 {
156 if (!w)
157 return;
158
159 ButtonSetColor(w, ARGB(255, 255, 0, 0));
160 }
161
163 {
164 if (!w)
165 return;
166
167 int color_pnl = ARGB(255, 255, 255, 255);
168 int color_lbl = ARGB(255, 255, 255, 255);
169
170 ButtonSetColor(w, color_pnl);
171
172 Widget title_label = w.FindAnyWidget(w.GetName() + "_label");
173 Widget option_label = w.FindAnyWidget("option_label");
174
175 if (title_label)
176 title_label.SetColor(color_lbl);
177
178 if (option_label)
179 option_label.SetColor(color_lbl);
180 }
181
183 {
184 if (!w)
185 return;
186
187 int color_pnl = ARGB(0, 0, 0, 0);
188 int color_lbl = ARGB(120, 255, 255, 255);
189
190 ButtonSetColor(w, color_pnl);
191
192 Widget title_label = w.FindAnyWidget(w.GetName() + "_label");
193 Widget option_label = w.FindAnyWidget("option_label");
194
195 if (title_label)
196 title_label.SetColor(color_lbl);
197
198 if (option_label)
199 option_label.SetColor(color_lbl);
200 }
201
203 {
204 Widget option = w.FindAnyWidget(w.GetName() + "_image");
205
206 if (option)
207 option.SetColor(color);
208 }
209
211 {
212 if (!w)
213 return;
214
215 int color_pnl = ARGB(255, 200, 0, 0);
216 int color_lbl = ARGB(255, 255, 255, 255);
217
218 ButtonSetColorConsole(w, color_pnl);
219 ButtonSetAlphaAnimConsole(null);
220 ButtonSetTextColorConsole(w, color_lbl);
221 }
222
224 {
225 if (!w)
226 return;
227
228 int color_pnl = ARGB(0, 0, 0, 0);
229 int color_lbl = ARGB(255, 255, 255, 255);
230
231 ButtonSetColorConsole(w, color_pnl);
232 ButtonSetAlphaAnimConsole(null);
233 ButtonSetTextColorConsole(w, color_lbl);
234 }
235
237 {
238 if (!w)
239 return;
240
241 int color_pnl = ARGB(0, 0, 0, 0);
242 int color_lbl = ARGB(120, 255, 255, 255);
243
244 ButtonSetColorConsole(w, color_pnl);
245 ButtonSetAlphaAnimConsole(null);
246 ButtonSetTextColorConsole(w, color_lbl);
247 }
248
250 {
251 w.SetColor(color);
252 }
253
255 {
256 if (!w)
257 return;
258
259 Widget panel = w.FindAnyWidget(w.GetName() + "_panel");
260
261 if (panel)
262 {
263 //m_Root.SetWidgetAnimAlpha(panel);
264 }
265 }
266
268 {
269 if (!w)
270 return;
271
272 TextWidget label = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_label"));
273 TextWidget text = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text"));
274 TextWidget text2 = TextWidget.Cast(w.FindAnyWidget(w.GetName() + "_text_1"));
275
276 if (label)
277 label.SetColor(color);
278
279 if (text)
280 text.SetColor(color);
281
282 if (text2)
283 text2.SetColor(color);
284 }
285}
Icon x
Icon y
Widget m_Root
Definition SizeToChild.c:85
Widget m_Parent
Definition SizeToChild.c:86
bool m_Enabled
Definition TrapTrigger.c:65
override bool IsFocusable(Widget w)
override void ColorNormalConsole(Widget w)
override void ColorHighlight(Widget w)
override void ColorDisabledConsole(Widget w)
override void ColorNormal(Widget w)
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
map: item x vector(index, width, height)
Definition EnWidgets.c:651
ScriptedWidgetEventHandler m_ParentClass
override bool OnFocusLost(Widget w, int x, int y)
void ButtonSetTextColorConsole(Widget w, int color)
void ButtonSetColor(Widget w, int color)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void ButtonSetColorConsole(Widget w, int color)
override bool OnFocus(Widget w, int x, int y)
override bool OnMouseEnter(Widget w, int x, int y)
proto native CGame GetGame()
bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
WidgetFlags
Definition EnWidgets.c:58
bool OnMouseEnter(Widget w, int x, int y)
proto native void SetFocus(Widget w)
bool OnFocusLost(Widget w, int x, int y)
bool OnFocus(Widget w, int x, int y)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322