Gdk.Popup

g GObject.GInterface GObject.GInterface Gdk.Popup Gdk.Popup GObject.GInterface->Gdk.Popup

Implementations:

None

Methods

get_autohide ()

get_parent ()

get_position_x ()

get_position_y ()

get_rect_anchor ()

get_surface_anchor ()

present (width, height, layout)

Virtual Methods

None

Properties

Name

Type

Flags

Short Description

autohide

bool

r/w/co

parent

Gdk.Surface

r/w/co

Signals

None

Fields

None

Class Details

class Gdk.Popup
Bases:

GObject.GInterface

Structure:

Gdk.PopupInterface

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

The GdkPopup is positioned relative to its parent surface.

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

get_autohide()[source]
Returns:

True if self will autohide

Return type:

bool

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

get_parent()[source]
Returns:

the parent surface

Return type:

Gdk.Surface or None

Returns the parent surface of a popup.

get_position_x()[source]
Returns:

the X coordinate of self position

Return type:

int

Obtains the position of the popup relative to its parent.

get_position_y()[source]
Returns:

the Y coordinate of self position

Return type:

int

Obtains the position of the popup relative to its parent.

get_rect_anchor()[source]
Returns:

the current rectangle anchor value of self

Return type:

Gdk.Gravity

Gets the current popup rectangle anchor.

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

get_surface_anchor()[source]
Returns:

the current surface anchor value of self

Return type:

Gdk.Gravity

Gets the current popup surface anchor.

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

present(width, height, layout)[source]
Parameters:
  • width (int) – the unconstrained popup width to layout

  • height (int) – the unconstrained popup height to layout

  • layout (Gdk.PopupLayout) – the GdkPopupLayout object used to layout

Returns:

False if it failed to be presented, otherwise True.

Return type:

bool

Present self 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 [signal`Gdk`.Surface::layout] signal being emitted. The resulting popup position can be queried using [method`Gdk`.Popup.get_position_x], [method`Gdk`.Popup.get_position_y], and the resulting size will be sent as parameters in the layout signal. Use [method`Gdk`.Popup.get_rect_anchor] and [method`Gdk`.Popup.get_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 [signal`Gdk`.Surface::layout] signal will not me emitted.

Property Details

Gdk.Popup.props.autohide
Name:

autohide

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Whether to hide on outside clicks.

Gdk.Popup.props.parent
Name:

parent

Type:

Gdk.Surface

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The parent surface.