FrameView.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. CanFocus = true;
  15. TabStop = TabBehavior.TabGroup;
  16. Border.Thickness = new Thickness (1);
  17. Border.LineStyle = DefaultBorderStyle;
  18. //Border.ColorScheme = ColorScheme;
  19. Border.Data = "Border";
  20. MouseClick += FrameView_MouseClick;
  21. }
  22. private void FrameView_MouseClick (object sender, MouseEventEventArgs e)
  23. {
  24. e.Handled = InvokeCommand (Command.HotKey) == true;
  25. }
  26. /// <summary>
  27. /// The default <see cref="LineStyle"/> for <see cref="FrameView"/>'s border. The default is
  28. /// <see cref="LineStyle.Single"/>.
  29. /// </summary>
  30. /// <remarks>
  31. /// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all
  32. /// <see cref="FrameView"/>s.
  33. /// </remarks>
  34. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  35. [JsonConverter (typeof (JsonStringEnumConverter<LineStyle>))]
  36. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  37. }