4 ref array<string> m_aElementNames;
6 protected ref array<ref Managed> m_aElementData =
new array<ref Managed>;
8 [
Attribute(
"-1", UIWidgets.EditBox,
"Element selected by default")]
12 int AddItem(
string item,
bool last =
false, Managed
data =
null)
15 m_aElementNames =
new array<string>;
17 int id = m_aElementNames.Insert(item);
19 m_aElementData.Insert(
data);
30 m_aElementNames.Clear();
33 m_aElementData.Clear();
37 void RemoveItem(
int item,
bool last =
false)
39 if (!m_aElementNames || item < 0 || item >= m_aElementNames.Count())
42 m_aElementNames.Remove(item);
43 m_aElementData.Remove(item);
51 return m_iSelectedItem;
55 string GetCurrentItem()
57 return GetItemName(m_iSelectedItem);
61 Managed GetCurrentItemData()
63 if (!m_aElementData.IsIndexValid(m_iSelectedItem))
66 return m_aElementData[m_iSelectedItem];
70 string GetItemName(
int item)
72 if (!m_aElementNames || !m_aElementData || item < 0 || item >= m_aElementNames.Count())
75 return m_aElementNames[item];
79 Managed GetItemData(
int item)
81 if (!m_aElementNames || !m_aElementData || item < 0 || item >= m_aElementNames.Count() || item >= m_aElementData.Count())
84 return m_aElementData[item];
93 return m_aElementNames.Count();
97 bool SetCurrentItem(
int i,
bool playSound =
false,
bool animate =
false)
99 if (i < 0 || !m_aElementNames || !m_aElementData || i >= m_aElementNames.Count())
105 if (m_iSelectedItem == i)