Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
spacerbase.c
Go to the documentation of this file.
1
// -----------------------------------------------------------
2
class
SpacerBase
:
ScriptedWidgetEventHandler
3
{
4
protected
Widget
m_root
;
5
protected
int
m_count
;
6
7
// -----------------------------------------------------------
8
void
OnWidgetScriptInit
(
Widget
w)
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
// -----------------------------------------------------------
40
override
bool
OnChildRemove
(
Widget
w,
Widget
child)
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
// -----------------------------------------------------------
64
void
UpdateLayout
()
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
{
77
UpdateChild
(child, width, height, index);
78
index++;
79
child = child.GetSibling();
80
}
81
}
82
protected
void
UpdateChild
(
Widget
child,
float
w,
float
h,
int
index) {}
83
};
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition
enwidgets.c:657
SpacerBase
Definition
spacerbase.c:3
SpacerBase::m_root
Widget m_root
Definition
spacerbase.c:4
SpacerBase::UpdateChild
void UpdateChild(Widget child, float w, float h, int index)
Definition
spacerbase.c:82
SpacerBase::GetChildIndex
int GetChildIndex(Widget w)
Definition
spacerbase.c:47
SpacerBase::OnChildAdd
override bool OnChildAdd(Widget w, Widget child)
Definition
spacerbase.c:32
SpacerBase::UpdateLayout
void UpdateLayout()
Definition
spacerbase.c:64
SpacerBase::OnChildRemove
override bool OnChildRemove(Widget w, Widget child)
Definition
spacerbase.c:40
SpacerBase::OnWidgetScriptInit
void OnWidgetScriptInit(Widget w)
Definition
spacerbase.c:8
SpacerBase::OnUpdate
override bool OnUpdate(Widget w)
Definition
spacerbase.c:25
SpacerBase::m_count
int m_count
Definition
spacerbase.c:5
Widget
Definition
enwidgets.c:190
INDEX_NOT_FOUND
const int INDEX_NOT_FOUND
Definition
gameplay.c:13
WidgetFlags
WidgetFlags
Definition
enwidgets.c:58
Games
Dayz
scripts
3_game
gui
spacers
spacerbase.c
Generated by
1.17.0