Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
presetsmenu.c
Go to the documentation of this file.
1 class PresetsMenu extends UIScriptedMenu
2 {
3  void PresetsMenu()
4  {
5  }
6 
7  void ~PresetsMenu()
8  {
9  }
10 
11  override Widget Init()
12  {
13  layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/day_z_options_controls_preset.layout");
14 
15  m_schemes_list = TextListboxWidget.Cast( layoutRoot.FindAnyWidget("PresetListboxWidget") );
16 
17  int c = GetGame().GetInput().GetProfilesCount();
18  for (int i = 0; i < c; i++)
19  {
20  string tmp;
21  GetGame().GetInput().GetProfileName(i, tmp);
22  m_schemes_list.AddItem(tmp, NULL, 0);
23  }
24 
25  i = GetGame().GetInput().GetCurrentProfile();
26  if (i >= 0 && i < c)
27  {
28  m_schemes_list.SelectRow(i);
29  }
30 
31  return layoutRoot;
32  }
33 
34  override bool OnClick(Widget w, int x, int y, int button)
35  {
36  super.OnClick(w, x, y, button);
37 
38  switch (w.GetUserID())
39  {
40  case IDC_CANCEL:
41  Close();
42 
43  return true;
44 
45  case IDC_OK:
46  int index = m_schemes_list.GetSelectedRow();
47  if (index != -1)
48  {
49  GetGame().GetInput().SetProfile(index);
50  GetGame().GetMission().GetOnInputPresetChanged().Invoke();
51  Close();
52  }
53 
54  return true;
55  }
56 
57  return false;
58  }
59 
60  private TextListboxWidget m_schemes_list;
61 }
GetGame
proto native CGame GetGame()
UIScriptedMenu
Definition: dayzgame.c:63
IDC_CANCEL
const int IDC_CANCEL
Definition: constants.c:128
Close
void Close()
y
Icon y
Init
class InventoryGridController extends ScriptedWidgetEventHandler Init
Definition: uihintpanel.c:46
x
Icon x
IDC_OK
const int IDC_OK
Definition: constants.c:127
Widget
Definition: enwidgets.c:189
OnClick
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
Definition: dayzgame.c:146