using Azimuth; using System.Drawing; namespace Glass.Testbed { /// /// The Testbed's widget catalog: the theme choices that would otherwise be copy/pasted to every call site. /// public static class Widgets { public static TextMaterial ButtonLabel(StringView text) { return new TextMaterial { Font = Fonts.Philosopher32, Text = text, TintColor = Color.Black, VerticalAlignment = Alignment.Vertical.Center, HorizontalAlignment = Alignment.Horizontal.Center, }; } public static TextMaterial Caption(StringView text) { return new TextMaterial { Font = Fonts.Philosopher32, Text = text, TintColor = Color.White, Multiline = false, VerticalMargin = 0, HorizontalMargin = 0, }; } /// /// A single line of text sitting inside a panel of its own, like a text field's contents or a status bar. /// public static TextMaterial FieldText(StringView text) { return new TextMaterial { Font = Fonts.Philosopher32, Text = text, TintColor = Color.FromArgb(24, 28, 34), Multiline = false, }; } public static readonly Material TooltipBackground = UiPacksheetMaterials.Panel with { TintColor = Color.FromArgb(190, 196, 206) }; /// /// Dark rather than Caption's white, since the tooltip background is a light slate. /// private static TextMaterial TooltipText(StringView text, bool multiline) { return new TextMaterial { Font = Fonts.Philosopher32, Text = text, TintColor = Color.FromArgb(24, 28, 34), Multiline = multiline, VerticalAlignment = Alignment.Vertical.Top, VerticalMargin = 0, HorizontalMargin = 0, }; } /// /// A tooltip carrying a single line of text, sized to it. /// public static Tooltip Tooltip(StringView text) { return new Tooltip(TooltipBackground, TooltipText(text, multiline: false)); } /// /// A tooltip carrying wrapped text, for more than fits comfortably on one line. /// public static Tooltip WrappedTooltip(StringView text, Scalar width) { return new Tooltip( TooltipBackground, TooltipText(text, multiline: true), Constraints.Loose(new Vector(width, Scalar.PositiveInfinity))); } public static TextMaterial Paragraph(StringView text, Alignment.Vertical verticalAlignment, TextOverflow overflowBehavior) { return new TextMaterial { Font = Fonts.Philosopher32, Text = text, TintColor = Color.Black, VerticalAlignment = verticalAlignment, OverflowBehavior = overflowBehavior, }; } } }