27 [
Attribute(
"false",
UIWidgets.CheckBox,
"Create all tabs on initialization, do not wait for first selection")]
30 [
Attribute(
"false",
UIWidgets.CheckBox,
"Do not initialize yourself. This is for initialization by supermenu.")]
36 [
Attribute(
"{668B05FDEF1D3268}UI/layouts/WidgetLibrary/WLib_TabViewElement.layout",
UIWidgets.ResourceNamePicker,
"Layout element used",
"layout")]
57 [
Attribute(
"0",
desc:
"If true it will hide the text of the tab and only show it when the tab is selected. Tabs should have images otherwise it might look weird")]
86 super.HandlerAttached(w);
120 ShowTab(realSelected,
true,
false);
138 super.HandlerDeattached(w);
157 comp.SetEnabled(
false,
false);
170 layout.EnableWidthOverride(
true);
182 content.m_ButtonComponent = comp;
187 image.SetVisible(
content.m_bShowImage);
192 Widget imageSize = button.FindAnyWidget(
"SizeTabImage");
194 imageSize.SetVisible(
content.m_bShowImage);
203 Widget overlay =
content.m_ButtonComponent.GetRootWidget().FindAnyWidget(
"Overlay");
211 float width =
content.m_fIconWidth;
214 size.EnableWidthOverride(
true);
215 size.EnableHeightOverride(
true);
216 size.SetWidthOverride(width);
217 size.SetHeightOverride(height);
230 if (
path ==
string.Empty)
258 SCR_MenuHelper.OnTabChange(
this, w);
271 if (button && button.IsEnabled())
273 GetGame().GetWorkspace().SetFocusedWidget(button);
277 child = child.GetChildren();
301 if (w && w.IsVisible())
360 if (!
content.m_ButtonComponent)
363 content.m_ButtonComponent.SetToggled(select,
false);
373 tab.SetVisible(
true);
394 tab.SetVisible(
false);
401 tab.RemoveFromHierarchy();
405 SCR_MenuHelper.OnTabChange(
this, tab);
412 void ShowTab(
int i,
bool callAction =
true,
bool playSound =
true)
448 ShowTab(i, callAction, playSound);
467 void AddTab(
ResourceName layout,
string content,
bool enabled =
true,
ResourceName tabImage =
string.Empty,
ResourceName iconLayout =
string.Empty,
float width = 32,
float height = 32,
string contentParam1 =
string.Empty,
string contentParam2 =
string.Empty,
string identifier =
string.Empty)
469 SCR_TabViewContent tabContent =
new SCR_TabViewContent;
470 tabContent.m_ElementLayout =
layout;
471 tabContent.m_bEnabled = enabled;
472 tabContent.m_sTabButtonContent =
content;
473 tabContent.m_sTabButtonContentParam1 = contentParam1;
474 tabContent.m_sTabButtonContentParam2 = contentParam2;
475 tabContent.m_sTabIdentifier = identifier;
477 if (iconLayout !=
string.Empty)
479 tabContent.m_bShowIcon =
true;
480 tabContent.m_IconLayout = iconLayout;
481 tabContent.m_fIconWidth = width;
482 tabContent.m_fIconHeight = height;
485 if (!tabImage.IsEmpty())
487 tabContent.m_TabImage = tabImage;
488 tabContent.m_bShowImage =
true;
518 button.RemoveFromHierarchy();
530 content.m_wTab.RemoveFromHierarchy();
542 ShowTab(newIndex,
true, playSound:
false);
605 void SetTabText(
int index,
string text,
string textParam1 =
string.Empty,
string textParam2 =
string.Empty)
614 m_aElements[
index].m_ButtonComponent.GetTextWidget().SetTextFormat(text, textParam1, textParam2);
631 image.LoadImageTexture(0, tabImage);
632 image.SetVisible(
true);
635 Widget imageSize = tabRoot.FindAnyWidget(
"SizeTabImage");
637 imageSize.SetVisible(
true);
650 image.SetVisible(show);
652 Widget imageSize = tabRoot.FindAnyWidget(
"SizeTabImage");
654 imageSize.SetVisible(show);
660 for (
int i = 0, len =
m_aElements.Count(); i < len; i++)
686 SCR_ModularButtonComponent modularButton = SCR_ModularButtonComponent.Cast(button.GetRootWidget().FindHandler(SCR_ModularButtonComponent));
688 modularButton.SetToggled(isToggled);
738 while (foundItem < 0)
749 else if (i > lastIndex)
767 void EnableTab(
int tabIndex,
bool enable,
bool animate =
true)
769 if (tabIndex < 0 || tabIndex >=
m_aElements.Count())
776 if (!tab.m_ButtonComponent)
779 tab.m_ButtonComponent.SetEnabled(enable, animate);
780 tab.m_bEnabled = tab.m_ButtonComponent.IsVisible() && tab.m_ButtonComponent.IsEnabled();
786 void EnableAllTabs(
bool enable,
bool ignoreCurrentActive =
true,
bool animate =
true)
790 for (
int i = 0; i < count; i++)
802 if (tabIndex < 0 || tabIndex >=
m_aElements.Count())
809 if (!tab.m_ButtonComponent)
812 tab.m_ButtonComponent.SetVisible(visible, animate);
813 tab.m_bEnabled = tab.m_ButtonComponent.IsVisible() && tab.m_ButtonComponent.IsEnabled();
838 w.SetEnabled(enable);
844 if (tabIndex == -1 || tabIndex >=
m_aElements.Count())
990class SCR_TabViewContent
995 [
Attribute(
"Button",
UIWidgets.EditBox,
"Content of the button: It can contain either name or image resource")]
996 string m_sTabButtonContent;
998 [
Attribute(
"",
UIWidgets.EditBox,
"Unique identifier of tab used in script to look for this one - optional for now")]
999 string m_sTabIdentifier;
1001 [
Attribute(
desc:
"Param if m_sTabButtonContent is name rather then image resource")]
1004 [
Attribute(
desc:
"Param if m_sTabButtonContent is name rather then image resource")]
1013 [
Attribute(
desc:
"Image name used in front of tab text when using image set")]
1014 string m_sTabImageName;
1022 [
Attribute(
"{6B997B683BD0FC21}UI/layouts/WidgetLibrary/TabView/WLib_TabViewInfoIcon.layout",
UIWidgets.ResourceNamePicker,
"",
"Path to layout")]
1029 float m_fIconHeight;
class RestAPIHelper< JsonApiStruct T > content
ArmaReforgerScripted GetGame()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI layouts Menus CleanSweep CleanSweepAreaSelection layout
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
ref ScriptInvokerTabView m_OnContentRemove
func ScriptInvokerTabViewContentIndexMethod
ref ScriptInvokerTabView m_OnContentShow
func ScriptInvokerTabViewIndexMethod
float m_fTabWidthTextHidden
ref ScriptInvokerTabView m_OnContentHide
func ScriptInvokerTabViewMethod
bool m_bCreateAllTabsAtStart
const float BUTTON_PADDING_RIGHT
ref ScriptInvokerTabViewIndex m_OnChanged
SCR_TabViewComponent SCR_ScriptedWidgetComponent BaseContainerProps()
ref array< ref SCR_TabViewContent > m_aElements
SCR_PagingButtonComponent m_PagingLeft
ScriptInvokerBase< ScriptInvokerTabViewContentIndexMethod > ScriptInvokerTabViewContentIndex
bool m_bShowTextOnlyWhenSelectedTab
SCR_TabViewComponent SCR_ScriptedWidgetComponent SCR_BaseContainerLocalizedTitleField("m_sTabButtonContent")
SCR_PagingButtonComponent m_PagingRight
ScriptInvokerBase< ScriptInvokerTabViewMethod > ScriptInvokerTabView
ScriptInvokerBase< ScriptInvokerTabViewIndexMethod > ScriptInvokerTabViewIndex
ref ScriptInvokerTabViewIndex m_OnContentCreate
override void CreateWidget(Widget parent)
void SetTextWithParam(string text, string param1, string param2)
float m_fTabWidthTextHidden
bool IsIconShown(int entry)
array< ref SCR_TabViewContent > GetContents()
ref ScriptInvokerTabView m_OnContentShow
void AddContentElement(SCR_TabViewContent content)
ref ScriptInvokerTabView m_OnContentRemove
bool m_bCreateAllTabsAtStart
SCR_TabViewContent GetContent(int index)
SCR_PagingButtonComponent m_PagingLeft
void EnableTab(int tabIndex, bool enable, bool animate=true)
void SetPagingButtonsVisible(bool visible, bool animate=true)
ref ScriptInvokerTabViewIndex m_OnChanged
void ShowTabText(int index, bool show, int buttonWidth=-1)
override void HandlerDeattached(Widget w)
bool m_bShowTextOnlyWhenSelectedTab
void SetTabImage(int index, ResourceName tabImage)
void FocusFirstWidget(Widget w)
ScriptInvokerTabViewIndex GetOnContentCreate()
void ShowTab(int i, bool callAction=true, bool playSound=true)
Widget GetEntryIcon(int entry)
void RemoveActionListeners()
ScriptInvokerTabView GetOnContentRemove()
void CreateTabContent(SCR_TabViewContent content, int index)
void ShowIcon(int entry, bool show)
void RemoveTab(int index)
const float BUTTON_PADDING_RIGHT
void AddTab(ResourceName layout, string content, bool enabled=true, ResourceName tabImage=string.Empty, ResourceName iconLayout=string.Empty, float width=32, float height=32, string contentParam1=string.Empty, string contentParam2=string.Empty, string identifier=string.Empty)
SCR_PagingButtonComponent m_PagingRight
bool GetListenToActions()
ScriptInvokerTabView GetOnContentShow()
void SetListenToActions(bool isAllowed)
void ShowAllTabsText(bool show, int buttonWidth=-1, bool ignoreSelected=true)
void SelectIndex(bool select, int i)
void RemoveTabByIdentifier(string identifier)
SCR_TabViewContent GetShownTabComponent()
ref ScriptInvokerTabViewContentIndex m_OnContentSelect
ref Color m_ColorBackground
void CreateTab(SCR_TabViewContent content)
void SetTabVisible(int tabIndex, bool visible, bool animate=true)
override void HandlerAttached(Widget w)
ref ScriptInvokerTabView m_OnContentHide
ref array< ref SCR_TabViewContent > m_aElements
void SetEntryIconSize(int index, float width=-1, float height=-1)
void EnableAllTabs(bool enable, bool ignoreCurrentActive=true, bool animate=true)
bool IsTabEnabled(int tabIndex)
int GetNextValidItem(bool toLeft)
void OnTabButtonToggle(SCR_ButtonBaseComponent button, bool isToggled)
void SetCanNavigate(bool isAllowed)
void CreateIcon(SCR_TabViewContent content)
void ShowImage(int index, bool show)
void UpdatePagingButtons(bool animate=true)
Enable or disable paging buttons, if it's possible to page to the right or left.
Widget GetContentWidget(int index)
void OnSelection(SCR_ButtonBaseComponent button)
void SetTabText(int index, string text, string textParam1=string.Empty, string textParam2=string.Empty)
ScriptInvokerTabViewIndex GetOnChanged()
ScriptInvokerTabView GetOnContentHide()
const string MANW_IDENTIFIER
void ShowTabByIdentifier(string identifier, bool callAction=true, bool playSound=true)
SCR_TabViewContent GetEntryContent(int index)
ref ScriptInvokerTabView m_OnTabChange
ScriptInvokerTabView GetOnTabChange()
ref ScriptInvokerTabViewIndex m_OnContentCreate
void AddActionListeners()
ScriptInvokerTabViewContentIndex GetOnContentSelect()
Base class for all final Reforger interactive elements.
static bool SetTexture(ImageWidget widget, ResourceName texture, string image="")
SCR_FieldOfViewSettings Attribute
WidgetFlags
Widget flags. See enf::Widget::SetFlags().