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_ButtonTextComponent.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
2
class
SCR_ButtonTextComponent
:
SCR_ButtonBaseComponent
3
{
4
[
Attribute
(
"Text"
,
desc
:
"Text widget name within the button"
)]
5
protected
LocalizedString
m_sTextWidgetName
;
6
7
[
Attribute
()]
8
protected
LocalizedString
m_sText
;
9
10
[
Attribute
(
"0"
,
UIWidgets
.CheckBox)]
11
bool
m_bUseTextColorization
;
12
13
[
Attribute
(
UIColors
.GetColorAttribute(
UIColors
.NEUTRAL_INFORMATION),
UIWidgets
.ColorPicker)]
14
ref
Color
m_TextDefault
;
15
16
[
Attribute
(
UIColors
.GetColorAttribute(
UIColors
.CONTRAST_COLOR),
UIWidgets
.ColorPicker)]
17
ref
Color
m_TextToggled
;
18
19
protected
TextWidget
m_wText
;
20
21
protected
ref
ScriptInvokerVoid
m_OnMouseEnter
;
22
protected
ref
ScriptInvokerVoid
m_OnMouseLeave
;
23
24
//------------------------------------------------------------------------------------------------
25
override
void
HandlerAttached
(
Widget
w)
26
{
27
super.HandlerAttached(w);
28
m_wText
=
TextWidget
.Cast(w.FindAnyWidget(
m_sTextWidgetName
));
29
if
(
m_wText
)
30
m_wText
.SetText(
m_sText
);
31
}
32
33
//------------------------------------------------------------------------------------------------
34
override
void
SetToggled
(
bool
toggled,
bool
animate =
true
,
bool
invokeChange =
true
,
bool
instant =
false
)
35
{
36
if
(!m_bCanBeToggled)
37
return
;
38
39
super.SetToggled(toggled, animate, invokeChange, instant);
40
ColorizeText
(animate);
41
}
42
43
//------------------------------------------------------------------------------------------------
44
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
45
{
46
if
(
m_OnMouseEnter
)
47
m_OnMouseEnter
.Invoke();
48
49
return
super.OnMouseEnter(w, x, y);
50
}
51
52
//------------------------------------------------------------------------------------------------
53
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
54
{
55
if
(
m_OnMouseLeave
)
56
m_OnMouseLeave
.Invoke();
57
58
return
super.OnMouseLeave(w, enterW, x, y);
59
}
60
61
//------------------------------------------------------------------------------------------------
62
protected
void
ColorizeText
(
bool
animate =
true
)
63
{
64
if
(!
m_bUseTextColorization
|| !
m_wText
)
65
return
;
66
67
Color
color;
68
if
(
m_bIsToggled
&& m_bCanBeToggled)
69
color =
m_TextToggled
;
70
else
71
color =
m_TextDefault
;
72
73
if
(animate)
74
AnimateWidget
.
Color
(
m_wText
, color,
m_fAnimationRate
);
75
else
76
{
77
AnimateWidget
.
StopAnimation
(
m_wText
,
WidgetAnimationColor
);
78
m_wText
.SetColor(color);
79
}
80
}
81
82
//------------------------------------------------------------------------------------------------
83
void
SetText
(
string
text)
84
{
85
if
(
m_sText
== text)
86
return
;
87
88
m_sText
= text;
89
if
(
m_wText
)
90
m_wText
.SetText(text);
91
}
92
93
//------------------------------------------------------------------------------------------------
94
void
SetTextWithParam
(
string
text,
string
param1
,
string
param2
)
95
{
96
m_sText
= text;
97
if
(
m_wText
)
98
m_wText
.SetTextFormat(text,
param1
,
param2
);
99
}
100
101
//------------------------------------------------------------------------------------------------
102
string
GetText
()
103
{
104
return
m_sText
;
105
}
106
107
//------------------------------------------------------------------------------------------------
108
TextWidget
GetTextWidget
()
109
{
110
return
m_wText
;
111
}
112
113
//------------------------------------------------------------------------------------------------
114
ScriptInvokerVoid
GetOnMouseEnter
()
115
{
116
if
(!
m_OnMouseEnter
)
117
m_OnMouseEnter
=
new
ScriptInvokerVoid
();
118
119
return
m_OnMouseEnter
;
120
}
121
122
//------------------------------------------------------------------------------------------------
123
ScriptInvokerVoid
GetOnMouseLeave
()
124
{
125
if
(!
m_OnMouseLeave
)
126
m_OnMouseLeave
=
new
ScriptInvokerVoid
();
127
128
return
m_OnMouseLeave
;
129
}
130
131
//------------------------------------------------------------------------------------------------
132
static
SCR_ButtonTextComponent
GetButtonText
(
string
name,
Widget
parent,
bool
searchAllChildren =
true
)
133
{
134
auto
comp =
SCR_ButtonTextComponent
.Cast(
135
SCR_WLibComponentBase
.GetComponent(
SCR_ButtonTextComponent
, name, parent, searchAllChildren)
136
);
137
return
comp;
138
}
139
140
//------------------------------------------------------------------------------------------------
141
static
SCR_ButtonTextComponent
FindButtonTextComponent
(notnull
Widget
w)
142
{
143
return
SCR_ButtonTextComponent
.Cast(w.FindHandler(
SCR_ButtonTextComponent
));
144
}
145
};
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Definition
SCR_ScriptInvokerHelper.c:9
AnimateWidget
Definition
AnimateWidget.c:3
AnimateWidget::StopAnimation
static bool StopAnimation(Widget w, typename typeName)
Definition
AnimateWidget.c:26
AnimateWidget::Color
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition
AnimateWidget.c:200
Color
Definition
Color.c:13
LocalizedString
Definition
LocalizedString.c:22
SCR_ButtonBaseComponent
Base class for any button, regardless its own content.
Definition
SCR_ButtonBaseComponent.c:7
SCR_ButtonBaseComponent::m_bIsToggled
bool m_bIsToggled
Definition
SCR_ButtonBaseComponent.c:12
SCR_ButtonTextComponent
Definition
SCR_ButtonTextComponent.c:3
SCR_ButtonTextComponent::SetToggled
override void SetToggled(bool toggled, bool animate=true, bool invokeChange=true, bool instant=false)
Definition
SCR_ButtonTextComponent.c:34
SCR_ButtonTextComponent::ColorizeText
void ColorizeText(bool animate=true)
Definition
SCR_ButtonTextComponent.c:62
SCR_ButtonTextComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
SCR_ButtonTextComponent.c:53
SCR_ButtonTextComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_ButtonTextComponent.c:25
SCR_ButtonTextComponent::GetText
string GetText()
Definition
SCR_ButtonTextComponent.c:102
SCR_ButtonTextComponent::m_OnMouseLeave
ref ScriptInvokerVoid m_OnMouseLeave
Definition
SCR_ButtonTextComponent.c:22
SCR_ButtonTextComponent::m_sTextWidgetName
LocalizedString m_sTextWidgetName
Definition
SCR_ButtonTextComponent.c:5
SCR_ButtonTextComponent::SetTextWithParam
void SetTextWithParam(string text, string param1, string param2)
Definition
SCR_ButtonTextComponent.c:94
SCR_ButtonTextComponent::SetText
void SetText(string text)
Definition
SCR_ButtonTextComponent.c:83
SCR_ButtonTextComponent::m_sText
LocalizedString m_sText
Definition
SCR_ButtonTextComponent.c:8
SCR_ButtonTextComponent::GetOnMouseLeave
ScriptInvokerVoid GetOnMouseLeave()
Definition
SCR_ButtonTextComponent.c:123
SCR_ButtonTextComponent::GetButtonText
static SCR_ButtonTextComponent GetButtonText(string name, Widget parent, bool searchAllChildren=true)
Definition
SCR_ButtonTextComponent.c:132
SCR_ButtonTextComponent::m_TextToggled
ref Color m_TextToggled
Definition
SCR_ButtonTextComponent.c:17
SCR_ButtonTextComponent::m_wText
TextWidget m_wText
Definition
SCR_ButtonTextComponent.c:19
SCR_ButtonTextComponent::GetOnMouseEnter
ScriptInvokerVoid GetOnMouseEnter()
Definition
SCR_ButtonTextComponent.c:114
SCR_ButtonTextComponent::m_TextDefault
ref Color m_TextDefault
Definition
SCR_ButtonTextComponent.c:14
SCR_ButtonTextComponent::m_OnMouseEnter
ref ScriptInvokerVoid m_OnMouseEnter
Definition
SCR_ButtonTextComponent.c:21
SCR_ButtonTextComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
SCR_ButtonTextComponent.c:44
SCR_ButtonTextComponent::FindButtonTextComponent
static SCR_ButtonTextComponent FindButtonTextComponent(notnull Widget w)
Definition
SCR_ButtonTextComponent.c:141
SCR_ButtonTextComponent::GetTextWidget
TextWidget GetTextWidget()
Definition
SCR_ButtonTextComponent.c:108
SCR_ButtonTextComponent::m_bUseTextColorization
bool m_bUseTextColorization
Definition
SCR_ButtonTextComponent.c:11
SCR_WLibComponentBase
Base class for all final Reforger interactive elements.
Definition
SCR_WLibComponentBase.c:9
SCR_WLibComponentBase::m_fAnimationRate
float m_fAnimationRate
Definition
SCR_WLibComponentBase.c:28
TextWidget
Definition
TextWidget.c:16
UIColors
Definition
Constants.c:17
UIWidgets
Definition
attributes.c:40
WidgetAnimationColor
Definition
WidgetAnimations.c:249
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
param2
T2 param2
Definition
tuple.c:92
param1
Tuple param1
scripts
Game
UI
Components
WidgetLibrary
Button
SCR_ButtonTextComponent.c
Generated by
1.17.0