IPopover.cs 2.9 KB

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