FrameView.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Text.Json.Serialization;
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// The FrameView is a container View with a border around it.
  5. /// </summary>
  6. public class FrameView : View
  7. {
  8. /// <summary>
  9. /// Initializes a new instance of the <see cref="Gui.FrameView"/> class.
  10. /// layout.
  11. /// </summary>
  12. public FrameView ()
  13. {
  14. Border.Thickness = new Thickness (1);
  15. Border.LineStyle = DefaultBorderStyle;
  16. //Border.ColorScheme = ColorScheme;
  17. Border.Data = "Border";
  18. MouseClick += FrameView_MouseClick;
  19. }
  20. private void FrameView_MouseClick (object sender, MouseEventEventArgs e)
  21. {
  22. e.Handled = InvokeCommand (Command.HotKey) == true;
  23. }
  24. /// <summary>
  25. /// The default <see cref="LineStyle"/> for <see cref="FrameView"/>'s border. The default is
  26. /// <see cref="LineStyle.Single"/>.
  27. /// </summary>
  28. /// <remarks>
  29. /// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all
  30. /// <see cref="FrameView"/>s.
  31. /// </remarks>
  32. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  33. [JsonConverter (typeof (JsonStringEnumConverter<LineStyle>))]
  34. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  35. }