4 protected const string BUTTON_UP =
"m_UpButton";
5 protected const string BUTTON_DOWN =
"m_DownButton";
6 protected const string BUTTON_SORT_CONFIRM =
"m_SortConfirmButton";
8 protected bool m_bWidgetEnabled =
false;
11 protected SCR_ModularButtonComponent m_ButtonUp;
12 protected SCR_ModularButtonComponent m_ButtonDown;
13 protected SCR_ModularButtonComponent m_ButtonSortConfirm;
15 protected bool m_bOnBottom;
16 protected bool m_bIsSorting;
27 Widget wButtonUp =
m_wRoot.FindAnyWidget(BUTTON_UP);
29 m_ButtonUp = SCR_ModularButtonComponent.FindComponent(wButtonUp);
33 m_ButtonUp.m_OnClicked.Insert(InvokeEventOnButtonUp);
34 m_aMouseButtons.Insert(m_ButtonUp);
38 Widget wButtonDown =
m_wRoot.FindAnyWidget(BUTTON_DOWN);
40 m_ButtonDown = SCR_ModularButtonComponent.FindComponent(wButtonDown);
44 m_ButtonDown.m_OnClicked.Insert(InvokeEventOnButtonDown);
45 m_aMouseButtons.Insert(m_ButtonDown);
49 Widget sortConfirm =
m_wRoot.FindAnyWidget(BUTTON_SORT_CONFIRM);
51 m_ButtonSortConfirm = SCR_ModularButtonComponent.FindComponent(sortConfirm);
53 if (m_ButtonSortConfirm)
55 m_ButtonSortConfirm.m_OnClicked.Insert(OnSortConfirm);
56 m_aMouseButtons.Insert(m_ButtonSortConfirm);
62 HandleEnableButtons(m_bWidgetEnabled, m_bIsSorting);
66 override void UpdateAllWidgets()
68 super.UpdateAllWidgets();
70 HandleEnableButtons(m_bWidgetEnabled, m_bIsSorting);
71 HandleSortingButtons();
74 m_Widgets.m_wDeleteButton.SetVisible(
false);
76 m_Widgets.m_wHorizontalState.SetVisible(
false);
77 m_Widgets.m_wUpdateButton.SetVisible(
false);
82 protected void HandleSortingButtons()
84 bool onTop =
m_wRoot.GetZOrder() == 0;
85 bool visible = m_bIsSorting || (m_bFocused &&
GetGame().GetInputManager().GetLastUsedInputDevice() == EInputDeviceType.MOUSE);
88 m_ButtonUp.SetVisible(!onTop && m_bWidgetEnabled && visible);
91 m_ButtonDown.SetVisible(!m_bOnBottom && m_bWidgetEnabled && visible);
93 if (m_ButtonSortConfirm)
94 m_ButtonSortConfirm.SetVisible(m_bIsSorting);
98 protected void OnSortConfirm()
101 m_OnSortConfirm.Invoke(
this);
105 protected void InvokeEventOnButtonUp()
107 if (Event_OnButtonUp)
108 Event_OnButtonUp.Invoke(
this);
112 protected void InvokeEventOnButtonDown()
114 if (Event_OnButtonDown)
115 Event_OnButtonDown.Invoke(
this);
122 void SetWidgetEnabled(
bool enabled)
124 m_bWidgetEnabled = enabled;
129 bool GetWidgetEnabled()
131 return m_bWidgetEnabled;
135 void SetOnBottom(
bool onBottom)
137 m_bOnBottom = onBottom;
141 void NotifySorting(
bool sorting)
143 m_bIsSorting = sorting;
144 HandleSortingButtons();
145 HandleEnableButtons(m_bWidgetEnabled, sorting);
151 if (!Event_OnButtonUp)
154 return Event_OnButtonUp;
160 if (!Event_OnButtonDown)
163 return Event_OnButtonDown;
169 if (!m_OnSortConfirm)
172 return m_OnSortConfirm;