public void SelectTab(Tab tabToSwitchTo) { if (currentVisibleTab != tabToSwitchTo) { foreach (GuiWidget tabPage in tabPageArea.Children) { if (tabToSwitchTo.TabPageControlledByTab != tabPage) { tabPage.Visible = false; } else { tabPage.Visible = true; } } tabToSwitchTo.TabPageControlledByTab.Visible = true; currentVisibleTab = tabToSwitchTo; OnTabIndexChanged(); Invalidate(); } }
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; }
private void Load(PrintItemWrapper printItem) { tabControl = new TabControl(); tabControl.TabBar.BorderColor = new RGBA_Bytes(0, 0, 0, 0); tabControl.TabBar.Padding = new BorderDouble(top: 6); RGBA_Bytes selectedTabColor; if (UserSettings.Instance.DisplayMode == ApplicationDisplayType.Responsive) { tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; selectedTabColor = ActiveTheme.Instance.TabLabelSelected; } else { tabControl.TabBar.BackgroundColor = ActiveTheme.Instance.TransparentLightOverlay; selectedTabColor = ActiveTheme.Instance.SecondaryAccentColor; } double buildHeight = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.build_height); // put in the 3D view partPreviewView = new View3DWidget(printItem, new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight), ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center), ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape), windowMode, autoRotate3DView, openMode); TabPage partPreview3DView = new TabPage(partPreviewView, string.Format("3D {0} ", "View".Localize()).ToUpper()); // put in the gcode view ViewGcodeBasic.WindowMode gcodeWindowMode = ViewGcodeBasic.WindowMode.Embeded; if (windowMode == View3DWidget.WindowMode.StandAlone) { gcodeWindowMode = ViewGcodeBasic.WindowMode.StandAlone; } viewGcodeBasic = new ViewGcodeBasic(printItem, new Vector3(ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.bed_size), buildHeight), ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.print_center), ActiveSliceSettings.Instance.GetValue<BedShape>(SettingsKey.bed_shape), gcodeWindowMode); if (windowMode == View3DWidget.WindowMode.StandAlone) { partPreviewView.Closed += (s, e) => Close(); viewGcodeBasic.Closed += (s, e) => Close(); } TabPage layerView = new TabPage(viewGcodeBasic, LocalizedString.Get("Layer View").ToUpper()); int tabPointSize = 16; // add the correct tabs based on whether we are stand alone or embedded Tab threeDViewTab; if (windowMode == View3DWidget.WindowMode.StandAlone || OsInformation.OperatingSystem == OSType.Android) { threeDViewTab = new SimpleTextTabWidget(partPreview3DView, "3D View Tab", tabPointSize, selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); tabControl.AddTab(threeDViewTab); layerViewTab = new SimpleTextTabWidget(layerView, "Layer View Tab", tabPointSize, selectedTabColor, new RGBA_Bytes(), ActiveTheme.Instance.TabLabelUnselected, new RGBA_Bytes()); tabControl.AddTab(layerViewTab); } else { threeDViewTab = new PopOutTextTabWidget(partPreview3DView, "3D View Tab", new Vector2(590, 400), tabPointSize); tabControl.AddTab(threeDViewTab); layerViewTab = new PopOutTextTabWidget(layerView, "Layer View Tab", new Vector2(590, 400), tabPointSize); tabControl.AddTab(layerViewTab); } threeDViewTab.ToolTipText = "Preview 3D Design".Localize(); layerViewTab.ToolTipText = "Preview layer Tool Paths".Localize(); this.AddChild(tabControl); }
private void SelectTab(Tab tabToSwitchTo) { tabBar.SelectTab(tabToSwitchTo); }