gdk4::prelude

Trait PopupExt

Source
pub trait PopupExt:
    IsA<Popup>
    + Sealed
    + 'static {
    // Provided methods
    fn is_autohide(&self) -> bool { ... }
    fn parent(&self) -> Option<Surface> { ... }
    fn position_x(&self) -> i32 { ... }
    fn position_y(&self) -> i32 { ... }
    fn rect_anchor(&self) -> Gravity { ... }
    fn surface_anchor(&self) -> Gravity { ... }
    fn present(&self, width: i32, height: i32, layout: &PopupLayout) -> bool { ... }
}
Expand description

Trait containing all Popup methods.

§Implementors

Popup

Provided Methods§

Source

fn is_autohide(&self) -> bool

Returns whether this popup is set to hide on outside clicks.

§Returns

true if @self will autohide

Source

fn parent(&self) -> Option<Surface>

Returns the parent surface of a popup.

§Returns

the parent surface

Source

fn position_x(&self) -> i32

Obtains the position of the popup relative to its parent.

§Returns

the X coordinate of @self position

Source

fn position_y(&self) -> i32

Obtains the position of the popup relative to its parent.

§Returns

the Y coordinate of @self position

Source

fn rect_anchor(&self) -> Gravity

Gets the current popup rectangle anchor.

The value returned may change after calling present(), or after the layout signal is emitted.

§Returns

the current rectangle anchor value of @self

Source

fn surface_anchor(&self) -> Gravity

Gets the current popup surface anchor.

The value returned may change after calling present(), or after the layout signal is emitted.

§Returns

the current surface anchor value of @self

Source

fn present(&self, width: i32, height: i32, layout: &PopupLayout) -> bool

Present @self after having processed the PopupLayout rules.

If the popup was previously not showing, it will be shown, otherwise it will change position according to @layout.

After calling this function, the result should be handled in response to the layout signal being emitted. The resulting popup position can be queried using position_x(), position_y(), and the resulting size will be sent as parameters in the layout signal. Use rect_anchor() and surface_anchor() to get the resulting anchors.

Presenting may fail, for example if the @self is set to autohide and is immediately hidden upon being presented. If presenting failed, the layout signal will not me emitted.

§width

the unconstrained popup width to layout

§height

the unconstrained popup height to layout

§layout

the PopupLayout object used to layout

§Returns

false if it failed to be presented, otherwise true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<O: IsA<Popup>> PopupExt for O