Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ButtonTextComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 [Attribute("Text", desc: "Text widget name within the button")]
6
7 [Attribute()]
9
10 [Attribute("0", UIWidgets.CheckBox)]
12
13 [Attribute(UIColors.GetColorAttribute(UIColors.NEUTRAL_INFORMATION), UIWidgets.ColorPicker)]
15
16 [Attribute(UIColors.GetColorAttribute(UIColors.CONTRAST_COLOR), UIWidgets.ColorPicker)]
18
20
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 {
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 {
56 m_OnMouseLeave.Invoke();
57
58 return super.OnMouseLeave(w, enterW, x, y);
59 }
60
61 //------------------------------------------------------------------------------------------------
62 protected void ColorizeText(bool animate = true)
63 {
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)
75 else
76 {
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 //------------------------------------------------------------------------------------------------
109 {
110 return m_wText;
111 }
112
113 //------------------------------------------------------------------------------------------------
121
122 //------------------------------------------------------------------------------------------------
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 //------------------------------------------------------------------------------------------------
142 {
143 return SCR_ButtonTextComponent.Cast(w.FindHandler(SCR_ButtonTextComponent));
144 }
145};
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
static bool StopAnimation(Widget w, typename typeName)
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition Color.c:13
Base class for any button, regardless its own content.
override void SetToggled(bool toggled, bool animate=true, bool invokeChange=true, bool instant=false)
void ColorizeText(bool animate=true)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override void HandlerAttached(Widget w)
ref ScriptInvokerVoid m_OnMouseLeave
void SetTextWithParam(string text, string param1, string param2)
ScriptInvokerVoid GetOnMouseLeave()
static SCR_ButtonTextComponent GetButtonText(string name, Widget parent, bool searchAllChildren=true)
ScriptInvokerVoid GetOnMouseEnter()
ref ScriptInvokerVoid m_OnMouseEnter
override bool OnMouseEnter(Widget w, int x, int y)
static SCR_ButtonTextComponent FindButtonTextComponent(notnull Widget w)
Base class for all final Reforger interactive elements.
SCR_FieldOfViewSettings Attribute
T2 param2
Definition tuple.c:92
Tuple param1