using System; using System.Collections.Generic; using Quik.Typography; namespace Quik { public enum TextAlignment { Left, Center, Right, Justify } public enum TextDecoration { None, Underline, Overline, Strikethrough } public enum TextTransform { None, Title, Upper, Lower, } public enum ListMarkerType { None, Disc, Circle, FilledSquare, Square, Dash, ArabicNumeral, RomanNumeralUpper, RomanNumeralLower, AlphabetUpper, AlphabetLower, Image } public enum ListMarkerPosition { Inside, Outside, } public abstract class StyleBase { public abstract object this[string key] { get; set; } public QuikColor? Color { get => (QuikColor?)this["color"]; set => this["color"] = value; } public float? LineHeight { get => (float?)this["line-height"]; set => this["line-height"] = value; } public float? LetterSpacing { get => (float?)this["letter-spacing"]; set => this["letter-spacing"] = value; } public TextAlignment? TextAlignment { get => (TextAlignment?)this["text-alignment"]; set => this["text-alignment"] = value; } public TextDecoration? TextDecoration { get => (TextDecoration?)this["text-decoration"]; set => this["text-decoration"] = value; } public float? TextIndent { get => (float?)this["text-indent"]; set => this["text-indent"] = value; } public TextTransform? TextTransform { get => (TextTransform?)this["text-transform"]; set => this["text-transform"] = value; } public ListMarkerType? ListMarker { get => (ListMarkerType?)this["list-marker"]; set => this["list-marker"] = value; } public ListMarkerPosition? ListMarkerPosition { get => (ListMarkerPosition?)this["list-marker-position"]; set => this["list-marker-position"] = value; } public QuikTexture ListMarkerImage { get => (QuikTexture)this["list-marker-image"]; set => this["list-marker-image"] = value; } public float? StrokeWidth { get => (float?)this["stroke-width"]; set => this["stroke-width"] = value; } public QuikColor? StrokeColor { get => (QuikColor?)this["stroke-color"]; set => this["stroke-color"] = value; } public QuikFont Font { get => (QuikFont)this["font"]; set => this["font"] = value; } public int? ZIndex { get => (int?)this["z-index"]; set => this["z-index"] = value; } } public class Style : StyleBase { private readonly Dictionary _keys = new Dictionary(); public override object this[string styleKey] { get => _keys.TryGetValue(styleKey, out object value) ? value : null; set { if (value == null) _keys.Remove(styleKey); else _keys[styleKey] = value; } } } public class StyleStack : StyleBase { public readonly List