FrameView.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. namespace Terminal.Gui;
  2. // TODO: FrameView is mis-named, really. It's far more about it being a TabGroup than a frame.
  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. // base sets focus on HotKey
  25. e.Handled = InvokeCommand (Command.HotKey, ctx: new (Command.HotKey, key: null, data: this)) == true;
  26. }
  27. /// <summary>
  28. /// The default <see cref="LineStyle"/> for <see cref="FrameView"/>'s border. The default is
  29. /// <see cref="LineStyle.Single"/>.
  30. /// </summary>
  31. /// <remarks>
  32. /// This property can be set in a Theme to change the default <see cref="LineStyle"/> for all
  33. /// <see cref="FrameView"/>s.
  34. /// </remarks>
  35. [SerializableConfigurationProperty (Scope = typeof (ThemeScope))]
  36. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  37. }