Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
HoverButtonComponent.c
Go to the documentation of this file.
1
// Base buttton that changes visuals on being hovered over, but no further functionality
2
3
//------------------------------------------------------------------------------------------------
4
5
class
HoverButtonComponent
:
ScriptedWidgetComponent
6
{
7
[
Attribute
(
"false"
,
UIWidgets
.CheckBox,
""
)]
8
protected
bool
m_bColorizeChildren
;
9
10
[
Attribute
(
"1 1 1 0"
,
UIWidgets
.ColorPicker,
""
)]
11
protected
ref
Color
m_ColorButtonDefault
;
12
13
[
Attribute
(
"1 1 1 1"
,
UIWidgets
.ColorPicker,
""
)]
14
protected
ref
Color
m_ColorButtonHovered
;
15
16
[
Attribute
(
"1 1 1 0"
,
UIWidgets
.ColorPicker,
""
)]
17
protected
ref
Color
m_ColorButtonDisabled
;
18
19
[
Attribute
(
"1 1 1 1"
,
UIWidgets
.ColorPicker,
""
)]
20
protected
ref
Color
m_ColorChildDefault
;
21
22
[
Attribute
(
"0 0 0 1"
,
UIWidgets
.ColorPicker,
""
)]
23
protected
ref
Color
m_ColorChildHovered
;
24
25
[
Attribute
(
"0.5 0.5 0.5 1"
,
UIWidgets
.ColorPicker,
""
)]
26
protected
ref
Color
m_ColorChildDisabled
;
27
28
[
Attribute
(
"0.2"
,
UIWidgets
.EditBox,
""
)]
29
protected
float
m_fAnimationLength
;
30
31
[
Attribute
(
SCR_SoundEvent
.CLICK,
UIWidgets
.EditBox,
""
)]
32
protected
string
m_sSoundClicked
;
33
34
[
Attribute
(
SCR_SoundEvent
.SOUND_FE_BUTTON_HOVER,
UIWidgets
.EditBox,
""
)]
35
protected
string
m_sSoundHovered
;
36
37
protected
Widget
m_wChild
;
38
39
40
//------------------------------------------------------------------------------------------------
41
override
void
HandlerAttached
(
Widget
w)
42
{
43
44
m_fAnimationLength
= 1 /
m_fAnimationLength
;
45
46
if
(!w.IsEnabled())
47
{
48
w.SetColor(
m_ColorButtonDisabled
);
49
if
(
m_wChild
)
50
w.SetColor(
m_ColorChildDisabled
);
51
}
52
else
53
{
54
w.SetColor(
m_ColorButtonDefault
);
55
if
(
m_wChild
)
56
{
57
AnimateWidget
.
Color
(
m_wChild
,
m_ColorChildDefault
,
m_fAnimationLength
);
58
}
59
}
60
}
61
62
//------------------------------------------------------------------------------------------------
63
override
bool
OnClick
(
Widget
w,
int
x,
int
y,
int
button)
64
{
65
SCR_UISoundEntity
.SoundEvent(
m_sSoundClicked
);
66
return
false
;
67
}
68
69
//------------------------------------------------------------------------------------------------
70
override
bool
OnMouseEnter
(
Widget
w,
int
x,
int
y)
71
{
72
SCR_UISoundEntity
.SoundEvent(
m_sSoundHovered
);
73
AnimateWidget
.
Color
(w,
m_ColorButtonHovered
,
m_fAnimationLength
);
74
if
(
m_bColorizeChildren
&&
m_wChild
)
75
AnimateWidget
.
Color
(
m_wChild
,
m_ColorChildHovered
,
m_fAnimationLength
);
76
77
return
false
;
78
}
79
80
//------------------------------------------------------------------------------------------------
81
override
bool
OnMouseLeave
(
Widget
w,
Widget
enterW,
int
x,
int
y)
82
{
83
AnimateWidget
.
Color
(w,
m_ColorButtonDefault
,
m_fAnimationLength
);
84
if
(
m_bColorizeChildren
&&
m_wChild
)
85
AnimateWidget
.
Color
(
m_wChild
,
m_ColorChildDefault
,
m_fAnimationLength
);
86
87
return
false
;
88
}
89
};
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
HoverButtonComponent
Definition
HoverButtonComponent.c:6
HoverButtonComponent::m_ColorButtonHovered
ref Color m_ColorButtonHovered
Definition
HoverButtonComponent.c:14
HoverButtonComponent::m_sSoundClicked
string m_sSoundClicked
Definition
HoverButtonComponent.c:32
HoverButtonComponent::m_wChild
Widget m_wChild
Definition
HoverButtonComponent.c:37
HoverButtonComponent::OnClick
override bool OnClick(Widget w, int x, int y, int button)
Definition
HoverButtonComponent.c:63
HoverButtonComponent::m_ColorChildHovered
ref Color m_ColorChildHovered
Definition
HoverButtonComponent.c:23
HoverButtonComponent::OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
Definition
HoverButtonComponent.c:70
HoverButtonComponent::m_ColorChildDefault
ref Color m_ColorChildDefault
Definition
HoverButtonComponent.c:20
HoverButtonComponent::m_fAnimationLength
float m_fAnimationLength
Definition
HoverButtonComponent.c:29
HoverButtonComponent::OnMouseLeave
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
Definition
HoverButtonComponent.c:81
HoverButtonComponent::m_ColorButtonDisabled
ref Color m_ColorButtonDisabled
Definition
HoverButtonComponent.c:17
HoverButtonComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
HoverButtonComponent.c:41
HoverButtonComponent::m_ColorChildDisabled
ref Color m_ColorChildDisabled
Definition
HoverButtonComponent.c:26
HoverButtonComponent::m_ColorButtonDefault
ref Color m_ColorButtonDefault
Definition
HoverButtonComponent.c:11
HoverButtonComponent::m_sSoundHovered
string m_sSoundHovered
Definition
HoverButtonComponent.c:35
HoverButtonComponent::m_bColorizeChildren
bool m_bColorizeChildren
Definition
HoverButtonComponent.c:8
SCR_SoundEvent
Definition
SCR_SoundEvent.c:2
SCR_UISoundEntity
Definition
SCR_UISoundEntity.c:8
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
Deprecated
HoverButtonComponent.c
Generated by
1.17.0