Window.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// An overlapped container for other views with a border and optional title.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// Window has <see cref="View.BorderStyle"/> set to <see cref="LineStyle.Single"/>, <see cref="View.Arrangement"/>
  9. /// set to <see cref="ViewArrangement.Overlapped"/>, and
  10. /// uses the Base <see cref="Colors.ColorSchemes"/> color scheme by default.
  11. /// </para>
  12. /// <para>
  13. /// To enable Window to be sized and moved by the user, adjust <see cref="View.Arrangement"/>.
  14. /// </para>
  15. /// </remarks>
  16. /// <seealso cref="FrameView"/>
  17. public class Window : Toplevel
  18. {
  19. /// <summary>
  20. /// Initializes a new instance of the <see cref="Window"/> class.
  21. /// </summary>
  22. public Window ()
  23. {
  24. CanFocus = true;
  25. TabStop = TabBehavior.TabGroup;
  26. Arrangement = ViewArrangement.Overlapped;
  27. base.ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property
  28. BorderStyle = DefaultBorderStyle;
  29. base.ShadowStyle = DefaultShadow;
  30. }
  31. /// <summary>
  32. /// Gets or sets whether all <see cref="Window"/>s are shown with a shadow effect by default.
  33. /// </summary>
  34. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  35. public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None;
  36. // TODO: enable this
  37. ///// <summary>
  38. ///// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is <see cref="LineStyle.Single"/>.
  39. ///// </summary>
  40. ///// <remarks>
  41. ///// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all <see cref="Window"/>s.
  42. ///// </remarks>
  43. /////[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
  44. ////public static ColorScheme DefaultColorScheme { get; set; } = Colors.ColorSchemes ["Base"];
  45. /// <summary>
  46. /// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is
  47. /// <see cref="LineStyle.Single"/>.
  48. /// </summary>
  49. /// <remarks>
  50. /// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all <see cref="Window"/>
  51. /// s.
  52. /// </remarks>
  53. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  54. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  55. }