7 protected bool m_bInitCalled;
9 protected ref array<string> m_aDropdownArray = {};
13 Widget comboBoxWidget = w.FindAnyWidget(m_sUiComponentName);
20 if (!m_ComboBoxComponent)
23 m_ComboBoxComponent.m_OnChanged.Insert(OnChangeComboBox);
28 array<ref SCR_BaseEditorAttributeEntry> entries =
new array<ref SCR_BaseEditorAttributeEntry>;
29 attribute.GetEntries(entries);
31 foreach (SCR_BaseEditorAttributeEntry entry: entries)
36 int count = m_comboboxData.GetValueCount();
38 for (
int i = 0; i < count; i++)
40 m_ComboBoxComponent.AddItem(m_comboboxData.GetValuesEntry(i).GetName());
50 int entriesCount = entries.Count();
51 for (
int i = 0; i < entriesCount; i++)
55 m_aDropdownArray.Insert(entry.GetText());
61 CreateDropdownEntries();
63 super.Init(w, attribute);
67 protected void CreateDropdownEntries()
69 if (!m_ComboBoxComponent)
72 foreach(
string entry : m_aDropdownArray)
74 m_ComboBoxComponent.AddItem(GetFullDropdownEntryText(entry));
79 protected string GetFullDropdownEntryText(
string text)
90 return m_comboboxData;
96 m_ComboBoxComponent.SetCurrentItem(0);
104 super.SetFromVar(var);
109 m_ComboBoxComponent.SetCurrentItem(var.GetInt(),
false,
false);
110 m_bInitCalled =
true;
114 override bool OnChange(Widget w,
int x,
int y,
bool finished)
117 if (!attribute)
return false;
120 if (var.GetInt() == x)
124 super.OnChange(w, x, y, finished);
131 OnChange(comboBox.GetRootWidget(), value, 0,
false);
135 override void HandlerDeattached(Widget w)
137 if (m_ComboBoxComponent)
138 m_ComboBoxComponent.m_OnChanged.Remove(OnChangeComboBox);