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_ColorizationComponent.c
Go to the documentation of this file.
1
class
SCR_ColorizationComponent
:
ScriptedWidgetComponent
2
{
3
[
Attribute
(
""
,
UIWidgets
.EditBox,
"Name of the widget to colorize. Leave empty for colorize root widget"
)]
4
string
m_sWidgetName;
5
6
[
Attribute
(
"0 0 0 1"
,
UIWidgets
.ColorPicker,
""
)]
7
ref
Color
m_ColorDefault;
8
9
[
Attribute
(
"true"
)]
10
bool
m_bSetHoverColor;
11
12
[
Attribute
(
"0 0 0 1"
,
UIWidgets
.ColorPicker,
""
)]
13
ref
Color
m_ColorHover;
14
15
[
Attribute
(
"true"
)]
16
bool
m_bSetFocusColor;
17
18
[
Attribute
(
"0 0 0 1"
,
UIWidgets
.ColorPicker,
""
)]
19
ref
Color
m_ColorFocus;
20
21
[
Attribute
(
"true"
)]
22
bool
m_bSetClickColor;
23
24
[
Attribute
(
"0 0 0 1"
,
UIWidgets
.ColorPicker,
""
)]
25
ref
Color
m_ColorClick;
26
27
[
Attribute
(
"true"
)]
28
bool
m_bAnimateWidgets;
29
30
[
Attribute
(
"0.2"
,
UIWidgets
.EditBox,
""
)]
31
protected
float
m_fAnimationLength
;
32
33
private
Widget
m_Widget;
34
private
float
m_wAnimationSpeed;
35
36
//------------------------------------------------------------------------------------------------
37
override
void
HandlerAttached(
Widget
w)
38
{
39
if
(m_sWidgetName !=
string
.Empty)
40
m_Widget = w.FindAnyWidget(m_sWidgetName);
41
else
42
m_Widget = w;
43
44
if
(
m_fAnimationLength
> 0)
45
m_wAnimationSpeed = 1 /
m_fAnimationLength
;
46
else
47
m_wAnimationSpeed = 1000;
// Instant animation
48
49
if
(m_Widget)
50
m_Widget.SetColor(m_ColorDefault);
51
}
52
53
//------------------------------------------------------------------------------------------------
54
override
bool
OnMouseButtonDown(
Widget
w,
int
x,
int
y,
int
button)
55
{
56
if
(!m_bSetClickColor)
57
return
false
;
58
59
Colorize(m_ColorClick);
60
return
false
;
61
}
62
63
//------------------------------------------------------------------------------------------------
64
override
bool
OnMouseButtonUp(Widget w,
int
x,
int
y,
int
button)
65
{
66
if
(!m_bSetClickColor)
67
return
false
;
68
69
if
(w ==
GetGame
().GetWorkspace().GetFocusedWidget())
70
Colorize(m_ColorFocus);
71
else
72
Colorize(m_ColorHover);
73
return
false
;
74
}
75
76
//------------------------------------------------------------------------------------------------
77
override
bool
OnFocus(Widget w,
int
x,
int
y)
78
{
79
if
(!m_bSetFocusColor)
80
return
false
;
81
82
Colorize(m_ColorFocus);
83
return
false
;
84
}
85
86
//------------------------------------------------------------------------------------------------
87
override
bool
OnFocusLost(Widget w,
int
x,
int
y)
88
{
89
if
(!m_bSetFocusColor)
90
return
false
;
91
92
if
(w == WidgetManager.GetWidgetUnderCursor())
93
Colorize(m_ColorHover);
94
else
95
Colorize(m_ColorDefault);
96
return
false
;
97
}
98
99
//------------------------------------------------------------------------------------------------
100
override
bool
OnMouseEnter(Widget w,
int
x,
int
y)
101
{
102
if
(!m_bSetHoverColor)
103
return
false
;
104
105
if
(w !=
GetGame
().GetWorkspace().GetFocusedWidget())
106
Colorize(m_ColorHover);
107
108
return
false
;
109
}
110
111
//------------------------------------------------------------------------------------------------
112
override
bool
OnMouseLeave(Widget w, Widget enterW,
int
x,
int
y)
113
{
114
if
(!m_bSetHoverColor)
115
return
false
;
116
117
if
(w !=
GetGame
().GetWorkspace().GetFocusedWidget())
118
Colorize(m_ColorDefault);
119
return
false
;
120
}
121
122
//------------------------------------------------------------------------------------------------
123
void
Colorize(Color color)
124
{
125
if
(!m_Widget)
126
return
;
127
128
if
(m_bAnimateWidgets)
129
AnimateWidget.Color(m_Widget, color, m_wAnimationSpeed);
130
else
131
m_Widget.SetColor(color);
132
}
133
};
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
Color
Definition
Color.c:13
SCR_ColorizationComponent
Definition
SCR_ColorizationComponent.c:2
SCR_ColorizationComponent::m_fAnimationLength
float m_fAnimationLength
Definition
SCR_ColorizationComponent.c:31
ScriptedWidgetComponent
Definition
ScriptedWidgetComponent.c:13
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Components
SCR_ColorizationComponent.c
Generated by
1.17.0