pub trait PopoverExt: 'static {
Show 21 methods fn bind_model(
        model: Option<&impl IsA<MenuModel>>,
        action_namespace: Option<&str>
    ); fn constrain_to(&self) -> PopoverConstraint; fn default_widget(&self) -> Option<Widget>; fn is_modal(&self) -> bool; fn pointing_to(&self) -> Option<Rectangle>; fn position(&self) -> PositionType; fn relative_to(&self) -> Option<Widget>; fn popdown(&self); fn popup(&self); fn set_constrain_to(&self, constraint: PopoverConstraint); fn set_default_widget(&self, widget: Option<&impl IsA<Widget>>); fn set_modal(&self, modal: bool); fn set_pointing_to(&self, rect: &Rectangle); fn set_position(&self, position: PositionType); fn set_relative_to(&self, relative_to: Option<&impl IsA<Widget>>); fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; fn connect_constrain_to_notify<F: Fn(&Self) + 'static>(
        f: F
    ) -> SignalHandlerId; fn connect_modal_notify<F: Fn(&Self) + 'static>(
        f: F
    ) -> SignalHandlerId; fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(
        f: F
    ) -> SignalHandlerId; fn connect_position_notify<F: Fn(&Self) + 'static>(
        f: F
    ) -> SignalHandlerId; fn connect_relative_to_notify<F: Fn(&Self) + 'static>(
        f: F
    ) -> SignalHandlerId;
Expand description

Trait containing all Popover methods.


PopoverMenu, Popover

Required Methods

Establishes a binding between a Popover and a gio::MenuModel.

The contents of self are removed and then refilled with menu items according to model. When model changes, self is updated. Calling this function twice on self with different model will cause the first binding to be replaced with a binding to the new model. If model is None then any previous binding is undone and all children are removed.

If action_namespace is non-None then the effect is as if all actions mentioned in the model have their names prefixed with the namespace, plus a dot. For example, if the action “quit” is mentioned and action_namespace is “app” then the effective action name is “app.quit”.

This function uses Actionable to define the action name and target values on the created menu items. If you want to use an action group other than “app” and “win”, or if you want to use a MenuShell outside of a ApplicationWindow, then you will need to attach your own action group to the widget hierarchy using WidgetExt::insert_action_group(). As an example, if you created a group with a “quit” action and inserted it with the name “mygroup” then you would use the action name “mygroup.quit” in your gio::MenuModel.


the gio::MenuModel to bind to or None to remove binding


the namespace for actions in model

Returns the constraint for placing this popover. See set_constrain_to().


the constraint for placing this popover.

Gets the widget that should be set as the default while the popover is shown.


the default widget, or None if there is none

Returns whether the popover is modal, see gtk_popover_set_modal to see the implications of this.


true if self is modal

If a rectangle to point to has been set, this function will return true and fill in rect with such rectangle, otherwise it will return false and fill in rect with the attached widget coordinates.


true if a rectangle to point to was set.


location to store the rectangle

Returns the preferred position of self.


The preferred position.

Returns the widget self is currently attached to


a Widget

Pops self down.This is different than a WidgetExt::hide() call in that it shows the popover with a transition. If you want to hide the popover without a transition, use WidgetExt::hide().

Pops self up. This is different than a WidgetExt::show() call in that it shows the popover with a transition. If you want to show the popover without a transition, use WidgetExt::show().

Sets a constraint for positioning this popover.

Note that not all platforms support placing popovers freely, and may already impose constraints.


the new constraint

Sets the widget that should be set as default widget while the popover is shown (see GtkWindowExt::set_default()). Popover remembers the previous default widget and reestablishes it when the popover is dismissed.


the new default widget, or None

Sets whether self is modal, a modal popover will grab all input within the toplevel and grab the keyboard focus on it when being displayed. Clicking outside the popover area or pressing Esc will dismiss the popover and ungrab input.

true to make popover claim all input within the toplevel

Sets the rectangle that self will point to, in the coordinate space of the widget self is attached to, see set_relative_to().


rectangle to point to

Sets the preferred position for self to appear. If the self is currently visible, it will be immediately updated.

This preference will be respected where possible, although on lack of space (eg. if close to the window edges), the Popover may choose to appear on the opposite side


preferred popover position

Sets a new widget to be attached to self. If self is visible, the position will be updated.

Note: the ownership of popovers is always given to their relative_to widget, so if relative_to is set to None on an attached self, it will be detached from its previous widget, and consequently destroyed unless extra references are kept.


a Widget

This signal is emitted when the popover is dismissed either through API or user interaction.