public bool RemoveTab(OxPanel tabPanel) { int index = items.IndexOf(tabPanel); if (index > -1) { tabs.RemoveAt(index); return(items.Remove(tabPanel)); } if (tabs.itemsCount <= 0) { selectedIndex = -1; } return(false); }
public OxPanel AddTab(string name) { OxButton tabButton = new OxButton(name); tabButton.clicked += TabButton_clicked; tabButton.ClearAllAppearances(); ApplyAppearanceFromResources(tabButton, "Textures/OxGUI/Element3"); tabs.AddItems(tabButton); Rect tabPanelDimensions = CalculateTabPanelDimensions(); OxPanel tabPanel = new OxPanel(new Vector2(tabPanelDimensions.x, tabPanelDimensions.y), new Vector2(tabPanelDimensions.width, tabPanelDimensions.height)); tabPanel.parentInfo = new ParentInfo(this); tabPanel.anchor = (OxHelpers.Anchor.Top | OxHelpers.Anchor.Bottom | OxHelpers.Anchor.Left | OxHelpers.Anchor.Right); tabPanel.ClearAllAppearances(); ApplyAppearanceFromResources(tabPanel, "Textures/OxGUI/Element4", true, false, false); items.Add(tabPanel); if (selectedIndex < 0) { selectedIndex = tabs.IndexOf(tabButton); tabs.SelectItem(tabButton); } return(tabPanel); }
public void SetTabName(OxPanel tabPanel, string name) { SetTabName(IndexOf(tabPanel), name); }