Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions Terminal.Gui/Configuration/ConfigPropertyHostTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,62 +40,30 @@ internal static class ConfigPropertyHostTypes
typeof (SchemeManager),
typeof (ThemeManager),
typeof (Color),
typeof (Glyphs),
typeof (Driver),
typeof (Key),
typeof (NerdFonts),
typeof (Trace),
typeof (View),
typeof (BorderView),
typeof (Button),
typeof (CharMap),
typeof (CheckBox),
typeof (Dialog),
typeof (FileDialog),
typeof (FileDialogStyle),
typeof (FrameView),
typeof (HexView),
typeof (LinearRangeDefaults),
typeof (Menu),
typeof (MenuBar),
typeof (MessageBox),
typeof (PopoverMenu),
typeof (SelectorBase),
typeof (StatusBar),
typeof (TextField),
typeof (TextView),
typeof (Window)
];

[DynamicDependency (PRESERVED_MEMBERS, typeof (Application))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (ConfigurationManager))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (SchemeManager))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (ThemeManager))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Color))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Glyphs))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Driver))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Key))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (NerdFonts))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Trace))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (View))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (BorderView))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Button))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (CharMap))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (CheckBox))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Dialog))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (FileDialog))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (FileDialogStyle))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (FrameView))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (HexView))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (LinearRangeDefaults))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Menu))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (MenuBar))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (MessageBox))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (PopoverMenu))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (SelectorBase))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (StatusBar))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (TextField))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (TextView))]
[DynamicDependency (PRESERVED_MEMBERS, typeof (Window))]
internal static Type [] GetTypes () => _types;
}
36 changes: 25 additions & 11 deletions Terminal.Gui/Configuration/Settings/ButtonSettings.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
namespace Terminal.Gui.Configuration;

/// <summary>
/// Settings POCO for <see cref="Views.Button"/> visual defaults (ThemeScope).
/// Immutable settings record for <see cref="Views.Button"/> visual defaults (ThemeScope).
/// </summary>
public class ButtonSettings
/// <remarks>
/// <para>
/// <see cref="Default"/> is the compile-time-known fallback (constructor defaults).
/// <see cref="Current"/> holds the currently effective values and is updated atomically by
/// <see cref="MecThemeManager"/> via <c>Volatile.Write</c> at startup and on theme switch. Mid-render
/// consumers always observe either the previous or the next reference — never a partially populated one.
/// </para>
/// </remarks>
public sealed record ButtonSettings
{
/// <summary>Gets or sets the default shadow style for buttons.</summary>
public ShadowStyles DefaultShadow { get; set; } = ShadowStyles.Opaque;
/// <summary>Gets the default shadow style for buttons.</summary>
public ShadowStyles DefaultShadow { get; init; } = ShadowStyles.Opaque;

/// <summary>Gets or sets the default mouse highlight states for buttons.</summary>
public MouseState DefaultMouseHighlightStates { get; set; } = MouseState.In | MouseState.Pressed | MouseState.PressedOutside;
/// <summary>Gets the default mouse highlight states for buttons.</summary>
public MouseState DefaultMouseHighlightStates { get; init; } = MouseState.In | MouseState.Pressed | MouseState.PressedOutside;

/// <summary>
/// The static facade instance. Always contains the current effective values.
/// Updated by the MEC binding at <see cref="IApplication"/> initialization.
/// </summary>
public static ButtonSettings Defaults { get; set; } = new ();
/// <summary>The compile-time-known defaults.</summary>
public static ButtonSettings Default { get; } = new ();

/// <summary>The currently effective values, updated atomically by <see cref="MecThemeManager"/>.</summary>
public static ButtonSettings Current
{
get => Volatile.Read (ref _current);
internal set => Volatile.Write (ref _current, value);
}

private static ButtonSettings _current = Default;
}
24 changes: 15 additions & 9 deletions Terminal.Gui/Configuration/Settings/CharMapSettings.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
namespace Terminal.Gui.Configuration;

/// <summary>
/// Settings POCO for <see cref="Views.CharMap"/> defaults (ThemeScope).
/// Immutable settings record for <see cref="Views.CharMap"/> defaults (ThemeScope).
/// </summary>
public class CharMapSettings
public sealed record CharMapSettings
{
/// <summary>Gets or sets the default cursor style for character map views.</summary>
public CursorStyle DefaultCursorStyle { get; set; } = CursorStyle.BlinkingBlock;
/// <summary>Gets the default cursor style for character map views.</summary>
public CursorStyle DefaultCursorStyle { get; init; } = CursorStyle.BlinkingBlock;

/// <summary>
/// The static facade instance. Always contains the current effective values.
/// Updated by the MEC binding at <see cref="IApplication"/> initialization.
/// </summary>
public static CharMapSettings Defaults { get; set; } = new ();
/// <summary>The compile-time-known defaults.</summary>
public static CharMapSettings Default { get; } = new ();

/// <summary>The currently effective values, updated atomically by <see cref="MecThemeManager"/>.</summary>
public static CharMapSettings Current
{
get => Volatile.Read (ref _current);
internal set => Volatile.Write (ref _current, value);
}

private static CharMapSettings _current = Default;
}
24 changes: 15 additions & 9 deletions Terminal.Gui/Configuration/Settings/CheckBoxSettings.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
namespace Terminal.Gui.Configuration;

/// <summary>
/// Settings POCO for <see cref="Views.CheckBox"/> visual defaults (ThemeScope).
/// Immutable settings record for <see cref="Views.CheckBox"/> visual defaults (ThemeScope).
/// </summary>
public class CheckBoxSettings
public sealed record CheckBoxSettings
{
/// <summary>Gets or sets the default mouse highlight states for checkboxes.</summary>
public MouseState DefaultMouseHighlightStates { get; set; } = MouseState.PressedOutside | MouseState.Pressed | MouseState.In;
/// <summary>Gets the default mouse highlight states for checkboxes.</summary>
public MouseState DefaultMouseHighlightStates { get; init; } = MouseState.PressedOutside | MouseState.Pressed | MouseState.In;

/// <summary>
/// The static facade instance. Always contains the current effective values.
/// Updated by the MEC binding at <see cref="IApplication"/> initialization.
/// </summary>
public static CheckBoxSettings Defaults { get; set; } = new ();
/// <summary>The compile-time-known defaults.</summary>
public static CheckBoxSettings Default { get; } = new ();

/// <summary>The currently effective values, updated atomically by <see cref="MecThemeManager"/>.</summary>
public static CheckBoxSettings Current
{
get => Volatile.Read (ref _current);
internal set => Volatile.Write (ref _current, value);
}

private static CheckBoxSettings _current = Default;
}
36 changes: 21 additions & 15 deletions Terminal.Gui/Configuration/Settings/DialogSettings.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
namespace Terminal.Gui.Configuration;

/// <summary>
/// Settings POCO for <see cref="Views.Dialog"/> visual defaults (ThemeScope).
/// Immutable settings record for <see cref="Views.Dialog"/> visual defaults (ThemeScope).
/// </summary>
public class DialogSettings
public sealed record DialogSettings
{
/// <summary>Gets or sets the default shadow style for dialogs.</summary>
public ShadowStyles DefaultShadow { get; set; } = ShadowStyles.Transparent;
/// <summary>Gets the default shadow style for dialogs.</summary>
public ShadowStyles DefaultShadow { get; init; } = ShadowStyles.Transparent;

/// <summary>Gets or sets the default border style for dialogs.</summary>
public LineStyle DefaultBorderStyle { get; set; } = LineStyle.Heavy;
/// <summary>Gets the default border style for dialogs.</summary>
public LineStyle DefaultBorderStyle { get; init; } = LineStyle.Heavy;

/// <summary>Gets or sets the default button alignment for dialogs.</summary>
public Alignment DefaultButtonAlignment { get; set; } = Alignment.End;
/// <summary>Gets the default button alignment for dialogs.</summary>
public Alignment DefaultButtonAlignment { get; init; } = Alignment.End;

/// <summary>Gets or sets the default button alignment modes for dialogs.</summary>
public AlignmentModes DefaultButtonAlignmentModes { get; set; } = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems;
/// <summary>Gets the default button alignment modes for dialogs.</summary>
public AlignmentModes DefaultButtonAlignmentModes { get; init; } = AlignmentModes.StartToEnd | AlignmentModes.AddSpaceBetweenItems;

/// <summary>
/// The static facade instance. Always contains the current effective values.
/// Updated by the MEC binding at <see cref="IApplication"/> initialization.
/// </summary>
public static DialogSettings Defaults { get; set; } = new ();
/// <summary>The compile-time-known defaults.</summary>
public static DialogSettings Default { get; } = new ();

/// <summary>The currently effective values, updated atomically by <see cref="MecThemeManager"/>.</summary>
public static DialogSettings Current
{
get => Volatile.Read (ref _current);
internal set => Volatile.Write (ref _current, value);
}

private static DialogSettings _current = Default;
}
24 changes: 15 additions & 9 deletions Terminal.Gui/Configuration/Settings/FrameViewSettings.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
namespace Terminal.Gui.Configuration;

/// <summary>
/// Settings POCO for <see cref="Views.FrameView"/> defaults (ThemeScope).
/// Immutable settings record for <see cref="Views.FrameView"/> defaults (ThemeScope).
/// </summary>
public class FrameViewSettings
public sealed record FrameViewSettings
{
/// <summary>Gets or sets the default border style for frame views.</summary>
public LineStyle DefaultBorderStyle { get; set; } = LineStyle.Rounded;
/// <summary>Gets the default border style for frame views.</summary>
public LineStyle DefaultBorderStyle { get; init; } = LineStyle.Rounded;

/// <summary>
/// The static facade instance. Always contains the current effective values.
/// Updated by the MEC binding at <see cref="IApplication"/> initialization.
/// </summary>
public static FrameViewSettings Defaults { get; set; } = new ();
/// <summary>The compile-time-known defaults.</summary>
public static FrameViewSettings Default { get; } = new ();

/// <summary>The currently effective values, updated atomically by <see cref="MecThemeManager"/>.</summary>
public static FrameViewSettings Current
{
get => Volatile.Read (ref _current);
internal set => Volatile.Write (ref _current, value);
}

private static FrameViewSettings _current = Default;
}
Loading