5 protected string m_sExpandButton;
6 protected Widget m_wExpandButton;
9 protected string m_sExpandButtonName;
10 protected TextWidget m_wExpandButtonName;
13 protected string m_sExpandButtonIcon;
14 protected ImageWidget m_wExpandButtonIcon;
17 protected bool m_bUseListFromButton;
19 protected bool m_bEnabled =
true;
20 protected bool m_bLocked =
false;
21 protected ref array<SCR_DeployButtonBase> m_aButtons = {};
23 protected Widget m_wRoot;
25 protected ref ScriptInvoker m_OnButtonFocused =
new ScriptInvoker();
26 protected ref ScriptInvoker m_OnMouseLeft =
new ScriptInvoker();
27 protected static ref ScriptInvoker<SCR_DeployRequestUIBaseComponent, bool> s_OnListExpand;
30 override void HandlerAttached(Widget w)
52 button.Lock(button == btn);
91 protected void ToggleCollapsed();
92 void SetExpanded(
bool expanded);
97 if (component ==
this)
104 void SetListWidget(Widget list)
111 Widget GetListWidget()
115 protected void OnMouseLeft()
117 m_OnMouseLeft.Invoke();
120 ScriptInvoker GetOnButtonFocused()
122 return m_OnButtonFocused;
125 ScriptInvoker GetOnMouseLeft()
127 return m_OnMouseLeft;
130 static ScriptInvoker GetOnListCollapse()
133 s_OnListExpand =
new ScriptInvoker();
135 return s_OnListExpand;
143 [
Attribute(
"0.898 0.541 0.184 1", UIWidgets.ColorPicker)]
144 protected ref Color m_ColorSelected;
146 [
Attribute(
"0.947 0.056 0.056 0.62", UIWidgets.ColorPicker)]
147 protected ref Color m_ColorWarning;
150 protected string m_sElements;
151 protected Widget m_wElements;
154 protected string m_sList;
155 protected Widget m_wList;
158 protected string m_sGridList;
159 protected GridLayoutWidget m_wGridList;
162 protected string m_sBackgroundHighlight;
163 protected Widget m_wBackgroundHighlight;
169 protected ButtonWidget m_wRootButton;
170 protected Widget m_wLoading;
171 protected SCR_LoadingSpinner m_Loading;
175 protected bool m_bCanBeUnlocked =
true;
176 protected bool m_bShowTooltip =
true;
179 override void HandlerAttached(Widget w)
181 super.HandlerAttached(w);
183 m_wRootButton = ButtonWidget.Cast(w);
186 m_Loading = SCR_LoadingSpinner.Cast(
m_wLoading.FindHandler(SCR_LoadingSpinner));
189 m_wBackgroundHighlight = w.FindAnyWidget(m_sBackgroundHighlight);
193 m_wGridList = GridLayoutWidget.Cast(w.GetParent().FindAnyWidget(m_sGridList));
198 m_wGridList = GridLayoutWidget.Cast(w.FindAnyWidget(m_sGridList));
203 override bool OnFocus(Widget w,
int x,
int y)
205 super.OnFocus(w, x, y);
207 if (ShouldShowTooltip())
218 GridLayoutWidget GetGridList()
229 s_ExpandedList.CollapseList();
232 s_ExpandedList =
this;
243 m_ParentHandler = parent;
246 protected void HandleTooltip()
248 if (m_ControlsTooltip)
249 m_ControlsTooltip.CreateTooltip();
254 if (m_ControlsTooltip)
255 m_ControlsTooltip.ForceDeleteTooltip();
258 void Update(
float dt)
262 m_Loading.Update(dt);
267 void Lock(
bool loadingAnim =
false)
285 void SetSelected(
bool selected)
287 Color color = Color.FromInt(Color.WHITE);
289 color = Color.FromInt(m_ColorSelected.PackToInt());
291 m_wElements.SetColor(color);
292 if (m_wBackgroundHighlight)
293 m_wBackgroundHighlight.SetVisible(selected);
299 GetGame().GetWorkspace().SetFocusedWidget(m_wRootButton);
302 override bool OnClick(Widget w,
int x,
int y,
int button)
307 return super.OnClick(w, x, y, button);
310 override void SetEnabled(
bool enabled,
bool animate =
true)
321 protected bool ShouldUnlock()
323 return m_bCanBeUnlocked;
327 void SetShouldUnlock(
bool shouldUnlock)
329 m_bCanBeUnlocked = shouldUnlock;
333 protected bool ShouldShowTooltip()
335 return m_bShowTooltip;
339 void SetTooltipAvailable(
bool available)
341 m_bShowTooltip = available;