Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ToolboxMultilineComponent.c
Go to the documentation of this file.
2{
3 [Attribute("4")]
4 protected int m_iMaxItemsInRow;
5
6 [Attribute("36")]
8
9 //------------------------------------------------------------------------------------------------
10 override void HandlerAttached(Widget w)
11 {
12 super.HandlerAttached(w);
14 }
15
16 //------------------------------------------------------------------------------------------------
17 override protected void CreateWidgets()
18 {
19 float padding = m_fElementSpacing * 0.5;
20 LayoutSlot.SetPadding(m_wButtonRow, -padding, -padding, -padding, -padding);
21 foreach (int i, string name : m_aElementNames)
22 {
23 Widget button = GetGame().GetWorkspace().CreateWidgets(m_ElementLayout, m_wButtonRow);
24
25 int row = Math.Floor(i / m_iMaxItemsInRow);
26 int column = i % m_iMaxItemsInRow;
27 UniformGridSlot.SetRow(button, row);
28 UniformGridSlot.SetColumn(button, column);
29
31 if (!comp)
32 continue;
33
34 m_aSelectionElements.Insert(comp);
35
36 comp.ShowBorder(false);
37
39 if (textComp)
40 textComp.SetText(name);
41
42 comp.m_OnClicked.Insert(OnElementClicked);
43 comp.m_OnToggled.Insert(OnElementChanged);
44
45 SizeLayoutWidget size = SizeLayoutWidget.Cast(comp.GetRootWidget().GetChildren());
46 if (!size)
47 return;
48
49 size.EnableHeightOverride(m_fElementHeight > 0);
50 size.SetHeightOverride(m_fElementHeight);
51 }
52
54 }
55
56 //------------------------------------------------------------------------------------------------
57 protected void RemoveWidgets()
58 {
60 {
61 comp.GetRootWidget().RemoveFromHierarchy();
62 }
64 }
65
66 //------------------------------------------------------------------------------------------------
67 void SetMaxItemsInRow(int maxItems)
68 {
69 if (m_iMaxItemsInRow == maxItems)
70 return;
71
72 m_iMaxItemsInRow = maxItems;
76 }
77
78 //------------------------------------------------------------------------------------------------
80 {
81 return m_iMaxItemsInRow;
82 }
83
84 //------------------------------------------------------------------------------------------------
86 {
87 Widget child = root.GetChildren();
88 while (child)
89 {
91 if (size)
92 return size;
93 child = child.GetChildren();
94 }
95 return null;
96 }
97};
ArmaReforgerScripted GetGame()
Definition game.c:1398
int size
Definition Math.c:13
Base class for any button, regardless its own content.
void ShowBorder(bool show, bool animate=true)
void OnElementClicked(SCR_ButtonBaseComponent comp)
ref array< SCR_ButtonBaseComponent > m_aSelectionElements
void OnElementChanged(SCR_ButtonBaseComponent comp, bool state)
SizeLayoutWidget FindSizeWidget(Widget root)
SCR_FieldOfViewSettings Attribute