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_AutomaticScrollComponent.c
Go to the documentation of this file.
1
class
SCR_AutomaticScrollComponent
:
SCR_ScriptedWidgetComponent
2
{
3
[
Attribute
(
"Content"
,
UIWidgets
.EditBox,
"Name of widget which will be animated"
)]
4
protected
string
m_sWidgetContentName
;
5
6
[
Attribute
(
"HorizontalContent"
,
UIWidgets
.EditBox,
"Name of widget which will be animated"
)]
7
protected
string
m_sWidgetHorizontalName
;
8
9
[
Attribute
(
"false"
,
UIWidgets
.CheckBox,
"When true, content will animate only when focused. When false, animate all the time"
)]
10
protected
bool
m_bAnimateOnFocus
;
11
12
[
Attribute
(
"false"
,
UIWidgets
.CheckBox,
"When true, content will animate only when focused. When false, animate all the time"
)]
13
protected
bool
m_bAnimateVertically
;
14
15
protected
bool
m_bIsInit
;
16
17
protected
Widget
m_ContentFrame
;
18
protected
Widget
m_ContentHorizontal
;
19
protected
SCR_HorizontalScrollAnimationComponent
m_ScrollComponent
;
20
21
//------------------------------------------------------------------------------------------------
22
protected
void
ResetScrolling
()
23
{
24
m_ScrollComponent
.AnimationStop();
25
m_ScrollComponent
.ResetPosition();
26
}
27
28
//------------------------------------------------------------------------------------------------
29
// Need to wait two frames for everything to init correctly
30
protected
void
UpdateScrollFrameSkip
()
31
{
32
GetGame
().GetCallqueue().Call(
StartScrolling
);
33
}
34
35
//------------------------------------------------------------------------------------------------
36
protected
void
StartScrolling
()
37
{
38
ResetScrolling
();
39
40
float
frameX, frameY, textX, textY;
41
m_ContentHorizontal
.GetScreenSize(frameX, frameY);
42
m_ContentFrame
.GetScreenSize(textX, textY);
43
44
bool
move;
45
if
(
m_bAnimateVertically
)
46
move = textY > frameY;
47
else
48
move = textX > frameX;
49
50
// Animation
51
if
(move)
52
m_ScrollComponent
.AnimationStart(
m_bAnimateVertically
);
53
}
54
55
//------------------------------------------------------------------------------------------------
56
override
bool
OnFocus
(
Widget
w,
int
x,
int
y)
57
{
58
if
(
m_bAnimateOnFocus
&&
m_bIsInit
)
59
StartScrolling
();
60
61
return
super.OnFocus(w, x, y);
62
}
63
64
//------------------------------------------------------------------------------------------------
65
override
bool
OnFocusLost
(
Widget
w,
int
x,
int
y)
66
{
67
if
(
m_bAnimateOnFocus
&&
m_bIsInit
)
68
ResetScrolling
();
69
70
return
super.OnFocusLost(w, x, y);
71
}
72
73
//------------------------------------------------------------------------------------------------
74
override
void
HandlerAttached
(
Widget
w)
75
{
76
super.HandlerAttached(w);
77
78
m_ContentHorizontal
= w.FindAnyWidget(
m_sWidgetHorizontalName
);
79
if
(!
m_ContentHorizontal
)
80
return
;
81
82
m_ContentFrame
= w.FindAnyWidget(
m_sWidgetContentName
);
83
m_ScrollComponent
= SCR_HorizontalScrollAnimationComponent.Cast(
m_ContentHorizontal
.FindHandler(SCR_HorizontalScrollAnimationComponent));
84
85
if
(!
m_ScrollComponent
|| !
m_ContentFrame
)
86
return
;
87
88
m_bIsInit
=
true
;
89
90
ResetScrolling
();
91
92
if
(!
m_bAnimateOnFocus
)
93
GetGame
().GetCallqueue().Call(
UpdateScrollFrameSkip
);
94
}
95
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
SCR_AutomaticScrollComponent
Definition
SCR_AutomaticScrollComponent.c:2
SCR_AutomaticScrollComponent::m_ScrollComponent
SCR_HorizontalScrollAnimationComponent m_ScrollComponent
Definition
SCR_AutomaticScrollComponent.c:19
SCR_AutomaticScrollComponent::StartScrolling
void StartScrolling()
Definition
SCR_AutomaticScrollComponent.c:36
SCR_AutomaticScrollComponent::HandlerAttached
override void HandlerAttached(Widget w)
Definition
SCR_AutomaticScrollComponent.c:74
SCR_AutomaticScrollComponent::m_ContentFrame
Widget m_ContentFrame
Definition
SCR_AutomaticScrollComponent.c:17
SCR_AutomaticScrollComponent::m_ContentHorizontal
Widget m_ContentHorizontal
Definition
SCR_AutomaticScrollComponent.c:18
SCR_AutomaticScrollComponent::m_sWidgetHorizontalName
string m_sWidgetHorizontalName
Definition
SCR_AutomaticScrollComponent.c:7
SCR_AutomaticScrollComponent::m_bIsInit
bool m_bIsInit
Definition
SCR_AutomaticScrollComponent.c:15
SCR_AutomaticScrollComponent::m_bAnimateVertically
bool m_bAnimateVertically
Definition
SCR_AutomaticScrollComponent.c:13
SCR_AutomaticScrollComponent::m_bAnimateOnFocus
bool m_bAnimateOnFocus
Definition
SCR_AutomaticScrollComponent.c:10
SCR_AutomaticScrollComponent::OnFocusLost
override bool OnFocusLost(Widget w, int x, int y)
Definition
SCR_AutomaticScrollComponent.c:65
SCR_AutomaticScrollComponent::m_sWidgetContentName
string m_sWidgetContentName
Definition
SCR_AutomaticScrollComponent.c:4
SCR_AutomaticScrollComponent::ResetScrolling
void ResetScrolling()
Definition
SCR_AutomaticScrollComponent.c:22
SCR_AutomaticScrollComponent::OnFocus
override bool OnFocus(Widget w, int x, int y)
Definition
SCR_AutomaticScrollComponent.c:56
SCR_AutomaticScrollComponent::UpdateScrollFrameSkip
void UpdateScrollFrameSkip()
Definition
SCR_AutomaticScrollComponent.c:30
SCR_ScriptedWidgetComponent
Definition
SCR_ScriptedWidgetComponent.c:8
UIWidgets
Definition
attributes.c:40
Widget
Definition
Widget.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
UI
Menu
SettingsMenu
SCR_AutomaticScrollComponent.c
Generated by
1.17.0