Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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  child = child.GetSibling();
17  }
18  }
19 
20  //------------------------------------------------------------------------------------------------
21  static void RemoveAllChildren(notnull Widget widget)
22  {
23  while (widget.GetChildren())
24  {
25  widget.GetChildren().RemoveFromHierarchy();
26  }
27  }
28 
29  //------------------------------------------------------------------------------------------------
30  static void ResizeToImage(notnull ImageWidget widget, int imageIndex = 0)
31  {
32  int x, y;
33  widget.GetImageSize(imageIndex, x, y);
34  widget.SetSize(x, y);
35  }
36 
37  //------------------------------------------------------------------------------------------------
41  static Widget GetRootWidget(notnull Widget widget)
42  {
43  WorkspaceWidget topTopParent = widget.GetWorkspace();
44  Widget parent;
45  while (widget && widget != topTopParent)
46  {
47  parent = widget;
48  widget = parent.GetParent();
49  }
50  return parent;
51  }
52 
53  //------------------------------------------------------------------------------------------------
56  static Widget GetWidgetOrChild(notnull Widget widget, string widgetName)
57  {
58  if (widget.GetName() == widgetName)
59  return widget;
60 
61  return widget.FindAnyWidget(widgetName);
62  }
63 };
64 
65 /*
66 class SCR_WidgetHelperT<Class T>
67 {
68  static T GetScriptedComponent(notnull Widget widget)
69  {
70  return T.Cast(widget.FindHandler(T));
71  }
72 };
73 // */
SCR_WidgetHelper
Definition: SCR_WidgetHelper.c:1