4 ref ScriptInvoker m_OnChanged =
new ScriptInvoker();
5 private bool m_bIsSelected =
false;
6 protected bool m_bIsTriggered =
true;
8 protected Widget m_wIcon;
10 protected ref Color COLOR_CHECKED_TRUE =
UIColors.CONTRAST_COLOR;
11 protected ref Color COLOR_CHECKED_FALSE =
UIColors.WHITE_DEFAULT;
14 override void HandlerAttached(Widget w)
16 super.HandlerAttached(w);
19 AnimateWidget.Color(
m_wBackground, COLOR_BACKGROUND_DEFAULT, m_fAnimationRate);
20 ColorizeCheckWidget();
24 override bool OnClick(Widget w,
int x,
int y,
int button)
26 super.OnClick(w, x, y, button);
30 SetSelected(!m_bIsSelected);
35 override bool OnMouseEnter(Widget w,
int x,
int y)
37 if (m_bMouseOverToFocus)
38 GetGame().GetWorkspace().SetFocusedWidget(w);
42 if (
GetGame().GetWorkspace().GetFocusedWidget() != w)
43 AnimateWidget.Color(
m_wBackground, COLOR_BACKGROUND_HOVERED, m_fAnimationRate);
49 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
51 AnimateWidget.Color(
m_wBackground, COLOR_BACKGROUND_DEFAULT, m_fAnimationRate);
56 override bool OnFocus(Widget w,
int x,
int y)
64 override bool OnFocusLost(Widget w,
int x,
int y)
71 override protected void OnMenuSelect()
77 ColorizeCheckWidget();
81 override protected void ColorizeWidgets(Color colorBackground, Color colorContent,
float speed = -1)
84 speed = m_fAnimationRate;
89 protected void ColorizeCheckWidget()
92 AnimateWidget.Color(
m_wIcon, COLOR_BACKGROUND_CLICKED, m_fAnimationRate);
94 AnimateWidget.Color(
m_wIcon, COLOR_CONTENT_DEFAULT, m_fAnimationRate);
100 return m_bIsSelected;
104 void SetSelected(
bool selected,
bool notify =
true)
106 if (m_bIsSelected == selected)
109 m_bIsSelected = selected;
111 ColorizeCheckWidget();
120 AnimateWidget.Opacity(
m_wRoot, 1, m_fAnimationRate);
129 AnimateWidget.Opacity(
m_wRoot, 0, m_fAnimationRate);