21 protected bool m_bSortOrderAscending;
23 [
Attribute(
"", UIWidgets.Auto,
"Internal name, returned by GetName()")]
24 protected string m_sName;
26 [
Attribute(
"false", UIWidgets.Auto,
"Locks sorting direction only in the order set by m_bDefaultSortOrder.")]
27 protected bool m_bSortSingleOrder;
29 [
Attribute(
"0", UIWidgets.ComboBox,
"Default sort order when we first click on this element.", enums: ParamEnumArray.FromEnum(
ESortOrder))]
33 const string TAG_ALL =
"all";
34 const string TAG_SORT_ASC =
"sort_asc";
35 const string TAG_SORT_DESC =
"sort_desc";
36 const string TAG_SORT_NONE =
"sort_none";
56 if (m_bSortSingleOrder)
58 SelectNewSortOrder(reset:
true);
63 m_bSortOrderAscending =
true;
65 m_bSortOrderAscending =
false;
79 if (m_bSortOrderAscending)
89 return m_eDefaultSortOrder;
104 protected override void HandlerAttached(Widget w)
106 super.HandlerAttached(w);
115 SelectNewSortOrder(reset:
true);
120 protected override void Internal_SetToggled(
bool newToggled,
bool invokeOnToggled =
true)
122 super.Internal_SetToggled(newToggled, invokeOnToggled);
127 protected override bool OnClick(Widget w,
int x,
int y,
int button)
132 Internal_SetToggled(
true,
true);
134 SelectNewSortOrder(reset: !oldToggled);
137 bool returnValue = super.OnClick(w, x, y, button);
145 protected void SelectNewSortOrder(
bool reset)
147 if (m_bSortSingleOrder || reset)
149 if (m_eDefaultSortOrder ==
ESortOrder.ASCENDING)
150 m_bSortOrderAscending =
true;
152 m_bSortOrderAscending =
false;
156 m_bSortOrderAscending = !m_bSortOrderAscending;
164 protected void UpdateSortEffects()
166 array<string> tags = {TAG_ALL};
169 if (m_bSortOrderAscending)
170 tags.Insert(TAG_SORT_ASC);
172 tags.Insert(TAG_SORT_DESC);
175 tags.Insert(TAG_SORT_NONE);