PopupLayout

The gdk.popup_layout.PopupLayout struct contains information that is necessary position a gdk.popup.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 gdk.popup.Popup.getPositionX, gdk.popup.Popup.getPositionY, gdk.popup.Popup.getRectAnchor and gdk.popup.Popup.getSurfaceAnchor after the popup has been presented. This can be used to adjust the rendering. For example, GtkPopover 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(gdk.rectangle.Rectangle anchorRect, gdk.types.Gravity rectAnchor, gdk.types.Gravity surfaceAnchor)

Create a popup layout description.

Members

Functions

copy
gdk.popup_layout.PopupLayout copy()

Makes a copy of layout.

equal
bool equal(gdk.popup_layout.PopupLayout other)

Check whether layout and other has identical layout properties.

getAnchorHints
gdk.types.AnchorHints getAnchorHints()

Get the gdk.types.AnchorHints.

getAnchorRect
gdk.rectangle.Rectangle getAnchorRect()

Get the anchor rectangle.

getOffset
void getOffset(int dx, int dy)

Retrieves the offset for the anchor rectangle.

getRectAnchor
gdk.types.Gravity 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.

getSurfaceAnchor
gdk.types.Gravity getSurfaceAnchor()

Returns the anchor position on the popup surface.

setAnchorHints
void setAnchorHints(gdk.types.AnchorHints anchorHints)

Set new anchor hints.

setAnchorRect
void setAnchorRect(gdk.rectangle.Rectangle 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(gdk.types.Gravity 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(gdk.types.Gravity anchor)

Set the anchor on the popup surface.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.