using System;
using System.Collections;
using System.Text.Json.Serialization;
using System.Text;
using Terminal.Gui;
using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui {
///
/// A with set to .
///
///
///
/// This is a helper class to simplify creating a with a border.
///
///
public class Window : Toplevel {
///
/// Initializes a new instance of the class using positioning.
///
public Window () : base () {
SetInitialProperties ();
}
///
/// Initializes a new instance of the class using positioning.
///
public Window (Rect frame) : base (frame)
{
SetInitialProperties ();
}
// TODO: enable this
/////
///// The default for 's border. The default is .
/////
/////
///// This property can be set in a Theme to change the default for all s.
/////
/////[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
////public static ColorScheme DefaultColorScheme { get; set; } = Colors.Base;
///
/// The default for 's border. The default is .
///
///
/// This property can be set in a Theme to change the default for all s.
///
[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
void SetInitialProperties ()
{
CanFocus = true;
ColorScheme = Colors.Base; // TODO: make this a theme property
BorderStyle = DefaultBorderStyle;
}
// TODO: Are these overrides really needed?
///
public override void Add (View view)
{
base.Add (view);
if (view.CanFocus) {
CanFocus = true;
}
AddMenuStatusBar (view);
}
///
public override void Remove (View view)
{
if (view == null) {
return;
}
SetNeedsDisplay ();
base.Remove (view);
RemoveMenuStatusBar (view);
}
}
}