Adds side-open button styles.

This commit is contained in:
Pieter-Jan Briers
2020-07-17 12:06:52 +02:00
parent d6b772adcc
commit 37a893c8ad
4 changed files with 185 additions and 41 deletions

View File

@@ -1,7 +1,9 @@
using Content.Client.Utility;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Shared.Maths;
namespace Content.Client.UserInterface.Stylesheets
{
@@ -11,11 +13,18 @@ namespace Content.Client.UserInterface.Stylesheets
public const string StyleClassLabelHeading = "LabelHeading";
public const string StyleClassLabelSubText = "LabelSubText";
public const string ButtonOpenRight = "OpenRight";
public const string ButtonOpenLeft = "OpenLeft";
public const string ButtonOpenBoth = "OpenBoth";
public abstract Stylesheet Stylesheet { get; }
protected StyleRule[] BaseRules { get; }
protected StyleBoxTexture BaseButton { get; }
protected StyleBoxTexture BaseButtonOpenRight { get; }
protected StyleBoxTexture BaseButtonOpenLeft { get; }
protected StyleBoxTexture BaseButtonOpenBoth { get; }
protected StyleBase(IResourceCache resCache)
{
@@ -32,6 +41,31 @@ namespace Content.Client.UserInterface.Stylesheets
BaseButton.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
BaseButton.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14);
BaseButtonOpenRight = new StyleBoxTexture(BaseButton)
{
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((0, 0), (14, 24))),
};
BaseButtonOpenRight.SetPatchMargin(StyleBox.Margin.Right, 0);
BaseButtonOpenRight.SetContentMarginOverride(StyleBox.Margin.Right, 8);
BaseButtonOpenRight.SetPadding(StyleBox.Margin.Right, 2);
BaseButtonOpenLeft = new StyleBoxTexture(BaseButton)
{
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (14, 24))),
};
BaseButtonOpenLeft.SetPatchMargin(StyleBox.Margin.Left, 0);
BaseButtonOpenLeft.SetContentMarginOverride(StyleBox.Margin.Left, 8);
BaseButtonOpenLeft.SetPadding(StyleBox.Margin.Left, 1);
BaseButtonOpenBoth = new StyleBoxTexture(BaseButton)
{
Texture = new AtlasTexture(buttonTex, UIBox2.FromDimensions((10, 0), (3, 24))),
};
BaseButtonOpenBoth.SetPatchMargin(StyleBox.Margin.Horizontal, 0);
BaseButtonOpenBoth.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
BaseButtonOpenBoth.SetPadding(StyleBox.Margin.Right, 2);
BaseButtonOpenBoth.SetPadding(StyleBox.Margin.Left, 1);
BaseRules = new[]
{
// Default font.