FrameView.cs 1.2 KB

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