IPopover.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #nullable enable
  2. namespace Terminal.Gui.App;
  3. /// <summary>
  4. /// Defines the contract for a popover view in Terminal.Gui.
  5. /// </summary>
  6. /// <remarks>
  7. /// <para>
  8. /// A popover is a transient UI element that appears above other content to display contextual information or UI,
  9. /// such as menus, tooltips, or dialogs.
  10. /// Popovers are managed by <see cref="ApplicationPopover"/> and are typically shown using
  11. /// <see cref="ApplicationPopover.Show"/>.
  12. /// </para>
  13. /// <para>
  14. /// Popovers are not modal; they do not block input to the rest of the application, but they do receive focus and
  15. /// input events while visible.
  16. /// When a popover is shown, it is responsible for handling its own layout and content.
  17. /// </para>
  18. /// <para>
  19. /// Popovers are automatically hidden when:
  20. /// <list type="bullet">
  21. /// <item>The user clicks outside the popover (unless occluded by a subview of the popover).</item>
  22. /// <item>The user presses <see cref="Application.QuitKey"/> (typically <c>Esc</c>).</item>
  23. /// <item>Another popover is shown.</item>
  24. /// </list>
  25. /// </para>
  26. /// <para>
  27. /// <b>Focus and Input:</b><br/>
  28. /// When visible, a popover receives focus and input events. If the user clicks outside the popover (and not on a
  29. /// subview),
  30. /// presses <see cref="Application.QuitKey"/>, or another popover is shown, the popover will be hidden
  31. /// automatically.
  32. /// </para>
  33. /// <para>
  34. /// <b>Layout:</b><br/>
  35. /// When the popover becomes visible, it is automatically laid out to fill the screen by default. You can override
  36. /// this behavior
  37. /// by setting <see cref="View.Width"/> and <see cref="View.Height"/> in your derived class.
  38. /// </para>
  39. /// <para>
  40. /// <b>Mouse:</b><br/>
  41. /// Popovers are transparent to mouse events (see <see cref="ViewportSettingsFlags.TransparentMouse"/>),
  42. /// meaning mouse events in a popover that are not also within a subview of the popover will not be captured.
  43. /// </para>
  44. /// <para>
  45. /// <b>Custom Popovers:</b><br/>
  46. /// To create a custom popover, inherit from <see cref="PopoverBaseImpl"/> and add your own content and logic.
  47. /// </para>
  48. /// </remarks>
  49. public interface IPopover
  50. {
  51. /// <summary>
  52. /// Gets or sets the <see cref="Toplevel"/> that this Popover is associated with. If null, it is not associated with
  53. /// any Toplevel and will receive all keyboard
  54. /// events from the <see cref="Application"/>. If set, it will only receive keyboard events the Toplevel would normally
  55. /// receive.
  56. /// When <see cref="ApplicationPopover.Register"/> is called, the <see cref="Toplevel"/> is set to the current
  57. /// <see cref="Application.Top"/> if not already set.
  58. /// </summary>
  59. Toplevel? Toplevel { get; set; }
  60. }