Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectableTileButtonComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
3{
4 ref ScriptInvoker m_OnChanged = new ScriptInvoker();
5 private bool m_bIsSelected = false;
6 protected bool m_bIsTriggered = true;
7
8 protected Widget m_wIcon;
9
10 protected ref Color COLOR_CHECKED_TRUE = UIColors.CONTRAST_COLOR;
11 protected ref Color COLOR_CHECKED_FALSE = UIColors.WHITE_DEFAULT;
12
13 //------------------------------------------------------------------------------------------------
14 override void HandlerAttached(Widget w)
15 {
16 super.HandlerAttached(w);
17
18 m_wIcon = m_wRoot.FindAnyWidget("ContentImage");
21 }
22
23 //------------------------------------------------------------------------------------------------
24 override bool OnClick(Widget w, int x, int y, int button)
25 {
26 super.OnClick(w, x, y, button);
27 if (button != 0)
28 return false;
29
30 SetSelected(!m_bIsSelected);
31 return false;
32 }
33
34 //------------------------------------------------------------------------------------------------
35 override bool OnMouseEnter(Widget w, int x, int y)
36 {
38 GetGame().GetWorkspace().SetFocusedWidget(w);
39
41
42 if (GetGame().GetWorkspace().GetFocusedWidget() != w)
44
45 return false;
46 }
47
48 //------------------------------------------------------------------------------------------------
49 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
50 {
52 return false;
53 }
54
55 //------------------------------------------------------------------------------------------------
56 override bool OnFocus(Widget w, int x, int y)
57 {
60 return false;
61 }
62
63 //------------------------------------------------------------------------------------------------
64 override bool OnFocusLost(Widget w, int x, int y)
65 {
67 return false;
68 }
69
70 //------------------------------------------------------------------------------------------------
71 override protected void OnMenuSelect()
72 {
73 if (!m_wRoot.IsEnabled())
74 return;
75
76 super.OnMenuSelect();
78 }
79
80 //------------------------------------------------------------------------------------------------
81 override protected void ColorizeWidgets(Color colorBackground, Color colorContent, float speed = -1)
82 {
83 if (speed < 0)
84 speed = m_fAnimationRate;
85 }
86
87 //------------------------------------------------------------------------------------------------
96
97 //------------------------------------------------------------------------------------------------
99 {
100 return m_bIsSelected;
101 }
102
103 //------------------------------------------------------------------------------------------------
104 void SetSelected(bool selected, bool notify = true)
105 {
106 if (m_bIsSelected == selected)
107 return;
108
109 m_bIsSelected = selected;
110
112
113 if (notify)
114 m_OnChanged.Invoke(this, m_wRoot, m_bIsSelected);
115 }
116
117 //------------------------------------------------------------------------------------------------
123
124 //------------------------------------------------------------------------------------------------
126 {
128 if (!m_bIsSelected)
130 }
131};
ArmaReforgerScripted GetGame()
Definition game.c:1398
Widget m_wRoot
static WidgetAnimationOpacity Opacity(Widget widget, float targetValue, float speed, bool toggleVisibility=false)
static WidgetAnimationColor Color(Widget widget, Color color, float speed)
Definition Color.c:13
Deprecated button component. Still used in many prefabs, so it works, it's just stripped of most of t...
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseEnter(Widget w, int x, int y)
void SetSelected(bool selected, bool notify=true)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
override bool OnFocus(Widget w, int x, int y)
override bool OnClick(Widget w, int x, int y, int button)
void ColorizeCheckWidget()
Set color of checked line.
void ColorizeWidgets(Color colorBackground, Color colorContent, float speed=-1)
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134