From ae46bba182f320cc089dbc588945eeed36537b0c Mon Sep 17 00:00:00 2001 From: Tig Date: Sun, 4 Aug 2024 12:01:35 -0600 Subject: [PATCH] MessageBox now centered by default. Dialog & MB now Thick linestyle by default. --- Terminal.Gui/Resources/config.json | 5 +++-- Terminal.Gui/Views/Dialog.cs | 6 +++--- Terminal.Gui/Views/MessageBox.cs | 12 +++++++++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Terminal.Gui/Resources/config.json b/Terminal.Gui/Resources/config.json index e3c1ac3dd..e4806af9b 100644 --- a/Terminal.Gui/Resources/config.json +++ b/Terminal.Gui/Resources/config.json @@ -29,8 +29,9 @@ "Dialog.DefaultButtonAlignmentModes": "AddSpaceBetweenItems", "FrameView.DefaultBorderStyle": "Single", "Window.DefaultBorderStyle": "Single", - "Dialog.DefaultBorderStyle": "Single", - "MessageBox.DefaultBorderStyle": "Double", + "Dialog.DefaultBorderStyle": "Heavy", + "MessageBox.DefaultButtonAlignment": "Center", + "MessageBox.DefaultBorderStyle": "Heavy", "Button.DefaultShadow": "None", "ColorSchemes": [ { diff --git a/Terminal.Gui/Views/Dialog.cs b/Terminal.Gui/Views/Dialog.cs index 7b4da9355..c1f18e8fb 100644 --- a/Terminal.Gui/Views/Dialog.cs +++ b/Terminal.Gui/Views/Dialog.cs @@ -20,7 +20,7 @@ public class Dialog : Window /// This property can be set in a Theme. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))] - public static Alignment DefaultButtonAlignment { get; set; } = Alignment.End; + public static Alignment DefaultButtonAlignment { get; set; } = Alignment.End; // Default is set in config.json /// The default for . /// This property can be set in a Theme. @@ -48,7 +48,7 @@ public class Dialog : Window /// [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))] - public new static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None; + public new static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None; // Default is set in config.json /// /// Defines the default border styling for . Can be configured via @@ -57,7 +57,7 @@ public class Dialog : Window [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))] - public new static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; + public new static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; // Default is set in config.json private readonly List [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] [JsonConverter (typeof (JsonStringEnumConverter))] - public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; + public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single; // Default is set in config.json + + /// The default for . + /// This property can be set in a Theme. + [SerializableConfigurationProperty (Scope = typeof (ThemeScope))] + [JsonConverter (typeof (JsonStringEnumConverter))] + public static Alignment DefaultButtonAlignment { get; set; } = Alignment.Center; // Default is set in config.json /// /// Defines the default minimum MessageBox width, as a percentage of the screen width. Can be configured via @@ -365,10 +371,10 @@ public static class MessageBox var d = new Dialog { Title = title, - Buttons = buttonList.ToArray (), - ButtonAlignment = Alignment.Center, + ButtonAlignment = MessageBox.DefaultButtonAlignment, ButtonAlignmentModes = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems, BorderStyle = MessageBox.DefaultBorderStyle, + Buttons = buttonList.ToArray (), }; d.Width = Dim.Auto (DimAutoStyle.Auto,