Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ContentBrowserSortingBarComponent.c
Go to the documentation of this file.
2 {
3 
4  [Attribute()]
5  bool m_bDefaultSelected = true;
6 
7  SCR_ButtonImageComponent m_CurrentSelection;
8  protected int m_iCurrentIndex;
9  protected ref array<SCR_ButtonImageComponent> m_aButtons = new array<SCR_ButtonImageComponent>();
10 
11  ref ScriptInvoker m_OnSortingChange = new ScriptInvoker();
12 
13  override void HandlerAttached(Widget w)
14  {
15  super.HandlerAttached(w);
16  m_iCurrentIndex = m_aButtons.Count() - 1;
17  m_CurrentSelection = m_aButtons[m_iCurrentIndex];
18 
19  m_aButtons[m_iCurrentIndex].SetToggled(true, false, false);
20  }
21 
22 
23  protected override void ListenToSelectables(notnull array<Widget> aWidgets)
24  {
25  foreach (Widget w : aWidgets)
26  {
28  if (!comp)
29  return;
30  m_aButtons.Insert(comp);
31  comp.m_OnToggled.Insert(OnSorting);
32  //Print("attach listener");
33  }
34  }
35 
36  int GetSelectedIndex()
37  {
38  return m_iCurrentIndex;
39  }
40 
41  protected void OnSorting(SCR_ButtonImageComponent comp, bool isSelected)
42  {
43  int index = -1;
44  if (isSelected)
45  {
46  if (m_CurrentSelection)
47  m_CurrentSelection.SetToggled(false, true, false);
48  m_CurrentSelection = comp;
49  index = m_aButtons.Find(comp);
50  m_iCurrentIndex = index;
51  }
52  else
53  {
54  m_CurrentSelection.SetToggled(true, false, false);
55  return;
56  }
57 
58  m_OnSortingChange.Invoke(index);
59 
60  }
61 };
SCR_ContentBrowserSortingBar
Definition: SCR_ContentBrowserSortingBarComponent.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ServerFilterBarComponent
Definition: SCR_ServerFilterBarComponent.c:2
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_ButtonImageComponent
Definition: SCR_ButtonImageComponent.c:2
m_aButtons
protected ref array< ref SCR_BrowserTooltipButtonPresetData > m_aButtons
Definition: SCR_BrowserHoverTooltipComponent.c:9