DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
OptionSelectorEditbox.c
См. документацию.
1class OptionSelectorEditbox extends OptionSelectorBase
2{
4
5 void OptionSelectorEditbox(Widget parent, string value, ScriptedWidgetEventHandler parent_menu, bool disabled)
6 {
7 m_Root = GetGame().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
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
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
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
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 {
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 {
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}
Icon x
Icon y
Widget m_Root
Определения SizeToChild.c:91
Widget m_Parent
Определения SizeToChild.c:92
proto native UIManager GetUIManager()
proto native WorkspaceWidget GetWorkspace()
Определения EnWidgets.c:354
void ~OptionSelectorEditbox()
Определения OptionSelectorEditbox.c:26
override bool OnFocus(Widget w, int x, int y)
Определения OptionSelectorEditbox.c:112
override bool OnChange(Widget w, int x, int y, bool finished)
Определения OptionSelectorEditbox.c:93
override bool IsFocusable(Widget w)
Определения OptionSelector.c:198
override bool OnFocusLost(Widget w, int x, int y)
Определения OptionSelectorEditbox.c:123
string GetValue()
Определения OptionSelectorEditbox.c:140
EditBoxWidget m_EditBox
Определения OptionSelectorEditbox.c:3
override void ColorHighlight(Widget w)
Определения OptionSelectorEditbox.c:145
void OptionSelectorEditbox(Widget parent, string value, ScriptedWidgetEventHandler parent_menu, bool disabled)
Определения OptionSelectorEditbox.c:5
override bool OnMouseEnter(Widget w, int x, int y)
Определения OptionSelectorEditbox.c:45
override void Enable()
Определения OptionSelector.c:207
override void ColorNormal(Widget w)
Определения OptionSelectorEditbox.c:159
override void Disable()
Определения OptionSelectorEditbox.c:38
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения OptionSelectorEditbox.c:69
void SetValue(string value, bool update=true)
Определения OptionSelectorEditbox.c:133
map: item x vector(index, width, height)
Определения EnWidgets.c:651
proto native UIScriptedMenu GetMenu()
Returns most-top open menu.
override bool OnMouseEnter(Widget w, int x, int y)
Определения CameraToolsMenu.c:928
override bool OnFocus(Widget w, int x, int y)
Определения CameraToolsMenu.c:940
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Определения CameraToolsMenu.c:935
Определения DayZGame.c:64
Определения EnWidgets.c:190
proto native CGame GetGame()
WidgetFlags
Определения EnWidgets.c:58
proto native external Widget CreateWidgets(string layout, Widget parentWidget=NULL, bool immedUpdate=true)
Create widgets from *.layout file.
proto native Widget GetFocus()
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Определения proto.c:322