gdk.popup_mixin

Module for Popup interface mixin

Templates 2

tmplPopupT()

A gdk.popup.Popup is a surface that is attached to another surface.

The gdk.popup.Popup is positioned relative to its parent surface.

gdk.popup.Popups are typically used to implement menus and similar popups. They can be modal, which is indicated by the gdk.popup.Popup.autohide property.

Functions
bool autohide()

Get autohide property.

Returns

Whether to hide on outside clicks.

Get parent property.

Returns

The parent surface.
bool getAutohide()

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

Returns

true if popup will autohide

Returns the parent surface of a popup.

Returns

the parent surface
int getPositionX()

Obtains the position of the popup relative to its parent.

Returns

the X coordinate of popup position
int getPositionY()

Obtains the position of the popup relative to its parent.

Returns

the Y coordinate of popup position
gdk.types.Gravity getRectAnchor()

Gets the current popup rectangle anchor.

The value returned may change after calling gdk.popup.Popup.present, or after the gdk.surface.Surface.layout signal is emitted.

Returns

the current rectangle anchor value of popup
gdk.types.Gravity getSurfaceAnchor()

Gets the current popup surface anchor.

The value returned may change after calling gdk.popup.Popup.present, or after the gdk.surface.Surface.layout signal is emitted.

Returns

the current surface anchor value of popup
bool present(int width, int height, gdk.popup_layout.PopupLayout layout)

Present popup after having processed the gdk.popup_layout.PopupLayout 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 gdk.surface.Surface.layout signal being emitted. The resulting popup position can be queried using gdk.popup.Popup.getPositionX, gdk.popup.Popup.getPositionY, and the resulting size will be sent as parameters in the layout signal. Use gdk.popup.Popup.getRectAnchor and gdk.popup.Popup.getSurfaceAnchor 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 gdk.surface.Surface.layout signal will not me emitted.

Parameters

widththe unconstrained popup width to layout
heightthe unconstrained popup height to layout
layoutthe gdk.popup_layout.PopupLayout object used to layout

Returns

false if it failed to be presented, otherwise true.
tmplPopupGidBuilderT()

Fluent builder implementation template for gdk.popup.Popup

Functions
T autohide(bool propval)

Set autohide property.

Parameters

propvalWhether to hide on outside clicks.

Returns

Builder instance for fluent chaining
T parent(gdk.surface.Surface propval)

Set parent property.

Parameters

propvalThe parent surface.

Returns

Builder instance for fluent chaining