Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
tabber.c
Go to the documentation of this file.
1// -----------------------------------------------------------
2class Tabber : ScriptedWidgetEventHandler
3{
4 Widget ButtonsPanel;
5 Widget ContentPanel;
6 reference int SelectedTab;
7
8 // -----------------------------------------------------------
9 void OnWidgetScriptInit(Widget w)
10 {
11 w.SetHandler(this);
12 SelectTab(SelectedTab);
13 }
14
15 // -----------------------------------------------------------
16 override bool OnClick(Widget w, int x, int y, int button)
17 {
18 if (w && w.GetParent() == ButtonsPanel)
19 {
20 SelectedTab = 0;
21 Widget iw = ButtonsPanel.GetChildren();
22 while(iw)
23 {
24 if (iw == w) break;
25 SelectedTab++;
26 iw = iw.GetSibling();
27 }
28
29 SelectTab(SelectedTab);
30 }
31
32 return false;
33 }
34
35 // -----------------------------------------------------------
36 protected void SelectTab(int index)
37 {
38 Print(index);
39 int n = 0;
40 Widget w = ContentPanel.GetChildren();
41 while(w)
42 {
43 if (n == index)
44 {
45 w.Show(true);
46 }
47 else
48 {
49 w.Show(false);
50 }
51 n++;
52 w = w.GetSibling();
53 }
54 }
55};
Definition tabber.c:3
void SelectTab(int index)
Definition tabber.c:36
proto void Print(void var)
Prints content of variable to console/log.
Icon x
Icon y