12 [
Attribute(
"{08CF3B69CB1ACBC4}UI/layouts/WidgetLibrary/WLib_NavigationButton.layout")]
13 protected ResourceName m_sNavigationButtonLayout;
15 [
Attribute(
"TabView", UIWidgets.EditBox,
desc:
"Name of tabview widget to find tab view component.")]
16 protected string m_sTabViewName;
21 protected ref array<SCR_SubMenuBase> m_aSubMenus = {};
32 void Init(Widget menuRoot)
34 m_wMenuRoot = menuRoot;
37 Widget tabView =
m_wRoot.FindAnyWidget(m_sTabViewName);
41 if (!m_TabViewComponent)
44 m_TabViewComponent.GetOnContentCreate().Insert(OnTabCreate);
45 m_TabViewComponent.GetOnContentShow().Insert(OnTabShow);
46 m_TabViewComponent.GetOnContentHide().Insert(OnTabHide);
47 m_TabViewComponent.GetOnContentRemove().Insert(OnTabRemove);
48 m_TabViewComponent.GetOnTabChange().Insert(OnTabChange);
51 if (m_TabViewComponent.m_bManualInit)
54 m_TabViewComponent.Init();
59 array<ref SCR_TabViewContent> contents = m_TabViewComponent.GetContents();
61 foreach (
int i, SCR_TabViewContent content : contents)
66 OnTabCreate(m_TabViewComponent, content.m_wTab, i);
68 if (i == m_TabViewComponent.m_iSelectedTab)
69 OnTabShow(m_TabViewComponent, content.m_wTab);
77 if (m_OpenedSubmenu && m_OpenedSubmenu.GetRootWidget().IsVisible() && m_OpenedSubmenu.GetShown())
78 m_OpenedSubmenu.OnMenuShow();
85 m_OpenedSubmenu.OnMenuHide();
89 void OnMenuUpdate(
float tDelta)
91 if (m_OpenedSubmenu && m_OpenedSubmenu.GetRootWidget().IsVisible() && m_OpenedSubmenu.GetShown())
92 m_OpenedSubmenu.OnMenuUpdate(tDelta);
96 void OnMenuFocusGained()
99 m_OpenedSubmenu.OnMenuFocusGained();
103 void OnMenuFocusLost()
106 m_OpenedSubmenu.OnMenuFocusLost();
118 subMenu.OnTabRemove();
134 subMenu.GetOnRequestCloseMenu().Insert(OnRequestCloseMenu);
135 subMenu.GetOnRequestTabChange().Insert(OnRequestTabChange);
138 subMenu.OnTabCreate(m_wMenuRoot, m_sNavigationButtonLayout,
index);
140 m_aSubMenus.Insert(subMenu);
156 m_OpenedSubmenu = subMenu;
186 subMenu.OnTabRemove();
187 m_aSubMenus.RemoveItem(subMenu);
202 subMenu.OnTabChange();
208 protected void OnRequestCloseMenu()
210 if (m_OnRequestCloseMenu)
211 m_OnRequestCloseMenu.Invoke();
215 protected void OnRequestTabChange(
int newTab,
int oldTab)
217 m_TabViewComponent.ShowTab(newTab);
225 return m_TabViewComponent;
231 return m_TabViewComponent.m_iSelectedTab;
237 return m_OpenedSubmenu;
243 if (!m_aSubMenus.IsIndexValid(
index))
246 return m_aSubMenus[
index];
261 if (!m_OnRequestCloseMenu)
264 return m_OnRequestCloseMenu;