Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
optionselectorbase.c
Go to the documentation of this file.
1
class
OptionSelectorBase
extends
ScriptedWidgetEventHandler
2
{
3
protected
int
m_SelectorType
= 0;
4
protected
Widget
m_Parent
;
5
protected
Widget
m_Root
;
6
7
protected
bool
m_Enabled
;
8
9
protected
ScriptedWidgetEventHandler
m_ParentClass
;
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
16
void
~OptionSelectorBase
()
17
{
18
delete
m_Root
;
19
}
20
21
Widget
GetParent
()
22
{
23
return
m_Parent
;
24
}
25
26
bool
IsFocusable
(
Widget
w)
27
{
28
if
(w)
29
{
30
return
w ==
m_Parent
;
31
}
32
return
false
;
33
}
34
35
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
36
{
37
if
(!
IsFocusable
(w))
38
return
true
;
39
40
if
(
m_ParentClass
)
41
{
42
m_ParentClass
.OnFocus(
m_Root
.GetParent(), -1,
m_SelectorType
);
43
#ifndef PLATFORM_CONSOLE
44
m_ParentClass
.OnMouseEnter(
m_Root
.GetParent().GetParent(),
x
,
y
);
45
#endif
46
}
47
48
UIScriptedMenu
menu =
g_Game
.GetUIManager().GetMenu();
49
50
if
(menu && menu.IsInherited(CharacterCreationMenu))
51
{
52
menu.
OnFocus
(
m_Root
.GetParent(), -1,
m_SelectorType
);
53
menu.
OnMouseEnter
(
m_Root
.GetParent().GetParent(),
x
,
y
);
54
}
55
56
#ifndef PLATFORM_CONSOLE
57
ColorHighlight
(w);
58
#else
59
ColorHighlightConsole
(w);
60
if
(
m_ParentClass
)
61
{
62
m_ParentClass
.OnFocus(
m_Root
.GetParent(), -1,
m_SelectorType
);
63
}
64
#endif
65
66
return
true
;
67
}
68
69
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
70
{
71
#ifdef PLATFORM_CONSOLE
72
if
(
IsFocusable
(enterW))
73
return
true
;
74
#endif
75
76
if
(
m_ParentClass
)
77
{
78
m_ParentClass
.OnFocus(null,
x
,
y
);
79
#ifndef PLATFORM_CONSOLE
80
m_ParentClass
.OnMouseLeave(
m_Root
.GetParent().GetParent(), enterW,
x
,
y
);
81
#endif
82
}
83
84
UIScriptedMenu
menu =
g_Game
.GetUIManager().GetMenu();
85
86
if
(menu && menu.IsInherited(CharacterCreationMenu))
87
{
88
menu.
OnFocus
(null,
x
,
y
);
89
menu.
OnMouseLeave
(
m_Root
.GetParent().GetParent(), enterW,
x
,
y
);
90
}
91
92
#ifndef PLATFORM_CONSOLE
93
ColorNormal
(w);
94
#else
95
ColorNormalConsole
(w);
96
if
(
m_ParentClass
)
97
{
98
m_ParentClass
.OnFocusLost(w,
x
,
y
);
99
}
100
#endif
101
102
return
true
;
103
}
104
105
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
106
{
107
if
(
IsFocusable
(w))
108
{
109
ColorHighlightConsole
(w);
110
if
(
m_ParentClass
)
111
{
112
m_ParentClass
.OnFocus(
m_Root
.GetParent(), -1,
m_SelectorType
);
113
}
114
return
true
;
115
}
116
return
false
;
117
}
118
119
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
120
{
121
ColorNormalConsole
(w);
122
if
(
m_ParentClass
)
123
{
124
m_ParentClass
.OnFocusLost(w,
x
,
y
);
125
}
126
return
true
;
127
}
128
129
void
Focus
()
130
{
131
#ifndef PLATFORM_CONSOLE
132
SetFocus
(
m_Root
);
133
#else
134
SetFocus
(
m_Parent
);
135
#endif
136
}
137
138
void
Enable
()
139
{
140
m_Enabled
=
true
;
141
142
m_Parent
.ClearFlags(
WidgetFlags
.IGNOREPOINTER);
143
144
#ifdef PLATFORM_CONSOLE
145
ColorNormalConsole
(
m_Parent
);
146
#else
147
ColorNormal
(
m_Parent
);
148
#endif
149
}
150
151
void
Disable
()
152
{
153
m_Enabled
=
false
;
154
155
m_Parent
.SetFlags(
WidgetFlags
.IGNOREPOINTER);
156
157
#ifdef PLATFORM_CONSOLE
158
ColorDisabledConsole
(
m_Parent
);
159
#else
160
ColorDisabled
(
m_Parent
);
161
#endif
162
}
163
164
void
ColorHighlight
(
Widget
w)
165
{
166
if
(!w)
167
return
;
168
169
ButtonSetColor
(w,
ARGB
(255, 255, 0, 0));
170
}
171
172
void
ColorNormal
(
Widget
w)
173
{
174
if
(!w)
175
return
;
176
177
int
color_pnl =
ARGB
(255, 255, 255, 255);
178
int
color_lbl =
ARGB
(255, 255, 255, 255);
179
180
ButtonSetColor
(w, color_pnl);
181
182
Widget
title_label = w.FindAnyWidget(w.GetName() +
"_label"
);
183
Widget
option_label = w.FindAnyWidget(
"option_label"
);
184
185
if
(title_label)
186
{
187
title_label.SetColor(color_lbl);
188
}
189
190
if
(option_label)
191
{
192
option_label.SetColor(color_lbl);
193
}
194
}
195
196
void
ColorDisabled
(
Widget
w)
197
{
198
if
(!w)
199
return
;
200
201
int
color_pnl =
ARGB
(0, 0, 0, 0);
202
int
color_lbl =
ARGB
(120, 255, 255, 255);
203
204
ButtonSetColor
(w, color_pnl);
205
206
Widget
title_label = w.FindAnyWidget(w.GetName() +
"_label"
);
207
Widget
option_label = w.FindAnyWidget(
"option_label"
);
208
209
if
(title_label)
210
{
211
title_label.SetColor(color_lbl);
212
}
213
214
if
(option_label)
215
{
216
option_label.SetColor(color_lbl);
217
}
218
}
219
220
void
ButtonSetColor
(
Widget
w,
int
color)
221
{
222
Widget
option = w.FindAnyWidget(w.GetName() +
"_image"
);
223
224
if
(option)
225
{
226
option.SetColor(color);
227
}
228
}
229
230
void
ColorHighlightConsole
(
Widget
w)
231
{
232
if
(!w)
233
return
;
234
235
int
color_pnl =
ARGB
(255, 200, 0, 0);
236
int
color_lbl =
ARGB
(255, 255, 255, 255);
237
238
ButtonSetColorConsole
(w, color_pnl);
239
ButtonSetAlphaAnimConsole
(null);
240
ButtonSetTextColorConsole
(w, color_lbl);
241
}
242
243
void
ColorNormalConsole
(
Widget
w)
244
{
245
if
(!w)
246
return
;
247
248
int
color_pnl =
ARGB
(0, 0, 0, 0);
249
int
color_lbl =
ARGB
(255, 255, 255, 255);
250
251
ButtonSetColorConsole
(w, color_pnl);
252
ButtonSetAlphaAnimConsole
(null);
253
ButtonSetTextColorConsole
(w, color_lbl);
254
}
255
256
void
ColorDisabledConsole
(
Widget
w)
257
{
258
if
(!w)
259
return
;
260
261
int
color_pnl =
ARGB
(0, 0, 0, 0);
262
int
color_lbl =
ARGB
(120, 255, 255, 255);
263
264
ButtonSetColorConsole
(w, color_pnl);
265
ButtonSetAlphaAnimConsole
(null);
266
ButtonSetTextColorConsole
(w, color_lbl);
267
}
268
269
void
ButtonSetColorConsole
(
Widget
w,
int
color)
270
{
271
w.SetColor(color);
272
}
273
274
void
ButtonSetAlphaAnimConsole
(
Widget
w)
275
{
276
if
(!w)
277
return
;
278
279
Widget
panel = w.FindAnyWidget(w.GetName() +
"_panel"
);
280
281
if
(panel)
282
{
283
//m_Root.SetWidgetAnimAlpha(panel);
284
}
285
}
286
287
void
ButtonSetTextColorConsole
(
Widget
w,
int
color)
288
{
289
if
(!w)
290
return
;
291
292
TextWidget
label =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_label"
));
293
TextWidget
text =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_text"
));
294
TextWidget
text2 =
TextWidget
.Cast(w.FindAnyWidget(w.GetName() +
"_text_1"
));
295
296
if
(label)
297
{
298
label.SetColor(color);
299
}
300
301
if
(text)
302
{
303
text.SetColor(color);
304
}
305
306
if
(text2)
307
{
308
text2.SetColor(color);
309
}
310
}
311
}
OptionSelectorBase
Definition
optionselector.c:2
OptionSelectorBase::IsFocusable
override bool IsFocusable(Widget w)
Definition
optionselector.c:204
OptionSelectorBase::ColorDisabledConsole
override void ColorDisabledConsole(Widget w)
Definition
optionselector.c:254
OptionSelectorBase::ColorNormalConsole
override void ColorNormalConsole(Widget w)
Definition
optionselector.c:241
OptionSelectorBase::ColorNormal
override void ColorNormal(Widget w)
Definition
optionselectoreditbox.c:159
OptionSelectorBase::ColorHighlight
override void ColorHighlight(Widget w)
Definition
optionselectoreditbox.c:145
ScriptInvoker
ScriptInvoker Class provide list of callbacks usage:
Definition
tools.c:116
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
enwidgets.c:657
ScriptedWidgetEventHandler::Disable
void Disable()
Definition
optionselectorbase.c:151
ScriptedWidgetEventHandler::m_Root
Widget m_Root
Definition
sizetochild.c:9
ScriptedWidgetEventHandler::ButtonSetColorConsole
void ButtonSetColorConsole(Widget w, int color)
Definition
optionselectorbase.c:269
ScriptedWidgetEventHandler::m_ParentClass
ScriptedWidgetEventHandler m_ParentClass
Definition
optionselectorbase.c:9
ScriptedWidgetEventHandler::ColorDisabled
void ColorDisabled(Widget w)
Definition
optionselectorbase.c:196
ScriptedWidgetEventHandler::m_SelectorType
int m_SelectorType
Definition
optionselectorbase.c:3
ScriptedWidgetEventHandler::~OptionSelectorBase
void ~OptionSelectorBase()
Definition
optionselectorbase.c:16
ScriptedWidgetEventHandler::m_Enabled
bool m_Enabled
Definition
optionselectorbase.c:7
ScriptedWidgetEventHandler::ColorHighlightConsole
void ColorHighlightConsole(Widget w)
Definition
optionselectorbase.c:230
ScriptedWidgetEventHandler::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
optionselectorbase.c:69
ScriptedWidgetEventHandler::ButtonSetAlphaAnimConsole
void ButtonSetAlphaAnimConsole(Widget w)
Definition
optionselectorbase.c:274
ScriptedWidgetEventHandler::m_OptionUnfocused
ref ScriptInvoker m_OptionUnfocused
Definition
optionselectorbase.c:12
ScriptedWidgetEventHandler::ButtonSetColor
void ButtonSetColor(Widget w, int color)
Definition
optionselectorbase.c:220
ScriptedWidgetEventHandler::m_Parent
LayoutHolder m_Parent
Definition
layoutholder.c:6
ScriptedWidgetEventHandler::GetParent
Widget GetParent()
Definition
optionselectorbase.c:21
ScriptedWidgetEventHandler::Focus
void Focus()
Definition
optionselectorbase.c:129
ScriptedWidgetEventHandler::ColorNormal
void ColorNormal(Widget w)
Definition
optionselectorbase.c:172
ScriptedWidgetEventHandler::ColorNormalConsole
void ColorNormalConsole(Widget w)
Definition
optionselectorbase.c:243
ScriptedWidgetEventHandler::ButtonSetTextColorConsole
void ButtonSetTextColorConsole(Widget w, int color)
Definition
optionselectorbase.c:287
ScriptedWidgetEventHandler::Enable
void Enable()
Definition
optionselectorbase.c:138
ScriptedWidgetEventHandler::m_OptionChanged
ref ScriptInvoker m_OptionChanged
Definition
optionselectorbase.c:14
ScriptedWidgetEventHandler::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
optionselectorbase.c:119
ScriptedWidgetEventHandler::IsFocusable
bool IsFocusable(Widget w)
Definition
optionselectorbase.c:26
ScriptedWidgetEventHandler::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
optionselectorbase.c:35
ScriptedWidgetEventHandler::ColorDisabledConsole
void ColorDisabledConsole(Widget w)
Definition
optionselectorbase.c:256
ScriptedWidgetEventHandler::m_OptionFocused
ref ScriptInvoker m_OptionFocused
Definition
optionselectorbase.c:11
ScriptedWidgetEventHandler::ColorHighlight
void ColorHighlight(Widget w)
Definition
optionselectorbase.c:164
ScriptedWidgetEventHandler::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
optionselectorbase.c:105
ScriptedWidgetEventHandler::m_AttemptOptionChange
ref ScriptInvoker m_AttemptOptionChange
Definition
optionselectorbase.c:13
TextWidget
Definition
enwidgets.c:220
UIScriptedMenu
Xbox menu.
Definition
dayzgame.c:64
UIScriptedMenu::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
cameratoolsmenu.c:935
UIScriptedMenu::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
cameratoolsmenu.c:928
UIScriptedMenu::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
cameratoolsmenu.c:940
Widget
Definition
enwidgets.c:190
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
WidgetFlags
WidgetFlags
Definition
enwidgets.c:58
SetFocus
proto native void SetFocus(Widget w)
x
Icon x
y
Icon y
ARGB
int ARGB(int a, int r, int g, int b)
Definition
proto.c:322
Games
Dayz
scripts
5_mission
gui
newui
optionselectorbase.c
Generated by
1.17.0