Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
scriptconsolepresetslist.c
Go to the documentation of this file.
1class ScriptConsolePresetsList extends ScriptedWidgetEventHandler
2{
3 protected Widget m_Root;
4 protected Widget m_Parent;
5 protected ScriptConsoleTabBase m_Tab;
6 protected TextListboxWidget m_PresetsList;
7
8 ref ScriptInvoker m_ItemSelected = new ScriptInvoker;
9
10 void ScriptConsolePresetsList(Widget parent, ScriptConsoleTabBase tab)
11 {
12 m_Parent = parent;
13 m_Tab = tab;
14
15 m_Root = GetGame().GetWorkspace().CreateWidgets(GetLayoutFile(), parent);
16 m_PresetsList = TextListboxWidget.Cast(m_Root);
17
18 m_Root.SetHandler(this);
19 }
20
21 void AddListItem(string label, int column, int row, Class data = null)
22 {
23 m_PresetsList.AddItem(label, data, column, row);
24 m_PresetsList.Update();
25 }
26
27 void ClearList()
28 {
29 m_PresetsList.ClearItems();
30 }
31
32 override bool OnItemSelected(Widget w, int x, int y, int row, int column, int oldRow, int oldColumn)
33 {
34 if (w == m_PresetsList)
35 {
36 m_ItemSelected.Invoke(row, column);
37 return true;
38 }
39
40 return false;
41 }
42
43 string GetLayoutFile()
44 {
45 return "gui/layouts/script_console/script_console_presets_list.layout";
46 }
47
48 Widget GetParent()
49 {
50 return m_Parent;
51 }
52
54 {
55 return m_Tab;
56 }
57
58 TextListboxWidget GetPresetsList()
59 {
60 return m_PresetsList;
61 }
62}
Super root of all classes in Enforce script.
Definition enscript.c:11
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
proto native CGame GetGame()
Icon x
Icon y
Widget m_Root
Definition sizetochild.c:91
Widget m_Parent
Definition sizetochild.c:92