using System.Text.Json.Serialization; namespace Terminal.Gui; /// /// A with set to /// . Provides a container for other views. /// /// /// /// If any subview is a button and the property is set to true, the Enter key will /// invoke the command on that subview. /// /// public class Window : Toplevel { /// /// Gets or sets whether all s are shown with a shadow effect by default. /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None; /// /// Initializes a new instance of the class. /// public Window () { CanFocus = true; TabStop = TabBehavior.TabGroup; ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property BorderStyle = DefaultBorderStyle; ShadowStyle = DefaultShadow; // This enables the default button to be activated by the Enter key. AddCommand ( Command.Accept, () => { // TODO: Perhaps all views should support the concept of being default? // ReSharper disable once InvertIf if (Subviews.FirstOrDefault (v => v is Button { IsDefault: true, Enabled: true }) is Button defaultBtn) { defaultBtn.InvokeCommand (Command.Accept); return true; } return OnAccept (); } ); KeyBindings.Add (Key.Enter, Command.Accept); } // TODO: enable this ///// ///// The default for 's border. The default is . ///// ///// ///// This property can be set in a Theme to change the default for all s. ///// /////[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))] ////public static ColorScheme DefaultColorScheme { get; set; } = Colors.ColorSchemes ["Base"]; /// /// The default for 's border. The default is /// . /// /// /// This property can be set in a Theme to change the default for all /// s. /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))] public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; }