9 ref ScriptInvoker<SCR_HoverDetectorComponent, Widget> m_OnHoverDetected =
new ScriptInvoker();
10 ref ScriptInvoker<SCR_HoverDetectorComponent, Widget> m_OnMouseLeave =
new ScriptInvoker();
12 [
Attribute(
"200",
desc:
"Time between mouse entering widget and event activation, in milliseconds")]
13 protected float m_fHoverDelayMs;
15 [
Attribute(
"0",
desc:
"Triggers OnHover when the widget is focused instead of just on mouse enter")]
16 protected bool m_bDetectFocus;
18 protected bool m_bMouseOver;
21 override bool OnMouseEnter(Widget w,
int x,
int y)
24 auto callQueue =
GetGame().GetCallqueue();
25 callQueue.Remove(OnTimer);
26 callQueue.CallLater(OnTimer, m_fHoverDelayMs);
31 override bool OnMouseLeave(Widget w, Widget enterW,
int x,
int y)
34 auto callQueue =
GetGame().GetCallqueue();
35 callQueue.Remove(OnTimer);
41 override bool OnFocus(Widget w,
int x,
int y)
43 bool onFocus = super.OnFocus(w, x, y);
46 return OnMouseEnter(w, x, y);
52 override bool OnFocusLost(Widget w,
int x,
int y)
54 bool onFocusLost = super.OnFocusLost(w, x, y);
57 return OnMouseLeave(w,
null, x, y);
71 protected void OnHoverDetected()
73 m_OnHoverDetected.Invoke(
this,
m_wRoot);