DayZ 1.24
Loading...
Searching...
No Matches
SpacerBase.c
Go to the documentation of this file.
1// -----------------------------------------------------------
3{
4 protected Widget m_root;
5 protected int m_count;
6
7 // -----------------------------------------------------------
9 {
10 m_root = w;
11 m_count = 0;
12
13 Widget child = m_root.GetChildren();
14 while (child)
15 {
16 m_count++;
17 child.SetFlags(WidgetFlags.EXACTPOS | WidgetFlags.EXACTSIZE, false);
18 child = child.GetSibling();
19 }
20
21 m_root.SetHandler(this);
22 }
23
24 // -----------------------------------------------------------
25 override bool OnUpdate(Widget w)
26 {
27 if (w == m_root) UpdateLayout();
28 return false;
29 }
30
31 // -----------------------------------------------------------
32 override bool OnChildAdd(Widget w, Widget child)
33 {
34 m_count++;
35 child.SetFlags(WidgetFlags.EXACTPOS | WidgetFlags.EXACTSIZE, false);
36 return false;
37 }
38
39 // -----------------------------------------------------------
41 {
42 m_count--;
43 return false;
44 }
45
46 // -----------------------------------------------------------
47 protected int GetChildIndex(Widget w)
48 {
49 Widget child = m_root.GetChildren();
50
51 int index = 0;
52 while (child)
53 {
54 if (child == w) return index;
55
56 index++;
57 child = child.GetSibling();
58 }
59
60 return INDEX_NOT_FOUND;
61 }
62
63 // -----------------------------------------------------------
65 {
66 if (m_count == 0) return;
67
68 float width;
69 float height;
70 m_root.GetScreenSize(width, height);
71
72 Widget child = m_root.GetChildren();
73
74 int index = 0;
75 while (child)
76 {
78 index++;
79 child = child.GetSibling();
80 }
81 }
82 protected void UpdateChild(Widget child, float w, float h, int index) {}
83};
map: item x vector(index, width, height)
Definition EnWidgets.c:651
void OnWidgetScriptInit(Widget w)
Definition SpacerBase.c:8
Widget m_root
Definition SpacerBase.c:4
int GetChildIndex(Widget w)
Definition SpacerBase.c:47
void UpdateChild(Widget child, float w, float h, int index)
Definition SpacerBase.c:82
override bool OnUpdate(Widget w)
Definition SpacerBase.c:25
void UpdateLayout()
Definition SpacerBase.c:64
override bool OnChildRemove(Widget w, Widget child)
Definition SpacerBase.c:40
int m_count
Definition SpacerBase.c:5
override bool OnChildAdd(Widget w, Widget child)
Definition SpacerBase.c:32
const int INDEX_NOT_FOUND
Definition gameplay.c:13
WidgetFlags
Definition EnWidgets.c:58