4 [
Attribute(
"Text",
desc:
"Text widget name within the button")]
11 bool m_bUseTextColorization;
14 ref Color m_TextDefault;
17 ref Color m_TextToggled;
19 protected TextWidget m_wText;
25 override void HandlerAttached(Widget w)
27 super.HandlerAttached(w);
28 m_wText = TextWidget.Cast(w.FindAnyWidget(m_sTextWidgetName));
34 override void SetToggled(
bool toggled,
bool animate =
true,
bool invokeChange =
true)
39 super.SetToggled(toggled, animate, invokeChange);
40 ColorizeText(animate);
44 override bool OnMouseEnter(Widget w,
int x,
int y)
49 return super.OnMouseEnter(w, x, y);
53 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
58 return super.OnMouseLeave(w, enterW, x, y);
62 protected void ColorizeText(
bool animate =
true)
64 if (!m_bUseTextColorization || !m_wText)
69 color = m_TextToggled;
71 color = m_TextDefault;
74 AnimateWidget.Color(m_wText, color, m_fAnimationRate);
77 AnimateWidget.StopAnimation(m_wText, WidgetAnimationColor);
78 m_wText.SetColor(color);
83 void SetText(
string text)
90 m_wText.SetText(text);
94 void SetTextWithParam(
string text,
string param1,
string param2)
98 m_wText.SetTextFormat(text, param1, param2);
108 TextWidget GetTextWidget()