## Popups Popups — Interface for popup surfaces |

## Functions

gboolean | gdk_popup_present ()
GdkGravity | gdk_popup_get_surface_anchor ()
GdkGravity | gdk_popup_get_rect_anchor ()
GdkSurface * | gdk_popup_get_parent ()
int | gdk_popup_get_position_x ()
int | gdk_popup_get_position_y ()
gboolean | gdk_popup_get_autohide ()

## Properties

gboolean | autohide | Read / Write / Construct Only
GdkSurface * | parent | Read / Write / Construct Only

## Signals

void | popup-layout-changed | Run First

## Types and Values

| GdkPopup

## Object Hierarchy

        GInterface
        ╰── GdkPopup

## Prerequisites

GdkPopup requires GdkSurface.

## Includes

    #include <gdk/gdk.h>

## Description

A GdkPopup is a surface that is attached to another surface, and is positioned relative to it.

## Functions

### gdk_popup_present ()

    gboolean
    gdk_popup_present (GdkPopup *popup,
                       int width,
                       int height,
                       GdkPopupLayout *layout);

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 of the layout can be queried using `gdk_popup_get_position_x()`, `gdk_popup_get_position_y()`, `gdk_surface_get_width()`, `gdk_surface_get_height()`, `gdk_popup_get_rect_anchor()` and `gdk_popup_get_surface_anchor()`.

Presenting may have fail, for example if it was immediately hidden if the `popup` was set to autohide.

#### Parameters

popup | the GdkPopup to show |
width | the unconstrained popup width to layout |
height | the unconstrained popup height to layout |
layout | the GdkPopupLayout object used to layout |

#### Returns

`FALSE` if it failed to be presented, otherwise `TRUE`.

### gdk_popup_get_surface_anchor ()

    GdkGravity
    gdk_popup_get_surface_anchor (GdkPopup *popup);

Gets the current popup surface anchor.

The value returned may change after calling `gdk_popup_present()`, or after the "popup-layout-changed" is emitted.

#### Parameters

popup | a GdkPopup |

#### Returns

the current surface anchor value of `popup`

### gdk_popup_get_rect_anchor ()

    GdkGravity
    gdk_popup_get_rect_anchor (GdkPopup *popup);

Gets the current popup rectangle anchor.

The value returned may change after calling `gdk_popup_present()`, or after the "popup-layout-changed" is emitted.

#### Parameters

popup | a GdkPopup |

#### Returns

the current rectangle anchor value of `popup`

### gdk_popup_get_parent ()

    GdkSurface *
    gdk_popup_get_parent (GdkPopup *popup);

Returns the parent surface of a popup.

#### Parameters

popup | a GdkPopup |

#### Returns

the parent surface.

[transfer none]

### gdk_popup_get_position_x ()

    int
    gdk_popup_get_position_x (GdkPopup *popup);

Obtains the position of the popup relative to its parent.

#### Parameters

popup | a GdkPopup |

#### Returns

the X coordinate of `popup` position

### gdk_popup_get_position_y ()

    int
    gdk_popup_get_position_y (GdkPopup *popup);

Obtains the position of the popup relative to its parent.

#### Parameters

popup | a GdkPopup |

#### Returns

the Y coordinate of `popup` position

### gdk_popup_get_autohide ()

    gboolean
    gdk_popup_get_autohide (GdkPopup *popup);

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

#### Parameters

popup | a GdkPopup |

#### Returns

`TRUE` if `popup` will autohide

## Types and Values

### GdkPopup

    typedef struct _GdkPopup GdkPopup;

## Property Details

### The `“autohide”` property

      “autohide”                 gboolean

Whether to hide on outside clicks.

Owner: GdkPopup

Flags: Read / Write / Construct Only

Default value: FALSE

### The `“parent”` property

      “parent”                   GdkSurface *

The parent surface.

Owner: GdkPopup

Flags: Read / Write / Construct Only

## Signal Details

### The `“popup-layout-changed”` signal

    void
    user_function (GdkPopup *popup,
                   gpointer  user_data)

Emitted when the layout of a popup surface has changed, e.g. if the popup layout was reactive and after the parent moved causing the popover to end up partially off-screen.

#### Parameters

popup | the GdkSurface that was laid out |
user_data | user data set when the signal handler was connected. |

Flags: Run First