Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_WidgetHelper.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
8 static void GetAllChildren(notnull Widget widget, notnull out array<ref Widget> widgetArray, bool recursive = false)
9 {
10 Widget child = widget.GetChildren();
11 while (child)
12 {
13 widgetArray.Insert(child);
14 if (recursive)
15 GetAllChildren(child, widgetArray, true);
16
17 child = child.GetSibling();
18 }
19 }
20
21 //------------------------------------------------------------------------------------------------
24 static void RemoveAllChildren(notnull Widget widget)
25 {
26 while (widget.GetChildren())
27 {
28 widget.GetChildren().RemoveFromHierarchy();
29 }
30 }
31
32 //------------------------------------------------------------------------------------------------
36 static void ResizeToImage(notnull ImageWidget widget, int imageIndex = 0)
37 {
38 int x, y;
39 widget.GetImageSize(imageIndex, x, y);
40 widget.SetSize(x, y);
41 }
42
43 //------------------------------------------------------------------------------------------------
47 static Widget GetRootWidget(notnull Widget widget)
48 {
49 WorkspaceWidget topTopParent = widget.GetWorkspace();
50 Widget parent;
51 while (widget && widget != topTopParent)
52 {
53 parent = widget;
54 widget = parent.GetParent();
55 }
56 return parent;
57 }
58
59 //------------------------------------------------------------------------------------------------
64 static Widget GetWidgetOrChild(notnull Widget widget, string widgetName)
65 {
66 if (widget.GetName() == widgetName)
67 return widget;
68
69 return widget.FindAnyWidget(widgetName);
70 }
71}
72
73//class SCR_WidgetHelperT<Class T>
74//{
75// static T GetScriptedComponent(notnull Widget widget)
76// {
77// return T.Cast(widget.FindHandler(T));
78// }
79//}
Widget GetRootWidget()