Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
MenuRootSubComponent.c
Go to the documentation of this file.
1
6{
7 private Widget m_Widget;
8 private MenuRootComponent m_Root;
9
15 {
16 return m_Widget;
17 }
18
24 {
25 if (!m_Root)
26 return null;
27
28 return m_Root.GetMenu();
29 }
30
35 MenuRootComponent GetRootComponent()
36 {
37 return m_Root;
38 }
39
45 protected bool IsUnique()
46 {
47 return true;
48 }
49
57
58 override void HandlerAttached(Widget w)
59 {
61 return; //--- Run-time only
62
63 m_Widget = w;
64
65 m_Root = MenuRootComponent.GetRootOf(m_Widget);
66 if (IsUnique())
67 {
68 if (!m_Root.FindComponent(Type()))
69 {
70 m_Root.AddComponent(this);
71 }
72 else
73 {
74 Print(string.Format("Duplicate instance of UI component %1 found on widget '%2'! The component is marked as unique, only one instance is allowed.", Type(), w.GetName()), LogLevel.WARNING);
75 return;
76 }
77 }
78
79 if (m_Root.GetMenu())
80 {
81 //--- Execute after delay to make sure all new components are registered first
82 GetGame().GetCallqueue().CallLater(HandlerAttachedScripted, 0, false, w);
83 }
84 }
85
86 override void HandlerDeattached(Widget w)
87 {
88 if (m_Root)
89 m_Root.RemoveComponent(this);
90 }
91};
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_RadialMenu GetMenu()
Widget GetWidget()
int Type
static MenuRootComponent GetRootOf(Widget widget)
override void HandlerAttached(Widget w)
override void HandlerDeattached(Widget w)
void HandlerAttachedScripted(Widget w)
static bool IsEditMode()
Definition Functions.c:1566
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