Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AutomaticScrollComponent.c
Go to the documentation of this file.
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
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 {
39
40 float frameX, frameY, textX, textY;
41 m_ContentHorizontal.GetScreenSize(frameX, frameY);
42 m_ContentFrame.GetScreenSize(textX, textY);
43
44 bool move;
46 move = textY > frameY;
47 else
48 move = textX > frameX;
49
50 // Animation
51 if (move)
53 }
54
55 //------------------------------------------------------------------------------------------------
56 override bool OnFocus(Widget w, int x, int y)
57 {
60
61 return super.OnFocus(w, x, y);
62 }
63
64 //------------------------------------------------------------------------------------------------
65 override bool OnFocusLost(Widget w, int x, int y)
66 {
69
70 return super.OnFocusLost(w, x, y);
71 }
72
73 //------------------------------------------------------------------------------------------------
74 override void HandlerAttached(Widget w)
75 {
76 super.HandlerAttached(w);
77
80 return;
81
82 m_ContentFrame = w.FindAnyWidget(m_sWidgetContentName);
83 m_ScrollComponent = SCR_HorizontalScrollAnimationComponent.Cast(m_ContentHorizontal.FindHandler(SCR_HorizontalScrollAnimationComponent));
84
86 return;
87
88 m_bIsInit = true;
89
91
93 GetGame().GetCallqueue().Call(UpdateScrollFrameSkip);
94 }
95}
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_HorizontalScrollAnimationComponent m_ScrollComponent
override bool OnFocusLost(Widget w, int x, int y)
override bool OnFocus(Widget w, int x, int y)
SCR_FieldOfViewSettings Attribute