FrameView.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Text.Json.Serialization;
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// The FrameView is a container frame that draws a frame around the contents. It is similar to a GroupBox in
  5. /// Windows.
  6. /// </summary>
  7. public class FrameView : View
  8. {
  9. /// <summary>
  10. /// Initializes a new instance of the <see cref="Gui.FrameView"/> class using <see cref="LayoutStyle.Computed"/>
  11. /// layout.
  12. /// </summary>
  13. public FrameView ()
  14. {
  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. [JsonConverter (typeof (JsonStringEnumConverter))]
  35. public static LineStyle DefaultBorderStyle { get; set; } = LineStyle.Single;
  36. }