Browse Source

Fixes #2663 - No more nested classes (#2664)

* Move all public nested classes out into own files

* Move more nested classes out

* Tidy up and treat CA1034 as an error.  Fix remaining nested classes.

* Remove partial keyword from ThemeManager as it is no longer needed

* Rename Bar to BarSeriesBar to more clearly indicate it is part of GraphView subsystem

* Fix xmldoc references

* Revert nesting changes to ConsoleDrivers

* Change to file scoped namespaces and revert renames

- LineCanvasCell back to just Cell
- ApplicationRunState back to just RunState

* Switch to file scoped namespaces
Thomas Nind 2 years ago
parent
commit
e2feeefa93
66 changed files with 1859 additions and 1809 deletions
  1. 0 75
      Terminal.Gui/Application.cs
  2. 29 32
      Terminal.Gui/Configuration/AppScope.cs
  3. 97 0
      Terminal.Gui/Configuration/ConfigProperty.cs
  4. 2 114
      Terminal.Gui/Configuration/ConfigurationManager.cs
  5. 1 1
      Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs
  6. 47 182
      Terminal.Gui/Configuration/Scope.cs
  7. 140 0
      Terminal.Gui/Configuration/ScopeJsonConverter.cs
  8. 28 0
      Terminal.Gui/Configuration/SerializableConfigurationProperty.cs
  9. 97 99
      Terminal.Gui/Configuration/SettingsScope.cs
  10. 207 0
      Terminal.Gui/Configuration/ThemeManager.cs
  11. 50 258
      Terminal.Gui/Configuration/ThemeScope.cs
  12. 20 0
      Terminal.Gui/Drawing/Cell.cs
  13. 0 16
      Terminal.Gui/Drawing/LineCanvas.cs
  14. 1 1
      Terminal.Gui/FileServices/FileDialogStyle.cs
  15. 0 13
      Terminal.Gui/MainLoop.cs
  16. 79 0
      Terminal.Gui/RunState.cs
  17. 1 0
      Terminal.Gui/Terminal.Gui.csproj
  18. 23 0
      Terminal.Gui/Timeout.cs
  19. 1 1
      Terminal.Gui/Views/FileDialog.cs
  20. 0 24
      Terminal.Gui/Views/GraphView/Annotations.cs
  21. 38 0
      Terminal.Gui/Views/GraphView/BarSeriesBar.cs
  22. 25 0
      Terminal.Gui/Views/GraphView/LineF.cs
  23. 5 42
      Terminal.Gui/Views/GraphView/Series.cs
  24. 5 1
      Terminal.Gui/Views/SpinnerView/SpinnerStyle.cs
  25. 39 0
      Terminal.Gui/Views/Tab.cs
  26. 3 3
      Terminal.Gui/Views/TabChangedEventArgs.cs
  27. 5 5
      Terminal.Gui/Views/TabMouseEventArgs.cs
  28. 28 0
      Terminal.Gui/Views/TabStyle.cs
  29. 2 70
      Terminal.Gui/Views/TabView.cs
  30. 49 0
      Terminal.Gui/Views/TableView/CellColorGetterArgs.cs
  31. 103 0
      Terminal.Gui/Views/TableView/ColumnStyle.cs
  32. 18 0
      Terminal.Gui/Views/TableView/ListColumnStyle.cs
  33. 0 18
      Terminal.Gui/Views/TableView/ListTableSource.cs
  34. 24 0
      Terminal.Gui/Views/TableView/RowColorGetterArgs.cs
  35. 36 0
      Terminal.Gui/Views/TableView/TableSelection.cs
  36. 132 0
      Terminal.Gui/Views/TableView/TableStyle.cs
  37. 15 350
      Terminal.Gui/Views/TableView/TableView.cs
  38. 94 0
      Terminal.Gui/Views/Tile.cs
  39. 0 91
      Terminal.Gui/Views/TileView.cs
  40. 15 15
      Terminal.Gui/Views/Toplevel.cs
  41. 2 208
      Terminal.Gui/Views/Wizard/Wizard.cs
  42. 208 0
      Terminal.Gui/Views/Wizard/WizardStep.cs
  43. 1 1
      UICatalog/Scenarios/ConfigurationEditor.cs
  44. 2 2
      UICatalog/Scenarios/Editor.cs
  45. 65 65
      UICatalog/Scenarios/GraphViewExample.cs
  46. 1 1
      UICatalog/Scenarios/ListColumns.cs
  47. 3 3
      UICatalog/Scenarios/Notepad.cs
  48. 8 8
      UICatalog/Scenarios/TabViewExample.cs
  49. 4 4
      UICatalog/Scenarios/TableEditor.cs
  50. 3 3
      UICatalog/Scenarios/WizardAsView.cs
  51. 6 6
      UICatalog/Scenarios/Wizards.cs
  52. 2 2
      UICatalog/UICatalog.cs
  53. 3 3
      UnitTests/Application/ApplicationTests.cs
  54. 1 1
      UnitTests/Application/MainLoopTests.cs
  55. 6 6
      UnitTests/Application/RunStateTests.cs
  56. 1 1
      UnitTests/Configuration/AppScopeTests.cs
  57. 3 3
      UnitTests/Configuration/SettingsScopeTests.cs
  58. 9 9
      UnitTests/Configuration/ThemeScopeTests.cs
  59. 12 12
      UnitTests/Dialogs/DialogTests.cs
  60. 19 19
      UnitTests/Dialogs/WizardTests.cs
  61. 2 2
      UnitTests/View/Layout/PosTests.cs
  62. 1 1
      UnitTests/Views/ButtonTests.cs
  63. 6 6
      UnitTests/Views/GraphViewTests.cs
  64. 1 1
      UnitTests/Views/OverlappedTests.cs
  65. 26 26
      UnitTests/Views/TabViewTests.cs
  66. 5 5
      UnitTests/Views/TableViewTests.cs

+ 0 - 75
Terminal.Gui/Application.cs

@@ -324,81 +324,6 @@ namespace Terminal.Gui {
 		/// </remarks>
 		public static event EventHandler<ToplevelEventArgs> NotifyStopRunState;
 
-		/// <summary>
-		/// The execution state for a <see cref="Toplevel"/> view.
-		/// </summary>
-		public class RunState : IDisposable {
-			/// <summary>
-			/// Initializes a new <see cref="RunState"/> class.
-			/// </summary>
-			/// <param name="view"></param>
-			public RunState (Toplevel view)
-			{
-				Toplevel = view;
-			}
-			/// <summary>
-			/// The <see cref="Toplevel"/> belonging to this <see cref="RunState"/>.
-			/// </summary>
-			public Toplevel Toplevel { get; internal set; }
-
-#if DEBUG_IDISPOSABLE
-			/// <summary>
-			/// For debug (see DEBUG_IDISPOSABLE define) purposes to verify objects are being disposed properly
-			/// </summary>
-			public bool WasDisposed = false;
-
-			/// <summary>
-			/// For debug (see DEBUG_IDISPOSABLE define) purposes to verify objects are being disposed properly
-			/// </summary>
-			public int DisposedCount = 0;
-
-			/// <summary>
-			/// For debug (see DEBUG_IDISPOSABLE define) purposes; the runstate instances that have been created
-			/// </summary>
-			public static List<RunState> Instances = new List<RunState> ();
-
-			/// <summary>
-			/// Creates a new RunState object.
-			/// </summary>
-			public RunState ()
-			{
-				Instances.Add (this);
-			}
-#endif
-
-			/// <summary>
-			/// Releases all resource used by the <see cref="Application.RunState"/> object.
-			/// </summary>
-			/// <remarks>
-			/// Call <see cref="Dispose()"/> when you are finished using the <see cref="Application.RunState"/>. 
-			/// </remarks>
-			/// <remarks>
-			/// <see cref="Dispose()"/> method leaves the <see cref="Application.RunState"/> in an unusable state. After
-			/// calling <see cref="Dispose()"/>, you must release all references to the
-			/// <see cref="Application.RunState"/> so the garbage collector can reclaim the memory that the
-			/// <see cref="Application.RunState"/> was occupying.
-			/// </remarks>
-			public void Dispose ()
-			{
-				Dispose (true);
-				GC.SuppressFinalize (this);
-#if DEBUG_IDISPOSABLE
-				WasDisposed = true;
-#endif
-			}
-
-			/// <summary>
-			/// Releases all resource used by the <see cref="Application.RunState"/> object.
-			/// </summary>
-			/// <param name="disposing">If set to <see langword="true"/> we are disposing and should dispose held objects.</param>
-			protected virtual void Dispose (bool disposing)
-			{
-				if (Toplevel != null && disposing) {
-					throw new InvalidOperationException ("You must clean up (Dispose) the Toplevel before calling Application.RunState.Dispose");
-				}
-			}
-		}
-
 		/// <summary>
 		/// Building block API: Prepares the provided <see cref="Toplevel"/> for execution.
 		/// </summary>

+ 29 - 32
Terminal.Gui/Configuration/AppScope.cs

@@ -9,37 +9,34 @@ using static Terminal.Gui.ConfigurationManager;
 
 #nullable enable
 
-namespace Terminal.Gui {
+namespace Terminal.Gui; 
 
-	public static partial class ConfigurationManager {
-		/// <summary>
-		/// The <see cref="Scope{T}"/> class for application-defined configuration settings.
-		/// </summary>
-		/// <remarks>
-		/// </remarks>
-		/// <example>
-		/// <para>
-		/// Use the <see cref="SerializableConfigurationProperty"/> attribute to mark properties that should be serialized as part
-		/// of application-defined configuration settings.
-		/// </para>
-		/// <code>
-		/// public class MyAppSettings {
-		///	[SerializableConfigurationProperty (Scope = typeof (AppScope))]
-		///	public static bool? MyProperty { get; set; } = true;
-		/// }
-		/// </code>
-		/// <para>
-		/// THe resultant Json will look like this:
-		/// </para>
-		/// <code>
-		///   "AppSettings": {
-		///     "MyAppSettings.MyProperty": true,
-		///     "UICatalog.ShowStatusBar": true
-		///   },
-		/// </code>
-		/// </example> 
-		[JsonConverter (typeof (ScopeJsonConverter<AppScope>))]
-		public class AppScope : Scope<AppScope> {
-		}
-	}
+/// <summary>
+/// The <see cref="Scope{T}"/> class for application-defined configuration settings.
+/// </summary>
+/// <remarks>
+/// </remarks>
+/// <example>
+/// <para>
+/// Use the <see cref="SerializableConfigurationProperty"/> attribute to mark properties that should be serialized as part
+/// of application-defined configuration settings.
+/// </para>
+/// <code>
+/// public class MyAppSettings {
+///	[SerializableConfigurationProperty (Scope = typeof (AppScope))]
+///	public static bool? MyProperty { get; set; } = true;
+/// }
+/// </code>
+/// <para>
+/// THe resultant Json will look like this:
+/// </para>
+/// <code>
+///   "AppSettings": {
+///     "MyAppSettings.MyProperty": true,
+///     "UICatalog.ShowStatusBar": true
+///   },
+/// </code>
+/// </example> 
+[JsonConverter (typeof (ScopeJsonConverter<AppScope>))]
+public class AppScope : Scope<AppScope> {
 }

+ 97 - 0
Terminal.Gui/Configuration/ConfigProperty.cs

@@ -0,0 +1,97 @@
+using System;
+using System.Reflection;
+using System.Text.Json.Serialization;
+
+#nullable enable
+
+namespace Terminal.Gui;
+
+/// <summary>
+/// Holds a property's value and the <see cref="PropertyInfo"/> that allows <see cref="ConfigurationManager"/> 
+/// to get and set the property's value.
+/// </summary>
+/// <remarks>
+/// Configuration properties must be <see langword="public"/> and <see langword="static"/> 
+/// and have the <see cref="SerializableConfigurationProperty"/>
+/// attribute. If the type of the property requires specialized JSON serialization, 
+/// a <see cref="JsonConverter"/> must be provided using 
+/// the <see cref="JsonConverterAttribute"/> attribute.
+/// </remarks>
+public class ConfigProperty {
+	private object? propertyValue;
+
+	/// <summary>
+	/// Describes the property.
+	/// </summary>
+	public PropertyInfo? PropertyInfo { get; set; }
+
+	/// <summary>
+	/// Helper to get either the Json property named (specified by [JsonPropertyName(name)]
+	/// or the actual property name.
+	/// </summary>
+	/// <param name="pi"></param>
+	/// <returns></returns>
+	public static string GetJsonPropertyName (PropertyInfo pi)
+	{
+		var jpna = pi.GetCustomAttribute (typeof (JsonPropertyNameAttribute)) as JsonPropertyNameAttribute;
+		return jpna?.Name ?? pi.Name;
+	}
+
+	/// <summary>
+	/// Holds the property's value as it was either read from the class's implementation or from a config file. 
+	/// If the property has not been set (e.g. because no configuration file specified a value), 
+	/// this will be <see langword="null"/>.
+	/// </summary>
+	/// <remarks>
+	/// On <see langword="set"/>, performs a sparse-copy of the new value to the existing value (only copies elements of 
+	/// the object that are non-null).
+	/// </remarks>
+	public object? PropertyValue {
+		get => propertyValue;
+		set {
+			propertyValue = value;
+		}
+	}
+
+	internal object? UpdateValueFrom (object source)
+	{
+		if (source == null) {
+			return PropertyValue;
+		}
+
+		var ut = Nullable.GetUnderlyingType (PropertyInfo!.PropertyType);
+		if (source.GetType () != PropertyInfo!.PropertyType && (ut != null && source.GetType () != ut)) {
+			throw new ArgumentException ($"The source object ({PropertyInfo!.DeclaringType}.{PropertyInfo!.Name}) is not of type {PropertyInfo!.PropertyType}.");
+		}
+		if (PropertyValue != null && source != null) {
+			PropertyValue = ConfigurationManager.DeepMemberwiseCopy (source, PropertyValue);
+		} else {
+			PropertyValue = source;
+		}
+
+		return PropertyValue;
+	}
+
+	/// <summary>
+	/// Retrieves (using reflection) the value of the static property described in <see cref="PropertyInfo"/>
+	/// into <see cref="PropertyValue"/>.
+	/// </summary>
+	/// <returns></returns>
+	public object? RetrieveValue ()
+	{
+		return PropertyValue = PropertyInfo!.GetValue (null);
+	}
+
+	/// <summary>
+	/// Applies the <see cref="PropertyValue"/> to the property described by <see cref="PropertyInfo"/>.
+	/// </summary>
+	/// <returns></returns>
+	public bool Apply ()
+	{
+		if (PropertyValue != null) {
+			PropertyInfo?.SetValue (null, ConfigurationManager.DeepMemberwiseCopy (PropertyValue, PropertyInfo?.GetValue (null)));
+		}
+		return PropertyValue != null;
+	}
+
+}

+ 2 - 114
Terminal.Gui/Configuration/ConfigurationManager.cs

@@ -69,118 +69,6 @@ public static partial class ConfigurationManager {
 			},
 	};
 
-	/// <summary>
-	/// An attribute that can be applied to a property to indicate that it should included in the configuration file.
-	/// </summary>
-	/// <example>
-	/// 	[SerializableConfigurationProperty(Scope = typeof(Configuration.ThemeManager.ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
-	///	public static LineStyle DefaultBorderStyle {
-	///	...
-	/// </example>
-	[AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
-	public class SerializableConfigurationProperty : System.Attribute {
-		/// <summary>
-		/// Specifies the scope of the property. 
-		/// </summary>
-		public Type? Scope { get; set; }
-
-		/// <summary>
-		/// If <see langword="true"/>, the property will be serialized to the configuration file using only the property name
-		/// as the key. If <see langword="false"/>, the property will be serialized to the configuration file using the
-		/// property name pre-pended with the classname (e.g. <c>Application.UseSystemConsole</c>).
-		/// </summary>
-		public bool OmitClassName { get; set; }
-	}
-
-	/// <summary>
-	/// Holds a property's value and the <see cref="PropertyInfo"/> that allows <see cref="ConfigurationManager"/> 
-	/// to get and set the property's value.
-	/// </summary>
-	/// <remarks>
-	/// Configuration properties must be <see langword="public"/> and <see langword="static"/> 
-	/// and have the <see cref="SerializableConfigurationProperty"/>
-	/// attribute. If the type of the property requires specialized JSON serialization, 
-	/// a <see cref="JsonConverter"/> must be provided using 
-	/// the <see cref="JsonConverterAttribute"/> attribute.
-	/// </remarks>
-	public class ConfigProperty {
-		private object? propertyValue;
-
-		/// <summary>
-		/// Describes the property.
-		/// </summary>
-		public PropertyInfo? PropertyInfo { get; set; }
-
-		/// <summary>
-		/// Helper to get either the Json property named (specified by [JsonPropertyName(name)]
-		/// or the actual property name.
-		/// </summary>
-		/// <param name="pi"></param>
-		/// <returns></returns>
-		public static string GetJsonPropertyName (PropertyInfo pi)
-		{
-			var jpna = pi.GetCustomAttribute (typeof (JsonPropertyNameAttribute)) as JsonPropertyNameAttribute;
-			return jpna?.Name ?? pi.Name;
-		}
-
-		/// <summary>
-		/// Holds the property's value as it was either read from the class's implementation or from a config file. 
-		/// If the property has not been set (e.g. because no configuration file specified a value), 
-		/// this will be <see langword="null"/>.
-		/// </summary>
-		/// <remarks>
-		/// On <see langword="set"/>, performs a sparse-copy of the new value to the existing value (only copies elements of 
-		/// the object that are non-null).
-		/// </remarks>
-		public object? PropertyValue {
-			get => propertyValue;
-			set {
-				propertyValue = value;
-			}
-		}
-
-		internal object? UpdateValueFrom (object source)
-		{
-			if (source == null) {
-				return PropertyValue;
-			}
-
-			var ut = Nullable.GetUnderlyingType (PropertyInfo!.PropertyType);
-			if (source.GetType () != PropertyInfo!.PropertyType && (ut != null && source.GetType () != ut)) {
-				throw new ArgumentException ($"The source object ({PropertyInfo!.DeclaringType}.{PropertyInfo!.Name}) is not of type {PropertyInfo!.PropertyType}.");
-			}
-			if (PropertyValue != null && source != null) {
-				PropertyValue = DeepMemberwiseCopy (source, PropertyValue);
-			} else {
-				PropertyValue = source;
-			}
-
-			return PropertyValue;
-		}
-
-		/// <summary>
-		/// Retrieves (using reflection) the value of the static property described in <see cref="PropertyInfo"/>
-		/// into <see cref="PropertyValue"/>.
-		/// </summary>
-		/// <returns></returns>
-		public object? RetrieveValue ()
-		{
-			return PropertyValue = PropertyInfo!.GetValue (null);
-		}
-
-		/// <summary>
-		/// Applies the <see cref="PropertyValue"/> to the property described by <see cref="PropertyInfo"/>.
-		/// </summary>
-		/// <returns></returns>
-		public bool Apply ()
-		{
-			if (PropertyValue != null) {
-				PropertyInfo?.SetValue (null, DeepMemberwiseCopy (PropertyValue, PropertyInfo?.GetValue (null)));
-			}
-			return PropertyValue != null;
-		}
-	}
-
 	/// <summary>
 	/// A dictionary of all properties in the Terminal.Gui project that are decorated with the <see cref="SerializableConfigurationProperty"/> attribute.
 	/// The keys are the property names pre-pended with the class that implements the property (e.g. <c>Application.UseSystemConsole</c>).
@@ -190,7 +78,7 @@ public static partial class ConfigurationManager {
 	/// <remarks>
 	/// Is <see langword="null"/> until <see cref="Initialize"/> is called. 
 	/// </remarks>
-	private static Dictionary<string, ConfigProperty>? _allConfigProperties;
+	internal static Dictionary<string, ConfigProperty>? _allConfigProperties;
 
 	/// <summary>
 	/// The backing property for <see cref="Settings"/>. 
@@ -319,7 +207,7 @@ public static partial class ConfigurationManager {
 
 	internal static StringBuilder jsonErrors = new StringBuilder ();
 
-	private static void AddJsonError (string error)
+	internal static void AddJsonError (string error)
 	{
 		Debug.WriteLine ($"ConfigurationManager: {error}");
 		jsonErrors.AppendLine (error);

+ 1 - 1
Terminal.Gui/Configuration/ConfigurationManagerEventArgs.cs

@@ -17,7 +17,7 @@ namespace Terminal.Gui {
 	}
 
 	/// <summary>
-	/// Event arguments for the <see cref="ConfigurationManager.ThemeManager"/> events.
+	/// Event arguments for the <see cref="ThemeManager"/> events.
 	/// </summary>
 	public class ThemeManagerEventArgs : EventArgs {
 		/// <summary>

+ 47 - 182
Terminal.Gui/Configuration/Scope.cs

@@ -3,209 +3,74 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
 using System.Reflection;
-using System.Text.Json;
-using System.Text.Json.Serialization;
 using static Terminal.Gui.ConfigurationManager;
 
 #nullable enable
 
 namespace Terminal.Gui {
-	public static partial class ConfigurationManager {
 
+	/// <summary>
+	/// Defines a configuration settings scope. Classes that inherit from this abstract class can be used to define
+	/// scopes for configuration settings. Each scope is a JSON object that contains a set of configuration settings.
+	/// </summary>
+	public class Scope<T> : Dictionary<string, ConfigProperty> { //, IScope<Scope<T>> {
 		/// <summary>
-		/// Defines a configuration settings scope. Classes that inherit from this abstract class can be used to define
-		/// scopes for configuration settings. Each scope is a JSON object that contains a set of configuration settings.
+		/// Crates a new instance.
 		/// </summary>
-		public class Scope<T> : Dictionary<string, ConfigProperty> { //, IScope<Scope<T>> {
-			/// <summary>
-			/// Crates a new instance.
-			/// </summary>
-			public Scope () : base (StringComparer.InvariantCultureIgnoreCase)
-			{
-				foreach (var p in GetScopeProperties ()) {
-					Add (p.Key, new ConfigProperty () { PropertyInfo = p.Value.PropertyInfo, PropertyValue = null });
-				}
-			}
-
-			private IEnumerable<KeyValuePair<string, ConfigProperty>> GetScopeProperties ()
-			{
-				return ConfigurationManager._allConfigProperties!.Where (cp =>
-					(cp.Value.PropertyInfo?.GetCustomAttribute (typeof (SerializableConfigurationProperty))
-					as SerializableConfigurationProperty)?.Scope == GetType ());
-			}
-
-			/// <summary>
-			/// Updates this instance from the specified source scope.
-			/// </summary>
-			/// <param name="source"></param>
-			/// <returns>The updated scope (this).</returns>
-			public Scope<T>? Update (Scope<T> source)
-			{
-				foreach (var prop in source) {
-					if (ContainsKey (prop.Key))
-						this [prop.Key].PropertyValue = this [prop.Key].UpdateValueFrom (prop.Value.PropertyValue!);
-					else {
-						this [prop.Key].PropertyValue = prop.Value.PropertyValue;
-					}
-				}
-				return this;
+		public Scope () : base (StringComparer.InvariantCultureIgnoreCase)
+		{
+			foreach (var p in GetScopeProperties ()) {
+				Add (p.Key, new ConfigProperty () { PropertyInfo = p.Value.PropertyInfo, PropertyValue = null });
 			}
+		}
 
-			/// <summary>
-			/// Retrieves the values of the properties of this scope from their corresponding static properties.
-			/// </summary>
-			public void RetrieveValues ()
-			{
-				foreach (var p in this.Where (cp => cp.Value.PropertyInfo != null)) {
-					p.Value.RetrieveValue ();
-				}
-			}
+		private IEnumerable<KeyValuePair<string, ConfigProperty>> GetScopeProperties ()
+		{
+			return ConfigurationManager._allConfigProperties!.Where (cp =>
+				(cp.Value.PropertyInfo?.GetCustomAttribute (typeof (SerializableConfigurationProperty))
+				as SerializableConfigurationProperty)?.Scope == GetType ());
+		}
 
-			/// <summary>
-			/// Applies the values of the properties of this scope to their corresponding static properties.
-			/// </summary>
-			/// <returns></returns>
-			internal virtual bool Apply ()
-			{
-				bool set = false;
-				foreach (var p in this.Where (t => t.Value != null && t.Value.PropertyValue != null)) {
-					if (p.Value.Apply ()) {
-						set = true;
-					}
+		/// <summary>
+		/// Updates this instance from the specified source scope.
+		/// </summary>
+		/// <param name="source"></param>
+		/// <returns>The updated scope (this).</returns>
+		public Scope<T>? Update (Scope<T> source)
+		{
+			foreach (var prop in source) {
+				if (ContainsKey (prop.Key))
+					this [prop.Key].PropertyValue = this [prop.Key].UpdateValueFrom (prop.Value.PropertyValue!);
+				else {
+					this [prop.Key].PropertyValue = prop.Value.PropertyValue;
 				}
-				return set;
 			}
+			return this;
 		}
 
 		/// <summary>
-		/// Converts <see cref="Scope{T}"/> instances to/from JSON. Does all the heavy lifting of reading/writing
-		/// config data to/from <see cref="ConfigurationManager"/> JSON documents.
+		/// Retrieves the values of the properties of this scope from their corresponding static properties.
 		/// </summary>
-		/// <typeparam name="scopeT"></typeparam>
-		class ScopeJsonConverter<scopeT> : JsonConverter<scopeT> where scopeT : Scope<scopeT> {
-			// See: https://stackoverflow.com/questions/60830084/how-to-pass-an-argument-by-reference-using-reflection
-			internal abstract class ReadHelper {
-				public abstract object? Read (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options);
-			}
-
-			internal class ReadHelper<converterT> : ReadHelper {
-				private readonly ReadDelegate _readDelegate;
-				private delegate converterT ReadDelegate (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options);
-				public ReadHelper (object converter)
-					=> _readDelegate = (ReadDelegate)Delegate.CreateDelegate (typeof (ReadDelegate), converter, "Read");
-				public override object? Read (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options)
-					=> _readDelegate.Invoke (ref reader, type, options);
-			}
-
-			public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
-			{
-				if (reader.TokenType != JsonTokenType.StartObject) {
-					throw new JsonException ($"Expected a JSON object (\"{{ \"propName\" : ... }}\"), but got \"{reader.TokenType}\".");
-				}
-
-				var scope = (scopeT)Activator.CreateInstance (typeof (scopeT))!;
-				while (reader.Read ()) {
-					if (reader.TokenType == JsonTokenType.EndObject) {
-						return scope!;
-					}
-					if (reader.TokenType != JsonTokenType.PropertyName) {
-						throw new JsonException ($"Expected a JSON property name, but got \"{reader.TokenType}\".");
-					}
-					var propertyName = reader.GetString ();
-					reader.Read ();
-
-					if (propertyName != null && scope!.TryGetValue (propertyName, out var configProp)) {
-						// This property name was found in the Scope's ScopeProperties dictionary
-						// Figure out if it needs a JsonConverter and if so, create one
-						var propertyType = configProp?.PropertyInfo?.PropertyType!;
-						if (configProp?.PropertyInfo?.GetCustomAttribute (typeof (JsonConverterAttribute)) is JsonConverterAttribute jca) {
-							var converter = Activator.CreateInstance (jca.ConverterType!)!;
-							if (converter.GetType ().BaseType == typeof (JsonConverterFactory)) {
-								var factory = (JsonConverterFactory)converter;
-								if (propertyType != null && factory.CanConvert (propertyType)) {
-									converter = factory.CreateConverter (propertyType, options);
-								}
-							}
-							var readHelper = Activator.CreateInstance ((Type?)typeof (ReadHelper<>).MakeGenericType (typeof (scopeT), propertyType!)!, converter) as ReadHelper;
-							try {
-								scope! [propertyName].PropertyValue = readHelper?.Read (ref reader, propertyType!, options);
-							} catch (NotSupportedException e) {
-								throw new JsonException ($"Error reading property \"{propertyName}\" of type \"{propertyType?.Name}\".", e);
-							}
-						} else {
-							try {
-								scope! [propertyName].PropertyValue = JsonSerializer.Deserialize (ref reader, propertyType!, options);
-							} catch (Exception ex) {
-								System.Diagnostics.Debug.WriteLine ($"scopeT Read: {ex}");
-							}
-						}
-					} else {
-						// It is not a config property. Maybe it's just a property on the Scope with [JsonInclude]
-						// like ScopeSettings.$schema...
-						var property = scope!.GetType ().GetProperties ().Where (p => {
-							var jia = p.GetCustomAttribute (typeof (JsonIncludeAttribute)) as JsonIncludeAttribute;
-							if (jia != null) {
-								var jpna = p.GetCustomAttribute (typeof (JsonPropertyNameAttribute)) as JsonPropertyNameAttribute;
-								if (jpna?.Name == propertyName) {
-									// Bit of a hack, modifying propertyName in an enumerator...
-									propertyName = p.Name;
-									return true;
-								}
-
-								return p.Name == propertyName;
-							}
-							return false;
-						}).FirstOrDefault ();
-
-						if (property != null) {
-							var prop = scope.GetType ().GetProperty (propertyName!)!;
-							prop.SetValue (scope, JsonSerializer.Deserialize (ref reader, prop.PropertyType, options));
-						} else {
-							// Unknown property
-							throw new JsonException ($"Unknown property name \"{propertyName}\".");
-						}
-					}
-				}
-				throw new JsonException ();
+		public void RetrieveValues ()
+		{
+			foreach (var p in this.Where (cp => cp.Value.PropertyInfo != null)) {
+				p.Value.RetrieveValue ();
 			}
+		}
 
-			public override void Write (Utf8JsonWriter writer, scopeT scope, JsonSerializerOptions options)
-			{
-				writer.WriteStartObject ();
-
-				var properties = scope!.GetType ().GetProperties ().Where (p => p.GetCustomAttribute (typeof (JsonIncludeAttribute)) != null);
-				foreach (var p in properties) {
-					writer.WritePropertyName (ConfigProperty.GetJsonPropertyName (p));
-					JsonSerializer.Serialize (writer, scope.GetType ().GetProperty (p.Name)?.GetValue (scope), options);
-				}
-
-				foreach (var p in from p in scope
-						  .Where (cp =>
-							cp.Value.PropertyInfo?.GetCustomAttribute (typeof (SerializableConfigurationProperty)) is
-							SerializableConfigurationProperty scp && scp?.Scope == typeof (scopeT))
-						  where p.Value.PropertyValue != null
-						  select p) {
-
-					writer.WritePropertyName (p.Key);
-					var propertyType = p.Value.PropertyInfo?.PropertyType;
-
-					if (propertyType != null && p.Value.PropertyInfo?.GetCustomAttribute (typeof (JsonConverterAttribute)) is JsonConverterAttribute jca) {
-						var converter = Activator.CreateInstance (jca.ConverterType!)!;
-						if (converter.GetType ().BaseType == typeof (JsonConverterFactory)) {
-							var factory = (JsonConverterFactory)converter;
-							if (factory.CanConvert (propertyType)) {
-								converter = factory.CreateConverter (propertyType, options)!;
-							}
-						}
-						if (p.Value.PropertyValue != null) {
-							converter.GetType ().GetMethod ("Write")?.Invoke (converter, new object [] { writer, p.Value.PropertyValue, options });
-						}
-					} else {
-						JsonSerializer.Serialize (writer, p.Value.PropertyValue, options);
-					}
+		/// <summary>
+		/// Applies the values of the properties of this scope to their corresponding static properties.
+		/// </summary>
+		/// <returns></returns>
+		internal virtual bool Apply ()
+		{
+			bool set = false;
+			foreach (var p in this.Where (t => t.Value != null && t.Value.PropertyValue != null)) {
+				if (p.Value.Apply ()) {
+					set = true;
 				}
-				writer.WriteEndObject ();
 			}
+			return set;
 		}
 	}
 }

+ 140 - 0
Terminal.Gui/Configuration/ScopeJsonConverter.cs

@@ -0,0 +1,140 @@
+using System;
+using System.Linq;
+using System.Reflection;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+#nullable enable
+
+namespace Terminal.Gui;
+
+/// <summary>
+/// Converts <see cref="Scope{T}"/> instances to/from JSON. Does all the heavy lifting of reading/writing
+/// config data to/from <see cref="ConfigurationManager"/> JSON documents.
+/// </summary>
+/// <typeparam name="scopeT"></typeparam>
+internal class ScopeJsonConverter<scopeT> : JsonConverter<scopeT> where scopeT : Scope<scopeT> {
+	// See: https://stackoverflow.com/questions/60830084/how-to-pass-an-argument-by-reference-using-reflection
+	internal abstract class ReadHelper {
+		public abstract object? Read (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options);
+	}
+
+	internal class ReadHelper<converterT> : ReadHelper {
+		private readonly ReadDelegate _readDelegate;
+		private delegate converterT ReadDelegate (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options);
+		public ReadHelper (object converter)
+			=> _readDelegate = (ReadDelegate)Delegate.CreateDelegate (typeof (ReadDelegate), converter, "Read");
+		public override object? Read (ref Utf8JsonReader reader, Type type, JsonSerializerOptions options)
+			=> _readDelegate.Invoke (ref reader, type, options);
+	}
+
+	public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+	{
+		if (reader.TokenType != JsonTokenType.StartObject) {
+			throw new JsonException ($"Expected a JSON object (\"{{ \"propName\" : ... }}\"), but got \"{reader.TokenType}\".");
+		}
+
+		var scope = (scopeT)Activator.CreateInstance (typeof (scopeT))!;
+		while (reader.Read ()) {
+			if (reader.TokenType == JsonTokenType.EndObject) {
+				return scope!;
+			}
+			if (reader.TokenType != JsonTokenType.PropertyName) {
+				throw new JsonException ($"Expected a JSON property name, but got \"{reader.TokenType}\".");
+			}
+			var propertyName = reader.GetString ();
+			reader.Read ();
+
+			if (propertyName != null && scope!.TryGetValue (propertyName, out var configProp)) {
+				// This property name was found in the Scope's ScopeProperties dictionary
+				// Figure out if it needs a JsonConverter and if so, create one
+				var propertyType = configProp?.PropertyInfo?.PropertyType!;
+				if (configProp?.PropertyInfo?.GetCustomAttribute (typeof (JsonConverterAttribute)) is JsonConverterAttribute jca) {
+					var converter = Activator.CreateInstance (jca.ConverterType!)!;
+					if (converter.GetType ().BaseType == typeof (JsonConverterFactory)) {
+						var factory = (JsonConverterFactory)converter;
+						if (propertyType != null && factory.CanConvert (propertyType)) {
+							converter = factory.CreateConverter (propertyType, options);
+						}
+					}
+					var readHelper = Activator.CreateInstance ((Type?)typeof (ReadHelper<>).MakeGenericType (typeof (scopeT), propertyType!)!, converter) as ReadHelper;
+					try {
+						scope! [propertyName].PropertyValue = readHelper?.Read (ref reader, propertyType!, options);
+					} catch (NotSupportedException e) {
+						throw new JsonException ($"Error reading property \"{propertyName}\" of type \"{propertyType?.Name}\".", e);
+					}
+				} else {
+					try {
+						scope! [propertyName].PropertyValue = JsonSerializer.Deserialize (ref reader, propertyType!, options);
+					} catch (Exception ex) {
+						System.Diagnostics.Debug.WriteLine ($"scopeT Read: {ex}");
+					}
+				}
+			} else {
+				// It is not a config property. Maybe it's just a property on the Scope with [JsonInclude]
+				// like ScopeSettings.$schema...
+				var property = scope!.GetType ().GetProperties ().Where (p => {
+					var jia = p.GetCustomAttribute (typeof (JsonIncludeAttribute)) as JsonIncludeAttribute;
+					if (jia != null) {
+						var jpna = p.GetCustomAttribute (typeof (JsonPropertyNameAttribute)) as JsonPropertyNameAttribute;
+						if (jpna?.Name == propertyName) {
+							// Bit of a hack, modifying propertyName in an enumerator...
+							propertyName = p.Name;
+							return true;
+						}
+
+						return p.Name == propertyName;
+					}
+					return false;
+				}).FirstOrDefault ();
+
+				if (property != null) {
+					var prop = scope.GetType ().GetProperty (propertyName!)!;
+					prop.SetValue (scope, JsonSerializer.Deserialize (ref reader, prop.PropertyType, options));
+				} else {
+					// Unknown property
+					throw new JsonException ($"Unknown property name \"{propertyName}\".");
+				}
+			}
+		}
+		throw new JsonException ();
+	}
+
+	public override void Write (Utf8JsonWriter writer, scopeT scope, JsonSerializerOptions options)
+	{
+		writer.WriteStartObject ();
+
+		var properties = scope!.GetType ().GetProperties ().Where (p => p.GetCustomAttribute (typeof (JsonIncludeAttribute)) != null);
+		foreach (var p in properties) {
+			writer.WritePropertyName (ConfigProperty.GetJsonPropertyName (p));
+			JsonSerializer.Serialize (writer, scope.GetType ().GetProperty (p.Name)?.GetValue (scope), options);
+		}
+
+		foreach (var p in from p in scope
+					.Where (cp =>
+					cp.Value.PropertyInfo?.GetCustomAttribute (typeof (SerializableConfigurationProperty)) is
+					SerializableConfigurationProperty scp && scp?.Scope == typeof (scopeT))
+					where p.Value.PropertyValue != null
+					select p) {
+
+			writer.WritePropertyName (p.Key);
+			var propertyType = p.Value.PropertyInfo?.PropertyType;
+
+			if (propertyType != null && p.Value.PropertyInfo?.GetCustomAttribute (typeof (JsonConverterAttribute)) is JsonConverterAttribute jca) {
+				var converter = Activator.CreateInstance (jca.ConverterType!)!;
+				if (converter.GetType ().BaseType == typeof (JsonConverterFactory)) {
+					var factory = (JsonConverterFactory)converter;
+					if (factory.CanConvert (propertyType)) {
+						converter = factory.CreateConverter (propertyType, options)!;
+					}
+				}
+				if (p.Value.PropertyValue != null) {
+					converter.GetType ().GetMethod ("Write")?.Invoke (converter, new object [] { writer, p.Value.PropertyValue, options });
+				}
+			} else {
+				JsonSerializer.Serialize (writer, p.Value.PropertyValue, options);
+			}
+		}
+		writer.WriteEndObject ();
+	}
+}

+ 28 - 0
Terminal.Gui/Configuration/SerializableConfigurationProperty.cs

@@ -0,0 +1,28 @@
+using System;
+
+#nullable enable
+
+namespace Terminal.Gui;
+
+/// <summary>
+/// An attribute that can be applied to a property to indicate that it should included in the configuration file.
+/// </summary>
+/// <example>
+/// 	[SerializableConfigurationProperty(Scope = typeof(Configuration.ThemeManager.ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
+///	public static LineStyle DefaultBorderStyle {
+///	...
+/// </example>
+[AttributeUsage (AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
+public class SerializableConfigurationProperty : System.Attribute {
+	/// <summary>
+	/// Specifies the scope of the property. 
+	/// </summary>
+	public Type? Scope { get; set; }
+
+	/// <summary>
+	/// If <see langword="true"/>, the property will be serialized to the configuration file using only the property name
+	/// as the key. If <see langword="false"/>, the property will be serialized to the configuration file using the
+	/// property name pre-pended with the classname (e.g. <c>Application.UseSystemConsole</c>).
+	/// </summary>
+	public bool OmitClassName { get; set; }
+}

+ 97 - 99
Terminal.Gui/Configuration/SettingsScope.cs

@@ -8,113 +8,111 @@ using System.Text.Json.Serialization;
 
 #nullable enable
 
-namespace Terminal.Gui {
-	public static partial class ConfigurationManager {
-		/// <summary>
-		/// The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties 
-		/// attributed with  <see cref="SettingsScope"/>.
-		/// </summary>
-		/// <example><code>
-		///  {
-		///    "$schema" : "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json",
-		///    "Application.UseSystemConsole" : true,
-		///    "Theme" : "Default",
-		///    "Themes": {
-		///    },
-		///  },
-		/// </code></example>
-		/// <remarks>
-		/// </remarks>
-		[JsonConverter (typeof (ScopeJsonConverter<SettingsScope>))]
-		public class SettingsScope : Scope<SettingsScope> {
-			/// <summary>
-			/// Points to our JSON schema.
-			/// </summary>
-			[JsonInclude, JsonPropertyName ("$schema")]
-			public string Schema { get; set; } = "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json";
+namespace Terminal.Gui;
 
-			/// <summary>
-			/// The list of paths to the configuration files.
-			/// </summary>
-			public List<string> Sources = new List<string> ();
+/// <summary>
+/// The root object of Terminal.Gui configuration settings / JSON schema. Contains only properties 
+/// attributed with  <see cref="SettingsScope"/>.
+/// </summary>
+/// <example><code>
+///  {
+///    "$schema" : "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json",
+///    "Application.UseSystemConsole" : true,
+///    "Theme" : "Default",
+///    "Themes": {
+///    },
+///  },
+/// </code></example>
+/// <remarks>
+/// </remarks>
+[JsonConverter (typeof (ScopeJsonConverter<SettingsScope>))]
+public class SettingsScope : Scope<SettingsScope> {
+	/// <summary>
+	/// Points to our JSON schema.
+	/// </summary>
+	[JsonInclude, JsonPropertyName ("$schema")]
+	public string Schema { get; set; } = "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json";
 
-			/// <summary>
-			/// Updates the <see cref="SettingsScope"/> with the settings in a JSON string.
-			/// </summary>
-			/// <param name="stream">Json document to update the settings with.</param>
-			/// <param name="source">The source (filename/resource name) the Json document was read from.</param>
-			public SettingsScope? Update (Stream stream, string source)
-			{
-				// Update the existing settings with the new settings.
-				try {
-					Update (JsonSerializer.Deserialize<SettingsScope> (stream, _serializerOptions)!);
-					OnUpdated ();
-					Debug.WriteLine ($"ConfigurationManager: Read configuration from \"{source}\"");
-					Sources.Add (source);
-					return this;
-				} catch (JsonException e) {
-					if (ThrowOnJsonErrors ?? false) {
-						throw;
-					} else {
-						AddJsonError ($"Error deserializing {source}: {e.Message}");
-					}
-				}
-				return this;
-			}
-			
-			/// <summary>
-			/// Updates the <see cref="SettingsScope"/> with the settings in a JSON file.
-			/// </summary>
-			/// <param name="filePath"></param>
-			public SettingsScope? Update (string filePath)
-			{
-				var realPath = filePath.Replace("~", Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
-				if (!File.Exists (realPath)) {
-					Debug.WriteLine ($"ConfigurationManager: Configuration file \"{realPath}\" does not exist.");
-					Sources.Add (filePath);
-					return this;
-				}
+	/// <summary>
+	/// The list of paths to the configuration files.
+	/// </summary>
+	public List<string> Sources = new List<string> ();
 
-				var stream = File.OpenRead (realPath);
-				return Update (stream, filePath);
+	/// <summary>
+	/// Updates the <see cref="SettingsScope"/> with the settings in a JSON string.
+	/// </summary>
+	/// <param name="stream">Json document to update the settings with.</param>
+	/// <param name="source">The source (filename/resource name) the Json document was read from.</param>
+	public SettingsScope? Update (Stream stream, string source)
+	{
+		// Update the existing settings with the new settings.
+		try {
+			Update (JsonSerializer.Deserialize<SettingsScope> (stream, ConfigurationManager._serializerOptions)!);
+			ConfigurationManager.OnUpdated ();
+			Debug.WriteLine ($"ConfigurationManager: Read configuration from \"{source}\"");
+			Sources.Add (source);
+			return this;
+		} catch (JsonException e) {
+			if (ConfigurationManager.ThrowOnJsonErrors ?? false) {
+				throw;
+			} else {
+				ConfigurationManager.AddJsonError ($"Error deserializing {source}: {e.Message}");
 			}
+		}
+		return this;
+	}
 
-			/// <summary>
-			/// Updates the <see cref="SettingsScope"/> with the settings from a Json resource.
-			/// </summary>
-			/// <param name="assembly"></param>
-			/// <param name="resourceName"></param>
-			public SettingsScope? UpdateFromResource (Assembly assembly, string resourceName)
-			{
-				if (resourceName == null || string.IsNullOrEmpty (resourceName)) {
-					Debug.WriteLine ($"ConfigurationManager: Resource \"{resourceName}\" does not exist in \"{assembly.GetName ().Name}\".");
-					return this;
-				}
-				
-				using Stream? stream = assembly.GetManifestResourceStream (resourceName)!;
-				if (stream == null) {
-					Debug.WriteLine ($"ConfigurationManager: Failed to read resource \"{resourceName}\" from \"{assembly.GetName ().Name}\".");
-					return this;
-				}
+	/// <summary>
+	/// Updates the <see cref="SettingsScope"/> with the settings in a JSON file.
+	/// </summary>
+	/// <param name="filePath"></param>
+	public SettingsScope? Update (string filePath)
+	{
+		var realPath = filePath.Replace ("~", Environment.GetFolderPath (Environment.SpecialFolder.UserProfile));
+		if (!File.Exists (realPath)) {
+			Debug.WriteLine ($"ConfigurationManager: Configuration file \"{realPath}\" does not exist.");
+			Sources.Add (filePath);
+			return this;
+		}
 
-				return Update (stream, $"resource://[{assembly.GetName().Name}]/{resourceName}");
-			}
+		var stream = File.OpenRead (realPath);
+		return Update (stream, filePath);
+	}
 
-			/// <summary>
-			/// Updates the <see cref="SettingsScope"/> with the settings in a JSON string.
-			/// </summary>
-			/// <param name="json">Json document to update the settings with.</param>
-			/// <param name="source">The source (filename/resource name) the Json document was read from.</param>
-			public SettingsScope? Update (string json, string source)
-			{
-				var stream = new MemoryStream ();
-				var writer = new StreamWriter (stream);
-				writer.Write (json);
-				writer.Flush ();
-				stream.Position = 0;
+	/// <summary>
+	/// Updates the <see cref="SettingsScope"/> with the settings from a Json resource.
+	/// </summary>
+	/// <param name="assembly"></param>
+	/// <param name="resourceName"></param>
+	public SettingsScope? UpdateFromResource (Assembly assembly, string resourceName)
+	{
+		if (resourceName == null || string.IsNullOrEmpty (resourceName)) {
+			Debug.WriteLine ($"ConfigurationManager: Resource \"{resourceName}\" does not exist in \"{assembly.GetName ().Name}\".");
+			return this;
+		}
 
-				return Update (stream, source);
-			}
+		using Stream? stream = assembly.GetManifestResourceStream (resourceName)!;
+		if (stream == null) {
+			Debug.WriteLine ($"ConfigurationManager: Failed to read resource \"{resourceName}\" from \"{assembly.GetName ().Name}\".");
+			return this;
 		}
+
+		return Update (stream, $"resource://[{assembly.GetName ().Name}]/{resourceName}");
+	}
+
+	/// <summary>
+	/// Updates the <see cref="SettingsScope"/> with the settings in a JSON string.
+	/// </summary>
+	/// <param name="json">Json document to update the settings with.</param>
+	/// <param name="source">The source (filename/resource name) the Json document was read from.</param>
+	public SettingsScope? Update (string json, string source)
+	{
+		var stream = new MemoryStream ();
+		var writer = new StreamWriter (stream);
+		writer.Write (json);
+		writer.Flush ();
+		stream.Position = 0;
+
+		return Update (stream, source);
 	}
 }

+ 207 - 0
Terminal.Gui/Configuration/ThemeManager.cs

@@ -0,0 +1,207 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text.Json.Serialization;
+
+#nullable enable
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Contains a dictionary of the <see cref="ThemeManager.Theme"/>s for a Terminal.Gui application.
+/// </summary>
+/// <remarks>
+/// <para>
+/// A Theme is a collection of settings that are named. The default theme is named "Default".
+/// </para>
+/// <para>
+/// The <see cref="ThemeManager.Theme"/> property is used to detemrine the currently active theme. 
+/// </para>
+/// </remarks>
+/// <para>
+/// <see cref="ThemeManager"/> is a singleton class. It is created when the first <see cref="ThemeManager"/> property is accessed.
+/// Accessing <see cref="ThemeManager.Instance"/> is the same as accessing <see cref="ConfigurationManager.Themes"/>.
+/// </para>
+/// <example><code>
+/// 	"Themes": [
+/// 	{
+/// 		"Default": {
+/// 			"ColorSchemes": [
+/// 			{
+/// 			"TopLevel": {
+/// 			"Normal": {
+/// 				"Foreground": "BrightGreen",
+/// 				"Background": "Black"
+/// 			},
+/// 			"Focus": {
+/// 			"Foreground": "White",
+/// 				"Background": "Cyan"
+/// 
+/// 			},
+/// 			"HotNormal": {
+/// 				"Foreground": "Brown",
+/// 				"Background": "Black"
+/// 
+/// 			},
+/// 			"HotFocus": {
+/// 				"Foreground": "Blue",
+/// 				"Background": "Cyan"
+/// 			},
+/// 			"Disabled": {
+/// 				"Foreground": "DarkGray",
+/// 				"Background": "Black"
+/// 
+/// 			}
+/// 		}
+/// 	}
+/// </code></example> 
+public class ThemeManager : IDictionary<string, ThemeScope> {
+	private static readonly ThemeManager _instance = new ThemeManager ();
+	static ThemeManager () { } // Make sure it's truly lazy
+	private ThemeManager () { } // Prevent instantiation outside
+
+	/// <summary>
+	/// Class is a singleton...
+	/// </summary>
+	public static ThemeManager Instance { get { return _instance; } }
+
+	private static string _theme = string.Empty;
+
+	/// <summary>
+	/// The currently selected theme. This is the internal version; see <see cref="Theme"/>.
+	/// </summary>
+	[JsonInclude, SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true), JsonPropertyName ("Theme")]
+	internal static string SelectedTheme {
+		get => _theme;
+		set {
+			var oldTheme = _theme;
+			_theme = value;
+			if (oldTheme != _theme &&
+				ConfigurationManager.Settings! ["Themes"]?.PropertyValue is Dictionary<string, ThemeScope> themes &&
+				themes.ContainsKey (_theme)) {
+				ConfigurationManager.Settings! ["Theme"].PropertyValue = _theme;
+				Instance.OnThemeChanged (oldTheme);
+			}
+		}
+	}
+
+	/// <summary>
+	/// Gets or sets the currently selected theme. The value is persisted to the "Theme"
+	/// property.
+	/// </summary>
+	[JsonIgnore]
+	public string Theme {
+		get => ThemeManager.SelectedTheme;
+		set {
+			ThemeManager.SelectedTheme = value;
+		}
+	}
+
+	/// <summary>
+	/// Called when the selected theme has changed. Fires the <see cref="ThemeChanged"/> event.
+	/// </summary>
+	internal void OnThemeChanged (string theme)
+	{
+		Debug.WriteLine ($"Themes.OnThemeChanged({theme}) -> {Theme}");
+		ThemeChanged?.Invoke (this, new ThemeManagerEventArgs (theme));
+	}
+
+	/// <summary>
+	/// Event fired he selected theme has changed.
+	/// application.
+	/// </summary>
+	public event EventHandler<ThemeManagerEventArgs>? ThemeChanged;
+
+	/// <summary>
+	/// Holds the <see cref="ThemeScope"/> definitions. 
+	/// </summary>
+	[JsonInclude, JsonConverter (typeof (DictionaryJsonConverter<ThemeScope>))]
+	[SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true)]
+	public static Dictionary<string, ThemeScope>? Themes {
+		get => ConfigurationManager.Settings? ["Themes"]?.PropertyValue as Dictionary<string, ThemeScope>; // themes ?? new Dictionary<string, ThemeScope> ();
+		set {
+			//if (themes == null || value == null) {
+			//	themes = value;
+			//} else {
+			//	themes = (Dictionary<string, ThemeScope>)DeepMemberwiseCopy (value!, themes!)!;
+			//}
+			ConfigurationManager.Settings! ["Themes"].PropertyValue = value;
+		}
+	}
+
+	internal static void Reset ()
+	{
+		Debug.WriteLine ($"Themes.Reset()");
+
+		Themes?.Clear ();
+		SelectedTheme = string.Empty;
+	}
+
+	internal static void GetHardCodedDefaults ()
+	{
+		Debug.WriteLine ($"Themes.GetHardCodedDefaults()");
+		var theme = new ThemeScope ();
+		theme.RetrieveValues ();
+
+		Themes = new Dictionary<string, ThemeScope> (StringComparer.InvariantCultureIgnoreCase) { { "Default", theme } };
+		SelectedTheme = "Default";
+	}
+
+	#region IDictionary
+#pragma warning disable 1591
+
+	public ICollection<string> Keys => ((IDictionary<string, ThemeScope>)Themes!).Keys;
+	public ICollection<ThemeScope> Values => ((IDictionary<string, ThemeScope>)Themes!).Values;
+	public int Count => ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Count;
+	public bool IsReadOnly => ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).IsReadOnly;
+	public ThemeScope this [string key] { get => ((IDictionary<string, ThemeScope>)Themes!) [key]; set => ((IDictionary<string, ThemeScope>)Themes!) [key] = value; }
+	public void Add (string key, ThemeScope value)
+	{
+		((IDictionary<string, ThemeScope>)Themes!).Add (key, value);
+	}
+	public bool ContainsKey (string key)
+	{
+		return ((IDictionary<string, ThemeScope>)Themes!).ContainsKey (key);
+	}
+	public bool Remove (string key)
+	{
+		return ((IDictionary<string, ThemeScope>)Themes!).Remove (key);
+	}
+	public bool TryGetValue (string key, out ThemeScope value)
+	{
+		return ((IDictionary<string, ThemeScope>)Themes!).TryGetValue (key, out value!);
+	}
+	public void Add (KeyValuePair<string, ThemeScope> item)
+	{
+		((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Add (item);
+	}
+	public void Clear ()
+	{
+		((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Clear ();
+	}
+	public bool Contains (KeyValuePair<string, ThemeScope> item)
+	{
+		return ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Contains (item);
+	}
+	public void CopyTo (KeyValuePair<string, ThemeScope> [] array, int arrayIndex)
+	{
+		((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).CopyTo (array, arrayIndex);
+	}
+	public bool Remove (KeyValuePair<string, ThemeScope> item)
+	{
+		return ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Remove (item);
+	}
+	public IEnumerator<KeyValuePair<string, ThemeScope>> GetEnumerator ()
+	{
+		return ((IEnumerable<KeyValuePair<string, ThemeScope>>)Themes!).GetEnumerator ();
+	}
+
+	IEnumerator IEnumerable.GetEnumerator ()
+	{
+		return ((IEnumerable)Themes!).GetEnumerator ();
+	}
+#pragma warning restore 1591
+
+	#endregion
+}

+ 50 - 258
Terminal.Gui/Configuration/ThemeScope.cs

@@ -1,263 +1,55 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Reflection;
-using System.Text.Json.Serialization;
-using static Terminal.Gui.ConfigurationManager;
+using System.Text.Json.Serialization;
 
 #nullable enable
 
-namespace Terminal.Gui {
-
-	public static partial class ConfigurationManager {
-		/// <summary>
-		/// The root object for a Theme. A Theme is a set of settings that are applied to the running <see cref="Application"/>
-		/// as a group.
-		/// </summary>
-		/// <remarks>
-		/// <para>
-		/// </para>
-		/// </remarks>
-		/// <example><code>
-		/// 	"Default": {
-		/// 		"ColorSchemes": [
-		/// 		{
-		/// 		"TopLevel": {
-		/// 		"Normal": {
-		/// 			"Foreground": "BrightGreen",
-		/// 			"Background": "Black"
-		/// 		},
-		/// 		"Focus": {
-		/// 		"Foreground": "White",
-		/// 			"Background": "Cyan"
-		/// 
-		/// 		},
-		/// 		"HotNormal": {
-		/// 			"Foreground": "Brown",
-		/// 			"Background": "Black"
-		/// 
-		/// 		},
-		/// 		"HotFocus": {
-		/// 			"Foreground": "Blue",
-		/// 			"Background": "Cyan"
-		/// 		},
-		/// 		"Disabled": {
-		/// 			"Foreground": "DarkGray",
-		/// 			"Background": "Black"
-		/// 
-		/// 		}
-		/// 	}
-		/// </code></example> 
-		[JsonConverter (typeof (ScopeJsonConverter<ThemeScope>))]
-		public class ThemeScope : Scope<ThemeScope> {
-
-			/// <inheritdoc/>
-			internal override bool Apply ()
-			{
-				var ret = base.Apply ();
-				Application.Driver?.InitalizeColorSchemes ();
-				return ret;
-			}
-		}
-
-		/// <summary>
-		/// Contains a dictionary of the <see cref="ThemeManager.Theme"/>s for a Terminal.Gui application.
-		/// </summary>
-		/// <remarks>
-		/// <para>
-		/// A Theme is a collection of settings that are named. The default theme is named "Default".
-		/// </para>
-		/// <para>
-		/// The <see cref="ThemeManager.Theme"/> property is used to detemrine the currently active theme. 
-		/// </para>
-		/// </remarks>
-		/// <para>
-		/// <see cref="ThemeManager"/> is a singleton class. It is created when the first <see cref="ThemeManager"/> property is accessed.
-		/// Accessing <see cref="ThemeManager.Instance"/> is the same as accessing <see cref="ConfigurationManager.Themes"/>.
-		/// </para>
-		/// <example><code>
-		/// 	"Themes": [
-		/// 	{
-		/// 		"Default": {
-		/// 			"ColorSchemes": [
-		/// 			{
-		/// 			"TopLevel": {
-		/// 			"Normal": {
-		/// 				"Foreground": "BrightGreen",
-		/// 				"Background": "Black"
-		/// 			},
-		/// 			"Focus": {
-		/// 			"Foreground": "White",
-		/// 				"Background": "Cyan"
-		/// 
-		/// 			},
-		/// 			"HotNormal": {
-		/// 				"Foreground": "Brown",
-		/// 				"Background": "Black"
-		/// 
-		/// 			},
-		/// 			"HotFocus": {
-		/// 				"Foreground": "Blue",
-		/// 				"Background": "Cyan"
-		/// 			},
-		/// 			"Disabled": {
-		/// 				"Foreground": "DarkGray",
-		/// 				"Background": "Black"
-		/// 
-		/// 			}
-		/// 		}
-		/// 	}
-		/// </code></example> 
-		public partial class ThemeManager : IDictionary<string, ThemeScope> {
-			private static readonly ThemeManager _instance = new ThemeManager ();
-			static ThemeManager () { } // Make sure it's truly lazy
-			private ThemeManager () { } // Prevent instantiation outside
-
-			/// <summary>
-			/// Class is a singleton...
-			/// </summary>
-			public static ThemeManager Instance { get { return _instance; } }
-
-			private static string _theme = string.Empty;
-
-			/// <summary>
-			/// The currently selected theme. This is the internal version; see <see cref="Theme"/>.
-			/// </summary>
-			[JsonInclude, SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true), JsonPropertyName ("Theme")]
-			internal static string SelectedTheme {
-				get => _theme;
-				set {
-					var oldTheme = _theme;
-					_theme = value;
-					if (oldTheme != _theme &&
-						ConfigurationManager.Settings! ["Themes"]?.PropertyValue is Dictionary<string, ThemeScope> themes &&
-						themes.ContainsKey (_theme)) {
-						ConfigurationManager.Settings! ["Theme"].PropertyValue = _theme;
-						Instance.OnThemeChanged (oldTheme);
-					}
-				}
-			}
-
-			/// <summary>
-			/// Gets or sets the currently selected theme. The value is persisted to the "Theme"
-			/// property.
-			/// </summary>
-			[JsonIgnore]
-			public string Theme {
-				get => ThemeManager.SelectedTheme;
-				set {
-					ThemeManager.SelectedTheme = value;
-				}
-			}
-
-			/// <summary>
-			/// Called when the selected theme has changed. Fires the <see cref="ThemeChanged"/> event.
-			/// </summary>
-			internal void OnThemeChanged (string theme)
-			{
-				Debug.WriteLine ($"Themes.OnThemeChanged({theme}) -> {Theme}");
-				ThemeChanged?.Invoke (this, new ThemeManagerEventArgs (theme));
-			}
-
-			/// <summary>
-			/// Event fired he selected theme has changed.
-			/// application.
-			/// </summary>
-			public event EventHandler<ThemeManagerEventArgs>? ThemeChanged;
-
-			/// <summary>
-			/// Holds the <see cref="ThemeScope"/> definitions. 
-			/// </summary>
-			[JsonInclude, JsonConverter (typeof (DictionaryJsonConverter<ThemeScope>))]
-			[SerializableConfigurationProperty (Scope = typeof (SettingsScope), OmitClassName = true)]
-			public static Dictionary<string, ThemeScope>? Themes {
-				get => Settings? ["Themes"]?.PropertyValue as Dictionary<string, ThemeScope>; // themes ?? new Dictionary<string, ThemeScope> ();
-				set {
-					//if (themes == null || value == null) {
-					//	themes = value;
-					//} else {
-					//	themes = (Dictionary<string, ThemeScope>)DeepMemberwiseCopy (value!, themes!)!;
-					//}
-					Settings! ["Themes"].PropertyValue = value;
-				}
-			}
-
-			internal static void Reset ()
-			{
-				Debug.WriteLine ($"Themes.Reset()");
-
-				Themes?.Clear ();
-				SelectedTheme = string.Empty;
-			}
-
-			internal static void GetHardCodedDefaults ()
-			{
-				Debug.WriteLine ($"Themes.GetHardCodedDefaults()");
-				var theme = new ThemeScope ();
-				theme.RetrieveValues ();
-
-				Themes = new Dictionary<string, ThemeScope> (StringComparer.InvariantCultureIgnoreCase) { { "Default", theme } };
-				SelectedTheme = "Default";
-			}
-
-			#region IDictionary
-#pragma warning disable 1591
-
-			public ICollection<string> Keys => ((IDictionary<string, ThemeScope>)Themes!).Keys;
-			public ICollection<ThemeScope> Values => ((IDictionary<string, ThemeScope>)Themes!).Values;
-			public int Count => ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Count;
-			public bool IsReadOnly => ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).IsReadOnly;
-			public ThemeScope this [string key] { get => ((IDictionary<string, ThemeScope>)Themes!) [key]; set => ((IDictionary<string, ThemeScope>)Themes!) [key] = value; }
-			public void Add (string key, ThemeScope value)
-			{
-				((IDictionary<string, ThemeScope>)Themes!).Add (key, value);
-			}
-			public bool ContainsKey (string key)
-			{
-				return ((IDictionary<string, ThemeScope>)Themes!).ContainsKey (key);
-			}
-			public bool Remove (string key)
-			{
-				return ((IDictionary<string, ThemeScope>)Themes!).Remove (key);
-			}
-			public bool TryGetValue (string key, out ThemeScope value)
-			{
-				return ((IDictionary<string, ThemeScope>)Themes!).TryGetValue (key, out value!);
-			}
-			public void Add (KeyValuePair<string, ThemeScope> item)
-			{
-				((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Add (item);
-			}
-			public void Clear ()
-			{
-				((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Clear ();
-			}
-			public bool Contains (KeyValuePair<string, ThemeScope> item)
-			{
-				return ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Contains (item);
-			}
-			public void CopyTo (KeyValuePair<string, ThemeScope> [] array, int arrayIndex)
-			{
-				((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).CopyTo (array, arrayIndex);
-			}
-			public bool Remove (KeyValuePair<string, ThemeScope> item)
-			{
-				return ((ICollection<KeyValuePair<string, ThemeScope>>)Themes!).Remove (item);
-			}
-			public IEnumerator<KeyValuePair<string, ThemeScope>> GetEnumerator ()
-			{
-				return ((IEnumerable<KeyValuePair<string, ThemeScope>>)Themes!).GetEnumerator ();
-			}
-
-			IEnumerator IEnumerable.GetEnumerator ()
-			{
-				return ((IEnumerable)Themes!).GetEnumerator ();
-			}
-#pragma warning restore 1591
-
-			#endregion
-		}
+namespace Terminal.Gui; 
+
+/// <summary>
+/// The root object for a Theme. A Theme is a set of settings that are applied to the running <see cref="Application"/>
+/// as a group.
+/// </summary>
+/// <remarks>
+/// <para>
+/// </para>
+/// </remarks>
+/// <example><code>
+/// 	"Default": {
+/// 		"ColorSchemes": [
+/// 		{
+/// 		"TopLevel": {
+/// 		"Normal": {
+/// 			"Foreground": "BrightGreen",
+/// 			"Background": "Black"
+/// 		},
+/// 		"Focus": {
+/// 		"Foreground": "White",
+/// 			"Background": "Cyan"
+/// 
+/// 		},
+/// 		"HotNormal": {
+/// 			"Foreground": "Brown",
+/// 			"Background": "Black"
+/// 
+/// 		},
+/// 		"HotFocus": {
+/// 			"Foreground": "Blue",
+/// 			"Background": "Cyan"
+/// 		},
+/// 		"Disabled": {
+/// 			"Foreground": "DarkGray",
+/// 			"Background": "Black"
+/// 
+/// 		}
+/// 	}
+/// </code></example> 
+[JsonConverter (typeof (ScopeJsonConverter<ThemeScope>))]
+public class ThemeScope : Scope<ThemeScope> {
+
+	/// <inheritdoc/>
+	internal override bool Apply ()
+	{
+		var ret = base.Apply ();
+		Application.Driver?.InitalizeColorSchemes ();
+		return ret;
 	}
 }

+ 20 - 0
Terminal.Gui/Drawing/Cell.cs

@@ -0,0 +1,20 @@
+using System.Text;
+
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Represents a single row/column within the <see cref="LineCanvas"/>. Includes the glyph and the foreground/background colors.
+/// </summary>
+public class Cell {
+	/// <summary>
+	/// The glyph to draw.
+	/// </summary>
+	public Rune? Rune { get; set; }
+
+	/// <summary>
+	/// The foreground color to draw the glyph with.
+	/// </summary>
+	public Attribute? Attribute { get; set; }
+
+}

+ 0 - 16
Terminal.Gui/Drawing/LineCanvas.cs

@@ -528,22 +528,6 @@ namespace Terminal.Gui {
 
 		}
 
-		/// <summary>
-		/// Represents a single row/column within the <see cref="LineCanvas"/>. Includes the glyph and the foreground/background colors.
-		/// </summary>
-		public class Cell {
-			/// <summary>
-			/// The glyph to draw.
-			/// </summary>
-			public Rune? Rune { get; set; }
-
-			/// <summary>
-			/// The foreground color to draw the glyph with.
-			/// </summary>
-			public Attribute? Attribute { get; set; }
-
-		}
-
 		private Cell GetCellForIntersects (ConsoleDriver driver, IntersectionDefinition [] intersects)
 		{
 			if (!intersects.Any ()) {

+ 1 - 1
Terminal.Gui/FileServices/FileDialogStyle.cs

@@ -142,7 +142,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Gets the style settings for the table of files (in currently selected directory).
 		/// </summary>
-		public TableView.TableStyle TableStyle { get; internal set; }
+		public TableStyle TableStyle { get; internal set; }
 
 		/// <summary>
 		/// Gets the style settings for the collapse-able directory/places tree

+ 0 - 13
Terminal.Gui/MainLoop.cs

@@ -46,19 +46,6 @@ namespace Terminal.Gui {
 	///   does not seem to be a way of supporting this on Windows.
 	/// </remarks>
 	public class MainLoop {
-		/// <summary>
-		/// Provides data for timers running manipulation.
-		/// </summary>
-		public sealed class Timeout {
-			/// <summary>
-			/// Time to wait before invoke the callback.
-			/// </summary>
-			public TimeSpan Span;
-			/// <summary>
-			/// The function that will be invoked.
-			/// </summary>
-			public Func<MainLoop, bool> Callback;
-		}
 
 		internal SortedList<long, Timeout> timeouts = new SortedList<long, Timeout> ();
 		object _timeoutsLockToken = new object ();

+ 79 - 0
Terminal.Gui/RunState.cs

@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+
+namespace Terminal.Gui;
+
+/// <summary>
+/// The execution state for a <see cref="Toplevel"/> view.
+/// </summary>
+public class RunState : IDisposable {
+	/// <summary>
+	/// Initializes a new <see cref="RunState"/> class.
+	/// </summary>
+	/// <param name="view"></param>
+	public RunState (Toplevel view)
+	{
+		Toplevel = view;
+	}
+	/// <summary>
+	/// The <see cref="Toplevel"/> belonging to this <see cref="RunState"/>.
+	/// </summary>
+	public Toplevel Toplevel { get; internal set; }
+
+#if DEBUG_IDISPOSABLE
+	/// <summary>
+	/// For debug (see DEBUG_IDISPOSABLE define) purposes to verify objects are being disposed properly
+	/// </summary>
+	public bool WasDisposed = false;
+
+	/// <summary>
+	/// For debug (see DEBUG_IDISPOSABLE define) purposes to verify objects are being disposed properly
+	/// </summary>
+	public int DisposedCount = 0;
+
+	/// <summary>
+	/// For debug (see DEBUG_IDISPOSABLE define) purposes; the runstate instances that have been created
+	/// </summary>
+	public static List<RunState> Instances = new List<RunState> ();
+
+	/// <summary>
+	/// Creates a new RunState object.
+	/// </summary>
+	public RunState ()
+	{
+		Instances.Add (this);
+	}
+#endif
+
+	/// <summary>
+	/// Releases all resource used by the <see cref="RunState"/> object.
+	/// </summary>
+	/// <remarks>
+	/// Call <see cref="Dispose()"/> when you are finished using the <see cref="RunState"/>. 
+	/// </remarks>
+	/// <remarks>
+	/// <see cref="Dispose()"/> method leaves the <see cref="RunState"/> in an unusable state. After
+	/// calling <see cref="Dispose()"/>, you must release all references to the
+	/// <see cref="RunState"/> so the garbage collector can reclaim the memory that the
+	/// <see cref="RunState"/> was occupying.
+	/// </remarks>
+	public void Dispose ()
+	{
+		Dispose (true);
+		GC.SuppressFinalize (this);
+#if DEBUG_IDISPOSABLE
+		WasDisposed = true;
+#endif
+	}
+
+	/// <summary>
+	/// Releases all resource used by the <see cref="RunState"/> object.
+	/// </summary>
+	/// <param name="disposing">If set to <see langword="true"/> we are disposing and should dispose held objects.</param>
+	protected virtual void Dispose (bool disposing)
+	{
+		if (Toplevel != null && disposing) {
+			throw new InvalidOperationException ("You must clean up (Dispose) the Toplevel before calling Application.RunState.Dispose");
+		}
+	}
+}

+ 1 - 0
Terminal.Gui/Terminal.Gui.csproj

@@ -5,6 +5,7 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DefineConstants>TRACE;DEBUG_IDISPOSABLE</DefineConstants>
     <DebugType>portable</DebugType>
+	<WarningsAsErrors>CS1574<!--,CA1034--></WarningsAsErrors>
   </PropertyGroup>
   <PropertyGroup>
     <!-- Version numbers are automatically updated by gitversion when a release is released -->

+ 23 - 0
Terminal.Gui/Timeout.cs

@@ -0,0 +1,23 @@
+//
+// MainLoop.cs: IMainLoopDriver and MainLoop for Terminal.Gui
+//
+// Authors:
+//   Miguel de Icaza ([email protected])
+//
+using System;
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Provides data for timers running manipulation.
+/// </summary>
+public sealed class Timeout {
+	/// <summary>
+	/// Time to wait before invoke the callback.
+	/// </summary>
+	public TimeSpan Span;
+	/// <summary>
+	/// The function that will be invoked.
+	/// </summary>
+	public Func<MainLoop, bool> Callback;
+}

+ 1 - 1
Terminal.Gui/Views/FileDialog.cs

@@ -1147,7 +1147,7 @@ namespace Terminal.Gui {
 			this.tableView.Update ();
 		}
 
-		private ColorScheme ColorGetter (TableView.CellColorGetterArgs args)
+		private ColorScheme ColorGetter (CellColorGetterArgs args)
 		{
 			var stats = this.RowToStats (args.RowIndex);
 

+ 0 - 24
Terminal.Gui/Views/GraphView/Annotations.cs

@@ -262,29 +262,5 @@ namespace Terminal.Gui {
 				yield return new LineF (Points [i], Points [i + 1]);
 			}
 		}
-
-		/// <summary>
-		/// Describes two points in graph space and a line between them
-		/// </summary>
-		public class LineF {
-			/// <summary>
-			/// The start of the line
-			/// </summary>
-			public PointF Start { get; }
-
-			/// <summary>
-			/// The end point of the line
-			/// </summary>
-			public PointF End { get; }
-
-			/// <summary>
-			/// Creates a new line between the points
-			/// </summary>
-			public LineF (PointF start, PointF end)
-			{
-				this.Start = start;
-				this.End = end;
-			}
-		}
 	}
 }

+ 38 - 0
Terminal.Gui/Views/GraphView/BarSeriesBar.cs

@@ -0,0 +1,38 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// A single bar in a <see cref="BarSeries"/>
+/// </summary>
+public class BarSeriesBar {
+
+	/// <summary>
+	/// Optional text that describes the bar.  This will be rendered on the corresponding
+	/// <see cref="Axis"/> unless <see cref="BarSeries.DrawLabels"/> is false
+	/// </summary>
+	public string Text { get; set; }
+
+	/// <summary>
+	/// The color and character that will be rendered in the console
+	/// when the bar extends over it
+	/// </summary>
+	public GraphCellToRender Fill { get; set; }
+
+	/// <summary>
+	/// The value in graph space X/Y (depending on <see cref="Orientation"/>) to which the bar extends.
+	/// </summary>
+	public float Value { get; }
+
+	/// <summary>
+	/// Creates a new instance of a single bar rendered in the given <paramref name="fill"/> that extends
+	/// out <paramref name="value"/> graph space units in the default <see cref="Orientation"/>
+	/// </summary>
+	/// <param name="text"></param>
+	/// <param name="fill"></param>
+	/// <param name="value"></param>
+	public BarSeriesBar (string text, GraphCellToRender fill, float value)
+	{
+		Text = text;
+		Fill = fill;
+		Value = value;
+	}
+}

+ 25 - 0
Terminal.Gui/Views/GraphView/LineF.cs

@@ -0,0 +1,25 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Describes two points in graph space and a line between them
+/// </summary>
+public class LineF {
+	/// <summary>
+	/// The start of the line
+	/// </summary>
+	public PointF Start { get; }
+
+	/// <summary>
+	/// The end point of the line
+	/// </summary>
+	public PointF End { get; }
+
+	/// <summary>
+	/// Creates a new line between the points
+	/// </summary>
+	public LineF (PointF start, PointF end)
+	{
+		this.Start = start;
+		this.End = end;
+	}
+}

+ 5 - 42
Terminal.Gui/Views/GraphView/Series.cs

@@ -119,7 +119,7 @@ namespace Terminal.Gui {
 			}
 
 			for (int i = 0; i < values.Length; i++) {
-				subSeries [i].Bars.Add (new BarSeries.Bar (label,
+				subSeries [i].Bars.Add (new BarSeriesBar (label,
 					new GraphCellToRender (fill), values [i]));
 			}
 		}
@@ -147,7 +147,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Ordered collection of graph bars to position along axis
 		/// </summary>
-		public List<Bar> Bars { get; set; } = new List<Bar> ();
+		public List<BarSeriesBar> Bars { get; set; } = new List<BarSeriesBar> ();
 
 		/// <summary>
 		/// Determines the spacing of bars along the axis. Defaults to 1 i.e. 
@@ -169,12 +169,12 @@ namespace Terminal.Gui {
 		public float Offset { get; set; } = 0;
 
 		/// <summary>
-		/// Overrides the <see cref="Bar.Fill"/> with a fixed color
+		/// Overrides the <see cref="BarSeriesBar.Fill"/> with a fixed color
 		/// </summary>
 		public Attribute? OverrideBarColor { get; set; }
 
 		/// <summary>
-		/// True to draw <see cref="Bar.Text"/> along the axis under the bar.  Defaults
+		/// True to draw <see cref="BarSeriesBar.Text"/> along the axis under the bar.  Defaults
 		/// to true.
 		/// </summary>
 		public bool DrawLabels { get; set; } = true;
@@ -268,7 +268,7 @@ namespace Terminal.Gui {
 		/// <param name="start">Screen position of the start of the bar</param>
 		/// <param name="end">Screen position of the end of the bar</param>
 		/// <param name="beingDrawn">The Bar that occupies this space and is being drawn</param>
-		protected virtual void DrawBarLine (GraphView graph, Point start, Point end, Bar beingDrawn)
+		protected virtual void DrawBarLine (GraphView graph, Point start, Point end, BarSeriesBar beingDrawn)
 		{
 			var adjusted = AdjustColor (beingDrawn.Fill);
 
@@ -280,42 +280,5 @@ namespace Terminal.Gui {
 
 			graph.SetDriverColorToGraphColor ();
 		}
-
-		/// <summary>
-		/// A single bar in a <see cref="BarSeries"/>
-		/// </summary>
-		public class Bar {
-
-			/// <summary>
-			/// Optional text that describes the bar.  This will be rendered on the corresponding
-			/// <see cref="Axis"/> unless <see cref="DrawLabels"/> is false
-			/// </summary>
-			public string Text { get; set; }
-
-			/// <summary>
-			/// The color and character that will be rendered in the console
-			/// when the bar extends over it
-			/// </summary>
-			public GraphCellToRender Fill { get; set; }
-
-			/// <summary>
-			/// The value in graph space X/Y (depending on <see cref="Orientation"/>) to which the bar extends.
-			/// </summary>
-			public float Value { get; }
-
-			/// <summary>
-			/// Creates a new instance of a single bar rendered in the given <paramref name="fill"/> that extends
-			/// out <paramref name="value"/> graph space units in the default <see cref="Orientation"/>
-			/// </summary>
-			/// <param name="text"></param>
-			/// <param name="fill"></param>
-			/// <param name="value"></param>
-			public Bar (string text, GraphCellToRender fill, float value)
-			{
-				Text = text;
-				Fill = fill;
-				Value = value;
-			}
-		}
 	}
 }

+ 5 - 1
Terminal.Gui/Views/SpinnerView/SpinnerStyle.cs

@@ -27,6 +27,8 @@
 
 using System;
 
+#pragma warning disable CA1034 // Nested types should not be visible
+
 namespace Terminal.Gui {
 	/// <summary>
 	/// SpinnerStyles used in a <see cref="SpinnerView"/>.
@@ -1696,4 +1698,6 @@ namespace Terminal.Gui {
 		}
 #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
 	}
-}
+}
+
+#pragma warning restore CA1034 // Nested types should not be visible

+ 39 - 0
Terminal.Gui/Views/Tab.cs

@@ -0,0 +1,39 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// A single tab in a <see cref="TabView"/>
+/// </summary>
+public class Tab {
+	private string text;
+
+	/// <summary>
+	/// The text to display in a <see cref="TabView"/>
+	/// </summary>
+	/// <value></value>
+	public string Text { get => text ?? "Unamed"; set => text = value; }
+
+	/// <summary>
+	/// The control to display when the tab is selected
+	/// </summary>
+	/// <value></value>
+	public View View { get; set; }
+
+	/// <summary>
+	/// Creates a new unamed tab with no controls inside
+	/// </summary>
+	public Tab ()
+	{
+
+	}
+
+	/// <summary>
+	/// Creates a new tab with the given text hosting a view
+	/// </summary>
+	/// <param name="text"></param>
+	/// <param name="view"></param>
+	public Tab (string text, View view)
+	{
+		this.Text = text;
+		this.View = view;
+	}
+}

+ 3 - 3
Terminal.Gui/Views/TabChangedEventArgs.cs

@@ -10,19 +10,19 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// The previously selected tab. May be null
 		/// </summary>
-		public TabView.Tab OldTab { get; }
+		public Tab OldTab { get; }
 
 		/// <summary>
 		/// The currently selected tab. May be null
 		/// </summary>
-		public TabView.Tab NewTab { get; }
+		public Tab NewTab { get; }
 
 		/// <summary>
 		/// Documents a tab change
 		/// </summary>
 		/// <param name="oldTab"></param>
 		/// <param name="newTab"></param>
-		public TabChangedEventArgs (TabView.Tab oldTab, TabView.Tab newTab)
+		public TabChangedEventArgs (Tab oldTab, Tab newTab)
 		{
 			OldTab = oldTab;
 			NewTab = newTab;

+ 5 - 5
Terminal.Gui/Views/TabMouseEventArgs.cs

@@ -3,17 +3,17 @@
 namespace Terminal.Gui {
 
 	/// <summary>
-	/// Describes a mouse event over a specific <see cref="TabView.Tab"/> in a <see cref="TabView"/>.
+	/// Describes a mouse event over a specific <see cref="Tab"/> in a <see cref="TabView"/>.
 	/// </summary>
 	public class TabMouseEventArgs : EventArgs {
 
 		/// <summary>
-		/// Gets the <see cref="TabView.Tab"/> (if any) that the mouse
+		/// Gets the <see cref="Tab"/> (if any) that the mouse
 		/// was over when the <see cref="MouseEvent"/> occurred.
 		/// </summary>
 		/// <remarks>This will be null if the click is after last tab
 		/// or before first.</remarks>
-		public TabView.Tab Tab { get; }
+		public Tab Tab { get; }
 
 		/// <summary>
 		/// Gets the actual mouse event.  Use <see cref="MouseEvent.Handled"/> to cancel this event
@@ -24,9 +24,9 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Creates a new instance of the <see cref="TabMouseEventArgs"/> class.
 		/// </summary>
-		/// <param name="tab"><see cref="TabView.Tab"/> that the mouse was over when the event occurred.</param>
+		/// <param name="tab"><see cref="Tab"/> that the mouse was over when the event occurred.</param>
 		/// <param name="mouseEvent">The mouse activity being reported</param>
-		public TabMouseEventArgs (TabView.Tab tab, MouseEvent mouseEvent)
+		public TabMouseEventArgs (Tab tab, MouseEvent mouseEvent)
 		{
 			Tab = tab;
 			MouseEvent = mouseEvent;

+ 28 - 0
Terminal.Gui/Views/TabStyle.cs

@@ -0,0 +1,28 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Describes render stylistic selections of a <see cref="TabView"/>
+/// </summary>
+public class TabStyle {
+
+	/// <summary>
+	/// True to show the top lip of tabs.  False to directly begin with tab text during 
+	/// rendering.  When true header line occupies 3 rows, when false only 2.
+	/// Defaults to true.
+	/// 
+	/// <para>When <see cref="TabsOnBottom"/> is enabled this instead applies to the
+	///  bottommost line of the control</para>
+	/// </summary> 
+	public bool ShowTopLine { get; set; } = true;
+
+	/// <summary>
+	/// True to show a solid box around the edge of the control.  Defaults to true.
+	/// </summary>
+	public bool ShowBorder { get; set; } = true;
+
+	/// <summary>
+	/// True to render tabs at the bottom of the view instead of the top
+	/// </summary>
+	public bool TabsOnBottom { get; set; } = false;
+
+}

+ 2 - 70
Terminal.Gui/Views/TabView.cs

@@ -9,7 +9,7 @@ namespace Terminal.Gui {
 	/// <summary>
 	/// Control that hosts multiple sub views, presenting a single one at once
 	/// </summary>
-	public partial class TabView : View {
+	public class TabView : View {
 		private Tab selectedTab;
 
 		/// <summary>
@@ -54,7 +54,7 @@ namespace Terminal.Gui {
 		public event EventHandler<TabChangedEventArgs> SelectedTabChanged;
 
 		/// <summary>
-		/// Event fired when a <see cref="TabView.Tab"/> is clicked.  Can be used to cancel navigation,
+		/// Event fired when a <see cref="Tab"/> is clicked.  Can be used to cancel navigation,
 		/// show context menu (e.g. on right click) etc.
 		/// </summary>
 		public event EventHandler<TabMouseEventArgs> TabClicked;
@@ -425,8 +425,6 @@ namespace Terminal.Gui {
 			SetNeedsDisplay ();
 		}
 
-		#region Nested Types
-
 		private class TabToRender {
 			public int X { get; set; }
 			public Tab Tab { get; set; }
@@ -745,71 +743,5 @@ namespace Terminal.Gui {
 		{
 			TabClicked?.Invoke (this, tabMouseEventArgs);
 		}
-
-		/// <summary>
-		/// A single tab in a <see cref="TabView"/>
-		/// </summary>
-		public class Tab {
-			private string text;
-
-			/// <summary>
-			/// The text to display in a <see cref="TabView"/>
-			/// </summary>
-			/// <value></value>
-			public string Text { get => text ?? "Unamed"; set => text = value; }
-
-			/// <summary>
-			/// The control to display when the tab is selected
-			/// </summary>
-			/// <value></value>
-			public View View { get; set; }
-
-			/// <summary>
-			/// Creates a new unamed tab with no controls inside
-			/// </summary>
-			public Tab ()
-			{
-
-			}
-
-			/// <summary>
-			/// Creates a new tab with the given text hosting a view
-			/// </summary>
-			/// <param name="text"></param>
-			/// <param name="view"></param>
-			public Tab (string text, View view)
-			{
-				this.Text = text;
-				this.View = view;
-			}
-		}
-
-		/// <summary>
-		/// Describes render stylistic selections of a <see cref="TabView"/>
-		/// </summary>
-		public class TabStyle {
-
-			/// <summary>
-			/// True to show the top lip of tabs.  False to directly begin with tab text during 
-			/// rendering.  When true header line occupies 3 rows, when false only 2.
-			/// Defaults to true.
-			/// 
-			/// <para>When <see cref="TabsOnBottom"/> is enabled this instead applies to the
-			///  bottommost line of the control</para>
-			/// </summary> 
-			public bool ShowTopLine { get; set; } = true;
-
-			/// <summary>
-			/// True to show a solid box around the edge of the control.  Defaults to true.
-			/// </summary>
-			public bool ShowBorder { get; set; } = true;
-
-			/// <summary>
-			/// True to render tabs at the bottom of the view instead of the top
-			/// </summary>
-			public bool TabsOnBottom { get; set; } = false;
-
-		}
-		#endregion
 	}
 }

+ 49 - 0
Terminal.Gui/Views/TableView/CellColorGetterArgs.cs

@@ -0,0 +1,49 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Arguments for a <see cref="CellColorGetterDelegate"/>.  Describes a cell for which a rendering
+/// <see cref="ColorScheme"/> is being sought
+/// </summary>
+public class CellColorGetterArgs {
+
+	/// <summary>
+	/// The data table hosted by the <see cref="TableView"/> control.
+	/// </summary>
+	public ITableSource Table { get; }
+
+	/// <summary>
+	/// The index of the row in <see cref="Table"/> for which color is needed
+	/// </summary>
+	public int RowIndex { get; }
+
+	/// <summary>
+	/// The index of column in <see cref="Table"/> for which color is needed
+	/// </summary>
+	public int ColIdex { get; }
+
+	/// <summary>
+	/// The hard typed value being rendered in the cell for which color is needed
+	/// </summary>
+	public object CellValue { get; }
+
+	/// <summary>
+	/// The textual representation of <see cref="CellValue"/> (what will actually be drawn to the screen)
+	/// </summary>
+	public string Representation { get; }
+
+	/// <summary>
+	/// the color scheme that is going to be used to render the cell if no cell specific color scheme is returned
+	/// </summary>
+	public ColorScheme RowScheme { get; }
+
+	internal CellColorGetterArgs (ITableSource table, int rowIdx, int colIdx, object cellValue, string representation, ColorScheme rowScheme)
+	{
+		Table = table;
+		RowIndex = rowIdx;
+		ColIdex = colIdx;
+		CellValue = cellValue;
+		Representation = representation;
+		RowScheme = rowScheme;
+	}
+
+}

+ 103 - 0
Terminal.Gui/Views/TableView/ColumnStyle.cs

@@ -0,0 +1,103 @@
+using System;
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Describes how to render a given column in  a <see cref="TableView"/> including <see cref="Alignment"/> 
+/// and textual representation of cells (e.g. date formats)
+/// 
+/// <a href="https://gui-cs.github.io/Terminal.Gui/articles/tableview.html">See TableView Deep Dive for more information</a>.
+/// </summary>
+public class ColumnStyle {
+
+	/// <summary>
+	/// Defines the default alignment for all values rendered in this column.  For custom alignment based on cell contents use <see cref="AlignmentGetter"/>.
+	/// </summary>
+	public TextAlignment Alignment { get; set; }
+
+	/// <summary>
+	/// Defines a delegate for returning custom alignment per cell based on cell values.  When specified this will override <see cref="Alignment"/>
+	/// </summary>
+	public Func<object, TextAlignment> AlignmentGetter;
+
+	/// <summary>
+	/// Defines a delegate for returning custom representations of cell values.  If not set then <see cref="object.ToString()"/> is used.  Return values from your delegate may be truncated e.g. based on <see cref="MaxWidth"/>
+	/// </summary>
+	public Func<object, string> RepresentationGetter;
+
+	/// <summary>
+	/// Defines a delegate for returning a custom color scheme per cell based on cell values.
+	/// Return null for the default
+	/// </summary>
+	public CellColorGetterDelegate ColorGetter;
+	private bool visible = true;
+
+	/// <summary>
+	/// Defines the format for values e.g. "yyyy-MM-dd" for dates
+	/// </summary>
+	public string Format { get; set; }
+
+	/// <summary>
+	/// Set the maximum width of the column in characters.  This value will be ignored if more than the tables <see cref="TableView.MaxCellWidth"/>.  Defaults to <see cref="TableView.DefaultMaxCellWidth"/>
+	/// </summary>
+	public int MaxWidth { get; set; } = TableView.DefaultMaxCellWidth;
+
+	/// <summary>
+	/// Set the minimum width of the column in characters.  Setting this will ensure that
+	/// even when a column has short content/header it still fills a given width of the control.
+	/// 
+	/// <para>This value will be ignored if more than the tables <see cref="TableView.MaxCellWidth"/> 
+	/// or the <see cref="MaxWidth"/>
+	/// </para>
+	/// <remarks>
+	/// For setting a flexible column width (down to a lower limit) use <see cref="MinAcceptableWidth"/>
+	/// instead
+	/// </remarks>
+	/// </summary>
+	public int MinWidth { get; set; }
+
+	/// <summary>
+	/// Enables flexible sizing of this column based on available screen space to render into.
+	/// </summary>
+	public int MinAcceptableWidth { get; set; } = TableView.DefaultMinAcceptableWidth;
+
+	/// <summary>
+	/// Gets or Sets a value indicating whether the column should be visible to the user.
+	/// This affects both whether it is rendered and whether it can be selected. Defaults to
+	/// true.
+	/// </summary>
+	/// <remarks>If <see cref="MaxWidth"/> is 0 then <see cref="Visible"/> will always return false.</remarks>
+	public bool Visible { get => MaxWidth >= 0 && visible; set => visible = value; }
+
+	/// <summary>
+	/// Returns the alignment for the cell based on <paramref name="cellValue"/> and <see cref="AlignmentGetter"/>/<see cref="Alignment"/>
+	/// </summary>
+	/// <param name="cellValue"></param>
+	/// <returns></returns>
+	public TextAlignment GetAlignment (object cellValue)
+	{
+		if (AlignmentGetter != null)
+			return AlignmentGetter (cellValue);
+
+		return Alignment;
+	}
+
+	/// <summary>
+	/// Returns the full string to render (which may be truncated if too long) that the current style says best represents the given <paramref name="value"/>
+	/// </summary>
+	/// <param name="value"></param>
+	/// <returns></returns>
+	public string GetRepresentation (object value)
+	{
+		if (!string.IsNullOrWhiteSpace (Format)) {
+
+			if (value is IFormattable f)
+				return f.ToString (Format, null);
+		}
+
+		if (RepresentationGetter != null)
+			return RepresentationGetter (value);
+
+		return value?.ToString ();
+	}
+}

+ 18 - 0
Terminal.Gui/Views/TableView/ListColumnStyle.cs

@@ -0,0 +1,18 @@
+namespace Terminal.Gui; 
+/// <summary>
+/// Defines rendering options that affect how the view is displayed.
+/// </summary>
+public class ListColumnStyle {
+
+	/// <summary>
+	/// Gets or sets an Orientation enum indicating whether to populate data down each column
+	/// rather than across each row.  Defaults to <see cref="Orientation.Horizontal"/>.
+	/// </summary>
+	public Orientation Orientation { get; set; } = Orientation.Horizontal;
+
+	/// <summary>
+	/// Gets or sets a flag indicating whether to scroll in the same direction as <see cref="ListColumnStyle.Orientation"/>.
+	/// Defaults to <see langword="false"/>.
+	/// </summary>
+	public bool ScrollParallel { get; set; } = false;
+}

+ 0 - 18
Terminal.Gui/Views/TableView/ListTableSource.cs

@@ -174,23 +174,5 @@ namespace Terminal.Gui {
 
 			return (cols > 1) ? cols : 1;
 		}
-
-		/// <summary>
-		/// Defines rendering options that affect how the view is displayed.
-		/// </summary>
-		public class ListColumnStyle {
-
-			/// <summary>
-			/// Gets or sets an Orientation enum indicating whether to populate data down each column
-			/// rather than across each row.  Defaults to <see cref="Orientation.Horizontal"/>.
-			/// </summary>
-			public Orientation Orientation { get; set; } = Orientation.Horizontal;
-
-			/// <summary>
-			/// Gets or sets a flag indicating whether to scroll in the same direction as <see cref="ListTableSource.ListColumnStyle.Orientation"/>.
-			/// Defaults to <see langword="false"/>.
-			/// </summary>
-			public bool ScrollParallel { get; set; } = false;
-		}
 	}
 }

+ 24 - 0
Terminal.Gui/Views/TableView/RowColorGetterArgs.cs

@@ -0,0 +1,24 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Arguments for <see cref="RowColorGetterDelegate"/>. Describes a row of data in a <see cref="ITableSource"/>
+/// for which <see cref="ColorScheme"/> is sought.
+/// </summary>
+public class RowColorGetterArgs {
+
+	/// <summary>
+	/// The data table hosted by the <see cref="TableView"/> control.
+	/// </summary>
+	public ITableSource Table { get; }
+
+	/// <summary>
+	/// The index of the row in <see cref="Table"/> for which color is needed
+	/// </summary>
+	public int RowIndex { get; }
+
+	internal RowColorGetterArgs (ITableSource table, int rowIdx)
+	{
+		Table = table;
+		RowIndex = rowIdx;
+	}
+}

+ 36 - 0
Terminal.Gui/Views/TableView/TableSelection.cs

@@ -0,0 +1,36 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Describes a selected region of the table
+/// </summary>
+public class TableSelection {
+
+	/// <summary>
+	/// Corner of the <see cref="Rect"/> where selection began
+	/// </summary>
+	/// <value></value>
+	public Point Origin { get; set; }
+
+	/// <summary>
+	/// Area selected
+	/// </summary>
+	/// <value></value>
+	public Rect Rect { get; set; }
+
+	/// <summary>
+	/// True if the selection was made through <see cref="Command.ToggleChecked"/>
+	/// and therefore should persist even through keyboard navigation.
+	/// </summary>
+	public bool IsToggled { get; set; }
+
+	/// <summary>
+	/// Creates a new selected area starting at the origin corner and covering the provided rectangular area
+	/// </summary>
+	/// <param name="origin"></param>
+	/// <param name="rect"></param>
+	public TableSelection (Point origin, Rect rect)
+	{
+		Origin = origin;
+		Rect = rect;
+	}
+}

+ 132 - 0
Terminal.Gui/Views/TableView/TableStyle.cs

@@ -0,0 +1,132 @@
+using System.Collections.Generic;
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Defines rendering options that affect how the table is displayed.
+/// 
+/// <a href="https://gui-cs.github.io/Terminal.Gui/articles/tableview.html">See TableView Deep Dive for more information</a>.
+/// </summary>
+public class TableStyle {
+
+	/// <summary>
+	/// Gets or sets a flag indicating whether to render headers of a <see cref="TableView"/>.
+	/// Defaults to <see langword="true"/>.
+	/// </summary>
+	/// <remarks><see cref="ShowHorizontalHeaderOverline"/>, <see cref="ShowHorizontalHeaderUnderline"/> etc
+	/// may still be used even if <see cref="ShowHeaders"/> is <see langword="false"/>.</remarks>
+	public bool ShowHeaders { get; set; } = true;
+
+	/// <summary>
+	/// When scrolling down always lock the column headers in place as the first row of the table
+	/// </summary>
+	public bool AlwaysShowHeaders { get; set; } = false;
+
+	/// <summary>
+	/// True to render a solid line above the headers
+	/// </summary>
+	public bool ShowHorizontalHeaderOverline { get; set; } = true;
+
+	/// <summary>
+	/// True to render a solid line under the headers
+	/// </summary>
+	public bool ShowHorizontalHeaderUnderline { get; set; } = true;
+
+	/// <summary>
+	/// True to render a solid line vertical line between cells
+	/// </summary>
+	public bool ShowVerticalCellLines { get; set; } = true;
+
+	/// <summary>
+	/// True to render a solid line vertical line between headers
+	/// </summary>
+	public bool ShowVerticalHeaderLines { get; set; } = true;
+
+	/// <summary>
+	/// True to render a arrows on the right/left of the table when 
+	/// there are more column(s) that can be scrolled to.  Requires
+	/// <see cref="ShowHorizontalHeaderUnderline"/> to be true.
+	/// Defaults to true
+	/// </summary>
+	public bool ShowHorizontalScrollIndicators { get; set; } = true;
+
+
+	/// <summary>
+	/// Gets or sets a flag indicating whether there should be a horizontal line after all the data
+	/// in the table. Defaults to <see langword="false"/>.
+	/// </summary>
+	public bool ShowHorizontalBottomline { get; set; } = false;
+
+	/// <summary>
+	/// True to invert the colors of the first symbol of the selected cell in the <see cref="TableView"/>.
+	/// This gives the appearance of a cursor for when the <see cref="ConsoleDriver"/> doesn't otherwise show
+	/// this
+	/// </summary>
+	public bool InvertSelectedCellFirstCharacter { get; set; } = false;
+
+	/// <summary>
+	/// Gets or sets a flag indicating whether to force <see cref="ColorScheme.Normal"/> use when rendering
+	/// vertical cell lines (even when <see cref="TableView.FullRowSelect"/> is on).
+	/// </summary>
+	public bool AlwaysUseNormalColorForVerticalCellLines { get; set; } = false;
+
+	/// <summary>
+	/// Collection of columns for which you want special rendering (e.g. custom column lengths, text alignment etc)
+	/// </summary>
+	public Dictionary<int, ColumnStyle> ColumnStyles { get; set; } = new Dictionary<int, ColumnStyle> ();
+
+	/// <summary>
+	/// Delegate for coloring specific rows in a different color.  For cell color <see cref="ColumnStyle.ColorGetter"/>
+	/// </summary>
+	/// <value></value>
+	public RowColorGetterDelegate RowColorGetter { get; set; }
+
+	/// <summary>
+	/// Determines rendering when the last column in the table is visible but it's
+	/// content or <see cref="ColumnStyle.MaxWidth"/> is less than the remaining 
+	/// space in the control.  True (the default) will expand the column to fill
+	/// the remaining bounds of the control.  False will draw a column ending line
+	/// and leave a blank column that cannot be selected in the remaining space.  
+	/// </summary>
+	/// <value></value>
+	public bool ExpandLastColumn { get; set; } = true;
+
+	/// <summary>
+	/// <para>
+	/// Determines how <see cref="TableView.ColumnOffset"/> is updated when scrolling
+	/// right off the end of the currently visible area.
+	/// </para>
+	/// <para>
+	/// If true then when scrolling right the scroll offset is increased the minimum required to show
+	/// the new column.  This may be slow if you have an incredibly large number of columns in
+	/// your table and/or slow <see cref="ColumnStyle.RepresentationGetter"/> implementations
+	/// </para>
+	/// <para>
+	/// If false then scroll offset is set to the currently selected column (i.e. PageRight).
+	/// </para>
+	/// </summary>
+	public bool SmoothHorizontalScrolling { get; set; } = true;
+
+	/// <summary>
+	/// Returns the entry from <see cref="ColumnStyles"/> for the given <paramref name="col"/> or null if no custom styling is defined for it
+	/// </summary>
+	/// <param name="col"></param>
+	/// <returns></returns>
+	public ColumnStyle GetColumnStyleIfAny (int col)
+	{
+		return ColumnStyles.TryGetValue (col, out ColumnStyle result) ? result : null;
+	}
+
+	/// <summary>
+	/// Returns an existing <see cref="ColumnStyle"/> for the given <paramref name="col"/> or creates a new one with default options
+	/// </summary>
+	/// <param name="col"></param>
+	/// <returns></returns>
+	public ColumnStyle GetOrCreateColumnStyle (int col)
+	{
+		if (!ColumnStyles.ContainsKey (col))
+			ColumnStyles.Add (col, new ColumnStyle ());
+
+		return ColumnStyles [col];
+	}
+}

+ 15 - 350
Terminal.Gui/Views/TableView/TableView.cs

@@ -4,10 +4,23 @@ using System.Collections;
 using System.Collections.Generic;
 using System.Data;
 using System.Linq;
-using static Terminal.Gui.SpinnerStyle;
 
 namespace Terminal.Gui {
 
+	/// <summary>
+	/// Delegate for providing color to <see cref="TableView"/> cells based on the value being rendered
+	/// </summary>
+	/// <param name="args">Contains information about the cell for which color is needed</param>
+	/// <returns></returns>
+	public delegate ColorScheme CellColorGetterDelegate (CellColorGetterArgs args);
+
+	/// <summary>
+	/// Delegate for providing color for a whole row of a <see cref="TableView"/>
+	/// </summary>
+	/// <param name="args"></param>
+	/// <returns></returns>
+	public delegate ColorScheme RowColorGetterDelegate (RowColorGetterArgs args);
+
 	/// <summary>
 	/// View for tabular data based on a <see cref="ITableSource"/>.
 	/// 
@@ -1767,248 +1780,7 @@ namespace Terminal.Gui {
 			return colStyle != null ? colStyle.GetRepresentation (value) : value.ToString ();
 		}
 
-		/// <summary>
-		/// Delegate for providing color to <see cref="TableView"/> cells based on the value being rendered
-		/// </summary>
-		/// <param name="args">Contains information about the cell for which color is needed</param>
-		/// <returns></returns>
-		public delegate ColorScheme CellColorGetterDelegate (CellColorGetterArgs args);
-
-		/// <summary>
-		/// Delegate for providing color for a whole row of a <see cref="TableView"/>
-		/// </summary>
-		/// <param name="args"></param>
-		/// <returns></returns>
-		public delegate ColorScheme RowColorGetterDelegate (RowColorGetterArgs args);
-
-		#region Nested Types
-		/// <summary>
-		/// Describes how to render a given column in  a <see cref="TableView"/> including <see cref="Alignment"/> 
-		/// and textual representation of cells (e.g. date formats)
-		/// 
-		/// <a href="https://gui-cs.github.io/Terminal.Gui/articles/tableview.html">See TableView Deep Dive for more information</a>.
-		/// </summary>
-		public class ColumnStyle {
-
-			/// <summary>
-			/// Defines the default alignment for all values rendered in this column.  For custom alignment based on cell contents use <see cref="AlignmentGetter"/>.
-			/// </summary>
-			public TextAlignment Alignment { get; set; }
-
-			/// <summary>
-			/// Defines a delegate for returning custom alignment per cell based on cell values.  When specified this will override <see cref="Alignment"/>
-			/// </summary>
-			public Func<object, TextAlignment> AlignmentGetter;
-
-			/// <summary>
-			/// Defines a delegate for returning custom representations of cell values.  If not set then <see cref="object.ToString()"/> is used.  Return values from your delegate may be truncated e.g. based on <see cref="MaxWidth"/>
-			/// </summary>
-			public Func<object, string> RepresentationGetter;
-
-			/// <summary>
-			/// Defines a delegate for returning a custom color scheme per cell based on cell values.
-			/// Return null for the default
-			/// </summary>
-			public CellColorGetterDelegate ColorGetter;
-			private bool visible = true;
-
-			/// <summary>
-			/// Defines the format for values e.g. "yyyy-MM-dd" for dates
-			/// </summary>
-			public string Format { get; set; }
-
-			/// <summary>
-			/// Set the maximum width of the column in characters.  This value will be ignored if more than the tables <see cref="TableView.MaxCellWidth"/>.  Defaults to <see cref="TableView.DefaultMaxCellWidth"/>
-			/// </summary>
-			public int MaxWidth { get; set; } = TableView.DefaultMaxCellWidth;
-
-			/// <summary>
-			/// Set the minimum width of the column in characters.  Setting this will ensure that
-			/// even when a column has short content/header it still fills a given width of the control.
-			/// 
-			/// <para>This value will be ignored if more than the tables <see cref="TableView.MaxCellWidth"/> 
-			/// or the <see cref="MaxWidth"/>
-			/// </para>
-			/// <remarks>
-			/// For setting a flexible column width (down to a lower limit) use <see cref="MinAcceptableWidth"/>
-			/// instead
-			/// </remarks>
-			/// </summary>
-			public int MinWidth { get; set; }
-
-			/// <summary>
-			/// Enables flexible sizing of this column based on available screen space to render into.
-			/// </summary>
-			public int MinAcceptableWidth { get; set; } = DefaultMinAcceptableWidth;
-
-			/// <summary>
-			/// Gets or Sets a value indicating whether the column should be visible to the user.
-			/// This affects both whether it is rendered and whether it can be selected. Defaults to
-			/// true.
-			/// </summary>
-			/// <remarks>If <see cref="MaxWidth"/> is 0 then <see cref="Visible"/> will always return false.</remarks>
-			public bool Visible { get => MaxWidth >= 0 && visible; set => visible = value; }
-
-			/// <summary>
-			/// Returns the alignment for the cell based on <paramref name="cellValue"/> and <see cref="AlignmentGetter"/>/<see cref="Alignment"/>
-			/// </summary>
-			/// <param name="cellValue"></param>
-			/// <returns></returns>
-			public TextAlignment GetAlignment (object cellValue)
-			{
-				if (AlignmentGetter != null)
-					return AlignmentGetter (cellValue);
-
-				return Alignment;
-			}
-
-			/// <summary>
-			/// Returns the full string to render (which may be truncated if too long) that the current style says best represents the given <paramref name="value"/>
-			/// </summary>
-			/// <param name="value"></param>
-			/// <returns></returns>
-			public string GetRepresentation (object value)
-			{
-				if (!string.IsNullOrWhiteSpace (Format)) {
-
-					if (value is IFormattable f)
-						return f.ToString (Format, null);
-				}
-
-				if (RepresentationGetter != null)
-					return RepresentationGetter (value);
-
-				return value?.ToString ();
-			}
-		}
-		/// <summary>
-		/// Defines rendering options that affect how the table is displayed.
-		/// 
-		/// <a href="https://gui-cs.github.io/Terminal.Gui/articles/tableview.html">See TableView Deep Dive for more information</a>.
-		/// </summary>
-		public class TableStyle {
-
-			/// <summary>
-			/// Gets or sets a flag indicating whether to render headers of a <see cref="TableView"/>.
-			/// Defaults to <see langword="true"/>.
-			/// </summary>
-			/// <remarks><see cref="ShowHorizontalHeaderOverline"/>, <see cref="ShowHorizontalHeaderUnderline"/> etc
-			/// may still be used even if <see cref="ShowHeaders"/> is <see langword="false"/>.</remarks>
-			public bool ShowHeaders { get; set; } = true;
-
-			/// <summary>
-			/// When scrolling down always lock the column headers in place as the first row of the table
-			/// </summary>
-			public bool AlwaysShowHeaders { get; set; } = false;
-
-			/// <summary>
-			/// True to render a solid line above the headers
-			/// </summary>
-			public bool ShowHorizontalHeaderOverline { get; set; } = true;
-
-			/// <summary>
-			/// True to render a solid line under the headers
-			/// </summary>
-			public bool ShowHorizontalHeaderUnderline { get; set; } = true;
-
-			/// <summary>
-			/// True to render a solid line vertical line between cells
-			/// </summary>
-			public bool ShowVerticalCellLines { get; set; } = true;
-
-			/// <summary>
-			/// True to render a solid line vertical line between headers
-			/// </summary>
-			public bool ShowVerticalHeaderLines { get; set; } = true;
-
-			/// <summary>
-			/// True to render a arrows on the right/left of the table when 
-			/// there are more column(s) that can be scrolled to.  Requires
-			/// <see cref="ShowHorizontalHeaderUnderline"/> to be true.
-			/// Defaults to true
-			/// </summary>
-			public bool ShowHorizontalScrollIndicators { get; set; } = true;
-
-
-			/// <summary>
-			/// Gets or sets a flag indicating whether there should be a horizontal line after all the data
-			/// in the table. Defaults to <see langword="false"/>.
-			/// </summary>
-			public bool ShowHorizontalBottomline { get; set; } = false;
-
-			/// <summary>
-			/// True to invert the colors of the first symbol of the selected cell in the <see cref="TableView"/>.
-			/// This gives the appearance of a cursor for when the <see cref="ConsoleDriver"/> doesn't otherwise show
-			/// this
-			/// </summary>
-			public bool InvertSelectedCellFirstCharacter { get; set; } = false;
-
-			/// <summary>
-			/// Gets or sets a flag indicating whether to force <see cref="ColorScheme.Normal"/> use when rendering
-			/// vertical cell lines (even when <see cref="FullRowSelect"/> is on).
-			/// </summary>
-			public bool AlwaysUseNormalColorForVerticalCellLines { get; set; } = false;
-
-			/// <summary>
-			/// Collection of columns for which you want special rendering (e.g. custom column lengths, text alignment etc)
-			/// </summary>
-			public Dictionary<int, ColumnStyle> ColumnStyles { get; set; } = new Dictionary<int, ColumnStyle> ();
-
-			/// <summary>
-			/// Delegate for coloring specific rows in a different color.  For cell color <see cref="ColumnStyle.ColorGetter"/>
-			/// </summary>
-			/// <value></value>
-			public RowColorGetterDelegate RowColorGetter { get; set; }
-
-			/// <summary>
-			/// Determines rendering when the last column in the table is visible but it's
-			/// content or <see cref="ColumnStyle.MaxWidth"/> is less than the remaining 
-			/// space in the control.  True (the default) will expand the column to fill
-			/// the remaining bounds of the control.  False will draw a column ending line
-			/// and leave a blank column that cannot be selected in the remaining space.  
-			/// </summary>
-			/// <value></value>
-			public bool ExpandLastColumn { get; set; } = true;
-
-			/// <summary>
-			/// <para>
-			/// Determines how <see cref="TableView.ColumnOffset"/> is updated when scrolling
-			/// right off the end of the currently visible area.
-			/// </para>
-			/// <para>
-			/// If true then when scrolling right the scroll offset is increased the minimum required to show
-			/// the new column.  This may be slow if you have an incredibly large number of columns in
-			/// your table and/or slow <see cref="ColumnStyle.RepresentationGetter"/> implementations
-			/// </para>
-			/// <para>
-			/// If false then scroll offset is set to the currently selected column (i.e. PageRight).
-			/// </para>
-			/// </summary>
-			public bool SmoothHorizontalScrolling { get; set; } = true;
-
-			/// <summary>
-			/// Returns the entry from <see cref="ColumnStyles"/> for the given <paramref name="col"/> or null if no custom styling is defined for it
-			/// </summary>
-			/// <param name="col"></param>
-			/// <returns></returns>
-			public ColumnStyle GetColumnStyleIfAny (int col)
-			{
-				return ColumnStyles.TryGetValue (col, out ColumnStyle result) ? result : null;
-			}
-
-			/// <summary>
-			/// Returns an existing <see cref="ColumnStyle"/> for the given <paramref name="col"/> or creates a new one with default options
-			/// </summary>
-			/// <param name="col"></param>
-			/// <returns></returns>
-			public ColumnStyle GetOrCreateColumnStyle (int col)
-			{
-				if (!ColumnStyles.ContainsKey (col))
-					ColumnStyles.Add (col, new ColumnStyle ());
-
-				return ColumnStyles [col];
-			}
-		}
+		
 
 		/// <summary>
 		/// Describes a desire to render a column at a given horizontal position in the UI
@@ -2045,112 +1817,5 @@ namespace Terminal.Gui {
 			}
 
 		}
-
-		/// <summary>
-		/// Arguments for a <see cref="CellColorGetterDelegate"/>.  Describes a cell for which a rendering
-		/// <see cref="ColorScheme"/> is being sought
-		/// </summary>
-		public class CellColorGetterArgs {
-
-			/// <summary>
-			/// The data table hosted by the <see cref="TableView"/> control.
-			/// </summary>
-			public ITableSource Table { get; }
-
-			/// <summary>
-			/// The index of the row in <see cref="Table"/> for which color is needed
-			/// </summary>
-			public int RowIndex { get; }
-
-			/// <summary>
-			/// The index of column in <see cref="Table"/> for which color is needed
-			/// </summary>
-			public int ColIdex { get; }
-
-			/// <summary>
-			/// The hard typed value being rendered in the cell for which color is needed
-			/// </summary>
-			public object CellValue { get; }
-
-			/// <summary>
-			/// The textual representation of <see cref="CellValue"/> (what will actually be drawn to the screen)
-			/// </summary>
-			public string Representation { get; }
-
-			/// <summary>
-			/// the color scheme that is going to be used to render the cell if no cell specific color scheme is returned
-			/// </summary>
-			public ColorScheme RowScheme { get; }
-
-			internal CellColorGetterArgs (ITableSource table, int rowIdx, int colIdx, object cellValue, string representation, ColorScheme rowScheme)
-			{
-				Table = table;
-				RowIndex = rowIdx;
-				ColIdex = colIdx;
-				CellValue = cellValue;
-				Representation = representation;
-				RowScheme = rowScheme;
-			}
-
-		}
-
-		/// <summary>
-		/// Arguments for <see cref="RowColorGetterDelegate"/>. Describes a row of data in a <see cref="ITableSource"/>
-		/// for which <see cref="ColorScheme"/> is sought.
-		/// </summary>
-		public class RowColorGetterArgs {
-
-			/// <summary>
-			/// The data table hosted by the <see cref="TableView"/> control.
-			/// </summary>
-			public ITableSource Table { get; }
-
-			/// <summary>
-			/// The index of the row in <see cref="Table"/> for which color is needed
-			/// </summary>
-			public int RowIndex { get; }
-
-			internal RowColorGetterArgs (ITableSource table, int rowIdx)
-			{
-				Table = table;
-				RowIndex = rowIdx;
-			}
-		}
-
-		/// <summary>
-		/// Describes a selected region of the table
-		/// </summary>
-		public class TableSelection {
-
-			/// <summary>
-			/// Corner of the <see cref="Rect"/> where selection began
-			/// </summary>
-			/// <value></value>
-			public Point Origin { get; set; }
-
-			/// <summary>
-			/// Area selected
-			/// </summary>
-			/// <value></value>
-			public Rect Rect { get; set; }
-
-			/// <summary>
-			/// True if the selection was made through <see cref="Command.ToggleChecked"/>
-			/// and therefore should persist even through keyboard navigation.
-			/// </summary>
-			public bool IsToggled { get; set; }
-
-			/// <summary>
-			/// Creates a new selected area starting at the origin corner and covering the provided rectangular area
-			/// </summary>
-			/// <param name="origin"></param>
-			/// <param name="rect"></param>
-			public TableSelection (Point origin, Rect rect)
-			{
-				Origin = origin;
-				Rect = rect;
-			}
-		}
-		#endregion
 	}
 }

+ 94 - 0
Terminal.Gui/Views/Tile.cs

@@ -0,0 +1,94 @@
+using System;
+
+namespace Terminal.Gui; 
+
+/// <summary>
+/// A single <see cref="ContentView"/> presented in a <see cref="TileView"/>. To create
+/// new instances use <see cref="TileView.RebuildForTileCount(int)"/> 
+/// or <see cref="TileView.InsertTile(int)"/>.
+/// </summary>
+public class Tile {
+	/// <summary>
+	/// The <see cref="ContentView"/> that is contained in this <see cref="TileView"/>.
+	/// Add new child views to this member for multiple 
+	/// <see cref="ContentView"/>s within the <see cref="Tile"/>.
+	/// </summary>
+	public View ContentView { get; internal set; }
+
+	/// <summary>
+	/// Gets or Sets the minimum size you to allow when splitter resizing along
+	/// parent <see cref="TileView.Orientation"/> direction.
+	/// </summary>
+	public int MinSize { get; set; }
+
+	/// <summary>
+	/// The text that should be displayed above the <see cref="ContentView"/>. This 
+	/// will appear over the splitter line or border (above the view client area).
+	/// </summary>
+	/// <remarks>
+	/// Title are not rendered for root level tiles 
+	/// <see cref="Gui.LineStyle"/> is <see cref="LineStyle.None"/>.
+	///</remarks>
+	public string Title {
+		get => _title;
+		set {
+			if (!OnTitleChanging (_title, value)) {
+				var old = _title;
+				_title = value;
+				OnTitleChanged (old, _title);
+				return;
+			}
+			_title = value;
+		}
+	}
+
+	private string _title = string.Empty;
+
+	/// <summary>
+	/// Called before the <see cref="Title"/> changes. Invokes the <see cref="TitleChanging"/> event, which can be cancelled.
+	/// </summary>
+	/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
+	/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
+	/// <returns><c>true</c> if an event handler cancelled the Title change.</returns>
+	public virtual bool OnTitleChanging (string oldTitle, string newTitle)
+	{
+		var args = new TitleEventArgs (oldTitle, newTitle);
+		TitleChanging?.Invoke (this, args);
+		return args.Cancel;
+	}
+
+	/// <summary>
+	/// Event fired when the <see cref="Title"/> is changing. Set <see cref="TitleEventArgs.Cancel"/> to 
+	/// <c>true</c> to cancel the Title change.
+	/// </summary>
+	public event EventHandler<TitleEventArgs> TitleChanging;
+
+	/// <summary>
+	/// Called when the <see cref="Title"/> has been changed. Invokes the <see cref="TitleChanged"/> event.
+	/// </summary>
+	/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
+	/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
+	public virtual void OnTitleChanged (string oldTitle, string newTitle)
+	{
+		var args = new TitleEventArgs (oldTitle, newTitle);
+		TitleChanged?.Invoke (this, args);
+	}
+
+	/// <summary>
+	/// Event fired after the <see cref="Title"/> has been changed. 
+	/// </summary>
+	public event EventHandler<TitleEventArgs> TitleChanged;
+
+	/// <summary>
+	/// Creates a new instance of the <see cref="Tile"/> class.
+	/// </summary>
+	public Tile ()
+	{
+		ContentView = new View () { Width = Dim.Fill (), Height = Dim.Fill () };
+#if DEBUG_IDISPOSABLE
+		ContentView.Data = "Tile.ContentView";
+#endif
+		Title = string.Empty;
+		MinSize = 0;
+	}
+}

+ 0 - 91
Terminal.Gui/Views/TileView.cs

@@ -18,97 +18,6 @@ namespace Terminal.Gui {
 		/// </summary>
 		public Key ToggleResizable { get; set; } = Key.CtrlMask | Key.F10;
 
-		/// <summary>
-		/// A single <see cref="ContentView"/> presented in a <see cref="TileView"/>. To create
-		/// new instances use <see cref="TileView.RebuildForTileCount(int)"/> 
-		/// or <see cref="TileView.InsertTile(int)"/>.
-		/// </summary>
-		public class Tile {
-			/// <summary>
-			/// The <see cref="ContentView"/> that is contained in this <see cref="TileView"/>.
-			/// Add new child views to this member for multiple 
-			/// <see cref="ContentView"/>s within the <see cref="Tile"/>.
-			/// </summary>
-			public View ContentView { get; internal set; }
-
-			/// <summary>
-			/// Gets or Sets the minimum size you to allow when splitter resizing along
-			/// parent <see cref="TileView.Orientation"/> direction.
-			/// </summary>
-			public int MinSize { get; set; }
-
-			/// <summary>
-			/// The text that should be displayed above the <see cref="ContentView"/>. This 
-			/// will appear over the splitter line or border (above the view client area).
-			/// </summary>
-			/// <remarks>
-			/// Title are not rendered for root level tiles 
-			/// <see cref="Gui.LineStyle"/> is <see cref="LineStyle.None"/>.
-			///</remarks>
-			public string Title {
-				get => _title;
-				set {
-					if (!OnTitleChanging (_title, value)) {
-						var old = _title;
-						_title = value;
-						OnTitleChanged (old, _title);
-						return;
-					}
-					_title = value;
-				}
-			}
-
-			private string _title = string.Empty;
-
-			/// <summary>
-			/// Called before the <see cref="Title"/> changes. Invokes the <see cref="TitleChanging"/> event, which can be cancelled.
-			/// </summary>
-			/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
-			/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
-			/// <returns><c>true</c> if an event handler cancelled the Title change.</returns>
-			public virtual bool OnTitleChanging (string oldTitle, string newTitle)
-			{
-				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanging?.Invoke (this, args);
-				return args.Cancel;
-			}
-
-			/// <summary>
-			/// Event fired when the <see cref="Title"/> is changing. Set <see cref="TitleEventArgs.Cancel"/> to 
-			/// <c>true</c> to cancel the Title change.
-			/// </summary>
-			public event EventHandler<TitleEventArgs> TitleChanging;
-
-			/// <summary>
-			/// Called when the <see cref="Title"/> has been changed. Invokes the <see cref="TitleChanged"/> event.
-			/// </summary>
-			/// <param name="oldTitle">The <see cref="Title"/> that is/has been replaced.</param>
-			/// <param name="newTitle">The new <see cref="Title"/> to be replaced.</param>
-			public virtual void OnTitleChanged (string oldTitle, string newTitle)
-			{
-				var args = new TitleEventArgs (oldTitle, newTitle);
-				TitleChanged?.Invoke (this, args);
-			}
-
-			/// <summary>
-			/// Event fired after the <see cref="Title"/> has been changed. 
-			/// </summary>
-			public event EventHandler<TitleEventArgs> TitleChanged;
-
-			/// <summary>
-			/// Creates a new instance of the <see cref="Tile"/> class.
-			/// </summary>
-			public Tile ()
-			{
-				ContentView = new View () { Width = Dim.Fill (), Height = Dim.Fill () };
-#if DEBUG_IDISPOSABLE
-				ContentView.Data = "Tile.ContentView";
-#endif
-				Title = string.Empty;
-				MinSize = 0;
-			}
-		}
-
 		List<Tile> tiles;
 		private List<Pos> splitterDistances;
 		private List<TileViewLineView> splitterLines;

+ 15 - 15
Terminal.Gui/Views/Toplevel.cs

@@ -31,9 +31,9 @@ namespace Terminal.Gui {
 		public bool Running { get; set; }
 
 		/// <summary>
-		/// Invoked when the <see cref="Toplevel"/> <see cref="Application.RunState"/> has begun to be loaded.
+		/// Invoked when the <see cref="Toplevel"/> <see cref="RunState"/> has begun to be loaded.
 		/// A Loaded event handler is a good place to finalize initialization before calling 
-		/// <see cref="Application.RunLoop(Application.RunState, bool)"/>.
+		/// <see cref="Application.RunLoop(RunState, bool)"/>.
 		/// </summary>
 		public event EventHandler Loaded;
 
@@ -47,51 +47,51 @@ namespace Terminal.Gui {
 		public event EventHandler Ready;
 
 		/// <summary>
-		/// Invoked when the Toplevel <see cref="Application.RunState"/> has been unloaded.
-		/// A Unloaded event handler is a good place to dispose objects after calling <see cref="Application.End(Application.RunState)"/>.
+		/// Invoked when the Toplevel <see cref="RunState"/> has been unloaded.
+		/// A Unloaded event handler is a good place to dispose objects after calling <see cref="Application.End(RunState)"/>.
 		/// </summary>
 		public event EventHandler Unloaded;
 
 		/// <summary>
-		/// Invoked when the Toplevel <see cref="Application.RunState"/> becomes the <see cref="Application.Current"/> Toplevel.
+		/// Invoked when the Toplevel <see cref="RunState"/> becomes the <see cref="Application.Current"/> Toplevel.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> Activate;
 
 		/// <summary>
-		/// Invoked when the Toplevel<see cref="Application.RunState"/> ceases to be the <see cref="Application.Current"/> Toplevel.
+		/// Invoked when the Toplevel<see cref="RunState"/> ceases to be the <see cref="Application.Current"/> Toplevel.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> Deactivate;
 
 		/// <summary>
-		/// Invoked when a child of the Toplevel <see cref="Application.RunState"/> is closed by  
-		/// <see cref="Application.End(Application.RunState)"/>.
+		/// Invoked when a child of the Toplevel <see cref="RunState"/> is closed by  
+		/// <see cref="Application.End(RunState)"/>.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> ChildClosed;
 
 		/// <summary>
-		/// Invoked when the last child of the Toplevel <see cref="Application.RunState"/> is closed from 
-		/// by <see cref="Application.End(Application.RunState)"/>.
+		/// Invoked when the last child of the Toplevel <see cref="RunState"/> is closed from 
+		/// by <see cref="Application.End(RunState)"/>.
 		/// </summary>
 		public event EventHandler AllChildClosed;
 
 		/// <summary>
-		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is being closed by  
+		/// Invoked when the Toplevel's <see cref="RunState"/> is being closed by  
 		/// <see cref="Application.RequestStop(Toplevel)"/>.
 		/// </summary>
 		public event EventHandler<ToplevelClosingEventArgs> Closing;
 
 		/// <summary>
-		/// Invoked when the Toplevel's <see cref="Application.RunState"/> is closed by <see cref="Application.End(Application.RunState)"/>.
+		/// Invoked when the Toplevel's <see cref="RunState"/> is closed by <see cref="Application.End(RunState)"/>.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> Closed;
 
 		/// <summary>
-		/// Invoked when a child Toplevel's <see cref="Application.RunState"/> has been loaded.
+		/// Invoked when a child Toplevel's <see cref="RunState"/> has been loaded.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> ChildLoaded;
 
 		/// <summary>
-		/// Invoked when a cjhild Toplevel's <see cref="Application.RunState"/> has been unloaded.
+		/// Invoked when a cjhild Toplevel's <see cref="RunState"/> has been unloaded.
 		/// </summary>
 		public event EventHandler<ToplevelEventArgs> ChildUnloaded;
 
@@ -174,7 +174,7 @@ namespace Terminal.Gui {
 		}
 
 		/// <summary>
-		/// Called from <see cref="Application.End(Application.RunState)"/> before the <see cref="Toplevel"/> is disposed.
+		/// Called from <see cref="Application.End(RunState)"/> before the <see cref="Toplevel"/> is disposed.
 		/// </summary>
 		internal virtual void OnUnloaded ()
 		{

+ 2 - 208
Terminal.Gui/Views/Wizard/Wizard.cs

@@ -28,13 +28,13 @@ namespace Terminal.Gui {
 	/// var wizard = new Wizard ($"Setup Wizard");
 	/// 
 	/// // Add 1st step
-	/// var firstStep = new Wizard.WizardStep ("End User License Agreement");
+	/// var firstStep = new WizardStep ("End User License Agreement");
 	/// wizard.AddStep(firstStep);
 	/// firstStep.NextButtonText = "Accept!";
 	/// firstStep.HelpText = "This is the End User License Agreement.";
 	/// 
 	/// // Add 2nd step
-	/// var secondStep = new Wizard.WizardStep ("Second Step");
+	/// var secondStep = new WizardStep ("Second Step");
 	/// wizard.AddStep(secondStep);
 	/// secondStep.HelpText = "This is the help text for the Second Step.";
 	/// var lbl = new Label ("Name:") { AutoSize = true };
@@ -55,212 +55,6 @@ namespace Terminal.Gui {
 	/// </code>
 	/// </example>
 	public class Wizard : Dialog {
-		/// <summary>
-		/// Represents a basic step that is displayed in a <see cref="Wizard"/>. The <see cref="WizardStep"/> view is divided horizontally in two. On the left is the
-		/// content view where <see cref="View"/>s can be added,  On the right is the help for the step.
-		/// Set <see cref="WizardStep.HelpText"/> to set the help text. If the help text is empty the help pane will not
-		/// be shown. 
-		/// 
-		/// If there are no Views added to the WizardStep the <see cref="HelpText"/> (if not empty) will fill the wizard step. 
-		/// </summary>
-		/// <remarks>
-		/// If <see cref="Button"/>s are added, do not set <see cref="Button.IsDefault"/> to true as this will conflict
-		/// with the Next button of the Wizard.
-		/// 
-		/// Subscribe to the <see cref="View.VisibleChanged"/> event to be notified when the step is active; see also: <see cref="Wizard.StepChanged"/>.
-		/// 
-		/// To enable or disable a step from being shown to the user, set <see cref="View.Enabled"/>.
-		/// 
-		/// </remarks>
-		public class WizardStep : FrameView {
-			///// <summary>
-			///// The title of the <see cref="WizardStep"/>. 
-			///// </summary>
-			///// <remarks>The Title is only displayed when the <see cref="Wizard"/> is used as a modal pop-up (see <see cref="Wizard.Modal"/>.</remarks>
-			//public new string Title {
-			//	// BUGBUG: v2 - No need for this as View now has Title w/ notifications.
-			//	get => title;
-			//	set {
-			//		if (!OnTitleChanging (title, value)) {
-			//			var old = title;
-			//			title = value;
-			//			OnTitleChanged (old, title);
-			//		}
-			//		base.Title = value;
-			//		SetNeedsDisplay ();
-			//	}
-			//}
-
-			//private string title = string.Empty;
-
-			// The contentView works like the ContentView in FrameView.
-			private View contentView = new View () { Data = "WizardContentView" };
-
-			/// <summary>
-			/// Sets or gets help text for the <see cref="WizardStep"/>.If <see cref="WizardStep.HelpText"/> is empty
-			/// the help pane will not be visible and the content will fill the entire WizardStep.
-			/// </summary>
-			/// <remarks>The help text is displayed using a read-only <see cref="TextView"/>.</remarks>
-			public string HelpText {
-				get => helpTextView.Text;
-				set {
-					helpTextView.Text = value;
-					ShowHide ();
-					SetNeedsDisplay ();
-				}
-			}
-			private TextView helpTextView = new TextView ();
-
-			/// <summary>
-			/// Sets or gets the text for the back button. The back button will only be visible on 
-			/// steps after the first step.
-			/// </summary>
-			/// <remarks>The default text is "Back"</remarks>
-			public string BackButtonText { get; set; } = string.Empty;
-
-			/// <summary>
-			/// Sets or gets the text for the next/finish button.
-			/// </summary>
-			/// <remarks>The default text is "Next..." if the Pane is not the last pane. Otherwise it is "Finish"</remarks>
-			public string NextButtonText { get; set; } = string.Empty;
-
-			/// <summary>
-			/// Initializes a new instance of the <see cref="Wizard"/> class using <see cref="LayoutStyle.Computed"/> positioning.
-			/// </summary>
-			public WizardStep ()
-			{
-				BorderStyle = LineStyle.None;
-				base.Add (contentView);
-
-				helpTextView.ReadOnly = true;
-				helpTextView.WordWrap = true;
-				base.Add (helpTextView);
-
-				// BUGBUG: v2 - Disabling scrolling for now
-				//var scrollBar = new ScrollBarView (helpTextView, true);
-
-				//scrollBar.ChangedPosition += (s,e) => {
-				//	helpTextView.TopRow = scrollBar.Position;
-				//	if (helpTextView.TopRow != scrollBar.Position) {
-				//		scrollBar.Position = helpTextView.TopRow;
-				//	}
-				//	helpTextView.SetNeedsDisplay ();
-				//};
-
-				//scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
-				//	helpTextView.LeftColumn = scrollBar.OtherScrollBarView.Position;
-				//	if (helpTextView.LeftColumn != scrollBar.OtherScrollBarView.Position) {
-				//		scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn;
-				//	}
-				//	helpTextView.SetNeedsDisplay ();
-				//};
-
-				//scrollBar.VisibleChanged += (s,e) => {
-				//	if (scrollBar.Visible && helpTextView.RightOffset == 0) {
-				//		helpTextView.RightOffset = 1;
-				//	} else if (!scrollBar.Visible && helpTextView.RightOffset == 1) {
-				//		helpTextView.RightOffset = 0;
-				//	}
-				//};
-
-				//scrollBar.OtherScrollBarView.VisibleChanged += (s,e) => {
-				//	if (scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 0) {
-				//		helpTextView.BottomOffset = 1;
-				//	} else if (!scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 1) {
-				//		helpTextView.BottomOffset = 0;
-				//	}
-				//};
-
-				//helpTextView.DrawContent += (s,e) => {
-				//	scrollBar.Size = helpTextView.Lines;
-				//	scrollBar.Position = helpTextView.TopRow;
-				//	if (scrollBar.OtherScrollBarView != null) {
-				//		scrollBar.OtherScrollBarView.Size = helpTextView.Maxlength;
-				//		scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn;
-				//	}
-				//	scrollBar.LayoutSubviews ();
-				//	scrollBar.Refresh ();
-				//};
-				//base.Add (scrollBar);
-				ShowHide ();
-			}
-
-			/// <summary>
-			/// Does the work to show and hide the contentView and helpView as appropriate
-			/// </summary>
-			internal void ShowHide ()
-			{
-				contentView.Height = Dim.Fill ();
-				helpTextView.Height = Dim.Fill ();
-				helpTextView.Width = Dim.Fill ();
-
-				if (contentView.InternalSubviews?.Count > 0) {
-					if (helpTextView.Text.Length > 0) {
-						contentView.Width = Dim.Percent (70);
-						helpTextView.X = Pos.Right (contentView);
-						helpTextView.Width = Dim.Fill ();
-
-					} else {
-						contentView.Width = Dim.Fill ();
-					}
-				} else {
-					if (helpTextView.Text.Length > 0) {
-						helpTextView.X = 0;
-					} else {
-						// Error - no pane shown
-					}
-
-				}
-				contentView.Visible = contentView.InternalSubviews?.Count > 0;
-				helpTextView.Visible = helpTextView.Text.Length > 0;
-			}
-
-			/// <summary>
-			/// Add the specified <see cref="View"/> to the <see cref="WizardStep"/>. 
-			/// </summary>
-			/// <param name="view"><see cref="View"/> to add to this container</param>
-			public override void Add (View view)
-			{
-				contentView.Add (view);
-				if (view.CanFocus) {
-					CanFocus = true;
-				}
-				ShowHide ();
-			}
-
-			/// <summary>
-			///   Removes a <see cref="View"/> from <see cref="WizardStep"/>.
-			/// </summary>
-			/// <remarks>
-			/// </remarks>
-			public override void Remove (View view)
-			{
-				if (view == null) {
-					return;
-				}
-
-				SetNeedsDisplay ();
-				var touched = view.Frame;
-				contentView.Remove (view);
-
-				if (contentView.InternalSubviews.Count < 1) {
-					this.CanFocus = false;
-				}
-				ShowHide ();
-			}
-
-			/// <summary>
-			///   Removes all <see cref="View"/>s from the <see cref="WizardStep"/>.
-			/// </summary>
-			/// <remarks>
-			/// </remarks>
-			public override void RemoveAll ()
-			{
-				contentView.RemoveAll ();
-				ShowHide ();
-			}
-
-		} // end of WizardStep class
 
 		/// <summary>
 		/// Initializes a new instance of the <see cref="Wizard"/> class using <see cref="LayoutStyle.Computed"/> positioning.

+ 208 - 0
Terminal.Gui/Views/Wizard/WizardStep.cs

@@ -0,0 +1,208 @@
+namespace Terminal.Gui; 
+
+/// <summary>
+/// Represents a basic step that is displayed in a <see cref="Wizard"/>. The <see cref="WizardStep"/> view is divided horizontally in two. On the left is the
+/// content view where <see cref="View"/>s can be added,  On the right is the help for the step.
+/// Set <see cref="WizardStep.HelpText"/> to set the help text. If the help text is empty the help pane will not
+/// be shown. 
+/// 
+/// If there are no Views added to the WizardStep the <see cref="HelpText"/> (if not empty) will fill the wizard step. 
+/// </summary>
+/// <remarks>
+/// If <see cref="Button"/>s are added, do not set <see cref="Button.IsDefault"/> to true as this will conflict
+/// with the Next button of the Wizard.
+/// 
+/// Subscribe to the <see cref="View.VisibleChanged"/> event to be notified when the step is active; see also: <see cref="Wizard.StepChanged"/>.
+/// 
+/// To enable or disable a step from being shown to the user, set <see cref="View.Enabled"/>.
+/// 
+/// </remarks>
+public class WizardStep : FrameView {
+	///// <summary>
+	///// The title of the <see cref="WizardStep"/>. 
+	///// </summary>
+	///// <remarks>The Title is only displayed when the <see cref="Wizard"/> is used as a modal pop-up (see <see cref="Wizard.Modal"/>.</remarks>
+	//public new string Title {
+	//	// BUGBUG: v2 - No need for this as View now has Title w/ notifications.
+	//	get => title;
+	//	set {
+	//		if (!OnTitleChanging (title, value)) {
+	//			var old = title;
+	//			title = value;
+	//			OnTitleChanged (old, title);
+	//		}
+	//		base.Title = value;
+	//		SetNeedsDisplay ();
+	//	}
+	//}
+
+	//private string title = string.Empty;
+
+	// The contentView works like the ContentView in FrameView.
+	private View contentView = new View () { Data = "WizardContentView" };
+
+	/// <summary>
+	/// Sets or gets help text for the <see cref="WizardStep"/>.If <see cref="WizardStep.HelpText"/> is empty
+	/// the help pane will not be visible and the content will fill the entire WizardStep.
+	/// </summary>
+	/// <remarks>The help text is displayed using a read-only <see cref="TextView"/>.</remarks>
+	public string HelpText {
+		get => helpTextView.Text;
+		set {
+			helpTextView.Text = value;
+			ShowHide ();
+			SetNeedsDisplay ();
+		}
+	}
+	private TextView helpTextView = new TextView ();
+
+	/// <summary>
+	/// Sets or gets the text for the back button. The back button will only be visible on 
+	/// steps after the first step.
+	/// </summary>
+	/// <remarks>The default text is "Back"</remarks>
+	public string BackButtonText { get; set; } = string.Empty;
+
+	/// <summary>
+	/// Sets or gets the text for the next/finish button.
+	/// </summary>
+	/// <remarks>The default text is "Next..." if the Pane is not the last pane. Otherwise it is "Finish"</remarks>
+	public string NextButtonText { get; set; } = string.Empty;
+
+	/// <summary>
+	/// Initializes a new instance of the <see cref="Wizard"/> class using <see cref="LayoutStyle.Computed"/> positioning.
+	/// </summary>
+	public WizardStep ()
+	{
+		BorderStyle = LineStyle.None;
+		base.Add (contentView);
+
+		helpTextView.ReadOnly = true;
+		helpTextView.WordWrap = true;
+		base.Add (helpTextView);
+
+		// BUGBUG: v2 - Disabling scrolling for now
+		//var scrollBar = new ScrollBarView (helpTextView, true);
+
+		//scrollBar.ChangedPosition += (s,e) => {
+		//	helpTextView.TopRow = scrollBar.Position;
+		//	if (helpTextView.TopRow != scrollBar.Position) {
+		//		scrollBar.Position = helpTextView.TopRow;
+		//	}
+		//	helpTextView.SetNeedsDisplay ();
+		//};
+
+		//scrollBar.OtherScrollBarView.ChangedPosition += (s,e) => {
+		//	helpTextView.LeftColumn = scrollBar.OtherScrollBarView.Position;
+		//	if (helpTextView.LeftColumn != scrollBar.OtherScrollBarView.Position) {
+		//		scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn;
+		//	}
+		//	helpTextView.SetNeedsDisplay ();
+		//};
+
+		//scrollBar.VisibleChanged += (s,e) => {
+		//	if (scrollBar.Visible && helpTextView.RightOffset == 0) {
+		//		helpTextView.RightOffset = 1;
+		//	} else if (!scrollBar.Visible && helpTextView.RightOffset == 1) {
+		//		helpTextView.RightOffset = 0;
+		//	}
+		//};
+
+		//scrollBar.OtherScrollBarView.VisibleChanged += (s,e) => {
+		//	if (scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 0) {
+		//		helpTextView.BottomOffset = 1;
+		//	} else if (!scrollBar.OtherScrollBarView.Visible && helpTextView.BottomOffset == 1) {
+		//		helpTextView.BottomOffset = 0;
+		//	}
+		//};
+
+		//helpTextView.DrawContent += (s,e) => {
+		//	scrollBar.Size = helpTextView.Lines;
+		//	scrollBar.Position = helpTextView.TopRow;
+		//	if (scrollBar.OtherScrollBarView != null) {
+		//		scrollBar.OtherScrollBarView.Size = helpTextView.Maxlength;
+		//		scrollBar.OtherScrollBarView.Position = helpTextView.LeftColumn;
+		//	}
+		//	scrollBar.LayoutSubviews ();
+		//	scrollBar.Refresh ();
+		//};
+		//base.Add (scrollBar);
+		ShowHide ();
+	}
+
+	/// <summary>
+	/// Does the work to show and hide the contentView and helpView as appropriate
+	/// </summary>
+	internal void ShowHide ()
+	{
+		contentView.Height = Dim.Fill ();
+		helpTextView.Height = Dim.Fill ();
+		helpTextView.Width = Dim.Fill ();
+
+		if (contentView.InternalSubviews?.Count > 0) {
+			if (helpTextView.Text.Length > 0) {
+				contentView.Width = Dim.Percent (70);
+				helpTextView.X = Pos.Right (contentView);
+				helpTextView.Width = Dim.Fill ();
+
+			} else {
+				contentView.Width = Dim.Fill ();
+			}
+		} else {
+			if (helpTextView.Text.Length > 0) {
+				helpTextView.X = 0;
+			} else {
+				// Error - no pane shown
+			}
+
+		}
+		contentView.Visible = contentView.InternalSubviews?.Count > 0;
+		helpTextView.Visible = helpTextView.Text.Length > 0;
+	}
+
+	/// <summary>
+	/// Add the specified <see cref="View"/> to the <see cref="WizardStep"/>. 
+	/// </summary>
+	/// <param name="view"><see cref="View"/> to add to this container</param>
+	public override void Add (View view)
+	{
+		contentView.Add (view);
+		if (view.CanFocus) {
+			CanFocus = true;
+		}
+		ShowHide ();
+	}
+
+	/// <summary>
+	///   Removes a <see cref="View"/> from <see cref="WizardStep"/>.
+	/// </summary>
+	/// <remarks>
+	/// </remarks>
+	public override void Remove (View view)
+	{
+		if (view == null) {
+			return;
+		}
+
+		SetNeedsDisplay ();
+		var touched = view.Frame;
+		contentView.Remove (view);
+
+		if (contentView.InternalSubviews.Count < 1) {
+			this.CanFocus = false;
+		}
+		ShowHide ();
+	}
+
+	/// <summary>
+	///   Removes all <see cref="View"/>s from the <see cref="WizardStep"/>.
+	/// </summary>
+	/// <remarks>
+	/// </remarks>
+	public override void RemoveAll ()
+	{
+		contentView.RemoveAll ();
+		ShowHide ();
+	}
+
+} // end of WizardStep class

+ 1 - 1
UICatalog/Scenarios/ConfigurationEditor.cs

@@ -75,7 +75,7 @@ namespace UICatalog.Scenarios {
 		}
 
 		private class ConfigTextView : TextView {
-			internal TileView.Tile Tile { get; set; }
+			internal Tile Tile { get; set; }
 			internal FileInfo FileInfo { get; set; }
 
 			internal ConfigTextView ()

+ 2 - 2
UICatalog/Scenarios/Editor.cs

@@ -751,9 +751,9 @@ namespace UICatalog.Scenarios {
 				Height = Dim.Fill ()
 			};
 
-			_tabView.AddTab (new TabView.Tab ("Find", FindTab ()), isFind);
+			_tabView.AddTab (new Tab ("Find", FindTab ()), isFind);
 			var replace = ReplaceTab ();
-			_tabView.AddTab (new TabView.Tab ("Replace", replace), !isFind);
+			_tabView.AddTab (new Tab ("Replace", replace), !isFind);
 			_tabView.SelectedTabChanged += (s, e) => _tabView.SelectedTab.View.FocusFirst ();
 			_winDialog.Add (_tabView);
 

+ 65 - 65
UICatalog/Scenarios/GraphViewExample.cs

@@ -302,24 +302,24 @@ namespace UICatalog.Scenarios {
 			var mediumStiple = new GraphCellToRender ((Rune)'\u2592');
 
 			var barSeries = new BarSeries () {
-				Bars = new List<BarSeries.Bar> () {
-					new BarSeries.Bar ("Switzerland", softStiple, 83.4f),
-					new BarSeries.Bar ("South Korea", !verticalBars?mediumStiple:softStiple, 83.3f),
-					new BarSeries.Bar ("Singapore", softStiple, 83.2f),
-					new BarSeries.Bar ("Spain", !verticalBars?mediumStiple:softStiple, 83.2f),
-					new BarSeries.Bar ("Cyprus", softStiple, 83.1f),
-					new BarSeries.Bar ("Australia", !verticalBars?mediumStiple:softStiple, 83),
-					new BarSeries.Bar ("Italy", softStiple, 83),
-					new BarSeries.Bar ("Norway", !verticalBars?mediumStiple:softStiple, 83),
-					new BarSeries.Bar ("Israel", softStiple, 82.6f),
-					new BarSeries.Bar ("France", !verticalBars?mediumStiple:softStiple, 82.5f),
-					new BarSeries.Bar ("Luxembourg", softStiple, 82.4f),
-					new BarSeries.Bar ("Sweden", !verticalBars?mediumStiple:softStiple, 82.4f),
-					new BarSeries.Bar ("Iceland", softStiple, 82.3f),
-					new BarSeries.Bar ("Canada", !verticalBars?mediumStiple:softStiple, 82.2f),
-					new BarSeries.Bar ("New Zealand", softStiple, 82),
-					new BarSeries.Bar ("Malta", !verticalBars?mediumStiple:softStiple, 81.9f),
-					new BarSeries.Bar ("Ireland", softStiple, 81.8f)
+				Bars = new List<BarSeriesBar> () {
+					new BarSeriesBar ("Switzerland", softStiple, 83.4f),
+					new BarSeriesBar ("South Korea", !verticalBars?mediumStiple:softStiple, 83.3f),
+					new BarSeriesBar ("Singapore", softStiple, 83.2f),
+					new BarSeriesBar ("Spain", !verticalBars?mediumStiple:softStiple, 83.2f),
+					new BarSeriesBar ("Cyprus", softStiple, 83.1f),
+					new BarSeriesBar ("Australia", !verticalBars?mediumStiple:softStiple, 83),
+					new BarSeriesBar ("Italy", softStiple, 83),
+					new BarSeriesBar ("Norway", !verticalBars?mediumStiple:softStiple, 83),
+					new BarSeriesBar ("Israel", softStiple, 82.6f),
+					new BarSeriesBar ("France", !verticalBars?mediumStiple:softStiple, 82.5f),
+					new BarSeriesBar ("Luxembourg", softStiple, 82.4f),
+					new BarSeriesBar ("Sweden", !verticalBars?mediumStiple:softStiple, 82.4f),
+					new BarSeriesBar ("Iceland", softStiple, 82.3f),
+					new BarSeriesBar ("Canada", !verticalBars?mediumStiple:softStiple, 82.2f),
+					new BarSeriesBar ("New Zealand", softStiple, 82),
+					new BarSeriesBar ("Malta", !verticalBars?mediumStiple:softStiple, 81.9f),
+					new BarSeriesBar ("Ireland", softStiple, 81.8f)
 				}
 			};
 
@@ -436,29 +436,29 @@ namespace UICatalog.Scenarios {
 			// Males (negative to make the bars go left)
 			var malesSeries = new BarSeries () {
 				Orientation = Orientation.Horizontal,
-				Bars = new List<BarSeries.Bar> ()
+				Bars = new List<BarSeriesBar> ()
 				{
-					new BarSeries.Bar("0-4",stiple,-2009363),
-					new BarSeries.Bar("5-9",stiple,-2108550),
-					new BarSeries.Bar("10-14",stiple,-2022370),
-					new BarSeries.Bar("15-19",stiple,-1880611),
-					new BarSeries.Bar("20-24",stiple,-2072674),
-					new BarSeries.Bar("25-29",stiple,-2275138),
-					new BarSeries.Bar("30-34",stiple,-2361054),
-					new BarSeries.Bar("35-39",stiple,-2279836),
-					new BarSeries.Bar("40-44",stiple,-2148253),
-					new BarSeries.Bar("45-49",stiple,-2128343),
-					new BarSeries.Bar("50-54",stiple,-2281421),
-					new BarSeries.Bar("55-59",stiple,-2232388),
-					new BarSeries.Bar("60-64",stiple,-1919839),
-					new BarSeries.Bar("65-69",stiple,-1647391),
-					new BarSeries.Bar("70-74",stiple,-1624635),
-					new BarSeries.Bar("75-79",stiple,-1137438),
-					new BarSeries.Bar("80-84",stiple,-766956),
-					new BarSeries.Bar("85-89",stiple,-438663),
-					new BarSeries.Bar("90-94",stiple,-169952),
-					new BarSeries.Bar("95-99",stiple,-34524),
-					new BarSeries.Bar("100+",stiple,-3016)
+					new BarSeriesBar("0-4",stiple,-2009363),
+					new BarSeriesBar("5-9",stiple,-2108550),
+					new BarSeriesBar("10-14",stiple,-2022370),
+					new BarSeriesBar("15-19",stiple,-1880611),
+					new BarSeriesBar("20-24",stiple,-2072674),
+					new BarSeriesBar("25-29",stiple,-2275138),
+					new BarSeriesBar("30-34",stiple,-2361054),
+					new BarSeriesBar("35-39",stiple,-2279836),
+					new BarSeriesBar("40-44",stiple,-2148253),
+					new BarSeriesBar("45-49",stiple,-2128343),
+					new BarSeriesBar("50-54",stiple,-2281421),
+					new BarSeriesBar("55-59",stiple,-2232388),
+					new BarSeriesBar("60-64",stiple,-1919839),
+					new BarSeriesBar("65-69",stiple,-1647391),
+					new BarSeriesBar("70-74",stiple,-1624635),
+					new BarSeriesBar("75-79",stiple,-1137438),
+					new BarSeriesBar("80-84",stiple,-766956),
+					new BarSeriesBar("85-89",stiple,-438663),
+					new BarSeriesBar("90-94",stiple,-169952),
+					new BarSeriesBar("95-99",stiple,-34524),
+					new BarSeriesBar("100+",stiple,-3016)
 
 				}
 			};
@@ -467,29 +467,29 @@ namespace UICatalog.Scenarios {
 			// Females
 			var femalesSeries = new BarSeries () {
 				Orientation = Orientation.Horizontal,
-				Bars = new List<BarSeries.Bar> ()
+				Bars = new List<BarSeriesBar> ()
 				{
-					new BarSeries.Bar("0-4",stiple,1915127),
-					new BarSeries.Bar("5-9",stiple,2011016),
-					new BarSeries.Bar("10-14",stiple,1933970),
-					new BarSeries.Bar("15-19",stiple,1805522),
-					new BarSeries.Bar("20-24",stiple,2001966),
-					new BarSeries.Bar("25-29",stiple,2208929),
-					new BarSeries.Bar("30-34",stiple,2345774),
-					new BarSeries.Bar("35-39",stiple,2308360),
-					new BarSeries.Bar("40-44",stiple,2159877),
-					new BarSeries.Bar("45-49",stiple,2167778),
-					new BarSeries.Bar("50-54",stiple,2353119),
-					new BarSeries.Bar("55-59",stiple,2306537),
-					new BarSeries.Bar("60-64",stiple,1985177),
-					new BarSeries.Bar("65-69",stiple,1734370),
-					new BarSeries.Bar("70-74",stiple,1763853),
-					new BarSeries.Bar("75-79",stiple,1304709),
-					new BarSeries.Bar("80-84",stiple,969611),
-					new BarSeries.Bar("85-89",stiple,638892),
-					new BarSeries.Bar("90-94",stiple,320625),
-					new BarSeries.Bar("95-99",stiple,95559),
-					new BarSeries.Bar("100+",stiple,12818)
+					new BarSeriesBar("0-4",stiple,1915127),
+					new BarSeriesBar("5-9",stiple,2011016),
+					new BarSeriesBar("10-14",stiple,1933970),
+					new BarSeriesBar("15-19",stiple,1805522),
+					new BarSeriesBar("20-24",stiple,2001966),
+					new BarSeriesBar("25-29",stiple,2208929),
+					new BarSeriesBar("30-34",stiple,2345774),
+					new BarSeriesBar("35-39",stiple,2308360),
+					new BarSeriesBar("40-44",stiple,2159877),
+					new BarSeriesBar("45-49",stiple,2167778),
+					new BarSeriesBar("50-54",stiple,2353119),
+					new BarSeriesBar("55-59",stiple,2306537),
+					new BarSeriesBar("60-64",stiple,1985177),
+					new BarSeriesBar("65-69",stiple,1734370),
+					new BarSeriesBar("70-74",stiple,1763853),
+					new BarSeriesBar("75-79",stiple,1304709),
+					new BarSeriesBar("80-84",stiple,969611),
+					new BarSeriesBar("85-89",stiple,638892),
+					new BarSeriesBar("90-94",stiple,320625),
+					new BarSeriesBar("95-99",stiple,95559),
+					new BarSeriesBar("100+",stiple,12818)
 				}
 			};
 
@@ -526,7 +526,7 @@ namespace UICatalog.Scenarios {
 				red = Application.Driver.MakeAttribute (Color.Red, Color.Black);
 				brightred = Application.Driver.MakeAttribute (Color.BrightRed, Color.Black);
 			}
-			protected override void DrawBarLine (GraphView graph, Terminal.Gui.Point start, Terminal.Gui.Point end, Bar beingDrawn)
+			protected override void DrawBarLine (GraphView graph, Terminal.Gui.Point start, Terminal.Gui.Point end, BarSeriesBar beingDrawn)
 			{
 				var driver = Application.Driver;
 
@@ -564,7 +564,7 @@ namespace UICatalog.Scenarios {
 
 			Random r = new Random ();
 			var series = new DiscoBarSeries ();
-			var bars = new List<BarSeries.Bar> ();
+			var bars = new List<BarSeriesBar> ();
 
 			Func<MainLoop, bool> genSample = (l) => {
 
@@ -572,7 +572,7 @@ namespace UICatalog.Scenarios {
 				// generate an imaginary sample
 				for (int i = 0; i < 31; i++) {
 					bars.Add (
-						new BarSeries.Bar (null, stiple, r.Next (0, 100)) {
+						new BarSeriesBar (null, stiple, r.Next (0, 100)) {
 							//ColorGetter = colorDelegate
 						});
 				}

+ 1 - 1
UICatalog/Scenarios/ListColumns.cs

@@ -49,7 +49,7 @@ namespace UICatalog.Scenarios {
 					ExpandLastColumn = false,
 				}
 			};
-			var listColStyle = new ListTableSource.ListColumnStyle ();
+			var listColStyle = new ListColumnStyle ();
 
 			var menu = new MenuBar (new MenuBarItem [] {
 				new MenuBarItem ("_File", new MenuItem [] {

+ 3 - 3
UICatalog/Scenarios/Notepad.cs

@@ -186,7 +186,7 @@ namespace UICatalog.Scenarios {
 		{
 			Close (focusedTabView, focusedTabView.SelectedTab);
 		}
-		private void Close (TabView tv, TabView.Tab tabToClose)
+		private void Close (TabView tv, Tab tabToClose)
 		{
 			var tab = tabToClose as OpenedFile;
 
@@ -285,7 +285,7 @@ namespace UICatalog.Scenarios {
 		{
 			Save (focusedTabView, focusedTabView.SelectedTab);
 		}
-		public void Save (TabView tabViewToSave, TabView.Tab tabToSave)
+		public void Save (TabView tabViewToSave, Tab tabToSave)
 		{
 			var tab = tabToSave as OpenedFile;
 
@@ -327,7 +327,7 @@ namespace UICatalog.Scenarios {
 			return true;
 		}
 
-		private class OpenedFile : TabView.Tab {
+		private class OpenedFile : Tab {
 			public FileInfo File { get; set; }
 
 			/// <summary>

+ 8 - 8
UICatalog/Scenarios/TabViewExample.cs

@@ -59,18 +59,18 @@ namespace UICatalog.Scenarios {
 				Height = 20,
 			};
 
-			tabView.AddTab (new TabView.Tab ("Tab1", new Label ("hodor!")), false);
-			tabView.AddTab (new TabView.Tab ("Tab2", new Label ("durdur")), false);
-			tabView.AddTab (new TabView.Tab ("Interactive Tab", GetInteractiveTab ()), false);
-			tabView.AddTab (new TabView.Tab ("Big Text", GetBigTextFileTab ()), false);
-			tabView.AddTab (new TabView.Tab (
+			tabView.AddTab (new Tab ("Tab1", new Label ("hodor!")), false);
+			tabView.AddTab (new Tab ("Tab2", new Label ("durdur")), false);
+			tabView.AddTab (new Tab ("Interactive Tab", GetInteractiveTab ()), false);
+			tabView.AddTab (new Tab ("Big Text", GetBigTextFileTab ()), false);
+			tabView.AddTab (new Tab (
 				"Long name Tab, I mean seriously long.  Like you would not believe how long this tab's name is its just too much really woooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooowwww thats long",
 				 new Label ("This tab has a very long name which should be truncated.  See TabView.MaxTabTextWidth")),
 				 false);
-			tabView.AddTab (new TabView.Tab ("Les Mise" + Char.ConvertFromUtf32 (Int32.Parse ("0301", NumberStyles.HexNumber)) + "rables", new Label ("This tab name is unicode")), false);
+			tabView.AddTab (new Tab ("Les Mise" + Char.ConvertFromUtf32 (Int32.Parse ("0301", NumberStyles.HexNumber)) + "rables", new Label ("This tab name is unicode")), false);
 
 			for (int i = 0; i < 100; i++) {
-				tabView.AddTab (new TabView.Tab ($"Tab{i}", new Label ($"Welcome to tab {i}")), false);
+				tabView.AddTab (new Tab ($"Tab{i}", new Label ($"Welcome to tab {i}")), false);
 			}
 
 			tabView.SelectedTab = tabView.Tabs.First ();
@@ -115,7 +115,7 @@ namespace UICatalog.Scenarios {
 
 		private void AddBlankTab ()
 		{
-			tabView.AddTab (new TabView.Tab (), false);
+			tabView.AddTab (new Tab (), false);
 		}
 
 		private View GetInteractiveTab ()

+ 4 - 4
UICatalog/Scenarios/TableEditor.cs

@@ -793,19 +793,19 @@ namespace UICatalog.Scenarios {
 		{
 			tableView.Style.ColumnStyles.Clear();
 
-			var alignMid = new TableView.ColumnStyle () {
+			var alignMid = new ColumnStyle () {
 				Alignment = TextAlignment.Centered
 			};
-			var alignRight = new TableView.ColumnStyle () {
+			var alignRight = new ColumnStyle () {
 				Alignment = TextAlignment.Right
 			};
 
-			var dateFormatStyle = new TableView.ColumnStyle () {
+			var dateFormatStyle = new ColumnStyle () {
 				Alignment = TextAlignment.Right,
 				RepresentationGetter = (v) => v is DateTime d ? d.ToString ("yyyy-MM-dd") : v.ToString ()
 			};
 
-			var negativeRight = new TableView.ColumnStyle () {
+			var negativeRight = new ColumnStyle () {
 
 				Format = "0.##",
 				MinWidth = 10,

+ 3 - 3
UICatalog/Scenarios/WizardAsView.cs

@@ -59,13 +59,13 @@ namespace UICatalog.Scenarios {
 			};
 
 			// Add 1st step
-			var firstStep = new Wizard.WizardStep () { Title = "End User License Agreement" };
+			var firstStep = new WizardStep () { Title = "End User License Agreement" };
 			wizard.AddStep (firstStep);
 			firstStep.NextButtonText = "Accept!";
 			firstStep.HelpText = "This is the End User License Agreement.\n\n\n\n\n\nThis is a test of the emergency broadcast system. This is a test of the emergency broadcast system.\nThis is a test of the emergency broadcast system.\n\n\nThis is a test of the emergency broadcast system.\n\nThis is a test of the emergency broadcast system.\n\n\n\nThe end of the EULA.";
 
 			// Add 2nd step
-			var secondStep = new Wizard.WizardStep () { Title = "Second Step" };
+			var secondStep = new WizardStep () { Title = "Second Step" };
 			wizard.AddStep (secondStep);
 			secondStep.HelpText = "This is the help text for the Second Step.\n\nPress the button to change the Title.\n\nIf First Name is empty the step will prevent moving to the next step.";
 
@@ -88,7 +88,7 @@ namespace UICatalog.Scenarios {
 			secondStep.Add (lbl, lastNameField);
 
 			// Add last step
-			var lastStep = new Wizard.WizardStep () { Title = "The last step" };
+			var lastStep = new WizardStep () { Title = "The last step" };
 			wizard.AddStep (lastStep);
 			lastStep.HelpText = "The wizard is complete!\n\nPress the Finish button to continue.\n\nPressing Esc will cancel.";
 

+ 6 - 6
UICatalog/Scenarios/Wizards.cs

@@ -137,13 +137,13 @@ namespace UICatalog.Scenarios {
 					};
 
 					// Add 1st step
-					var firstStep = new Wizard.WizardStep () { Title = "End User License Agreement"};
+					var firstStep = new WizardStep () { Title = "End User License Agreement"};
 					firstStep.NextButtonText = "Accept!";
 					firstStep.HelpText = "This is the End User License Agreement.\n\n\n\n\n\nThis is a test of the emergency broadcast system. This is a test of the emergency broadcast system.\nThis is a test of the emergency broadcast system.\n\n\nThis is a test of the emergency broadcast system.\n\nThis is a test of the emergency broadcast system.\n\n\n\nThe end of the EULA.";
 					wizard.AddStep (firstStep);
 
 					// Add 2nd step
-					var secondStep = new Wizard.WizardStep () { Title = "Second Step" };
+					var secondStep = new WizardStep () { Title = "Second Step" };
 					wizard.AddStep (secondStep);
 					secondStep.HelpText = "This is the help text for the Second Step.\n\nPress the button to change the Title.\n\nIf First Name is empty the step will prevent moving to the next step.";
 
@@ -184,7 +184,7 @@ namespace UICatalog.Scenarios {
 					};
 
 					// Add 3rd (optional) step
-					var thirdStep = new Wizard.WizardStep () { Title = "Third Step (Optional)" };
+					var thirdStep = new WizardStep () { Title = "Third Step (Optional)" };
 					wizard.AddStep (thirdStep);
 					thirdStep.HelpText = "This is step is optional (WizardStep.Enabled = false). Enable it with the checkbox in Step 2.";
 					var step3Label = new Label () {
@@ -207,7 +207,7 @@ namespace UICatalog.Scenarios {
 					};
 
 					// Add 4th step
-					var fourthStep = new Wizard.WizardStep () { Title = "Step Four" };
+					var fourthStep = new WizardStep () { Title = "Step Four" };
 					wizard.AddStep (fourthStep);
 					var someText = new TextView () {
 						Text = "This step (Step Four) shows how to show/hide the Help pane. The step contains this TextView (but it's hard to tell it's a TextView because of Issue #1800).",
@@ -266,14 +266,14 @@ namespace UICatalog.Scenarios {
 					fourthStep.Add (scrollBar);
 
 					// Add last step
-					var lastStep = new Wizard.WizardStep () { Title = "The last step" };
+					var lastStep = new WizardStep () { Title = "The last step" };
 					wizard.AddStep (lastStep);
 					lastStep.HelpText = "The wizard is complete!\n\nPress the Finish button to continue.\n\nPressing ESC will cancel the wizard.";
 					var finalFinalStepEnabledCeckBox = new CheckBox () { Text = "Enable _Final Final Step", Checked = false, X = 0, Y = 1 };
 					lastStep.Add (finalFinalStepEnabledCeckBox);
 
 					// Add an optional FINAL last step
-					var finalFinalStep = new Wizard.WizardStep () { Title = "The VERY last step" };
+					var finalFinalStep = new WizardStep () { Title = "The VERY last step" };
 					wizard.AddStep (finalFinalStep);
 					finalFinalStep.HelpText = "This step only shows if it was enabled on the other last step.";
 					finalFinalStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked;

+ 2 - 2
UICatalog/UICatalog.cs

@@ -839,10 +839,10 @@ namespace UICatalog {
 			// Validate there are no outstanding Application.RunState-based instances 
 			// after a scenario was selected to run. This proves the main UI Catalog
 			// 'app' closed cleanly.
-			foreach (var inst in Application.RunState.Instances) {
+			foreach (var inst in RunState.Instances) {
 				Debug.Assert (inst.WasDisposed);
 			}
-			Application.RunState.Instances.Clear ();
+			RunState.Instances.Clear ();
 #endif
 		}
 

+ 3 - 3
UnitTests/Application/ApplicationTests.cs

@@ -15,7 +15,7 @@ namespace Terminal.Gui.ApplicationTests {
 		{
 #if DEBUG_IDISPOSABLE
 			Responder.Instances.Clear ();
-			Application.RunState.Instances.Clear ();
+			RunState.Instances.Clear ();
 #endif
 		}
 
@@ -142,7 +142,7 @@ namespace Terminal.Gui.ApplicationTests {
 				Application.RequestStop ();
 			};
 
-			Application.RunState runstate = null;
+			RunState runstate = null;
 			EventHandler<RunStateEventArgs> NewRunStateFn = (s, e) => {
 				Assert.NotNull (e.State);
 				runstate = e.State;
@@ -187,7 +187,7 @@ namespace Terminal.Gui.ApplicationTests {
 			Toplevel topLevel = null;
 			Application.InternalInit (() => topLevel = new TestToplevel (), new FakeDriver ());
 
-			Application.RunState runstate = null;
+			RunState runstate = null;
 			EventHandler<RunStateEventArgs> NewRunStateFn = (s, e) => {
 				Assert.NotNull (e.State);
 				runstate = e.State;

+ 1 - 1
UnitTests/Application/MainLoopTests.cs

@@ -507,7 +507,7 @@ namespace Terminal.Gui.ApplicationTests {
 			var mainloop = new MainLoop (testMainloop);
 			Assert.Empty (mainloop.timeouts);
 			Assert.Empty (mainloop.idleHandlers);
-			Assert.NotNull (new MainLoop.Timeout () {
+			Assert.NotNull (new Timeout () {
 				Span = new TimeSpan (),
 				Callback = (_) => true
 			});

+ 6 - 6
UnitTests/Application/RunStateTests.cs

@@ -18,25 +18,25 @@ namespace Terminal.Gui.ApplicationTests {
 		{
 #if DEBUG_IDISPOSABLE
 			Responder.Instances.Clear ();
-			Application.RunState.Instances.Clear ();
+			RunState.Instances.Clear ();
 #endif
 		}
 
 		[Fact]
 		public void New_Creates_RunState ()
 		{
-			var rs = new Application.RunState (null);
+			var rs = new RunState (null);
 			Assert.Null (rs.Toplevel);
 
 			var top = new Toplevel ();
-			rs = new Application.RunState (top);
+			rs = new RunState (top);
 			Assert.Equal (top, rs.Toplevel);
 		}
 
 		[Fact]
 		public void Dispose_Cleans_Up_RunState ()
 		{
-			var rs = new Application.RunState (null);
+			var rs = new RunState (null);
 			Assert.NotNull (rs);
 
 			// Should not throw because Toplevel was null
@@ -45,7 +45,7 @@ namespace Terminal.Gui.ApplicationTests {
 			Assert.True (rs.WasDisposed);
 #endif
 			var top = new Toplevel ();
-			rs = new Application.RunState (top);
+			rs = new RunState (top);
 			Assert.NotNull (rs);
 
 			// Should throw because Toplevel was not cleaned up
@@ -73,7 +73,7 @@ namespace Terminal.Gui.ApplicationTests {
 			Application.Shutdown ();
 #if DEBUG_IDISPOSABLE
 			// Validate there are no outstanding RunState-based instances left
-			foreach (var inst in Application.RunState.Instances) 				Assert.True (inst.WasDisposed);
+			foreach (var inst in RunState.Instances) 				Assert.True (inst.WasDisposed);
 #endif
 		}
 

+ 1 - 1
UnitTests/Configuration/AppScopeTests.cs

@@ -63,7 +63,7 @@ namespace Terminal.Gui.ConfigurationTests {
 			Assert.True (AppSettingsTestClass.TestProperty);
 
 			// ConfigurationManager.Themes should NOT apply theme settings
-			ConfigurationManager.ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply ();
+			ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply ();
 			Assert.True (AppSettingsTestClass.TestProperty);
 
 			// ConfigurationManager.AppSettings should NOT apply theme settings

+ 3 - 3
UnitTests/Configuration/SettingsScopeTests.cs

@@ -15,7 +15,7 @@ namespace Terminal.Gui.ConfigurationTests {
 		{
 			ConfigurationManager.Reset ();
 
-			Assert.Equal (3, ((Dictionary<string, ConfigurationManager.ThemeScope>)ConfigurationManager.Settings ["Themes"].PropertyValue).Count);
+			Assert.Equal (3, ((Dictionary<string, ThemeScope>)ConfigurationManager.Settings ["Themes"].PropertyValue).Count);
 
 			ConfigurationManager.GetHardCodedDefaults ();
 			Assert.NotEmpty (ConfigurationManager.Themes);
@@ -30,8 +30,8 @@ namespace Terminal.Gui.ConfigurationTests {
 			Assert.True (ConfigurationManager.Settings ["Theme"].PropertyValue is string);
 			Assert.Equal ("Default", ConfigurationManager.Settings ["Theme"].PropertyValue as string);
 
-			Assert.True (ConfigurationManager.Settings ["Themes"].PropertyValue is Dictionary<string, ConfigurationManager.ThemeScope>);
-			Assert.Single (((Dictionary<string, ConfigurationManager.ThemeScope>)ConfigurationManager.Settings ["Themes"].PropertyValue));
+			Assert.True (ConfigurationManager.Settings ["Themes"].PropertyValue is Dictionary<string, ThemeScope>);
+			Assert.Single (((Dictionary<string, ThemeScope>)ConfigurationManager.Settings ["Themes"].PropertyValue));
 
 		}
 

+ 9 - 9
UnitTests/Configuration/ThemeScopeTests.cs

@@ -21,15 +21,15 @@ namespace Terminal.Gui.ConfigurationTests {
 		public void ThemeManager_ClassMethodsWork ()
 		{
 			ConfigurationManager.Reset ();
-			Assert.Equal (ConfigurationManager.ThemeManager.Instance, ConfigurationManager.Themes);
-			Assert.NotEmpty (ConfigurationManager.ThemeManager.Themes);
+			Assert.Equal (ThemeManager.Instance, ConfigurationManager.Themes);
+			Assert.NotEmpty (ThemeManager.Themes);
 
-			ConfigurationManager.ThemeManager.SelectedTheme = "foo";
-			Assert.Equal ("foo", ConfigurationManager.ThemeManager.SelectedTheme);
-			ConfigurationManager.ThemeManager.Reset ();
-			Assert.Equal (string.Empty, ConfigurationManager.ThemeManager.SelectedTheme);
+			ThemeManager.SelectedTheme = "foo";
+			Assert.Equal ("foo", ThemeManager.SelectedTheme);
+			ThemeManager.Reset ();
+			Assert.Equal (string.Empty, ThemeManager.SelectedTheme);
 
-			Assert.Empty (ConfigurationManager.ThemeManager.Themes);
+			Assert.Empty (ThemeManager.Themes);
 		}
 
 		[Fact]
@@ -59,7 +59,7 @@ namespace Terminal.Gui.ConfigurationTests {
 
 			ConfigurationManager.Themes ["Default"] ["Dialog.DefaultButtonAlignment"].PropertyValue = Dialog.ButtonAlignments.Right;
 
-			ConfigurationManager.ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply ();
+			ThemeManager.Themes! [ThemeManager.SelectedTheme]!.Apply ();
 			Assert.Equal (Dialog.ButtonAlignments.Right, Dialog.DefaultButtonAlignment);
 		}
 		
@@ -69,7 +69,7 @@ namespace Terminal.Gui.ConfigurationTests {
 		{
 			ConfigurationManager.Reset ();
 
-			var initial = ConfigurationManager.ThemeManager.Themes;
+			var initial = ThemeManager.Themes;
 			
 			var serialized = JsonSerializer.Serialize<IDictionary<string, ThemeScope>> (ConfigurationManager.Themes, _jsonOptions);
 			var deserialized = JsonSerializer.Deserialize<IDictionary<string, ThemeScope>> (serialized, _jsonOptions);

+ 12 - 12
UnitTests/Dialogs/DialogTests.cs

@@ -42,7 +42,7 @@ namespace Terminal.Gui.DialogTests {
 		//	Application.End (runstate);
 		//}
 
-		private (Application.RunState, Dialog) RunButtonTestDialog (string title, int width, Dialog.ButtonAlignments align, params Button [] btns)
+		private (RunState, Dialog) RunButtonTestDialog (string title, int width, Dialog.ButtonAlignments align, params Button [] btns)
 		{
 			var dlg = new Dialog (btns) {
 				Title = title,
@@ -209,7 +209,7 @@ namespace Terminal.Gui.DialogTests {
 		public void ButtonAlignment_One ()
 		{
 			var d = (FakeDriver)Application.Driver;
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var title = "1234";
 			// E.g "|[ ok ]|"
@@ -281,7 +281,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Two ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -327,7 +327,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Two_Hidden ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 			bool firstIteration = false;
 
 			var d = (FakeDriver)Application.Driver;
@@ -394,7 +394,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Three ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -442,7 +442,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Four ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -493,7 +493,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Four_On_Too_Small_Width ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -540,7 +540,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Four_Wider ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -594,7 +594,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void ButtonAlignment_Four_WideOdd ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -647,7 +647,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void Zero_Buttons_Works ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -667,7 +667,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void One_Button_Works ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 
@@ -687,7 +687,7 @@ namespace Terminal.Gui.DialogTests {
 		[AutoInitShutdown]
 		public void Add_Button_Works ()
 		{
-			Application.RunState runstate = null;
+			RunState runstate = null;
 
 			var d = (FakeDriver)Application.Driver;
 

+ 19 - 19
UnitTests/Dialogs/WizardTests.cs

@@ -159,7 +159,7 @@ namespace Terminal.Gui.DialogTests {
 			var bottomRow = $"{CM.Glyphs.LLCornerDbl}{new string (CM.Glyphs.HLineDbl.ToString () [0], width - 2)}{CM.Glyphs.LRCornerDbl}";
 
 			var wizard = new Wizard () { Title = title, Width = width, Height = height };
-			wizard.AddStep (new Wizard.WizardStep () { Title = stepTitle });
+			wizard.AddStep (new WizardStep () { Title = stepTitle });
 			//wizard.LayoutSubviews ();
 			var firstIteration = false;
 			var runstate = Application.Begin (wizard);
@@ -229,7 +229,7 @@ namespace Terminal.Gui.DialogTests {
 			var bottomRow = $"{CM.Glyphs.LLCornerDbl}{new string (CM.Glyphs.HLineDbl.ToString () [0], width - 2)}{CM.Glyphs.LRCornerDbl}";
 
 			var wizard = new Wizard () { Title = title, Width = width, Height = height };
-			wizard.AddStep (new Wizard.WizardStep () { Title = "ABCD" });
+			wizard.AddStep (new WizardStep () { Title = "ABCD" });
 
 			Application.End (Application.Begin (wizard));
 			TestHelpers.AssertDriverContentsWithFrameAre ($"{topRow}\n{separatorRow}\n{buttonRow}\n{bottomRow}", output);
@@ -243,7 +243,7 @@ namespace Terminal.Gui.DialogTests {
 			// If no steps should be null
 			Assert.Null (wizard.GetPreviousStep ());
 
-			var step1 = new Wizard.WizardStep () { Title = "step1" };
+			var step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
 
 			// If no current step, should be last step
@@ -258,7 +258,7 @@ namespace Terminal.Gui.DialogTests {
 			Assert.Null (wizard.GetPreviousStep ());
 
 			// If two steps and at 2 and step 1 is `Enabled = true`should be step1
-			var step2 = new Wizard.WizardStep () { Title = "step2" };
+			var step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 			wizard.CurrentStep = step2;
 			step1.Enabled = true;
@@ -272,7 +272,7 @@ namespace Terminal.Gui.DialogTests {
 			//   At step 1 should be null
 			//   At step 2 should be step 1
 			//   At step 3 should be step 2
-			var step3 = new Wizard.WizardStep () { Title = "step3" };
+			var step3 = new WizardStep () { Title = "step3" };
 			wizard.AddStep (step3);
 			step1.Enabled = true;
 			wizard.CurrentStep = step1;
@@ -334,7 +334,7 @@ namespace Terminal.Gui.DialogTests {
 			// If no steps should be null
 			Assert.Null (wizard.GetNextStep ());
 
-			var step1 = new Wizard.WizardStep () { Title = "step1" };
+			var step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
 
 			// If no current step, should be first step
@@ -349,7 +349,7 @@ namespace Terminal.Gui.DialogTests {
 			Assert.Null (wizard.GetNextStep ());
 
 			// If two steps and at 1 and step 2 is `Enabled = true`should be step 2
-			var step2 = new Wizard.WizardStep () { Title = "step2" };
+			var step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 			Assert.Equal (step2.Title, wizard.GetNextStep ().Title);
 
@@ -363,7 +363,7 @@ namespace Terminal.Gui.DialogTests {
 			//   At step 1 should be step 2
 			//   At step 2 should be step 3
 			//   At step 3 should be null
-			var step3 = new Wizard.WizardStep () { Title = "step3" };
+			var step3 = new WizardStep () { Title = "step3" };
 			wizard.AddStep (step3);
 			step1.Enabled = true;
 			wizard.CurrentStep = step1;
@@ -457,15 +457,15 @@ namespace Terminal.Gui.DialogTests {
 
 			Assert.Null (wizard.GetFirstStep ());
 
-			var step1 = new Wizard.WizardStep () { Title = "step1" };
+			var step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
 			Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
 
-			var step2 = new Wizard.WizardStep () { Title = "step2" };
+			var step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 			Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
 
-			var step3 = new Wizard.WizardStep () { Title = "step3" };
+			var step3 = new WizardStep () { Title = "step3" };
 			wizard.AddStep (step3);
 			Assert.Equal (step1.Title, wizard.GetFirstStep ().Title);
 
@@ -487,15 +487,15 @@ namespace Terminal.Gui.DialogTests {
 
 			Assert.Null (wizard.GetLastStep ());
 
-			var step1 = new Wizard.WizardStep () { Title = "step1" };
+			var step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
 			Assert.Equal (step1.Title, wizard.GetLastStep ().Title);
 
-			var step2 = new Wizard.WizardStep () { Title = "step2" };
+			var step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 			Assert.Equal (step2.Title, wizard.GetLastStep ().Title);
 
-			var step3 = new Wizard.WizardStep () { Title = "step3" };
+			var step3 = new WizardStep () { Title = "step3" };
 			wizard.AddStep (step3);
 			Assert.Equal (step3.Title, wizard.GetLastStep ().Title);
 
@@ -515,7 +515,7 @@ namespace Terminal.Gui.DialogTests {
 		{
 			// https://github.com/gui-cs/Terminal.Gui/issues/1833
 			var wizard = new Wizard ();
-			var step1 = new Wizard.WizardStep () { Title = "step1" };
+			var step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
 
 			var finishedFired = false;
@@ -543,9 +543,9 @@ namespace Terminal.Gui.DialogTests {
 			// Same test, but with two steps
 			wizard = new Wizard ();
 			firstIteration = false;
-			step1 = new Wizard.WizardStep () { Title = "step1" };
+			step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
-			var step2 = new Wizard.WizardStep () { Title = "step2" };
+			var step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 
 			finishedFired = false;
@@ -580,9 +580,9 @@ namespace Terminal.Gui.DialogTests {
 			// Same test, but with two steps but the 1st one disabled
 			wizard = new Wizard ();
 			firstIteration = false;
-			step1 = new Wizard.WizardStep () { Title = "step1" };
+			step1 = new WizardStep () { Title = "step1" };
 			wizard.AddStep (step1);
-			step2 = new Wizard.WizardStep () { Title = "step2" };
+			step2 = new WizardStep () { Title = "step2" };
 			wizard.AddStep (step2);
 			step1.Enabled = false;
 

+ 2 - 2
UnitTests/View/Layout/PosTests.cs

@@ -547,9 +547,9 @@ namespace Terminal.Gui.ViewTests {
 				return (win, button);
 			}
 
-			Application.RunState rs;
+			RunState rs;
 
-			void cleanup (Application.RunState rs)
+			void cleanup (RunState rs)
 			{
 				// Cleanup
 				Application.End (rs);

+ 1 - 1
UnitTests/Views/ButtonTests.cs

@@ -474,7 +474,7 @@ namespace Terminal.Gui.ViewsTests {
 				Width = Dim.Fill (),
 				Height = Dim.Fill ()
 			};
-			tabView.AddTab (new TabView.Tab ("Find", tab), true);
+			tabView.AddTab (new Tab ("Find", tab), true);
 
 			var win = new Window () {
 				Width = Dim.Fill (),

+ 6 - 6
UnitTests/Views/GraphViewTests.cs

@@ -711,7 +711,7 @@ namespace Terminal.Gui.ViewsTests {
 			Assert.Empty (axisY.LabelPoints);
 
 			// bar of height 0
-			barSeries.Bars.Add (new BarSeries.Bar ("hi", new GraphCellToRender ((Rune)'.'), 0));
+			barSeries.Bars.Add (new BarSeriesBar ("hi", new GraphCellToRender ((Rune)'.'), 0));
 			barSeries.Orientation = Orientation.Vertical;
 
 			// redraw graph
@@ -753,9 +753,9 @@ namespace Terminal.Gui.ViewsTests {
 			barSeries.BarEvery = 1f;
 
 			barSeries.Bars.Add (
-				new BarSeries.Bar ("hi1", new GraphCellToRender ((Rune)'.'), 100));
+				new BarSeriesBar ("hi1", new GraphCellToRender ((Rune)'.'), 100));
 			barSeries.Bars.Add (
-				new BarSeries.Bar ("hi2", new GraphCellToRender ((Rune)'.'), 100));
+				new BarSeriesBar ("hi2", new GraphCellToRender ((Rune)'.'), 100));
 
 			barSeries.Orientation = Orientation.Vertical;
 
@@ -809,11 +809,11 @@ namespace Terminal.Gui.ViewsTests {
 
 			// 1 bar that is very wide (100 graph units horizontally = screen pos 50 but bounded by screen)
 			barSeries.Bars.Add (
-				new BarSeries.Bar ("hi1", new GraphCellToRender ((Rune)'.'), 100));
+				new BarSeriesBar ("hi1", new GraphCellToRender ((Rune)'.'), 100));
 
 			// 1 bar that is shorter
 			barSeries.Bars.Add (
-				new BarSeries.Bar ("hi2", new GraphCellToRender ((Rune)'.'), 5));
+				new BarSeriesBar ("hi2", new GraphCellToRender ((Rune)'.'), 5));
 
 			// redraw graph
 			graph.Draw ();
@@ -860,7 +860,7 @@ namespace Terminal.Gui.ViewsTests {
 				return FinalColor = base.AdjustColor (graphCellToRender);
 			}
 
-			protected override void DrawBarLine (GraphView graph, Point start, Point end, Bar beingDrawn)
+			protected override void DrawBarLine (GraphView graph, Point start, Point end, BarSeriesBar beingDrawn)
 			{
 				base.DrawBarLine (graph, start, end, beingDrawn);
 

+ 1 - 1
UnitTests/Views/OverlappedTests.cs

@@ -15,7 +15,7 @@ namespace Terminal.Gui.ViewsTests {
 		{
 #if DEBUG_IDISPOSABLE
 			Responder.Instances.Clear ();
-			Application.RunState.Instances.Clear ();
+			RunState.Instances.Clear ();
 #endif
 		}
 

+ 26 - 26
UnitTests/Views/TabViewTests.cs

@@ -23,15 +23,15 @@ namespace Terminal.Gui.ViewsTests {
 			return GetTabView (out _, out _);
 		}
 
-		private TabView GetTabView (out TabView.Tab tab1, out TabView.Tab tab2, bool initFakeDriver = true)
+		private TabView GetTabView (out Tab tab1, out Tab tab2, bool initFakeDriver = true)
 		{
 			if (initFakeDriver)
 				InitFakeDriver ();
 
 			var tv = new TabView ();
 			tv.ColorScheme = new ColorScheme ();
-			tv.AddTab (tab1 = new TabView.Tab ("Tab1", new TextField ("hi")), false);
-			tv.AddTab (tab2 = new TabView.Tab ("Tab2", new Label ("hi2")), false);
+			tv.AddTab (tab1 = new Tab ("Tab1", new TextField ("hi")), false);
+			tv.AddTab (tab2 = new Tab ("Tab2", new Label ("hi2")), false);
 			return tv;
 		}
 
@@ -41,10 +41,10 @@ namespace Terminal.Gui.ViewsTests {
 			InitFakeDriver ();
 
 			var tv = new TabView ();
-			TabView.Tab tab1;
-			TabView.Tab tab2;
-			tv.AddTab (tab1 = new TabView.Tab ("Tab1", new TextField ("hi")), false);
-			tv.AddTab (tab2 = new TabView.Tab ("Tab1", new Label ("hi2")), true);
+			Tab tab1;
+			Tab tab2;
+			tv.AddTab (tab1 = new Tab ("Tab1", new TextField ("hi")), false);
+			tv.AddTab (tab2 = new Tab ("Tab1", new Label ("hi2")), true);
 
 			Assert.Equal (2, tv.Tabs.Count);
 			Assert.Equal (tab2, tv.SelectedTab);
@@ -98,8 +98,8 @@ namespace Terminal.Gui.ViewsTests {
 
 			tv.SelectedTab = tab1;
 
-			TabView.Tab oldTab = null;
-			TabView.Tab newTab = null;
+			Tab oldTab = null;
+			Tab newTab = null;
 			int called = 0;
 
 			tv.SelectedTabChanged += (s, e) => {
@@ -172,13 +172,13 @@ namespace Terminal.Gui.ViewsTests {
 		{
 			var tv = GetTabView (out var tab1, out var tab2);
 
-			TabView.Tab tab3;
-			TabView.Tab tab4;
-			TabView.Tab tab5;
+			Tab tab3;
+			Tab tab4;
+			Tab tab5;
 
-			tv.AddTab (tab3 = new TabView.Tab (), false);
-			tv.AddTab (tab4 = new TabView.Tab (), false);
-			tv.AddTab (tab5 = new TabView.Tab (), false);
+			tv.AddTab (tab3 = new Tab (), false);
+			tv.AddTab (tab4 = new Tab (), false);
+			tv.AddTab (tab5 = new Tab (), false);
 
 			tv.SelectedTab = tab1;
 
@@ -320,7 +320,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out var tab1, out var tab2, false);
 			tv.Width = 10;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false };
+			tv.Style = new TabStyle { ShowTopLine = false };
 			tv.ApplyStyleChanges ();
 
 			// Ensures that the tab bar subview gets the bounds of the parent TabView
@@ -414,7 +414,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 4;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false };
+			tv.Style = new TabStyle { ShowTopLine = false };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -452,7 +452,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 3;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false };
+			tv.Style = new TabStyle { ShowTopLine = false };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -472,7 +472,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out var tab1, out var tab2, false);
 			tv.Width = 10;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { TabsOnBottom = true };
+			tv.Style = new TabStyle { TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 
 			// Ensures that the tab bar subview gets the bounds of the parent TabView
@@ -535,7 +535,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out var tab1, out var tab2, false);
 			tv.Width = 10;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false, TabsOnBottom = true };
+			tv.Style = new TabStyle { ShowTopLine = false, TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 
 			// Ensures that the tab bar subview gets the bounds of the parent TabView
@@ -611,7 +611,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 4;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { TabsOnBottom = true };
+			tv.Style = new TabStyle { TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -631,7 +631,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 4;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false, TabsOnBottom = true };
+			tv.Style = new TabStyle { ShowTopLine = false, TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -651,7 +651,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 3;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { TabsOnBottom = true };
+			tv.Style = new TabStyle { TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -671,7 +671,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out _, out _, false);
 			tv.Width = 3;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { ShowTopLine = false, TabsOnBottom = true };
+			tv.Style = new TabStyle { ShowTopLine = false, TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 			tv.LayoutSubviews ();
 
@@ -724,7 +724,7 @@ namespace Terminal.Gui.ViewsTests {
 			var tv = GetTabView (out var tab1, out var tab2, false);
 			tv.Width = 20;
 			tv.Height = 5;
-			tv.Style = new TabView.TabStyle { TabsOnBottom = true };
+			tv.Style = new TabStyle { TabsOnBottom = true };
 			tv.ApplyStyleChanges ();
 
 			tv.LayoutSubviews ();
@@ -776,7 +776,7 @@ namespace Terminal.Gui.ViewsTests {
 └──────────────────┘
 ", output);
 
-			TabView.Tab clicked = null;
+			Tab clicked = null;
 			
 
 			tv.TabClicked += (s,e)=>{

+ 5 - 5
UnitTests/Views/TableViewTests.cs

@@ -327,7 +327,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			// select the last row
 			tableView.MultiSelectedRegions.Clear ();
-			tableView.MultiSelectedRegions.Push (new TableView.TableSelection (new Point (0, 3), new Rect (0, 3, 4, 1)));
+			tableView.MultiSelectedRegions.Push (new TableSelection (new Point (0, 3), new Rect (0, 3, 4, 1)));
 
 			Assert.Equal (4, tableView.GetAllSelectedCells ().Count ());
 
@@ -430,8 +430,8 @@ namespace Terminal.Gui.ViewsTests {
 			*/
 
 			tableView.MultiSelectedRegions.Clear ();
-			tableView.MultiSelectedRegions.Push (new TableView.TableSelection (new Point (1, 1), new Rect (1, 1, 2, 2)));
-			tableView.MultiSelectedRegions.Push (new TableView.TableSelection (new Point (7, 3), new Rect (7, 3, 2, 1)));
+			tableView.MultiSelectedRegions.Push (new TableSelection (new Point (1, 1), new Rect (1, 1, 2, 2)));
+			tableView.MultiSelectedRegions.Push (new TableSelection (new Point (7, 3), new Rect (7, 3, 2, 1)));
 
 			tableView.SelectedColumn = 8;
 			tableView.SelectedRow = 3;
@@ -1534,7 +1534,7 @@ namespace Terminal.Gui.ViewsTests {
 
 			// user has rectangular selection 
 			tableView.MultiSelectedRegions.Push (
-				new TableView.TableSelection (
+				new TableSelection (
 				new Point (0, 0),
 				new Rect (0, 0, 3, 1))
 				);
@@ -2999,7 +2999,7 @@ A B C
 				ShowHorizontalHeaderOverline = false,
 				ShowHorizontalHeaderUnderline = false
 			};
-			var listStyle = new ListTableSource.ListColumnStyle () {
+			var listStyle = new ListColumnStyle () {
 				Orientation = orient,
 				ScrollParallel = parallel
 			};