Use new tab styling

- Issue MatterHackers/MCCentral#2607
Use new tab styling for DockingTabs
This commit is contained in:
John Lewin 2018-01-08 13:38:47 -08:00
parent f78aaa0920
commit a4f86cccda
4 changed files with 30 additions and 27 deletions

View file

@ -157,7 +157,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
this.RemoveAllChildren();
TabControl tabControl = null;
SimpleTabs tabControl = null;
if (this.ControlIsPinned)
{
var resizePage = new ResizeContainer(this)
@ -168,7 +168,18 @@ namespace MatterHackers.MatterControl.CustomWidgets
SplitterWidth = theme.SplitterWidth,
};
tabControl = theme.CreateTabControl();
tabControl = new SimpleTabs(this.CreatePinButton(), theme)
{
VAnchor = VAnchor.Stretch,
HAnchor = HAnchor.Stretch,
};
tabControl.TabBar.BackgroundColor = theme.ActiveTabColor.AdjustLightness(0.9).ToColor();
tabControl.ActiveTabChanged += (s, e) =>
{
printer.ViewState.SliceSettingsTabIndex = tabControl.SelectedTabIndex;
};
resizePage.AddChild(tabControl);
this.AddChild(resizePage);
@ -183,24 +194,19 @@ namespace MatterHackers.MatterControl.CustomWidgets
{
var content = new DockingWindowContent(this, nameWidget.Value, tabTitle);
var tabPage = new TabPage(content, tabTitle);
var textTab = new TextTab(
tabPage,
tabTitle + " Tab",
12,
ActiveTheme.Instance.TabLabelSelected,
Color.Transparent,
ActiveTheme.Instance.TabLabelUnselected,
Color.Transparent,
useUnderlineStyling: true);
tabControl.AddTab(textTab);
int localTabIndex = tabIndex;
textTab.Click += (s, e) =>
{
printer.ViewState.SliceSettingsTabIndex = localTabIndex;
};
tabControl.AddTab(
new ToolTab(
tabTitle,
tabControl,
content,
theme,
hasClose: false,
pointSize: theme.FontSize11)
{
Name = tabTitle + " Tab",
InactiveTabColor = Color.Transparent,
ActiveTabColor = theme.TabBodyBackground
});
}
else // control is floating
{
@ -291,9 +297,6 @@ namespace MatterHackers.MatterControl.CustomWidgets
if (this.ControlIsPinned)
{
tabControl.TabBar.AddChild(new HorizontalSpacer());
tabControl.TabBar.AddChild(this.CreatePinButton());
tabControl.TabBar.Padding = new BorderDouble(right: theme.ToolbarPadding.Right);
if (printer.ViewState.SliceSettingsTabIndex < tabControl.TabCount)

View file

@ -139,8 +139,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
public Color InactiveTabColor { get; set; }
public Color ActiveTabColor { get; set; }
public ToolTab(string tabLabel, SimpleTabs parentTabControl, GuiWidget tabContent, ThemeConfig theme, string tabImageUrl = null, bool hasClose = true)
: base(tabLabel, parentTabControl, tabContent, theme, tabImageUrl, hasClose, theme.FontSize10)
public ToolTab(string tabLabel, SimpleTabs parentTabControl, GuiWidget tabContent, ThemeConfig theme, string tabImageUrl = null, bool hasClose = true, int pointSize = -1)
: base(tabLabel, parentTabControl, tabContent, theme, tabImageUrl, hasClose, pointSize: (pointSize == -1) ? theme.FontSize10 : pointSize)
{
tabPill.Padding = tabPill.Padding.Clone(top: 9, bottom: 10);
}

View file

@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public int TabCount => _allTabs.Count;
public void AddTab(GuiWidget tabWidget, int position)
public void AddTab(GuiWidget tabWidget, int position = -1)
{
var iTab = tabWidget as ITab;

View file

@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
HAnchor = HAnchor.Stretch,
MinimumSize = new Vector2(200, 200)
};
primaryTabControl.TabBar.BackgroundColor = theme.ActiveTabColor.AdjustLightness(0.85).ToColor();
primaryTabControl.TabBar.BackgroundColor = theme.ActiveTabColor.AdjustLightness(0.9).ToColor();
for (int topCategoryIndex = 0; topCategoryIndex < SliceSettingsOrganizer.Instance.UserLevels[UserLevel].CategoriesList.Count; topCategoryIndex++)
{