Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectionWidgetComponent.c
Go to the documentation of this file.
2{
3 [Attribute()]
4 ref array<string> m_aElementNames;
5
6 protected ref array<ref Managed> m_aElementData = new array<ref Managed>;
7
8 [Attribute("-1", UIWidgets.EditBox, "Element selected by default")]
10
11 //------------------------------------------------------------------------------------------------
12 int AddItem(string item, bool last = false, Managed data = null)
13 {
14 if (!m_aElementNames)
15 m_aElementNames = new array<string>;
16
17 int id = m_aElementNames.Insert(item);
18
19 m_aElementData.Insert(data);
20
21 return id;
22 }
23
24 //------------------------------------------------------------------------------------------------
25 void ClearAll()
26 {
27 m_iSelectedItem = -1;
28
29 if (m_aElementNames)
30 m_aElementNames.Clear();
31
33 m_aElementData.Clear();
34 }
35
36 //------------------------------------------------------------------------------------------------
37 void RemoveItem(int item, bool last = false)
38 {
39 if (!m_aElementNames || item < 0 || item >= m_aElementNames.Count())
40 return;
41
42 m_aElementNames.Remove(item);
43 m_aElementData.Remove(item);
44
45 m_iSelectedItem = -1;
46 }
47
48 //------------------------------------------------------------------------------------------------
50 {
51 return m_iSelectedItem;
52 }
53
54 //------------------------------------------------------------------------------------------------
56 {
58 }
59
60 //------------------------------------------------------------------------------------------------
62 {
63 if (!m_aElementData.IsIndexValid(m_iSelectedItem))
64 return null;
65
67 }
68
69 //------------------------------------------------------------------------------------------------
70 string GetItemName(int item)
71 {
72 if (!m_aElementNames || !m_aElementData || item < 0 || item >= m_aElementNames.Count())
73 return string.Empty;
74
75 return m_aElementNames[item];
76 }
77
78 //------------------------------------------------------------------------------------------------
79 Managed GetItemData(int item)
80 {
81 if (!m_aElementNames || !m_aElementData || item < 0 || item >= m_aElementNames.Count() || item >= m_aElementData.Count())
82 return null;
83
84 return m_aElementData[item];
85 }
86
87 //------------------------------------------------------------------------------------------------
89 {
90 if (!m_aElementNames)
91 return 0;
92
93 return m_aElementNames.Count();
94 }
95
96 //------------------------------------------------------------------------------------------------
97 bool SetCurrentItem(int i, bool playSound = false, bool animate = false)
98 {
99 if (i < 0 || !m_aElementNames || !m_aElementData || i >= m_aElementNames.Count())
100 return false;
101
102 if (playSound)
104
105 if (m_iSelectedItem == i)
106 return false;
107
108 m_iSelectedItem = i;
109
110 return true;
111 }
112
113//---- REFACTOR NOTE START: This code will need to be refactored as current implementation is not conforming to the standards ----
114// auto
115
116 //------------------------------------------------------------------------------------------------
117 static SCR_SelectionWidgetComponent GetSelectionComponent(string name, Widget parent, bool searchAllChildren = true)
118 {
119 auto comp = SCR_SelectionWidgetComponent.Cast(
120 SCR_WLibComponentBase.GetComponent(SCR_SelectionWidgetComponent, name, parent, searchAllChildren)
121 );
122 return comp;
123 }
124
125//---- REFACTOR NOTE END ----
126
127};
AddonBuildInfoTool id
Get all prefabs that have the spawner data
Base class for all widgets that can change their internal state as editbox or spinbox.
int AddItem(string item, bool last=false, Managed data=null)
void RemoveItem(int item, bool last=false)
bool SetCurrentItem(int i, bool playSound=false, bool animate=false)
static SCR_SelectionWidgetComponent GetSelectionComponent(string name, Widget parent, bool searchAllChildren=true)
Base class for all final Reforger interactive elements.
SCR_FieldOfViewSettings Attribute