Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_ToolboxMultilineComponent.c
Go to the documentation of this file.
1
class
SCR_ToolboxMultilineComponent
:
SCR_ToolboxComponent
2
{
3
[
Attribute
(
"4"
)]
4
protected
int
m_iMaxItemsInRow
;
5
6
[
Attribute
(
"36"
)]
7
float
m_fElementHeight
;
8
9
//------------------------------------------------------------------------------------------------
10
override
void
HandlerAttached
(
Widget
w)
11
{
12
super.HandlerAttached(w);
13
m_iMaxItemsInRow
=
Math
.Max(
m_iMaxItemsInRow
, 1);
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
30
SCR_ButtonBaseComponent
comp =
SCR_ButtonBaseComponent
.Cast(button.FindHandler(
SCR_ButtonBaseComponent
));
31
if
(!comp)
32
continue
;
33
34
m_aSelectionElements
.Insert(comp);
35
36
comp.
ShowBorder
(
false
);
37
38
SCR_ButtonTextComponent
textComp =
SCR_ButtonTextComponent
.Cast(comp);
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
53
SetInitialState
();
54
}
55
56
//------------------------------------------------------------------------------------------------
57
protected
void
RemoveWidgets
()
58
{
59
foreach
(
SCR_ButtonBaseComponent
comp :
m_aSelectionElements
)
60
{
61
comp.GetRootWidget().RemoveFromHierarchy();
62
}
63
m_aSelectionElements
.Clear();
64
}
65
66
//------------------------------------------------------------------------------------------------
67
void
SetMaxItemsInRow
(
int
maxItems)
68
{
69
if
(
m_iMaxItemsInRow
== maxItems)
70
return
;
71
72
m_iMaxItemsInRow
= maxItems;
73
m_iMaxItemsInRow
=
Math
.Max(
m_iMaxItemsInRow
, 1);
74
RemoveWidgets
();
75
CreateWidgets
();
76
}
77
78
//------------------------------------------------------------------------------------------------
79
int
GetMaxItemsInRow
()
80
{
81
return
m_iMaxItemsInRow
;
82
}
83
84
//------------------------------------------------------------------------------------------------
85
SizeLayoutWidget
FindSizeWidget
(
Widget
root)
86
{
87
Widget
child = root.GetChildren();
88
while
(child)
89
{
90
SizeLayoutWidget
size
=
SizeLayoutWidget
.Cast(child);
91
if
(
size
)
92
return
size
;
93
child = child.GetChildren();
94
}
95
return
null;
96
}
97
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
size
int size
Definition
PrefabImporter.c:35
LayoutSlot
Definition
LayoutSlot.c:13
Math
Definition
Math.c:13
SCR_ButtonBaseComponent
Base class for any button, regardless its own content.
Definition
SCR_ButtonBaseComponent.c:7
SCR_ButtonBaseComponent::ShowBorder
void ShowBorder(bool show, bool animate=true)
Definition
SCR_ButtonBaseComponent.c:256
SCR_ButtonBaseComponent::m_OnClicked
ref ScriptInvoker m_OnClicked
Definition
SCR_ButtonBaseComponent.c:51
SCR_ButtonBaseComponent::m_OnToggled
ref ScriptInvoker m_OnToggled
Definition
SCR_ButtonBaseComponent.c:53
SCR_ButtonTextComponent
Definition
SCR_ButtonTextComponent.c:3
SCR_ButtonTextComponent::SetText
void SetText(string text)
Definition
SCR_ButtonTextComponent.c:83
SCR_ToolboxComponent
Definition
SCR_ToolboxComponent.c:3
SCR_ToolboxComponent::m_fElementSpacing
float m_fElementSpacing
Definition
SCR_ToolboxComponent.c:13
SCR_ToolboxComponent::OnElementClicked
void OnElementClicked(SCR_ButtonBaseComponent comp)
Definition
SCR_ToolboxComponent.c:155
SCR_ToolboxComponent::m_aSelectionElements
ref array< SCR_ButtonBaseComponent > m_aSelectionElements
Definition
SCR_ToolboxComponent.c:18
SCR_ToolboxComponent::SetInitialState
void SetInitialState()
Definition
SCR_ToolboxComponent.c:127
SCR_ToolboxComponent::m_wButtonRow
Widget m_wButtonRow
Definition
SCR_ToolboxComponent.c:4
SCR_ToolboxComponent::OnElementChanged
void OnElementChanged(SCR_ButtonBaseComponent comp, bool state)
Definition
SCR_ToolboxComponent.c:177
SCR_ToolboxComponent::m_ElementLayout
ResourceName m_ElementLayout
Definition
SCR_ToolboxComponent.c:10
SCR_ToolboxMultilineComponent
Definition
SCR_ToolboxMultilineComponent.c:2
SCR_ToolboxMultilineComponent::SetMaxItemsInRow
void SetMaxItemsInRow(int maxItems)
Definition
SCR_ToolboxMultilineComponent.c:67
SCR_ToolboxMultilineComponent::m_iMaxItemsInRow
int m_iMaxItemsInRow
Definition
SCR_ToolboxMultilineComponent.c:4
SCR_ToolboxMultilineComponent::FindSizeWidget
SizeLayoutWidget FindSizeWidget(Widget root)
Definition
SCR_ToolboxMultilineComponent.c:85
SCR_ToolboxMultilineComponent::m_fElementHeight
float m_fElementHeight
Definition
SCR_ToolboxMultilineComponent.c:7
SCR_ToolboxMultilineComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ToolboxMultilineComponent.c:10
SCR_ToolboxMultilineComponent::CreateWidgets
void CreateWidgets()
Definition
SCR_ToolboxMultilineComponent.c:17
SCR_ToolboxMultilineComponent::RemoveWidgets
void RemoveWidgets()
Definition
SCR_ToolboxMultilineComponent.c:57
SCR_ToolboxMultilineComponent::GetMaxItemsInRow
int GetMaxItemsInRow()
Definition
SCR_ToolboxMultilineComponent.c:79
SizeLayoutWidget
Definition
SizeLayoutWidget.c:16
UniformGridSlot
Definition
UniformGridSlot.c:13
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
WidgetLibrary
SCR_Toolbox
SCR_ToolboxMultilineComponent.c
Generated by
1.17.0