Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
tabber.c
Go to the documentation of this file.
1 // -----------------------------------------------------------
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 };
y
Icon y
Tabber
Definition: tabber.c:2
Print
proto void Print(void var)
Prints content of variable to console/log.
x
Icon x
Widget
Definition: enwidgets.c:189
ScriptedWidgetEventHandler
map: item x vector(index, width, height)
Definition: enwidgets.c:650