Window.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. namespace Terminal.Gui;
  2. /// <summary>
  3. /// A <see cref="Toplevel"/> <see cref="View"/> with <see cref="View.BorderStyle"/> set to
  4. /// <see cref="LineStyle.Single"/>. Provides a container for other views.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// If any subview is a button and the <see cref="Button.IsDefault"/> property is set to true, the Enter key will
  9. /// invoke the <see cref="Command.Accept"/> command on that subview.
  10. /// </para>
  11. /// </remarks>
  12. public class Window : Toplevel
  13. {
  14. /// <summary>
  15. /// Gets or sets whether all <see cref="Window"/>s are shown with a shadow effect by default.
  16. /// </summary>
  17. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  18. public static ShadowStyle DefaultShadow { get; set; } = ShadowStyle.None;
  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.Movable | ViewArrangement.Overlapped | ViewArrangement.Resizable;
  27. ColorScheme = Colors.ColorSchemes ["Base"]; // TODO: make this a theme property
  28. BorderStyle = DefaultBorderStyle;
  29. ShadowStyle = DefaultShadow;
  30. }
  31. // TODO: enable this
  32. ///// <summary>
  33. ///// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is <see cref="LineStyle.Single"/>.
  34. ///// </summary>
  35. ///// <remarks>
  36. ///// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all <see cref="Window"/>s.
  37. ///// </remarks>
  38. /////[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
  39. ////public static ColorScheme DefaultColorScheme { get; set; } = Colors.ColorSchemes ["Base"];
  40. /// <summary>
  41. /// The default <see cref="LineStyle"/> for <see cref="Window"/>'s border. The default is
  42. /// <see cref="LineStyle.Single"/>.
  43. /// </summary>
  44. /// <remarks>
  45. /// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all <see cref="Window"/>
  46. /// s.
  47. /// </remarks>
  48. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  49. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  50. }