IPopover.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. /// To implement a custom popover, inherit from <see cref="PopoverBaseImpl"/> or implement this interface directly.
  28. /// </para>
  29. /// </remarks>
  30. public interface IPopover
  31. {
  32. /// <summary>
  33. /// Gets or sets the <see cref="Toplevel"/> that this Popover is associated with. If null, it is not associated with
  34. /// any Toplevel and will receive all keyboard
  35. /// events from the <see cref="Application"/>. If set, it will only receive keyboard events the Toplevel would normally
  36. /// receive.
  37. /// When <see cref="ApplicationPopover.Register"/> is called, the <see cref="Toplevel"/> is set to the current
  38. /// <see cref="Application.Top"/> if not already set.
  39. /// </summary>
  40. Toplevel? Toplevel { get; set; }
  41. }