Window.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #nullable enable
  2. namespace Terminal.Gui.Views;
  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="float"/>, <see cref="View.Arrangement"/>
  9. /// set to <see cref="ViewArrangement.Overlapped"/>, and
  10. /// uses the "Base" <see cref="Scheme"/> 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. SchemeName = SchemeManager.SchemesToSchemeName (Schemes.Base);
  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. [ConfigurationProperty (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. /////[ConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
  44. ////public static Scheme DefaultScheme { get; set; } = Colors.Schemes ["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. [ConfigurationProperty (Scope = typeof (ThemeScope))]
  54. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  55. }