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_ButtonSplitComponent.c
Go to the documentation of this file.
1
3
4
//------------------------------------------------------------------------------------------------
5
class
SCR_ButtonSplitComponent
:
SCR_ButtonComponent
6
{
7
protected
ref array<ref Widget>
m_aWidgetCells
=
new
array<ref Widget>();
8
protected
ref array<bool>
m_aPreventContentChange
=
new
array<bool>;
9
10
protected
ref array<SCR_ButtonComponent>
m_aInnerButtons
=
new
array<SCR_ButtonComponent>;
11
12
protected
Color
m_cColorContent
;
13
14
protected
ref
Widget
m_wHoverWidget
;
15
16
[
Attribute
(defvalue:
"0"
)]
17
protected
int
m_iButtonPaddingLeft
;
18
[
Attribute
(defvalue:
"0"
)]
19
protected
int
m_iButtonPaddingTop
;
20
[
Attribute
(defvalue:
"0"
)]
21
protected
int
m_iButtonPaddingRigh
;
22
[
Attribute
(defvalue:
"0"
)]
23
protected
int
m_iButtonPaddingBottom
;
24
25
protected
bool
m_bColorizeFocusLost
=
true
;
26
27
//------------------------------------------------------------------------------------------------
28
void
SetColorizeFocusLost
(
bool
colorize) {
m_bColorizeFocusLost
= colorize; }
29
30
//------------------------------------------------------------------------------------------------
31
override
protected
void
HandlerAttached
(
Widget
w)
32
{
33
super.HandlerAttached(w);
34
HorizontalLayoutSlot
.SetPadding(
m_wOverlay
,
m_iButtonPaddingLeft
,
m_iButtonPaddingTop
,
m_iButtonPaddingRigh
,
m_iButtonPaddingBottom
);
35
m_cColorContent
=
COLOR_CONTENT_DEFAULT
;
36
}
37
38
//------------------------------------------------------------------------------------------------
39
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
40
{
41
if
(!
m_bColorizeFocusLost
)
42
return
false
;
43
44
super.OnMouseEnter(w, x, y);
45
m_wHoverWidget
= w;
46
47
return
false
;
48
}
49
50
//------------------------------------------------------------------------------------------------
51
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
52
{
53
super.OnMouseLeave(w, enterW, x, y);
54
55
if
(!
m_bColorizeFocusLost
)
56
{
57
m_OnHoverLeave
.Invoke();
58
return
false
;
59
}
60
61
return
false
;
62
}
63
64
//------------------------------------------------------------------------------------------------
65
override
protected
void
ColorizeWidgets
(
Color
colorBackground,
Color
colorContent,
float
speed = -1)
66
{
67
if
(speed < 0)
68
speed =
m_fAnimationRate
;
69
70
m_cColorContent
= colorContent;
71
ColorizeCellPart
(
"Background"
, colorBackground, speed,
false
);
72
ColorizeCellPart
(
"Content"
,
m_cColorContent
, speed,
true
);
73
}
74
75
//------------------------------------------------------------------------------------------------
76
void
InsertWidgetCells
(array<string> cellNames)
77
{
78
Widget
w;
79
foreach
(
string
cellName : cellNames)
80
{
81
w =
m_wRoot
.FindAnyWidget(cellName);
82
if
(w)
83
{
84
m_aWidgetCells
.Insert(w);
85
m_aPreventContentChange
.Insert(
false
);
86
}
87
}
88
}
89
90
//------------------------------------------------------------------------------------------------
92
void
SetupInnerButton
(
string
widgetName)
93
{
94
Widget
w =
m_wRoot
.FindAnyWidget(widgetName);
95
if
(!w)
96
return
;
97
98
// Has this cell a button?
99
SCR_ButtonComponent
button =
SCR_ButtonComponent
.Cast(w.FindHandler(
SCR_ButtonComponent
));
100
if
(!button)
101
return
;
102
103
// Insert on click to focus root
104
button.m_OnFocus.Insert(
OnInnerButtonFocus
);
105
}
106
107
//------------------------------------------------------------------------------------------------
109
protected
void
OnInnerButtonFocus
(
Widget
w)
110
{
111
if
(!
m_wHoverWidget
)
112
return
;
113
GetGame
().GetWorkspace().SetFocusedWidget(
m_wHoverWidget
);
114
115
if
(!
m_wRoot
)
116
return
;
117
GetGame
().GetWorkspace().SetFocusedWidget(
m_wRoot
);
118
}
119
120
//------------------------------------------------------------------------------------------------
122
protected
void
ColorizeCellPart
(
string
partName,
Color
c,
float
speed,
float
prevent)
123
{
124
for
(
int
i = 0; i <
m_aWidgetCells
.Count(); i++)
125
{
126
if
(i >
m_aPreventContentChange
.Count())
127
break
;
128
129
if
(prevent &&
m_aPreventContentChange
[i])
130
{
131
continue
;
132
}
133
134
Widget
w =
m_aWidgetCells
[i];
135
Widget
wPart = null;
136
string
name = w.GetName();
137
if
(!w)
138
continue
;
139
140
wPart = w.FindAnyWidget(partName);
141
142
if
(!wPart)
143
wPart = w.FindAnyWidget(
"Overlay"
);
144
145
if
(wPart)
146
AnimateWidget
.
Color
(wPart, c, speed);
147
}
148
}
149
150
//------------------------------------------------------------------------------------------------
152
void
ColorizeCellPart
(
string
partName,
Color
c,
float
speed,
float
prevent,
int
id
)
153
{
154
if
(prevent)
155
return
;
156
157
Widget
w =
m_aWidgetCells
[
id
];
158
Widget
wPart = null;
159
160
if
(w)
161
wPart = w.FindAnyWidget(partName);
162
163
if
(!wPart)
164
wPart = w.FindAnyWidget(
"Overlay"
);
165
166
if
(wPart)
167
AnimateWidget
.
Color
(wPart, c, speed);
168
}
169
170
//------------------------------------------------------------------------------------------------
171
void
PreventContentColoringOn
(
int
iCellId,
bool
bPrevent)
172
{
173
m_aPreventContentChange
[iCellId] = bPrevent;
174
}
175
176
//------------------------------------------------------------------------------------------------
177
Color
GetColorContent
()
178
{
179
return
Color
.FromInt(
m_cColorContent
.PackToInt());
180
}
181
};
id
AddonBuildInfoTool id
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
m_wRoot
Widget m_wRoot
Definition
SCR_GameModeCleanSweep.c:25
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::Color
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition
AnimateWidget.c:200
Color
Definition
Color.c:13
HorizontalLayoutSlot
Definition
HorizontalLayoutSlot.c:13
SCR_ButtonComponent
Deprecated button component. Still used in many prefabs, so it works, it's just stripped of most of t...
Definition
SCR_ButtonComponent.c:5
SCR_ButtonComponent::m_OnHoverLeave
ref ScriptInvoker< Widget > m_OnHoverLeave
Definition
SCR_ButtonComponent.c:24
SCR_ButtonComponent::m_wOverlay
Widget m_wOverlay
Definition
SCR_ButtonComponent.c:9
SCR_ButtonComponent::COLOR_CONTENT_DEFAULT
ref Color COLOR_CONTENT_DEFAULT
Definition
SCR_ButtonComponent.c:17
SCR_ButtonSplitComponent
Definition
SCR_ButtonSplitComponent.c:6
SCR_ButtonSplitComponent::m_cColorContent
Color m_cColorContent
Definition
SCR_ButtonSplitComponent.c:12
SCR_ButtonSplitComponent::m_aPreventContentChange
ref array< bool > m_aPreventContentChange
Definition
SCR_ButtonSplitComponent.c:8
SCR_ButtonSplitComponent::m_iButtonPaddingRigh
int m_iButtonPaddingRigh
Definition
SCR_ButtonSplitComponent.c:21
SCR_ButtonSplitComponent::ColorizeCellPart
void ColorizeCellPart(string partName, Color c, float speed, float prevent, int id)
Set color of one specific cell.
Definition
SCR_ButtonSplitComponent.c:152
SCR_ButtonSplitComponent::m_aWidgetCells
ref array< ref Widget > m_aWidgetCells
Definition
SCR_ButtonSplitComponent.c:7
SCR_ButtonSplitComponent::HandlerAttached
void HandlerAttached(Widget w)
Definition
SCR_ButtonSplitComponent.c:31
SCR_ButtonSplitComponent::ColorizeCellPart
void ColorizeCellPart(string partName, Color c, float speed, float prevent)
Set color of every cell.
Definition
SCR_ButtonSplitComponent.c:122
SCR_ButtonSplitComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_ButtonSplitComponent.c:39
SCR_ButtonSplitComponent::GetColorContent
Color GetColorContent()
Definition
SCR_ButtonSplitComponent.c:177
SCR_ButtonSplitComponent::ColorizeWidgets
void ColorizeWidgets(Color colorBackground, Color colorContent, float speed=-1)
Definition
SCR_ButtonSplitComponent.c:65
SCR_ButtonSplitComponent::InsertWidgetCells
void InsertWidgetCells(array< string > cellNames)
Definition
SCR_ButtonSplitComponent.c:76
SCR_ButtonSplitComponent::m_bColorizeFocusLost
bool m_bColorizeFocusLost
Definition
SCR_ButtonSplitComponent.c:25
SCR_ButtonSplitComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_ButtonSplitComponent.c:51
SCR_ButtonSplitComponent::OnInnerButtonFocus
void OnInnerButtonFocus(Widget w)
Focus button root.
Definition
SCR_ButtonSplitComponent.c:109
SCR_ButtonSplitComponent::m_iButtonPaddingLeft
int m_iButtonPaddingLeft
Definition
SCR_ButtonSplitComponent.c:17
SCR_ButtonSplitComponent::m_aInnerButtons
ref array< SCR_ButtonComponent > m_aInnerButtons
Definition
SCR_ButtonSplitComponent.c:10
SCR_ButtonSplitComponent::PreventContentColoringOn
void PreventContentColoringOn(int iCellId, bool bPrevent)
Definition
SCR_ButtonSplitComponent.c:171
SCR_ButtonSplitComponent::SetColorizeFocusLost
void SetColorizeFocusLost(bool colorize)
Definition
SCR_ButtonSplitComponent.c:28
SCR_ButtonSplitComponent::m_iButtonPaddingBottom
int m_iButtonPaddingBottom
Definition
SCR_ButtonSplitComponent.c:23
SCR_ButtonSplitComponent::m_iButtonPaddingTop
int m_iButtonPaddingTop
Definition
SCR_ButtonSplitComponent.c:19
SCR_ButtonSplitComponent::m_wHoverWidget
ref Widget m_wHoverWidget
Definition
SCR_ButtonSplitComponent.c:14
SCR_ButtonSplitComponent::SetupInnerButton
void SetupInnerButton(string widgetName)
Find and setup focusing on root for every inner widget.
Definition
SCR_ButtonSplitComponent.c:92
SCR_WLibComponentBase::m_fAnimationRate
float m_fAnimationRate
Definition
SCR_WLibComponentBase.c:28
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
WidgetLibrary
SCR_ButtonSplitComponent.c
Generated by
1.17.0