New styling for various new controls.

This commit is contained in:
Pieter-Jan Briers
2019-03-05 09:39:12 +01:00
parent 0030da78a6
commit 0bcb6adf6a
2 changed files with 104 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ namespace Content.Client.UserInterface
var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png"); var windowBackgroundTex = resCache.GetTexture("/Nano/window_background.png");
var windowBackground = new StyleBoxTexture var windowBackground = new StyleBoxTexture
{ {
Texture = windowBackgroundTex, Texture = windowBackgroundTex,
}; };
windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetPatchMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2);
windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2); windowBackground.SetExpandMargin(StyleBox.Margin.Horizontal | StyleBox.Margin.Bottom, 2);
@@ -77,6 +77,44 @@ namespace Content.Client.UserInterface
lineEdit.SetPatchMargin(StyleBox.Margin.All, 3); lineEdit.SetPatchMargin(StyleBox.Margin.All, 3);
lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); lineEdit.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
var tabContainerPanelTex = resCache.GetTexture("/Nano/tabcontainer_panel.png");
var tabContainerPanel = new StyleBoxTexture
{
Texture = tabContainerPanelTex,
};
tabContainerPanel.SetPatchMargin(StyleBox.Margin.All, 2);
var tabContainerBoxActive = new StyleBoxFlat {BackgroundColor = new Color(64, 64, 64)};
tabContainerBoxActive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 3);
var tabContainerBoxInactive = new StyleBoxFlat {BackgroundColor = new Color(32, 32, 32)};
tabContainerBoxInactive.SetContentMarginOverride(StyleBox.Margin.Horizontal, 3);
var vScrollBarGrabberNormal = new StyleBoxFlat
{
BackgroundColor = Color.Gray, ContentMarginLeftOverride = 10
};
var vScrollBarGrabberHover = new StyleBoxFlat
{
BackgroundColor = new Color(140, 140, 140), ContentMarginLeftOverride = 10
};
var vScrollBarGrabberGrabbed = new StyleBoxFlat
{
BackgroundColor = new Color(160, 160, 160), ContentMarginLeftOverride = 10
};
var hScrollBarGrabberNormal = new StyleBoxFlat
{
BackgroundColor = Color.Gray, ContentMarginTopOverride = 10
};
var hScrollBarGrabberHover = new StyleBoxFlat
{
BackgroundColor = new Color(140, 140, 140), ContentMarginTopOverride = 10
};
var hScrollBarGrabberGrabbed = new StyleBoxFlat
{
BackgroundColor = new Color(160, 160, 160), ContentMarginTopOverride = 10
};
Stylesheet = new Stylesheet(new[] Stylesheet = new Stylesheet(new[]
{ {
// Default font. // Default font.
@@ -185,6 +223,71 @@ namespace Content.Client.UserInterface
{ {
new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit), new StyleProperty(LineEdit.StylePropertyStyleBox, lineEdit),
}), }),
new StyleRule(
new SelectorElement(typeof(LineEdit), new[] {LineEdit.StyleClassLineEditNotEditable}, null, null),
new[]
{
new StyleProperty("font-color", new Color(192, 192, 192)),
}),
new StyleRule(new SelectorElement(typeof(LineEdit), null, null, LineEdit.StylePseudoClassPlaceholder),
new[]
{
new StyleProperty("font-color", Color.Gray),
}),
// TabContainer
new StyleRule(new SelectorElement(typeof(TabContainer), null, null, null),
new[]
{
new StyleProperty(TabContainer.StylePropertyPanelStyleBox, tabContainerPanel),
new StyleProperty(TabContainer.StylePropertyTabStyleBox, tabContainerBoxActive),
new StyleProperty(TabContainer.StylePropertyTabStyleBoxInactive, tabContainerBoxInactive),
}),
// Scroll bars
new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, null),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
vScrollBarGrabberNormal),
}),
new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, ScrollBar.StylePseudoClassHover),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
vScrollBarGrabberHover),
}),
new StyleRule(new SelectorElement(typeof(VScrollBar), null, null, ScrollBar.StylePseudoClassGrabbed),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
vScrollBarGrabberGrabbed),
}),
new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, null),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
hScrollBarGrabberNormal),
}),
new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, ScrollBar.StylePseudoClassHover),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
hScrollBarGrabberHover),
}),
new StyleRule(new SelectorElement(typeof(HScrollBar), null, null, ScrollBar.StylePseudoClassGrabbed),
new[]
{
new StyleProperty(ScrollBar.StylePropertyGrabber,
hScrollBarGrabberGrabbed),
}),
}); });
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B