diff --git a/SnowyPeak.Duality.Plugins.YAUI/Appearance.cs b/SnowyPeak.Duality.Plugins.YAUI/Appearance.cs index fe1fe13..e69e4f2 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Appearance.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Appearance.cs @@ -1,16 +1,9 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; using Duality.Editor; using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls; using SnowyPeak.Duality.Plugins.YAUI.Properties; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI { @@ -20,10 +13,10 @@ public class Appearance : Resource { public static readonly Appearance DEFAULT = new Appearance(); - public ContentRef Active; - public ContentRef Disabled; - public ContentRef Hover; - public ContentRef Normal; + public ContentRef Active { get; set; } + public ContentRef Disabled { get; set; } + public ContentRef Hover { get; set; } + public ContentRef Normal { get; set; } public Border Border { get; set; } public Appearance() @@ -39,11 +32,11 @@ public Material this[Control.ControlStatus status] { get { - if ((status & Control.ControlStatus.Disabled) != Control.ControlStatus.None) + if (status.HasFlag(Control.ControlStatus.Disabled)) { return this.Disabled.Res; } - else if ((status & Control.ControlStatus.Active) != Control.ControlStatus.None) + else if (status.HasFlag(Control.ControlStatus.Active)) { return this.Active.Res; } - else if ((status & Control.ControlStatus.Hover) != Control.ControlStatus.None) + else if (status.HasFlag(Control.ControlStatus.Hover)) { return this.Hover.Res; } else { return this.Normal.Res; } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Border.cs b/SnowyPeak.Duality.Plugins.YAUI/Border.cs index ff6beb6..7fe423c 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Border.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Border.cs @@ -1,10 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI { @@ -12,30 +7,15 @@ public struct Border { public static readonly Border Zero = new Border(0); - public float Bottom; - public float Left; - public float Right; - public float Top; + public float Bottom { get; set; } + public float Left { get; set; } + public float Right { get; set; } + public float Top { get; set; } - public Vector2 BottomRight - { - get { return new Vector2(this.Right, this.Bottom); } - } - - public Vector2 TopLeft - { - get { return new Vector2(this.Left, this.Top); } - } - - public float Horizontal - { - get { return this.Left + this.Right; } - } - - public float Vertical - { - get { return this.Top + this.Bottom; } - } + public Vector2 BottomRight => new Vector2(this.Right, this.Bottom); + public Vector2 TopLeft => new Vector2(this.Left, this.Top); + public float Horizontal => this.Left + this.Right; + public float Vertical => this.Top + this.Bottom; public Border(float value) : this(value, value, value, value) diff --git a/SnowyPeak.Duality.Plugins.YAUI/CellInfo.cs b/SnowyPeak.Duality.Plugins.YAUI/CellInfo.cs index ddf74b4..b7028f6 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/CellInfo.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/CellInfo.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - +// This code is provided under the MIT license. Originally by Alessandro Pilati. namespace SnowyPeak.Duality.Plugins.YAUI { public struct CellInfo { - public int ColSpan; - public int Column; - public int Row; - public int RowSpan; + public int ColSpan { get; set; } + public int Column { get; set; } + public int Row { get; set; } + public int RowSpan { get; set; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Button.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Button.cs index d8e0f69..ed2e30e 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Button.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Button.cs @@ -2,14 +2,8 @@ using Duality; using Duality.Drawing; using Duality.Input; -using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -46,7 +40,7 @@ protected override void Init() public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - this.TextConfiguration = this.Template.TextConfiguration.Clone(); + this.TextConfiguration = this.Template.TextConfiguration; } protected override void _Draw(Canvas canvas, float zOffset) diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/CanvasPanel.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/CanvasPanel.cs index f27604e..ead98dc 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/CanvasPanel.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/CanvasPanel.cs @@ -1,11 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -16,8 +10,8 @@ public class CanvasPanel : ControlsContainer public Vector2 Offset; #pragma warning restore S1104 // Fields should not have public accessibility - public CanvasPanel(Skin skin = null, string templateName = null) - : base(skin, templateName) + public CanvasPanel(Skin skin = null, string templateName = null, bool drawSelf = true) + : base(skin, templateName, drawSelf) { } internal override void _LayoutControls() diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/CheckButton.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/CheckButton.cs index 04ef38c..39bc238 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/CheckButton.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/CheckButton.cs @@ -5,11 +5,6 @@ using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -28,6 +23,8 @@ public bool Checked } } + public bool UseToggleStyle { get; set; } + public GlyphConfiguration GlyphConfiguration { get; set; } // Delegates @@ -65,14 +62,26 @@ private void CheckButton_OnMouseButton(IInteractiveControl button, MouseButtonEv public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - this.GlyphConfiguration = this.Template.GlyphConfiguration.Clone(); + this.GlyphConfiguration = this.Template.GlyphConfiguration; + } + + public override void OnUpdate(float msFrame) + { + base.OnUpdate(msFrame); + + if (this.UseToggleStyle) + { + if (this.Checked) this.Status |= ControlStatus.Active; + else this.Status &= ~ControlStatus.Active; + } } protected override void _Draw(Canvas canvas, float zOffset) { base._Draw(canvas, zOffset); - if (this.GlyphConfiguration.Glyph.IsAvailable && + if (!this.UseToggleStyle && + this.GlyphConfiguration.Glyph.IsAvailable && this.GlyphConfiguration.Glyph.Res.MainTexture.IsAvailable && this.Checked) { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/CompositeControl.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/CompositeControl.cs index 9a7b0fd..6bf5176 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/CompositeControl.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/CompositeControl.cs @@ -2,11 +2,6 @@ using Duality; using Duality.Drawing; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/GlyphConfiguration.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/GlyphConfiguration.cs index 46c2571..65895df 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/GlyphConfiguration.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/GlyphConfiguration.cs @@ -10,10 +10,8 @@ namespace SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration { - public sealed class GlyphConfiguration + public struct GlyphConfiguration { - public static readonly GlyphConfiguration DEFAULT = new GlyphConfiguration(); - public Alignment Alignment { get; set; } public ContentRef Glyph { get; set; } public Border Margin { get; set; } @@ -24,15 +22,9 @@ public GlyphConfiguration(ContentRef? glyph = null, Alignment alignmen this.Alignment = alignment; this.Margin = margin ?? Border.Zero; } - - public GlyphConfiguration Clone() - { - return new GlyphConfiguration() - { - Glyph = this.Glyph, - Alignment = this.Alignment, - Margin = this.Margin - }; - } + + public void SetAlignment(Alignment alignment) { this.Alignment = alignment; } + public void SetGlyph(ContentRef glyph) { this.Glyph = glyph; } + public void SetMargin(Border margin) { this.Margin = margin; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ListBoxConfiguration.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ListBoxConfiguration.cs index c8bd265..1909a5c 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ListBoxConfiguration.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ListBoxConfiguration.cs @@ -8,9 +8,8 @@ namespace SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration { - public sealed class ListBoxConfiguration + public struct ListBoxConfiguration { - public static readonly ListBoxConfiguration DEFAULT = new ListBoxConfiguration(); public static readonly Size DEFAULT_ITEMS_SIZE = new Size(20); public ContentRef ItemAppearance { get; set; } @@ -22,13 +21,7 @@ public ListBoxConfiguration(ContentRef? itemAppearance = null, Size? this.ItemAppearance = itemAppearance ?? Appearance.DEFAULT; } - public ListBoxConfiguration Clone() - { - return new ListBoxConfiguration() - { - ItemsSize = this.ItemsSize, - ItemAppearance = this.ItemAppearance - }; - } + public void SetItemAppearance(ContentRef appearance) { this.ItemAppearance = appearance; } + public void SetitemSize(Size size) { this.ItemsSize = size; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ProgressConfiguration.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ProgressConfiguration.cs index 4f35331..a098240 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ProgressConfiguration.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ProgressConfiguration.cs @@ -10,10 +10,8 @@ namespace SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration { - public sealed class ProgressConfiguration + public struct ProgressConfiguration { - public static readonly ProgressConfiguration DEFAULT = new ProgressConfiguration(); - public ContentRef BarAppearance { get; set; } public ProgressBar.BarStyle BarStyle { get; set; } @@ -28,15 +26,9 @@ public ProgressConfiguration(ContentRef? barAppearance = null, Direc this.Margin = margin ?? Border.Zero; } - public ProgressConfiguration Clone() - { - return new ProgressConfiguration() - { - BarAppearance = this.BarAppearance, - Direction = this.Direction, - BarStyle = this.BarStyle, - Margin = this.Margin - }; - } + public void SetBarAppearance(ContentRef appearance) { this.BarAppearance = appearance; } + public void SetBarStyle(ProgressBar.BarStyle style) { this.BarStyle = style; } + public void SetDirection(Direction direction) { this.Direction = direction; } + public void SetMargin(Border margin) { this.Margin = margin; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ScrollBarConfiguration.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ScrollBarConfiguration.cs index 6722603..9513363 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ScrollBarConfiguration.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/ScrollBarConfiguration.cs @@ -8,9 +8,8 @@ namespace SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration { - public sealed class ScrollBarConfiguration + public struct ScrollBarConfiguration { - public static readonly ScrollBarConfiguration DEFAULT = new ScrollBarConfiguration(); public static readonly Size DEFAULT_BUTTON_SIZE = new Size(10); public static readonly Size DEFAULT_CURSOR_SIZE = new Size(10); @@ -31,16 +30,10 @@ public ScrollBarConfiguration(ContentRef? buttonIncreaseAppearance = this.CursorAppearance = cursorAppearance ?? Appearance.DEFAULT; } - public ScrollBarConfiguration Clone() - { - return new ScrollBarConfiguration() - { - ButtonsSize = this.ButtonsSize, - CursorSize = this.CursorSize, - ButtonIncreaseAppearance = this.ButtonIncreaseAppearance, - ButtonDecreaseAppearance = this.ButtonDecreaseAppearance, - CursorAppearance = this.CursorAppearance - }; - } + public void SetButtonDecreaseAppearance(ContentRef appearance) { this.ButtonDecreaseAppearance = appearance; } + public void SetButtonIncreaseAppearance(ContentRef appearance) { this.ButtonIncreaseAppearance = appearance; } + public void SetCursorAppearance(ContentRef appearance) { this.CursorAppearance = appearance; } + public void SetButtonsSize(Size size) { this.ButtonsSize = size; } + public void SetCursorSize(Size size) { this.CursorSize = size; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/TextConfiguration.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/TextConfiguration.cs index ab0db9f..301a4c7 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/TextConfiguration.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Configuration/TextConfiguration.cs @@ -10,14 +10,12 @@ namespace SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration { - public sealed class TextConfiguration + public struct TextConfiguration { - public static readonly TextConfiguration DEFAULT = new TextConfiguration(); - - public Alignment Alignment { get; set; } - public ColorRgba Color { get; set; } - public ContentRef Font { get; set; } - public Border Margin { get; set; } + public Alignment Alignment { get; private set; } + public ColorRgba Color { get; private set; } + public ContentRef Font { get; private set; } + public Border Margin { get; private set; } public TextConfiguration(ContentRef? font = null, ColorRgba? color = null, Alignment alignment = Alignment.Center, Border? margin = null) { @@ -27,15 +25,9 @@ public TextConfiguration(ContentRef? font = null, ColorRgba? color = null, this.Margin = margin ?? Border.Zero; } - public TextConfiguration Clone() - { - return new TextConfiguration() - { - Font = this.Font, - Color = this.Color, - Alignment = this.Alignment, - Margin = this.Margin - }; - } + public void SetAlignment(Alignment alignment) { this.Alignment = alignment; } + public void SetColor(ColorRgba color) { this.Color = color; } + public void SetFont(ContentRef font) { this.Font = font; } + public void SetMargin(Border margin) { this.Margin = margin; } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Control.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Control.cs index a36fe26..525b08a 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Control.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Control.cs @@ -1,14 +1,10 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; using Duality.Drawing; -using Duality.Input; using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Templates; using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -39,8 +35,8 @@ public enum ControlVisibility public Size Size; #pragma warning restore S1104 // Fields should not have public accessibility - protected const float INNER_ZOFFSET = -0.00001f; - protected const float LAYOUT_ZOFFSET = -0.0001f; + protected const float INNER_ZOFFSET = -0.001f; + protected const float LAYOUT_ZOFFSET = -0.01f; protected readonly RawList vertices = new RawList(36); protected Skin skin; diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ControlsContainer.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ControlsContainer.cs index 32c41e8..8dbef54 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ControlsContainer.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ControlsContainer.cs @@ -5,20 +5,21 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { - public abstract class ControlsContainer : Control, ILayout + public abstract class ControlsContainer : Control, ILayout { public bool IsPassthrough { get; set; } protected readonly List children = new List(); - protected ControlsContainer(Skin skin, string templateName) + protected ControlsContainer(Skin skin, string templateName, bool drawSelf) : base(skin, templateName) - { } + { + if (!drawSelf) + this.Appearance = null; + } protected override void Init() { @@ -42,7 +43,7 @@ public void ApplySkinSingle(Skin skin) public ControlsContainer Add(Control child) { if (this.children.Contains(child)) - { throw new InvalidOperationException(string.Format("Duplicate control {0} in parent {1}", child, this)); } + throw new InvalidOperationException(string.Format("Duplicate control {0} in parent {1}", child, this)); else { // check that I am not introducing a circular ancestry @@ -50,7 +51,7 @@ public ControlsContainer Add(Control child) while (cc != null) { if (cc == child) - { throw new InvalidOperationException(string.Format("Circular ancestry between {0} and {1}", child, this)); } + throw new InvalidOperationException(string.Format("Circular ancestry between {0} and {1}", child, this)); cc = cc.Parent; } @@ -89,10 +90,10 @@ public Control FindHoveredControl(Vector2 position) c.ControlArea.Contains(position)); if (result is ILayout il) - { result = il.FindHoveredControl(position); } + result = il.FindHoveredControl(position); if (result == null && !this.IsPassthrough) - { result = this; } + result = this; return result; } @@ -105,7 +106,7 @@ public IEnumerable GetChildren() where T : Control public void LayoutControls() { foreach (Control c in this.children) - { c.ActualSize = c.Visibility == ControlVisibility.Collapsed ? Size.Zero : c.Size; } + c.ActualSize = c.Visibility == ControlVisibility.Collapsed ? Size.Zero : c.Size; this._LayoutControls(); @@ -123,7 +124,7 @@ public override void OnUpdate(float msFrame) base.OnUpdate(msFrame); foreach (Control c in this.children) - { c.OnUpdate(msFrame); } + c.OnUpdate(msFrame); } public ControlsContainer Remove(Control child) diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/DockPanel.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/DockPanel.cs index aa8e232..0d50e9a 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/DockPanel.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/DockPanel.cs @@ -1,25 +1,18 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. -using Duality; -using Duality.Drawing; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { public sealed class DockPanel : ControlsContainer { - public DockPanel(Skin skin = null, string templateName = null) - : base(skin, templateName) + public DockPanel(Skin skin = null, string templateName = null, bool drawSelf = true) + : base(skin, templateName, drawSelf) { } internal override void _LayoutControls() { Border centralArea = this.Margin; - foreach (Control c in this.children.Where(c => c.Docking != Dock.Center)) + foreach (Control c in this.children) { switch (c.Docking) { @@ -73,20 +66,23 @@ internal override void _LayoutControls() } } - foreach (Control c in this.children.Where(c => c.Docking == Dock.Center)) + foreach (Control c in this.children) { - if (c.StretchToFill) + if (c.Docking == Dock.Center) { - c.ActualSize.X = this.ActualSize.X - centralArea.Left - centralArea.Right; - c.ActualSize.Y = this.ActualSize.Y - centralArea.Top - centralArea.Bottom; + if (c.StretchToFill) + { + c.ActualSize.X = this.ActualSize.X - centralArea.Left - centralArea.Right; + c.ActualSize.Y = this.ActualSize.Y - centralArea.Top - centralArea.Bottom; - c.ActualPosition.X = centralArea.Left; - c.ActualPosition.Y = centralArea.Top; - } - else - { - c.ActualPosition.X = centralArea.Left + ((this.ActualSize.X - centralArea.Left - centralArea.Right - c.ActualSize.X) / 2); - c.ActualPosition.Y = centralArea.Top + ((this.ActualSize.Y - centralArea.Top - centralArea.Bottom - c.ActualSize.Y) / 2); + c.ActualPosition.X = centralArea.Left; + c.ActualPosition.Y = centralArea.Top; + } + else + { + c.ActualPosition.X = centralArea.Left + ((this.ActualSize.X - centralArea.Left - centralArea.Right - c.ActualSize.X) / 2); + c.ActualPosition.Y = centralArea.Top + ((this.ActualSize.Y - centralArea.Top - centralArea.Bottom - c.ActualSize.Y) / 2); + } } } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/GridPanel.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/GridPanel.cs index 4c08760..a1be07c 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/GridPanel.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/GridPanel.cs @@ -1,11 +1,8 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -58,8 +55,8 @@ private IEnumerable ParseDimensions(IEnumerable value) }); } - public GridPanel(Skin skin = null, string templateName = null) - : base(skin, templateName) + public GridPanel(Skin skin = null, string templateName = null, bool drawSelf = true) + : base(skin, templateName, drawSelf) { } internal override void _LayoutControls() @@ -70,7 +67,7 @@ internal override void _LayoutControls() float variableRows = 0; float variableColumns = 0; - foreach(Dimension row in this.rows) + foreach (Dimension row in this.rows) { if (row.IsVariable) variableRows += row.Value; diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/HorizontalScrollBar.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/HorizontalScrollBar.cs index e7af36d..8b04bf5 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/HorizontalScrollBar.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/HorizontalScrollBar.cs @@ -1,13 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; -using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/IInteractiveControl.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/IInteractiveControl.cs index 0a2bac3..5a4f0fe 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/IInteractiveControl.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/IInteractiveControl.cs @@ -1,11 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. -using Duality; using Duality.Input; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ILayout.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ILayout.cs index 6d38c7a..df3bded 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ILayout.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ILayout.cs @@ -1,10 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/InteractiveControl.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/InteractiveControl.cs index f8dfa05..612a415 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/InteractiveControl.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/InteractiveControl.cs @@ -1,14 +1,7 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; using Duality.Input; -using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ListBox.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ListBox.cs index 18f806d..46d1912 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ListBox.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ListBox.cs @@ -6,8 +6,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -50,7 +48,7 @@ public TextConfiguration TextConfiguration foreach (ToggleButton tb in this.toggleButtons) { tb.ApplySkin(this.skin); - tb.TextConfiguration = this.textConfiguration.Clone(); + tb.TextConfiguration = this.textConfiguration; } } } @@ -79,8 +77,8 @@ public override void ApplySkin(Skin skin) { this.scrollBar.ApplySkin(this.skin); - this.ListBoxConfiguration = this.Template.ListBoxConfiguration.Clone(); - this.TextConfiguration = this.Template.TextConfiguration.Clone(); + this.ListBoxConfiguration = this.Template.ListBoxConfiguration; + this.TextConfiguration = this.Template.TextConfiguration; } } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ProgressBar.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ProgressBar.cs index d893294..621a08c 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ProgressBar.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ProgressBar.cs @@ -4,11 +4,6 @@ using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -41,8 +36,8 @@ public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - this.ProgressConfiguration = this.Template.ProgressConfiguration.Clone(); - this.TextConfiguration = this.Template.TextConfiguration.Clone(); + this.ProgressConfiguration = this.Template.ProgressConfiguration; + this.TextConfiguration = this.Template.TextConfiguration; } protected override void _Draw(Canvas canvas, float zOffset) diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/RadioButton.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/RadioButton.cs index 08c3f72..e2e3295 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/RadioButton.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/RadioButton.cs @@ -1,14 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. -using Duality; -using Duality.Drawing; using Duality.Input; -using Duality.Resources; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -42,7 +33,7 @@ private void RadioButton_OnMouseButton(IInteractiveControl button, MouseButtonEv if (args.Button == MouseButton.Left && args.IsPressed) { foreach (RadioButton rb in UIHelper.GetRadioButtonsInGroup(this.RadioGroup)) - { rb.Checked = false; } + rb.Checked = false; this.Checked = true; } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Renderer.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Renderer.cs index a46729f..5a7f424 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Renderer.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Renderer.cs @@ -2,12 +2,6 @@ using Duality; using Duality.Drawing; using Duality.Resources; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ScrollBar.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ScrollBar.cs index 450a3a0..bb59406 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ScrollBar.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ScrollBar.cs @@ -1,14 +1,9 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; using Duality.Input; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -89,6 +84,8 @@ public int Value public bool AllowDrag { get; set; } + public bool AllowButtons { get; set; } + // Delegates public delegate void ValueChangeEventDelegate(ScrollBar scrollBar, int oldValue, int newValue); // Events @@ -119,7 +116,7 @@ public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - this.ScrollBarConfiguration = this.Template.ScrollBarConfiguration.Clone(); + this.ScrollBarConfiguration = this.Template.ScrollBarConfiguration; this.Margin = this.Template.ScrollBarMargin; } diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/Separator.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/Separator.cs index c7a3f7e..4024f32 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/Separator.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/Separator.cs @@ -1,12 +1,4 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. -using Duality; -using Duality.Drawing; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/SpriteBox.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/SpriteBox.cs index e838280..0107763 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/SpriteBox.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/SpriteBox.cs @@ -1,15 +1,8 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; using Duality.Drawing; -using Duality.Input; using Duality.Resources; -using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; -using SnowyPeak.Duality.Plugins.YAUI.Templates; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/StackPanel.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/StackPanel.cs index 354b5ff..1e873de 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/StackPanel.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/StackPanel.cs @@ -1,12 +1,4 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. -using Duality; -using Duality.Drawing; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace SnowyPeak.Duality.Plugins.YAUI.Controls { public sealed class StackPanel : ControlsContainer @@ -20,8 +12,8 @@ public enum Stacking private float start; public Direction Direction { get; set; } - public StackPanel(Skin skin = null, string templateName = null) - : base(skin, templateName) + public StackPanel(Skin skin = null, string templateName = null, bool drawSelf = true) + : base(skin, templateName, drawSelf) { } internal override void _LayoutControls() diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBlock.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBlock.cs index 1f8ccb8..9cff3e3 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBlock.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBlock.cs @@ -1,15 +1,8 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; using Duality.Drawing; -using Duality.Input; -using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -35,8 +28,7 @@ public TextBlock(Skin skin = null, string templateName = null) public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - - this.TextConfiguration = this.Template.TextConfiguration.Clone(); + this.TextConfiguration = this.Template.TextConfiguration; } protected override void _Draw(Canvas canvas, float zOffset) diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBox.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBox.cs index e9eb1d0..2859b96 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBox.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/TextBox.cs @@ -2,14 +2,8 @@ using Duality; using Duality.Drawing; using Duality.Input; -using Duality.Resources; using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { @@ -68,7 +62,7 @@ public override void ApplySkin(Skin skin) { base.ApplySkin(skin); - this.TextConfiguration = this.Template.TextConfiguration.Clone(); + this.TextConfiguration = this.Template.TextConfiguration; } protected override void _Draw(Canvas canvas, float zOffset) diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/ToggleButton.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/ToggleButton.cs index 3ec8ca8..88c8e73 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/ToggleButton.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/ToggleButton.cs @@ -1,15 +1,6 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; using Duality.Input; -using Duality.Resources; -using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/Controls/VerticalScrollBar.cs b/SnowyPeak.Duality.Plugins.YAUI/Controls/VerticalScrollBar.cs index dc40074..e56cba1 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/Controls/VerticalScrollBar.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/Controls/VerticalScrollBar.cs @@ -1,13 +1,5 @@ // This code is provided under the MIT license. Originally by Alessandro Pilati. using Duality; -using Duality.Drawing; -using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; -using SnowyPeak.Duality.Plugins.YAUI.Templates; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace SnowyPeak.Duality.Plugins.YAUI.Controls { diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Dark.cs b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Dark.cs index 32a88db..ae757ea 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Dark.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Dark.cs @@ -170,13 +170,12 @@ protected override void Initialize() { Appearance = baseAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Left, - Color = COLOR_ACCENT, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: COLOR_ACCENT, + alignment: Alignment.Left, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(TextBlock), baseTemplate); this.AddDefaultTemplate(typeof(SpriteBox), baseTemplate); @@ -185,13 +184,12 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Left, - Color = COLOR_ACCENT, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: COLOR_ACCENT, + alignment: Alignment.Left, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(Button), buttonTemplate); this.AddDefaultTemplate(typeof(ToggleButton), buttonTemplate); @@ -201,12 +199,11 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - GlyphConfiguration = new GlyphConfiguration() - { - Glyph = matGlyph, - Margin = new Border(5), - Alignment = Alignment.Right - }, + GlyphConfiguration = new GlyphConfiguration( + glyph: matGlyph, + alignment: Alignment.Right, + margin: new Border(5) + ), TextConfiguration = buttonTemplate.TextConfiguration }; this.AddDefaultTemplate(typeof(CheckButton), glyphTemplate); @@ -217,14 +214,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(18), ScrollBarMargin = new Border(1), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarUpAppearance, - ButtonIncreaseAppearance = scrollBarDownAppearance, - CursorAppearance = buttonAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(12, 36) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarDownAppearance, + buttonDecreaseAppearance: scrollBarUpAppearance, + cursorAppearance: buttonAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(12, 36) + ) }; this.AddDefaultTemplate(typeof(VerticalScrollBar), vScrollBarTemplate); @@ -233,14 +229,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(18), ScrollBarMargin = new Border(1), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarLeftAppearance, - ButtonIncreaseAppearance = scrollBarRightAppearance, - CursorAppearance = buttonAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(36, 12) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarDownAppearance, + buttonDecreaseAppearance: scrollBarUpAppearance, + cursorAppearance: buttonAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(36, 12) + ) }; this.AddDefaultTemplate(typeof(HorizontalScrollBar), hScrollBarTemplate); @@ -248,11 +243,10 @@ protected override void Initialize() { Appearance = backgroundAppearance, MinSize = new Size(4), - ListBoxConfiguration = new ListBoxConfiguration() - { - ItemAppearance = buttonAppearance, - ItemsSize = new Size(20) - }, + ListBoxConfiguration = new ListBoxConfiguration( + itemAppearance: buttonAppearance, + itemsSize: new Size(20) + ), TextConfiguration = buttonTemplate.TextConfiguration, ListBoxMargin = new Border(2) }; diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fathoms.cs b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fathoms.cs index 2b76f3f..7af71dc 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fathoms.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fathoms.cs @@ -113,13 +113,12 @@ protected override void Initialize() { Appearance = baseAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Center, - Color = COLOR_ACCENT, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: COLOR_ACCENT, + alignment: Alignment.Center, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(TextBlock), baseTemplate); this.AddDefaultTemplate(typeof(SpriteBox), baseTemplate); @@ -128,13 +127,12 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Center, - Color = COLOR_ACCENT, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: COLOR_ACCENT, + alignment: Alignment.Center, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(Button), buttonTemplate); this.AddDefaultTemplate(typeof(ToggleButton), buttonTemplate); @@ -144,12 +142,11 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - GlyphConfiguration = new GlyphConfiguration() - { - Glyph = matGlyph, - Margin = new Border(5), - Alignment = Alignment.Right - }, + GlyphConfiguration = new GlyphConfiguration( + glyph: matGlyph, + alignment: Alignment.Right, + margin: new Border(5) + ), TextConfiguration = buttonTemplate.TextConfiguration }; this.AddDefaultTemplate(typeof(CheckButton), glyphTemplate); @@ -160,14 +157,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(18), ScrollBarMargin = new Border(1), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarButtonAppearance, - ButtonIncreaseAppearance = scrollBarButtonAppearance, - CursorAppearance = buttonAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(16, 24) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarButtonAppearance, + buttonDecreaseAppearance: scrollBarButtonAppearance, + cursorAppearance: buttonAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(16, 24) + ) }; this.AddDefaultTemplate(typeof(VerticalScrollBar), vScrollBarTemplate); @@ -176,14 +172,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(18), ScrollBarMargin = new Border(1), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarButtonAppearance, - ButtonIncreaseAppearance = scrollBarButtonAppearance, - CursorAppearance = buttonAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(24, 16) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarButtonAppearance, + buttonDecreaseAppearance: scrollBarButtonAppearance, + cursorAppearance: buttonAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(24, 16) + ) }; this.AddDefaultTemplate(typeof(HorizontalScrollBar), hScrollBarTemplate); @@ -191,11 +186,10 @@ protected override void Initialize() { Appearance = backgroundAppearance, MinSize = new Size(4), - ListBoxConfiguration = new ListBoxConfiguration() - { - ItemAppearance = buttonAppearance, - ItemsSize = new Size(20) - }, + ListBoxConfiguration = new ListBoxConfiguration( + itemAppearance: buttonAppearance, + itemsSize: new Size(20) + ), TextConfiguration = buttonTemplate.TextConfiguration, ListBoxMargin = new Border(2) }; diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma.cs b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma.cs new file mode 100644 index 0000000..de89e19 --- /dev/null +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma.cs @@ -0,0 +1,160 @@ +// This code is provided under the MIT license. Originally by Alessandro Pilati. +using Duality; +using Duality.Drawing; +using Duality.Resources; +using SnowyPeak.Duality.Plugins.YAUI.Controls; +using SnowyPeak.Duality.Plugins.YAUI.Controls.Configuration; +using SnowyPeak.Duality.Plugins.YAUI.Templates; + +namespace SnowyPeak.Duality.Plugins.YAUI.DefaultSkins +{ + public sealed class Figma : Skin + { + public static readonly ColorRgba COLOR_ACCENT = new ColorRgba(133, 141, 142); + public static readonly ColorRgba COLOR_BACKGROUND = new ColorRgba(5, 5, 5); + public static readonly ColorRgba COLOR_BRIGHT = new ColorRgba(45, 45, 45); + public static readonly ColorRgba COLOR_CONTROL = new ColorRgba(30, 30, 30); + public static readonly ColorRgba COLOR_DULL = new ColorRgba(20, 20, 20); + public static readonly ColorRgba COLOR_HIGHLIGHT = new ColorRgba(53, 60, 65); + + protected override void Initialize() + { + ContentRef fntFont = ResourceHelper.LoadFont(YAUICorePlugin.YAUIAssembly, Fonts.ManropeRegular); + + this.AddDefaultTemplate(typeof(ControlsContainer), ControlTemplate.Empty); + this.AddDefaultTemplate(typeof(CanvasPanel), ControlTemplate.Empty); + this.AddDefaultTemplate(typeof(DockPanel), ControlTemplate.Empty); + this.AddDefaultTemplate(typeof(GridPanel), ControlTemplate.Empty); + this.AddDefaultTemplate(typeof(StackPanel), ControlTemplate.Empty); + + // layout components + ContentRef matForm = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.form.png")); + ControlTemplate formTemplate = new ControlTemplate + { + Appearance = new Appearance + { + Active = matForm, + Disabled = matForm, + Hover = matForm, + Normal = matForm, + Border = new Border(20) + }, + MinSize = new Size(40) + }; + this.AddCustomTemplate("form", formTemplate); + + TextTemplate buttonTemplate = new TextTemplate + { + Appearance = new Appearance + { + Active = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.button-active.png")), + Disabled = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.button-disabled.png")), + Hover = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.button-hover.png")), + Normal = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.button-normal.png")), + Border = new Border(5) + }, + MinSize = new Size(32, 16), + TextConfiguration = new TextConfiguration( + font: fntFont, + color: ColorRgba.White, + alignment: Alignment.Center, + margin: new Border(5) + ) + }; + this.AddDefaultTemplate(typeof(Button), buttonTemplate); + this.AddDefaultTemplate(typeof(ToggleButton), buttonTemplate); + + GlyphTemplate checkTemplate = new GlyphTemplate(buttonTemplate) + { + GlyphConfiguration = new GlyphConfiguration( + glyph: ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.glyph-check-active.png")), + alignment: Alignment.Left, + margin: new Border(5) + ) + }; + this.AddDefaultTemplate(typeof(CheckButton), checkTemplate); + + GlyphTemplate radioTemplate = new GlyphTemplate(buttonTemplate) + { + GlyphConfiguration = new GlyphConfiguration( + glyph: ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.glyph-radio-active.png")), + alignment: Alignment.Left, + margin: new Border(5) + ) + }; + this.AddDefaultTemplate(typeof(RadioButton), radioTemplate); + + TextTemplate textTemplate = new TextTemplate(buttonTemplate); + this.AddDefaultTemplate(typeof(TextBox), textTemplate); + this.AddDefaultTemplate(typeof(TextBlock), textTemplate); + + ContentRef scrollbarHBaseMaterial = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-horizontal-normal.png")); + scrollbarHBaseMaterial.Res.Technique = DrawTechnique.Alpha; + ContentRef scrollbarVBaseMaterial = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-vertical-normal.png")); + scrollbarVBaseMaterial.Res.Technique = DrawTechnique.Alpha; + + ScrollBarTemplate scrollHTemplate = new ScrollBarTemplate + { + Appearance = new Appearance + { + Normal = scrollbarHBaseMaterial, + Hover = scrollbarHBaseMaterial, + Active = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-horizontal-active.png")), + Disabled = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-horizontal-disabled.png")), + Border = Border.Zero + }, + MinSize = new Size(16), + ScrollBarConfiguration = new ScrollBarConfiguration( + cursorAppearance: new Appearance + { + Normal = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-normal.png")), + Hover = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-hover.png")), + Active = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-active.png")), + Disabled = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-disabled.png")), + Border = Border.Zero + }, + cursorSize: new Size(16) + ) + }; + this.AddDefaultTemplate(typeof(HorizontalScrollBar), scrollHTemplate); + + ScrollBarTemplate scrollVTemplate = new ScrollBarTemplate + { + Appearance = new Appearance + { + Normal = scrollbarVBaseMaterial, + Hover = scrollbarVBaseMaterial, + Active = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-vertical-active.png")), + Disabled = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-vertical-disabled.png")), + Border = Border.Zero + }, + MinSize = new Size(16), + ScrollBarConfiguration = new ScrollBarConfiguration( + cursorAppearance: new Appearance + { + Normal = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-normal.png")), + Hover = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-hover.png")), + Active = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-active.png")), + Disabled = ResourceHelper.GetMaterial(YAUICorePlugin.YAUIAssembly, Skin.Path("Figma.scrollbar-cursor-disabled.png")), + Border = Border.Zero + }, + cursorSize: new Size(16) + ) + }; + this.AddDefaultTemplate(typeof(VerticalScrollBar), scrollVTemplate); + + ListBoxTemplate listTemplate = new ListBoxTemplate + { + Appearance = null, + ListBoxConfiguration = new ListBoxConfiguration( + itemAppearance: textTemplate.Appearance, + itemsSize: new Size(20) + ), + ListBoxMargin = new Border(5), + MinSize = new Size(20), + TextConfiguration = textTemplate.TextConfiguration + }; + this.AddDefaultTemplate(typeof(ListBox), listTemplate); + } + } +} \ No newline at end of file diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-active.png new file mode 100644 index 0000000..ae5d01e Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-disabled.png new file mode 100644 index 0000000..f78edff Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-hover.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-hover.png new file mode 100644 index 0000000..cbe839f Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-hover.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-normal.png new file mode 100644 index 0000000..b96974d Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/button-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/form.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/form.png new file mode 100644 index 0000000..02abd68 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/form.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-active.png new file mode 100644 index 0000000..9311292 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-disabled.png new file mode 100644 index 0000000..90f1ba6 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-hover.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-hover.png new file mode 100644 index 0000000..0efcf39 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-hover.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-normal.png new file mode 100644 index 0000000..60f02b8 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-check-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-active.png new file mode 100644 index 0000000..b5c714c Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-disabled.png new file mode 100644 index 0000000..1f198c9 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-hover.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-hover.png new file mode 100644 index 0000000..0fca489 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-hover.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-normal.png new file mode 100644 index 0000000..9fbc155 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/glyph-radio-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-active.png new file mode 100644 index 0000000..b5c714c Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-disabled.png new file mode 100644 index 0000000..4f5fd55 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-hover.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-hover.png new file mode 100644 index 0000000..f07475b Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-hover.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-normal.png new file mode 100644 index 0000000..3d97855 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-cursor-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-active.png new file mode 100644 index 0000000..8d7b7e1 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-disabled.png new file mode 100644 index 0000000..b6e7f5d Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-normal.png new file mode 100644 index 0000000..b590bbe Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-horizontal-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-active.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-active.png new file mode 100644 index 0000000..69d59b9 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-active.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-disabled.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-disabled.png new file mode 100644 index 0000000..f74bc99 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-disabled.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-normal.png b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-normal.png new file mode 100644 index 0000000..6e8c273 Binary files /dev/null and b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Figma/scrollbar-vertical-normal.png differ diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fonts.cs b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fonts.cs index 21d333f..18625f2 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fonts.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Fonts.cs @@ -8,6 +8,7 @@ namespace SnowyPeak.Duality.Plugins.YAUI.DefaultSkins { internal static class Fonts { + public static string ManropeRegular = "SnowyPeak.Duality.Plugins.YAUI.DefaultSkins.Manrope-Regular.Font.res"; public static string RobotoRegular = "SnowyPeak.Duality.Plugins.YAUI.DefaultSkins.Roboto-Regular.Font.res"; public static string NotoSansRegular = "SnowyPeak.Duality.Plugins.YAUI.DefaultSkins.NotoSans-Regular.Font.res"; } diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/LightRounded.cs b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/LightRounded.cs index 007efb7..b613793 100644 --- a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/LightRounded.cs +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/LightRounded.cs @@ -92,13 +92,12 @@ protected override void Initialize() { Appearance = baseAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Left, - Color = ColorRgba.White, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: ColorRgba.White, + alignment: Alignment.Left, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(TextBlock), baseTemplate); this.AddDefaultTemplate(typeof(SpriteBox), baseTemplate); @@ -107,13 +106,12 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Right, - Color = ColorRgba.White, - Font = fntFont, - Margin = new Border(5) - } + TextConfiguration = new TextConfiguration( + font: fntFont, + color: ColorRgba.White, + alignment: Alignment.Right, + margin: new Border(5) + ) }; this.AddDefaultTemplate(typeof(Button), buttonTemplate); this.AddDefaultTemplate(typeof(ToggleButton), buttonTemplate); @@ -123,12 +121,11 @@ protected override void Initialize() { Appearance = buttonAppearance, MinSize = new Size(20), - GlyphConfiguration = new GlyphConfiguration() - { - Glyph = matRoundWhite, - Margin = new Border(5), - Alignment = Alignment.Right - }, + GlyphConfiguration = new GlyphConfiguration( + glyph: matRoundWhite, + alignment: Alignment.Right, + margin: new Border(5) + ), TextConfiguration = buttonTemplate.TextConfiguration }; this.AddDefaultTemplate(typeof(CheckButton), glyphTemplate); @@ -139,14 +136,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(20), ScrollBarMargin = new Border(2), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarAppearance, - ButtonIncreaseAppearance = scrollBarAppearance, - CursorAppearance = scrollBarAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(16, 36) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarAppearance, + buttonDecreaseAppearance: scrollBarAppearance, + cursorAppearance: scrollBarAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(16, 32) + ) }; this.AddDefaultTemplate(typeof(VerticalScrollBar), vScrollBarTemplate); @@ -155,14 +151,13 @@ protected override void Initialize() Appearance = backgroundAppearance, MinSize = new Size(20), ScrollBarMargin = new Border(2), - ScrollBarConfiguration = new ScrollBarConfiguration() - { - ButtonDecreaseAppearance = scrollBarAppearance, - ButtonIncreaseAppearance = scrollBarAppearance, - CursorAppearance = scrollBarAppearance, - ButtonsSize = new Size(16), - CursorSize = new Size(36, 16) - } + ScrollBarConfiguration = new ScrollBarConfiguration( + buttonIncreaseAppearance: scrollBarAppearance, + buttonDecreaseAppearance: scrollBarAppearance, + cursorAppearance: scrollBarAppearance, + buttonsSize: new Size(16), + cursorSize: new Size(32, 16) + ) }; this.AddDefaultTemplate(typeof(HorizontalScrollBar), hScrollBarTemplate); @@ -170,11 +165,10 @@ protected override void Initialize() { Appearance = backgroundAppearance, MinSize = new Size(4), - ListBoxConfiguration = new ListBoxConfiguration() - { - ItemAppearance = buttonAppearance, - ItemsSize = new Size(20) - }, + ListBoxConfiguration = new ListBoxConfiguration( + itemAppearance: buttonAppearance, + itemsSize: new Size(20) + ), TextConfiguration = buttonTemplate.TextConfiguration, ListBoxMargin = new Border(2) }; @@ -184,19 +178,17 @@ protected override void Initialize() { Appearance = backgroundAppearance, MinSize = new Size(15), - ProgressConfiguration = new ProgressConfiguration() - { - BarAppearance = buttonAppearance, - BarStyle = ProgressBar.BarStyle.Cutoff, - Direction = Direction.LeftToRight, - Margin = new Border(5) - }, - TextConfiguration = new TextConfiguration() - { - Alignment = Alignment.Center, - Color = ColorRgba.DarkGrey, - Font = fntFont - } + ProgressConfiguration = new ProgressConfiguration( + barAppearance: buttonAppearance, + direction: Direction.LeftToRight, + style: ProgressBar.BarStyle.Cutoff, + margin: new Border(5) + ), + TextConfiguration = new TextConfiguration( + font: fntFont, + color: ColorRgba.DarkGrey, + alignment: Alignment.Center + ) }; this.AddDefaultTemplate(typeof(ProgressBar), progressTemplate); } diff --git a/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Manrope-Regular.Font.res b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Manrope-Regular.Font.res new file mode 100644 index 0000000..8f0c3cc --- /dev/null +++ b/SnowyPeak.Duality.Plugins.YAUI/DefaultSkins/Manrope-Regular.Font.res @@ -0,0 +1,54 @@ + + + +
+ + 12 +