PopupLayout

The GdkPopupLayout struct contains information that is necessary position a [interface@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

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

Sliding popups

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.

Constructors

this
this(GdkPopupLayout* gdkPopupLayout, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(GdkRectangle* anchorRect, GdkGravity rectAnchor, GdkGravity surfaceAnchor)

Create a popup layout description.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

doref
alias doref = ref_
Undocumented in source.

Functions

copy
PopupLayout copy()

Makes a copy of @layout.

equal
bool equal(PopupLayout other)

Check whether @layout and @other has identical layout properties.

getAnchorHints
GdkAnchorHints getAnchorHints()

Get the GdkAnchorHints.

getAnchorRect
GdkRectangle* getAnchorRect()

Get the anchor rectangle.

getOffset
void getOffset(int dx, int dy)

Retrieves the offset for the anchor rectangle.

getPopupLayoutStruct
GdkPopupLayout* getPopupLayoutStruct(bool transferOwnership)

Get the main Gtk struct

getRectAnchor
GdkGravity getRectAnchor()

Returns the anchor position on the anchor rectangle.

getShadowWidth
void getShadowWidth(int left, int right, int top, int bottom)

Obtains the shadow widths of this layout.

getStruct
void* getStruct()

the main Gtk struct as a void*

getSurfaceAnchor
GdkGravity getSurfaceAnchor()

Returns the anchor position on the popup surface.

ref_
PopupLayout ref_()

Increases the reference count of @value.

setAnchorHints
void setAnchorHints(GdkAnchorHints anchorHints)

Set new anchor hints.

setAnchorRect
void setAnchorRect(GdkRectangle* anchorRect)

Set the anchor rectangle.

setOffset
void setOffset(int dx, int dy)

Offset the position of the anchor rectangle with the given delta.

setRectAnchor
void setRectAnchor(GdkGravity anchor)

Set the anchor on the anchor rectangle.

setShadowWidth
void setShadowWidth(int left, int right, int top, int bottom)

Sets the shadow width of the popup.

setSurfaceAnchor
void setSurfaceAnchor(GdkGravity anchor)

Set the anchor on the popup surface.

unref
void unref()

Decreases the reference count of @value.

Static functions

getType
GType getType()

Variables

gdkPopupLayout
GdkPopupLayout* gdkPopupLayout;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta