Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ServerBrowserMenuWidgets.c
Go to the documentation of this file.
1 /*
2 Class for storing server browser menu widget references
3 */
4 
6 {
7  const string WIDGET_CONTENT = "ServerBrowserContent";
8 
9  // Constant names of widgets
10  const string WIDGET_TAB_VIEW = "TabView";
11  const string WIDGET_FILTER = "FilterPanel";
12  const string WIDGET_SERVER_HEADER = "SortingHeader";
13  const string WIDGET_SORT_SESSION_NAME = "sortName";
14  const string WIDGET_SORT_SESSION_FAVORITE = "sortFavourite";
15  const string WIDGET_SEARCH = "m_FilterSearch";
16  const string WIDGET_SCROLL_LAYOUT = "ScrollLayout0";
17  const string WIDGET_SERVER_SCENARIO_DETAILS_PANEL = "ServerScenarioDetailsPanel";
18  const string WIDGET_SERVERS_FEEDBACK = "txtServersFeedback";
19  const string WIDGET_LOADING_SERVERS = "LoadingServers";
20  const string WIDGET_SCROLLABLE_LIST = "vServerListView";
21 
22  // Buttons
23  const string WIDGET_BUTTON_JOIN = "BtnQuickJoin";
24  const string WIDGET_BUTTON_DETAILS = "BtnDetails";
25  const string WIDGET_BUTTON_FAVORITE = "BtnFavorite";
26  const string WIDGET_BUTTON_HOST = "HostNewServerButton";
27  const string WIDGET_BUTTON_REFRESH = "RefreshButton";
28  const string WIDGET_BUTTON_DIRECTJOIN = "BtnManualConnect";
29  const string WIDGET_BUTTON_FILTER = "Filter";
30 
31  // Messages widgets
32  static string WIDGET_PANEL_EMPTY = "MenuPanelEmpty";
33  static string WIDGET_MESSAGE_WRAP = "SimpleMessageWrap";
34  static string WIDGET_MESSAGE_LIST = "SimpleMessageList";
35 
36  // Widgets elements
37  Widget m_wRoot;
38  Widget m_wContent;
39  Widget m_wPanelEmpty;
40 
41  Widget m_wSearchEditBox;
42  Widget m_wButtonConnect;
43  Widget m_wControllerActionsOverlay;
44  TextWidget m_wTxtServersFeedback;
45  Widget m_wLoadingServers;
46  Widget m_wSortSessionName;
47  Widget m_wSortSessionFavorite;
48 
49  Widget m_wHostNewServerButton;
50  SCR_HostButtonComponent m_HostButton;
51 
52  SCR_InputButtonComponent m_JoinButton;
53  SCR_InputButtonComponent m_DetailsButton;
54  SCR_InputButtonComponent m_FavoritesButton;
55 
56  SCR_InputButtonComponent m_RefreshButton;
57  SCR_InputButtonComponent m_DirectJoinButton;
58  SCR_InputButtonComponent m_FilterButton;
59  ref array<SCR_InputButtonComponent> m_aEntryButtons = {};
60 
61  //------------------------------------------------------------------------------------------------
63  void FindAllWidgets(Widget root)
64  {
65  m_wRoot = root;
66  m_wContent = m_wRoot.FindAnyWidget(WIDGET_CONTENT);
67  m_wPanelEmpty = m_wRoot.FindAnyWidget(WIDGET_PANEL_EMPTY);
68 
69  m_wSearchEditBox = m_wRoot.FindAnyWidget(WIDGET_SEARCH);
70 
71  m_wTxtServersFeedback = TextWidget.Cast(m_wRoot.FindAnyWidget(WIDGET_SERVERS_FEEDBACK));
72 
73  m_wLoadingServers = m_wRoot.FindAnyWidget(WIDGET_LOADING_SERVERS);
74 
75  m_wSortSessionName = m_wRoot.FindAnyWidget(WIDGET_SORT_SESSION_NAME);
76  m_wSortSessionFavorite = m_wRoot.FindAnyWidget(WIDGET_SORT_SESSION_FAVORITE);
77 
78  m_wHostNewServerButton = m_wRoot.FindAnyWidget(WIDGET_BUTTON_HOST);
79  if (m_wHostNewServerButton)
80  m_HostButton = SCR_HostButtonComponent.FindComponent(m_wHostNewServerButton);
81 
83  m_JoinButton = FindButton(WIDGET_BUTTON_JOIN);
84  m_DetailsButton = FindButton(WIDGET_BUTTON_DETAILS);
85  m_FavoritesButton = FindButton(WIDGET_BUTTON_FAVORITE);
86 
87  m_aEntryButtons.Insert(m_JoinButton);
88  m_aEntryButtons.Insert(m_DetailsButton);
89  m_aEntryButtons.Insert(m_FavoritesButton);
90 
92  m_RefreshButton = FindButton(WIDGET_BUTTON_REFRESH);
93  m_DirectJoinButton = FindButton(WIDGET_BUTTON_DIRECTJOIN);
94  m_FilterButton = FindButton(WIDGET_BUTTON_FILTER);
95  }
96 
97  //------------------------------------------------------------------------------------------------
98  SCR_InputButtonComponent FindButton(string name)
99  {
100  Widget button = m_wRoot.FindAnyWidget(name);
101  SCR_InputButtonComponent buttonComp;
102 
103  if (button)
104  buttonComp = SCR_InputButtonComponent.FindComponent(button);
105 
106  return buttonComp;
107  }
108 
109  //------------------------------------------------------------------------------------------------
111  // return SCR_WLibComponentBase based handler
112  ScriptedWidgetEventHandler FindHandlerReference(out Widget target, string targetName, typename typeName, Widget parent = null)
113  {
114  typename type = ScriptedWidgetEventHandler;
115 
116  // Default parent
117  if (!parent)
118  parent = m_wRoot;
119 
120  // Find widget
121  target = parent.FindAnyWidget(targetName);
122 
123  if (!target)
124  {
125  #ifdef SB_DEBUG
126  string error = string.Format("Could not find widget of NAME: %1 of PARENT: %2", targetName, parent);
127  Print(error, LogLevel.ERROR);
128  #endif
129  return null;
130  }
131 
132  // Find handler
133  return target.FindHandler(typeName);
134  }
135 }
ServerBrowserMenuWidgets
Definition: ServerBrowserMenuWidgets.c:5
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_HostButtonComponent
Definition: SCR_HostButtonComponent.c:6
m_wContent
protected Widget m_wContent
Definition: SCR_InfoDisplay.c:64
type
EDamageType type
Definition: SCR_DestructibleTreeV2.c:32
SCR_InputButtonComponent
Definition: SCR_InputButtonComponent.c:1