DayZ 1.24
Loading...
Searching...
No Matches
WidgetEventHandler.c
Go to the documentation of this file.
2{
4
21
23 {
24 return s_instance;
25 }
26
47
49 {
52 m_OnMouseWheel.Remove(w);
53 m_OnDropReceived.Remove(w);
54 m_OnDrag.Remove(w);
55 m_OnDrop.Remove(w);
56 m_OnDraggingOver.Remove(w);
57 m_OnMouseEnter.Remove(w);
58 m_OnMouseButtonLeave.Remove(w);
59 m_OnClick.Remove(w);
60 m_OnDoubleClick.Remove(w);
61 m_OnDoubleClick.Remove(w);
62 m_OnFocus.Remove(w);
63 m_OnFocusLost.Remove(w);
64 m_OnController.Remove(w);
65 m_OnChildAdd.Remove(w);
66 m_OnChildRemove.Remove(w);
67 w.SetHandler(NULL);
68 }
69
76
83
90
97
99 {
100 w.SetHandler(this);
102 m_OnDrag.Insert(w, param);
103 }
104
106 {
107 w.SetHandler(this);
109 m_OnDrop.Insert(w, param);
110 }
111
118
125
132
134 {
135 w.SetHandler(this);
137 m_OnClick.Insert(w, param);
138 }
139
146
148 {
149 w.SetHandler(this);
151 m_OnFocus.Insert(w, param);
152 }
154 {
155 w.SetHandler(this);
157 m_OnFocusLost.Insert(w, param);
158 }
159
161 {
162 w.SetHandler(this);
164 m_OnChildAdd.Insert(w, param);
165 }
166
173
174 override bool OnClick(Widget w, int x, int y, int button)
175 {
177 if (param == NULL)
178 return false;
179
180 if (!param.param1)
181 m_OnClick.Remove(w);
182
184 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
185
186 return true;
187 }
188
189 override bool OnDoubleClick(Widget w, int x, int y, int button)
190 {
192 if (param == NULL)
193 return false;
194
195 if (!param.param1)
196 m_OnDoubleClick.Remove(w);
197
199 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
200
201 return true;
202 }
203
204 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
205 {
207 if (param == NULL)
208 return false;
209
210 if (!param.param1)
211 m_OnMouseButtonLeave.Remove(w);
212
214 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
215
216 return true;
217 }
218
219 override bool OnMouseEnter(Widget w, int x, int y)
220 {
222 if (param == NULL)
223 return false;
224
225 if (!param.param1)
226 m_OnMouseEnter.Remove(w);
227
228 Param param2 = new Param3<Widget, int, int>(w, x, y);
229 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
230
231 return true;
232 }
233
234 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
235 {
237 if (param == NULL)
238 return false;
239
240 if (!param.param1)
242
244 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
245
246 return true;
247 }
248
249 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
250 {
252 if (param == NULL)
253 return false;
254
255 if (!param.param1)
257
259 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
260
261 return true;
262 }
263
264 override bool OnDrag(Widget w, int x, int y)
265 {
267 if (param == NULL)
268 return false;
269
270 if (!param.param1)
271 m_OnDrag.Remove(w);
272
273 Param param2 = new Param3<Widget, int, int>(w, x, y);
274 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
275
276 return true;
277 }
278
279 override bool OnDrop(Widget w, int x, int y, Widget reciever)
280 {
282 if (param == NULL)
283 return false;
284
285 if (!param.param1)
286 m_OnDrop.Remove(w);
287
288 Param param2 = new Param3<Widget, int, int>(w, x, y);
289 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
290
291 return true;
292 }
293
294 override bool OnDraggingOver(Widget w, int x, int y, Widget reciever)
295 {
297 if (param == NULL)
298 return false;
299
300 if (!param.param1)
301 m_OnDraggingOver.Remove(w);
302
304 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
305
306 return true;
307 }
308
309 override bool OnDropReceived(Widget w, int x, int y, Widget reciever)
310 {
311 if (w.GetName() == "GridItem")
312 return false;
315 if (param == NULL)
316 return false;
317
318 if (!param.param1)
319 m_OnDropReceived.Remove(w);
320
322 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
323
324 return true;
325 }
326
327 override bool OnFocus(Widget w, int x, int y)
328 {
330 if (param == NULL)
331 return false;
332
333 if (!param.param1)
334 m_OnFocus.Remove(w);
335
336 Param param2 = new Param3<Widget, int, int>(w, x, y);
337 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
338
339 return true;
340 }
341
342 override bool OnFocusLost(Widget w, int x, int y)
343 {
345 if (param == NULL)
346 return false;
347
348 if (!param.param1)
349 m_OnFocusLost.Remove(w);
350
351 Param param2 = new Param3<Widget, int, int>(w, x, y);
352 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
353
354 return true;
355 }
356
357 override bool OnMouseWheel(Widget w, int x, int y, int wheel)
358 {
360 if (param == NULL)
361 return false;
362
363 if (!param.param1)
364 m_OnMouseWheel.Remove(w);
365
366 Param param2 = new Param4<Widget, int, int, int>(w, x, y, wheel);
367 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
368
369 return true;
370 }
371
373 {
375 if (param == NULL)
376 return false;
377
378 if (!param.param1)
379 m_OnChildAdd.Remove(w);
380
381 Param param2 = new Param2<Widget, Widget>(w, child);
382 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
383
384 return true;
385 }
386
388 {
390 if (param == NULL)
391 return false;
392
393 if (!param.param1)
394 m_OnChildRemove.Remove(w);
395
396 Param param2 = new Param2<Widget, Widget>(w, child);
397 GetGame().GameScript.CallFunctionParams(param.param1, param.param2, NULL, param2);
398
399 return true;
400 }
401}
Icon x
Icon y
TODO doc.
Definition EnScript.c:118
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
map: item x vector(index, width, height)
Definition EnWidgets.c:651
ref map< Widget, ref Param > m_OnFocusLost
static ref WidgetEventHandler s_instance
override bool OnMouseEnter(Widget w, int x, int y)
override bool OnDrop(Widget w, int x, int y, Widget reciever)
override bool OnFocus(Widget w, int x, int y)
override bool OnDropReceived(Widget w, int x, int y, Widget reciever)
void RegisterOnDropReceived(Widget w, Managed eventHandler, string functionName)
void RegisterOnClick(Widget w, Managed eventHandler, string functionName)
void RegisterOnMouseLeave(Widget w, Managed eventHandler, string functionName)
void RegisterOnMouseWheel(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnDoubleClick
void RegisterOnDraggingOver(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnClick
ref map< Widget, ref Param > m_OnDraggingOver
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
override bool OnDraggingOver(Widget w, int x, int y, Widget reciever)
void RegisterOnFocus(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnChildAdd
void RegisterOnDrag(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnFocus
ref map< Widget, ref Param > m_OnDrag
override bool OnDrag(Widget w, int x, int y)
override bool OnChildRemove(Widget w, Widget child)
override bool OnChildAdd(Widget w, Widget child)
ref map< Widget, ref Param > m_OnDrop
ref map< Widget, ref Param > m_OnMouseButtonLeave
ref map< Widget, ref Param > m_OnMouseEnter
override bool OnFocusLost(Widget w, int x, int y)
ref map< Widget, ref Param > m_OnMouseButtonUpRegister
ref map< Widget, ref Param > m_OnMouseWheel
ref map< Widget, ref Param > m_OnChildRemove
override bool OnClick(Widget w, int x, int y, int button)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
void RegisterOnDrop(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnDropReceived
void RegisterOnFocusLost(Widget w, Managed eventHandler, string functionName)
void RegisterOnChildRemove(Widget w, Managed eventHandler, string functionName)
void UnregisterWidget(Widget w)
static WidgetEventHandler GetInstance()
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
void RegisterOnMouseEnter(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnController
void RegisterOnMouseButtonDown(Widget w, Managed eventHandler, string functionName)
ref map< Widget, ref Param > m_OnMouseButtonDownRegister
void RegisterOnMouseButtonUp(Widget w, Managed eventHandler, string functionName)
override bool OnDoubleClick(Widget w, int x, int y, int button)
override bool OnMouseWheel(Widget w, int x, int y, int wheel)
void RegisterOnChildAdd(Widget w, Managed eventHandler, string functionName)
void RegisterOnDoubleClick(Widget w, Managed eventHandler, string functionName)
proto native CGame GetGame()