PopupLayout


Object Hierarchy:

Object hierarchy for PopupLayout

Description:

[ CCode ( ref_function = "gdk_popup_layout_ref" , type_id = "gdk_popup_layout_get_type ()" , unref_function = "gdk_popup_layout_unref" ) ]
[ Compact ]
public class PopupLayout

The `GdkPopupLayout` struct contains information that is necessary position a [iface@Gdk.

Popup] relative to its parent.

The positioning requires a negotiation with the windowing system, since it depends on external constraints, such as the position of the parent surface, and the screen dimensions.

The basic ingredients are a rectangle on the parent surface, and the anchor on both that rectangle and the popup. The anchors specify a side or corner to place next to each other.

![Popup anchors](popup-anchors.png)

For cases where placing the anchors next to each other would make the popup extend offscreen, the layout includes some hints for how to resolve this problem. The hints may suggest to flip the anchor position to the other side, or to 'slide' the popup along a side, or to resize it.

![Flipping popups](popup-flip.png)

![Sliding popups](popup-slide.png)

These hints may be combined.

Ultimatively, it is up to the windowing system to determine the position and size of the popup. You can learn about the result by calling [ method@Gdk.Popup.get_position_x], [method@Gdk.Popup.get_position_y], [method@Gdk.Popup.get_rect_anchor] and [method@Gdk.Popup.get_surface_anchor ] after the popup has been presented. This can be used to adjust the rendering. For example, [class@Gtk.Popover] changes its arrow position accordingly. But you have to be careful avoid changing the size of the popover, or it has to be presented again.


Namespace: Gdk
Package: gtk4

Content:

Creation methods:

Methods: