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_SelectionMenuEntryComponent.c
Go to the documentation of this file.
1
5
//------------------------------------------------------------------------------------------------
6
class
SCR_SelectionMenuEntryComponent
:
SCR_ScriptedWidgetComponent
7
{
8
[
Attribute
(
"0.4"
)]
9
protected
float
m_fDisabledOpacity
;
10
11
[
Attribute
(
"Size"
)]
12
protected
string
m_sSizeLayout
;
13
14
[
Attribute
(
"EntryText"
)]
15
protected
string
m_sEntryText
;
16
17
protected
SCR_SelectionMenuEntry
m_Entry
;
18
19
protected
bool
m_bEnabled
=
true
;
20
protected
float
m_fOriginalSize
;
21
protected
float
m_fAdjustedSize
;
22
23
protected
Widget
m_wSizeLayout
;
24
protected
TextWidget
m_wEntryText
;
25
26
// Invokers
27
protected
ref
ScriptInvoker<SCR_SelectionMenuEntryComponent>
m_OnMouseEnter
;
28
protected
ref
ScriptInvoker<SCR_SelectionMenuEntryComponent>
m_OnMouseLeave
;
29
30
//------------------------------------------------------------------------------------------------
31
protected
void
InvokeOnMouseEnter
()
32
{
33
if
(
m_OnMouseEnter
)
34
m_OnMouseEnter
.Invoke(
this
);
35
}
36
37
//------------------------------------------------------------------------------------------------
38
ScriptInvoker
GetOnMouseEnter
()
39
{
40
if
(!
m_OnMouseEnter
)
41
m_OnMouseEnter
=
new
ScriptInvoker
();
42
43
return
m_OnMouseEnter
;
44
}
45
46
//------------------------------------------------------------------------------------------------
47
protected
void
InvokeOnMouseLeave
()
48
{
49
if
(
m_OnMouseLeave
)
50
m_OnMouseLeave
.Invoke(
this
);
51
}
52
53
//------------------------------------------------------------------------------------------------
54
ScriptInvoker
GetOnMouseLeave
()
55
{
56
if
(!
m_OnMouseLeave
)
57
m_OnMouseLeave
=
new
ScriptInvoker
();
58
59
return
m_OnMouseLeave
;
60
}
61
62
//------------------------------------------------------------------------------------------------
63
protected
void
InvokeOnClick
()
64
{
65
if
(
m_OnClick
)
66
m_OnClick
.Invoke(
this
);
67
}
68
69
//------------------------------------------------------------------------------------------------
70
ScriptInvoker
GetOnClick
()
71
{
72
if
(!
m_OnClick
)
73
m_OnClick
=
new
ScriptInvoker
();
74
75
return
m_OnClick
;
76
}
77
78
//------------------------------------------------------------------------------------------------
79
// Override
80
//------------------------------------------------------------------------------------------------
81
82
//------------------------------------------------------------------------------------------------
83
override
void
HandlerAttached
(
Widget
w)
84
{
85
super.HandlerAttached(w);
86
87
SetEnabled
(
m_bEnabled
);
88
89
m_wSizeLayout
=
m_wRoot
.FindAnyWidget(
m_sSizeLayout
);
90
m_wEntryText
=
TextWidget
.Cast(
m_wRoot
.FindAnyWidget(
m_sEntryText
));
91
m_fOriginalSize
=
GetLayoutSize
();
92
m_fAdjustedSize
=
m_fOriginalSize
;
93
94
// Set anchor to allow for size/pos override
95
if
(
m_wSizeLayout
)
96
FrameSlot
.SetAnchor(
m_wSizeLayout
, 0.5, 0.5);
97
}
98
99
//------------------------------------------------------------------------------------------------
100
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
101
{
102
InvokeOnMouseEnter
();
103
return
false
;
104
}
105
106
//------------------------------------------------------------------------------------------------
107
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
108
{
109
InvokeOnMouseLeave
();
110
return
false
;
111
}
112
113
//------------------------------------------------------------------------------------------------
114
override
bool
OnClick
(
Widget
w,
int
x,
int
y,
int
button)
115
{
116
if
(button == 0)
117
InvokeOnClick
();
118
119
return
false
;
120
}
121
122
//------------------------------------------------------------------------------------------------
123
// Custom
124
//------------------------------------------------------------------------------------------------
125
126
//------------------------------------------------------------------------------------------------
127
void
SetEnabled
(
bool
enabled)
128
{
129
m_bEnabled
= enabled;
130
131
if
(!
m_wRoot
)
132
return
;
133
134
// Set visuals
135
if
(
m_bEnabled
)
136
m_wRoot
.SetOpacity(1);
137
else
138
m_wRoot
.SetOpacity(
m_fDisabledOpacity
);
139
}
140
141
//------------------------------------------------------------------------------------------------
142
float
GetLayoutSize
()
143
{
144
if
(!
m_wSizeLayout
)
145
return
-1;
146
147
return
FrameSlot
.GetSize(
m_wSizeLayout
)[0];
148
}
149
150
//------------------------------------------------------------------------------------------------
152
void
SetEntry
(
SCR_SelectionMenuEntry
entry)
153
{
154
m_Entry
= entry;
155
}
156
157
//------------------------------------------------------------------------------------------------
158
void
SetEntryText
(
string
str)
159
{
160
if
(!
m_wEntryText
)
161
{
162
Print
(
"Entry text widget was not found!"
,
LogLevel
.ERROR);
163
return
;
164
}
165
166
m_wEntryText
.SetVisible(!str.IsEmpty());
167
m_wEntryText
.SetText(str);
168
}
169
170
//------------------------------------------------------------------------------------------------
171
float
GetOriginalSize
()
172
{
173
return
m_fOriginalSize
;
174
}
175
176
//------------------------------------------------------------------------------------------------
177
float
GetAdjustedSize
()
178
{
179
return
m_fAdjustedSize
;
180
}
181
}
FrameSlot
Definition
FrameSlot.c:13
SCR_ScriptedWidgetComponent
Definition
SCR_ScriptedWidgetComponent.c:8
SCR_ScriptedWidgetComponent::m_OnClick
ref ScriptInvoker m_OnClick
Definition
SCR_ScriptedWidgetComponent.c:12
SCR_ScriptedWidgetComponent::m_wRoot
Widget m_wRoot
Definition
SCR_ScriptedWidgetComponent.c:9
SCR_SelectionMenuEntryComponent
Definition
SCR_SelectionMenuEntryComponent.c:7
SCR_SelectionMenuEntryComponent::m_Entry
SCR_SelectionMenuEntry m_Entry
Definition
SCR_SelectionMenuEntryComponent.c:17
SCR_SelectionMenuEntryComponent::InvokeOnMouseLeave
void InvokeOnMouseLeave()
Definition
SCR_SelectionMenuEntryComponent.c:47
SCR_SelectionMenuEntryComponent::m_fOriginalSize
float m_fOriginalSize
Definition
SCR_SelectionMenuEntryComponent.c:20
SCR_SelectionMenuEntryComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_SelectionMenuEntryComponent.c:107
SCR_SelectionMenuEntryComponent::m_fAdjustedSize
float m_fAdjustedSize
Definition
SCR_SelectionMenuEntryComponent.c:21
SCR_SelectionMenuEntryComponent::m_sEntryText
string m_sEntryText
Definition
SCR_SelectionMenuEntryComponent.c:15
SCR_SelectionMenuEntryComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_SelectionMenuEntryComponent.c:100
SCR_SelectionMenuEntryComponent::m_fDisabledOpacity
float m_fDisabledOpacity
Definition
SCR_SelectionMenuEntryComponent.c:9
SCR_SelectionMenuEntryComponent::GetLayoutSize
float GetLayoutSize()
Definition
SCR_SelectionMenuEntryComponent.c:142
SCR_SelectionMenuEntryComponent::m_OnMouseLeave
ref ScriptInvoker< SCR_SelectionMenuEntryComponent > m_OnMouseLeave
Definition
SCR_SelectionMenuEntryComponent.c:28
SCR_SelectionMenuEntryComponent::GetAdjustedSize
float GetAdjustedSize()
Definition
SCR_SelectionMenuEntryComponent.c:177
SCR_SelectionMenuEntryComponent::m_wEntryText
TextWidget m_wEntryText
Definition
SCR_SelectionMenuEntryComponent.c:24
SCR_SelectionMenuEntryComponent::SetEntry
void SetEntry(SCR_SelectionMenuEntry entry)
Set entry holding data driving this visuals.
Definition
SCR_SelectionMenuEntryComponent.c:152
SCR_SelectionMenuEntryComponent::m_sSizeLayout
string m_sSizeLayout
Definition
SCR_SelectionMenuEntryComponent.c:12
SCR_SelectionMenuEntryComponent::InvokeOnMouseEnter
void InvokeOnMouseEnter()
Definition
SCR_SelectionMenuEntryComponent.c:31
SCR_SelectionMenuEntryComponent::SetEnabled
void SetEnabled(bool enabled)
Definition
SCR_SelectionMenuEntryComponent.c:127
SCR_SelectionMenuEntryComponent::SetEntryText
void SetEntryText(string str)
Definition
SCR_SelectionMenuEntryComponent.c:158
SCR_SelectionMenuEntryComponent::GetOriginalSize
float GetOriginalSize()
Definition
SCR_SelectionMenuEntryComponent.c:171
SCR_SelectionMenuEntryComponent::GetOnClick
ScriptInvoker GetOnClick()
Definition
SCR_SelectionMenuEntryComponent.c:70
SCR_SelectionMenuEntryComponent::GetOnMouseEnter
ScriptInvoker GetOnMouseEnter()
Definition
SCR_SelectionMenuEntryComponent.c:38
SCR_SelectionMenuEntryComponent::m_wSizeLayout
Widget m_wSizeLayout
Definition
SCR_SelectionMenuEntryComponent.c:23
SCR_SelectionMenuEntryComponent::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
SCR_SelectionMenuEntryComponent.c:114
SCR_SelectionMenuEntryComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_SelectionMenuEntryComponent.c:83
SCR_SelectionMenuEntryComponent::GetOnMouseLeave
ScriptInvoker GetOnMouseLeave()
Definition
SCR_SelectionMenuEntryComponent.c:54
SCR_SelectionMenuEntryComponent::m_bEnabled
bool m_bEnabled
Definition
SCR_SelectionMenuEntryComponent.c:19
SCR_SelectionMenuEntryComponent::m_OnMouseEnter
ref ScriptInvoker< SCR_SelectionMenuEntryComponent > m_OnMouseEnter
Definition
SCR_SelectionMenuEntryComponent.c:27
SCR_SelectionMenuEntryComponent::InvokeOnClick
void InvokeOnClick()
Definition
SCR_SelectionMenuEntryComponent.c:63
SCR_SelectionMenuEntry
Definition
SCR_SelectionMenuEntry.c:8
TextWidget
Definition
TextWidget.c:16
Widget
Definition
Widget.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ScriptInvoker
ScriptInvokerBase< func > ScriptInvoker
Definition
tools.c:134
scripts
Game
UI
HUD
SelectionMenu
SCR_SelectionMenuEntryComponent.c
Generated by
1.17.0