Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_SelectionMenuEntryComponent.c
Go to the documentation of this file.
1
5//------------------------------------------------------------------------------------------------
7{
8 [Attribute("0.4")]
9 protected float m_fDisabledOpacity;
10
11 [Attribute("Size")]
12 protected string m_sSizeLayout;
13
14 [Attribute("EntryText")]
15 protected string m_sEntryText;
16
18
19 protected bool m_bEnabled = true;
20 protected float m_fOriginalSize;
21 protected float m_fAdjustedSize;
22
25
26 // Invokers
29
30 //------------------------------------------------------------------------------------------------
31 protected void InvokeOnMouseEnter()
32 {
34 m_OnMouseEnter.Invoke(this);
35 }
36
37 //------------------------------------------------------------------------------------------------
45
46 //------------------------------------------------------------------------------------------------
47 protected void InvokeOnMouseLeave()
48 {
50 m_OnMouseLeave.Invoke(this);
51 }
52
53 //------------------------------------------------------------------------------------------------
61
62 //------------------------------------------------------------------------------------------------
63 protected void InvokeOnClick()
64 {
65 if (m_OnClick)
66 m_OnClick.Invoke(this);
67 }
68
69 //------------------------------------------------------------------------------------------------
71 {
72 if (!m_OnClick)
74
75 return m_OnClick;
76 }
77
78 //------------------------------------------------------------------------------------------------
79 // Override
80 //------------------------------------------------------------------------------------------------
81
82 //------------------------------------------------------------------------------------------------
83 override void HandlerAttached(Widget w)
84 {
85 super.HandlerAttached(w);
86
88
89 m_wSizeLayout = m_wRoot.FindAnyWidget(m_sSizeLayout);
90 m_wEntryText = TextWidget.Cast(m_wRoot.FindAnyWidget(m_sEntryText));
93
94 // Set anchor to allow for size/pos override
95 if (m_wSizeLayout)
96 FrameSlot.SetAnchor(m_wSizeLayout, 0.5, 0.5);
97 }
98
99 //------------------------------------------------------------------------------------------------
100 override bool OnMouseEnter(Widget w, int x, int y)
101 {
103 return false;
104 }
105
106 //------------------------------------------------------------------------------------------------
107 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
108 {
110 return false;
111 }
112
113 //------------------------------------------------------------------------------------------------
114 override bool OnClick(Widget w, int x, int y, int button)
115 {
116 if (button == 0)
118
119 return false;
120 }
121
122 //------------------------------------------------------------------------------------------------
123 // Custom
124 //------------------------------------------------------------------------------------------------
125
126 //------------------------------------------------------------------------------------------------
127 void SetEnabled(bool enabled)
128 {
129 m_bEnabled = enabled;
130
131 if (!m_wRoot)
132 return;
133
134 // Set visuals
135 if (m_bEnabled)
136 m_wRoot.SetOpacity(1);
137 else
138 m_wRoot.SetOpacity(m_fDisabledOpacity);
139 }
140
141 //------------------------------------------------------------------------------------------------
143 {
144 if (!m_wSizeLayout)
145 return -1;
146
147 return FrameSlot.GetSize(m_wSizeLayout)[0];
148 }
149
150 //------------------------------------------------------------------------------------------------
153 {
154 m_Entry = entry;
155 }
156
157 //------------------------------------------------------------------------------------------------
158 void SetEntryText(string str)
159 {
160 if (!m_wEntryText)
161 {
162 Print("Entry text widget was not found!", LogLevel.ERROR);
163 return;
164 }
165
166 m_wEntryText.SetVisible(!str.IsEmpty());
167 m_wEntryText.SetText(str);
168 }
169
170 //------------------------------------------------------------------------------------------------
172 {
173 return m_fOriginalSize;
174 }
175
176 //------------------------------------------------------------------------------------------------
178 {
179 return m_fAdjustedSize;
180 }
181}
SCR_SelectionMenuEntry m_Entry
void InvokeOnMouseLeave()
float m_fOriginalSize
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
float m_fAdjustedSize
string m_sEntryText
override bool OnMouseEnter(Widget w, int x, int y)
float m_fDisabledOpacity
float GetLayoutSize()
ref ScriptInvoker< SCR_SelectionMenuEntryComponent > m_OnMouseLeave
float GetAdjustedSize()
TextWidget m_wEntryText
void SetEntry(SCR_SelectionMenuEntry entry)
Set entry holding data driving this visuals.
string m_sSizeLayout
void InvokeOnMouseEnter()
void SetEnabled(bool enabled)
void SetEntryText(string str)
float GetOriginalSize()
ScriptInvoker GetOnClick()
ScriptInvoker GetOnMouseEnter()
Widget m_wSizeLayout
override bool OnClick(Widget w, int x, int y, int button)
override void HandlerAttached(Widget w)
ScriptInvoker GetOnMouseLeave()
bool m_bEnabled
ref ScriptInvoker< SCR_SelectionMenuEntryComponent > m_OnMouseEnter
void InvokeOnClick()
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
SCR_FieldOfViewSettings Attribute
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134