Class PopoverImpl
Abstract base class for popover views in Terminal.Gui. Implements IPopoverView.
public abstract class PopoverImpl : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IPopoverView, IPopover
- Inheritance
-
PopoverImpl
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
IMPORTANT: Popovers must be registered with Popover using Register(IPopoverView?) before they can be shown.
Requirements:
Derived classes must:
- Set ViewportSettings to include Transparent and TransparentMouse.
- Add a key binding for Quit (typically bound to QuitKey).
Default Behavior:
This base class provides:
- Fills the screen by default (Width = Fill(), Height = Fill()).
- Transparent viewport settings for proper mouse event handling.
- Automatic layout when becoming visible.
- Focus restoration when hidden.
- Default Quit implementation that hides the popover.
Lifecycle:
Use Show(IPopoverView?) to display and Hide(IPopoverView?) or
set Visible to false to hide.
Constructors
- PopoverImpl()
Initializes a new instance of the PopoverImpl class.
Properties
- Anchor
Gets or sets the anchor positioning function. When the popover is shown, this function is called to determine the anchor rectangle for positioning.
- Target
Gets or sets the target View of this popover as a weak reference. This is typically the view that triggered the popover to be shown. Commands that bubble from Views within the Popover will be bridged to this target view, allowing them to be handled as if they originated from the target. This is useful for scenarios where the View that triggered the popover is not part of the popover's view hierarchy, but still wants commands to be handled in the context of that view.
Methods
- Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- MakeVisible(Point?, Rectangle?)
Makes the popover visible. Base implementation performs layout and delegates to Show(IPopoverView?). Derived classes typically override to add positioning logic before calling base.
- OnVisibleChanged()
Called when the Visible property has changed. Hides the popover via ApplicationPopover when becoming invisible.
- OnVisibleChanging()
Called when the Visible property is changing. Handles layout and focus management.
- ToString()
Returns a string representation of the popover, including its type, visibility, owner, and target.
- TryGetTarget(out View?)
Attempts to retrieve the Target view. Returns false if the target has been collected or was never set.