Module: Gdk::Popup

Defined in:
(unknown)

Overview

A GdkPopup is a surface that is attached to another surface.

The GdkPopup is positioned relative to its parent surface.

GdkPopups are typically used to implement menus and similar popups. They can be modal, which is indicated by the [propertyGdk.Popup:autohide] property.

Instance Method Summary collapse

Instance Method Details

#autohideBoolean

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

Returns:

  • (Boolean)

    true if popup will autohide

#parentGdk::Surface

Returns the parent surface of a popup.

Returns:

#position_xInteger

Obtains the position of the popup relative to its parent.

Returns:

  • (Integer)

    the X coordinate of popup position

#position_yInteger

Obtains the position of the popup relative to its parent.

Returns:

  • (Integer)

    the Y coordinate of popup position

#present(width, height, layout) ⇒ Boolean

Present popup after having processed the GdkPopupLayout rules.

If the popup was previously now showing, it will be showed, otherwise it will change position according to layout.

After calling this function, the result should be handled in response to the [signalGdk.Surface::layout] signal being emitted. The resulting popup position can be queried using [methodGdk.Popup.get_position_x], [methodGdk.Popup.get_position_y], and the resulting size will be sent as parameters in the layout signal. Use [methodGdk.Popup.get_rect_anchor] and [methodGdk.Popup.get_surface_anchor] to get the resulting anchors.

Presenting may fail, for example if the popup is set to autohide and is immediately hidden upon being presented. If presenting failed, the [signalGdk.Surface::layout] signal will not me emitted.

Parameters:

  • width (Integer)

    the unconstrained popup width to layout

  • height (Integer)

    the unconstrained popup height to layout

  • layout (Gdk::PopupLayout)

    the GdkPopupLayout object used to layout

Returns:

  • (Boolean)

    false if it failed to be presented, otherwise true.

#rect_anchorGdk::Gravity

Gets the current popup rectangle anchor.

The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

Returns:

  • (Gdk::Gravity)

    the current rectangle anchor value of popup

#surface_anchorGdk::Gravity

Gets the current popup surface anchor.

The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

Returns:

  • (Gdk::Gravity)

    the current surface anchor value of popup