Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
optionselectoreditbox.c
Go to the documentation of this file.
1
class
OptionSelectorEditbox
extends
OptionSelectorBase
2
{
3
protected
EditBoxWidget
m_EditBox
;
4
5
void
OptionSelectorEditbox
(
Widget
parent,
string
value,
ScriptedWidgetEventHandler
parent_menu,
bool
disabled)
6
{
7
m_Root
=
g_Game
.GetWorkspace().CreateWidgets(
"gui/layouts/new_ui/option_editbox.layout"
, parent);
8
#ifdef PLATFORM_CONSOLE
9
m_Parent
= parent.GetParent().GetParent();
10
#else
11
#ifdef PLATFORM_WINDOWS
12
m_Parent
= parent.GetParent();
13
#endif
14
#endif
15
16
m_SelectorType = 1;
17
m_ParentClass = parent_menu;
18
m_EditBox
=
EditBoxWidget
.Cast(
m_Root
.FindAnyWidget(
"option_value"
));
19
20
SetValue
(value);
21
Enable
();
22
23
m_Parent
.SetHandler(
this
);
24
}
25
26
void
~OptionSelectorEditbox
()
27
{
28
delete
m_Root
;
29
}
30
31
override
void
Enable
()
32
{
33
super.Enable();
34
35
m_EditBox
.ClearFlags(
WidgetFlags
.IGNOREPOINTER);
36
}
37
38
override
void
Disable
()
39
{
40
super.Disable();
41
42
m_EditBox
.SetFlags(
WidgetFlags
.IGNOREPOINTER);
43
}
44
45
override
bool
OnMouseEnter
(
Widget
w,
int
x
,
int
y
)
46
{
47
if
(!
IsFocusable
(w))
48
return
true
;
49
50
if
(m_ParentClass)
51
{
52
m_ParentClass.OnFocus(
m_Root
.GetParent(), -1, m_SelectorType);
53
m_ParentClass.OnMouseEnter(
m_Root
.GetParent().GetParent(),
x
,
y
);
54
}
55
56
UIScriptedMenu
menu =
g_Game
.GetUIManager().GetMenu();
57
58
if
(menu && menu.IsInherited(CharacterCreationMenu))
59
{
60
menu.
OnFocus
(
m_Root
.GetParent(), -1, m_SelectorType);
61
menu.
OnMouseEnter
(
m_Root
.GetParent().GetParent(),
x
,
y
);
62
}
63
64
ColorHighlight
(w);
65
66
return
true
;
67
}
68
69
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x
,
int
y
)
70
{
71
if
(
IsFocusable
(enterW))
72
return
true
;
73
74
if
(m_ParentClass)
75
{
76
m_ParentClass.OnFocus(null,
x
,
y
);
77
m_ParentClass.OnMouseLeave(
m_Root
.GetParent().GetParent(), enterW,
x
,
y
);
78
}
79
80
UIScriptedMenu
menu =
g_Game
.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
ColorNormal
(w);
89
90
return
true
;
91
}
92
93
override
bool
OnChange
(
Widget
w,
int
x
,
int
y
,
bool
finished)
94
{
95
if
(w ==
m_EditBox
)
96
{
97
m_OptionChanged.Invoke(
GetValue
());
98
return
true
;
99
}
100
return
false
;
101
}
102
103
override
bool
IsFocusable
(
Widget
w)
104
{
105
if
(w)
106
{
107
return
(w ==
m_Parent
|| w ==
m_EditBox
);
108
}
109
return
false
;
110
}
111
112
override
bool
OnFocus
(
Widget
w,
int
x
,
int
y
)
113
{
114
if
(
GetFocus
() !=
m_EditBox
)
115
{
116
SetFocus
(
m_EditBox
);
117
m_Parent
.Enable(
false
);
118
}
119
120
return
super.OnFocus(
m_Parent
,
x
,
y
);
121
}
122
123
override
bool
OnFocusLost
(
Widget
w,
int
x
,
int
y
)
124
{
125
if
(w ==
m_EditBox
)
126
{
127
m_Parent
.Enable(
true
);
128
return
super.OnFocusLost(
m_Parent
,
x
,
y
);
129
}
130
return
false
;
131
}
132
133
void
SetValue
(
string
value,
bool
update =
true
)
134
{
135
m_EditBox
.SetText(value);
136
if
(update)
137
m_OptionChanged.Invoke(
GetValue
());
138
}
139
140
string
GetValue
()
141
{
142
return
m_EditBox
.GetText();
143
}
144
145
override
void
ColorHighlight
(
Widget
w)
146
{
147
if
(!w)
148
return
;
149
150
if
(
m_EditBox
)
151
{
152
SetFocus
(
m_EditBox
);
153
m_EditBox
.SetColor(
ARGB
(255, 200, 0, 0));
154
}
155
156
super.ColorHighlight(w);
157
}
158
159
override
void
ColorNormal
(
Widget
w)
160
{
161
if
(!w)
162
return
;
163
164
if
(
m_EditBox
)
165
{
166
m_EditBox
.SetColor(
ARGB
(140, 255, 255, 255));
167
}
168
169
super.ColorNormal(w);
170
}
171
}
m_Parent
Entity m_Parent
Definition
cachedequipmentstoragebase.c:15
EditBoxWidget
Definition
enwidgets.c:354
OptionSelectorBase
Definition
optionselector.c:2
OptionSelectorBase::IsFocusable
override bool IsFocusable(Widget w)
Definition
optionselector.c:204
OptionSelectorBase::OnChange
override bool OnChange(Widget w, int x, int y, bool finished)
Definition
optionselectoreditbox.c:93
OptionSelectorBase::Disable
override void Disable()
Definition
optionselectoreditbox.c:38
OptionSelectorBase::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
optionselectoreditbox.c:69
OptionSelectorBase::SetValue
void SetValue(string value, bool update=true)
Definition
optionselectoreditbox.c:133
OptionSelectorBase::Enable
override void Enable()
Definition
optionselector.c:213
OptionSelectorBase::ColorNormal
override void ColorNormal(Widget w)
Definition
optionselectoreditbox.c:159
OptionSelectorBase::OptionSelectorEditbox
void OptionSelectorEditbox(Widget parent, string value, ScriptedWidgetEventHandler parent_menu, bool disabled)
Definition
optionselectoreditbox.c:5
OptionSelectorBase::m_EditBox
EditBoxWidget m_EditBox
Definition
optionselectoreditbox.c:3
OptionSelectorBase::~OptionSelectorEditbox
void ~OptionSelectorEditbox()
Definition
optionselectoreditbox.c:26
OptionSelectorBase::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
optionselectoreditbox.c:123
OptionSelectorBase::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
optionselectoreditbox.c:45
OptionSelectorBase::GetValue
string GetValue()
Definition
optionselectoreditbox.c:140
OptionSelectorBase::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
optionselectoreditbox.c:112
OptionSelectorBase::ColorHighlight
override void ColorHighlight(Widget w)
Definition
optionselectoreditbox.c:145
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
enwidgets.c:657
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
GetFocus
proto native Widget GetFocus()
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
m_Root
Widget m_Root
Definition
sizetochild.c:91
Games
Dayz
scripts
5_mission
gui
newui
optionselectoreditbox.c
Generated by
1.17.0