public void AddTab(Tab newTab) { TabPage tabPageWidget = newTab.TabPageControlledByTab; tabPages.Add(tabPageWidget.Text, tabPageWidget); switch (Orientation) { case UI.Orientation.Horizontal: newTab.VAnchor = UI.VAnchor.ParentCenter; break; case UI.Orientation.Vertical: newTab.HAnchor = UI.HAnchor.ParentLeft | UI.HAnchor.ParentRight; break; } tabBar.AddChild(newTab); tabBar.TabPageArea.AddChild(tabPageWidget); if (tabBar.TabPageArea.Children.Count == 1) { tabBar.SelectTab(newTab); } else { tabPageWidget.Visible = false; } }
public void AddTab(Tab newTab, int tabPosition = -1) { var tabPage = newTab.TabPage; // Use name, not text tabPages.Add(newTab.Name, tabPage); tabBar.AddChild(newTab, tabPosition); tabBar.TabPageContainer.AddChild(tabPage); tabPage.Visible = false; }
public void AddTab(Tab newTab) { TabPage tabPageWidget = newTab.TabPage; // Use name, not text tabPages.Add(newTab.Name, tabPageWidget); switch (Orientation) { case Orientation.Horizontal: newTab.VAnchor = VAnchor.ParentCenter; break; case Orientation.Vertical: newTab.HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight; break; } tabBar.AddChild(newTab); tabBar.TabPageContainer.AddChild(tabPageWidget); tabPageWidget.Visible = false; }