3.10 <GdkPopupLayout>

Structure: <GdkPopupLayout>

Contains information that is necessary position a <GdkPopup> 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.

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.

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 popup:get-position-x, popup:get-position-y, popup:get-rect-anchor and popup:get-surface-anchor 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.

Procedures

Method: popup-layout:copy self ⇒ %return
Method: copy self ⇒ %return

Makes a copy of self.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkPopupLayout>.

a copy of self.

Method: popup-layout:equal? self other ⇒ %return
Method: equal? self other ⇒ %return

Check whether self and other has identical layout properties.

self

Passed: a <GdkPopupLayout>.

a popup layout

other

Passed: a <GdkPopupLayout>.

another popup layout

%return

Returned: a boolean.

true if self and other have identical layout properties, otherwise false.

Method: popup-layout:get-anchor-hints self ⇒ %return
Method: get-anchor-hints self ⇒ %return

Get the anchor hints.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkAnchorHints>.

the anchor hints

Method: popup-layout:get-anchor-rect self ⇒ %return
Method: get-anchor-rect self ⇒ %return

Get the anchor rectangle.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkRectangle>.

The anchor rectangle

Method: popup-layout:get-offset self ⇒ dx dy
Method: get-offset self ⇒ dx dy

Retrieves the offset for the anchor rectangle.

self

Passed: a <GdkPopupLayout>.

a popup layout

dx

Returned: a 32-bit integer.

return location for the delta X coordinate

dy

Returned: a 32-bit integer.

return location for the delta Y coordinate

Method: popup-layout:get-rect-anchor self ⇒ %return
Method: get-rect-anchor self ⇒ %return

Returns the anchor position on the anchor rectangle.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkGravity>.

the anchor on the anchor rectangle.

Method: popup-layout:get-shadow-width self ⇒ left right top bottom
Method: get-shadow-width self ⇒ left right top bottom

Obtains the shadow widths of this layout.

self

Passed: a <GdkPopupLayout>.

a popup layout

left

Returned: a 32-bit integer.

return location for the left shadow width

right

Returned: a 32-bit integer.

return location for the right shadow width

top

Returned: a 32-bit integer.

return location for the top shadow width

bottom

Returned: a 32-bit integer.

return location for the bottom shadow width

Method: popup-layout:get-surface-anchor self ⇒ %return
Method: get-surface-anchor self ⇒ %return

Returns the anchor position on the popup surface.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkGravity>.

the anchor on the popup surface.

Procedure: popup-layout:new anchor-rect rect-anchor surface-anchor ⇒ %return

Create a popup layout description.

Used together with popup:present? to describe how a popup surface should be placed and behave on-screen.

anchor-rect is relative to the top-left corner of the surface’s parent. rect-anchor and surface-anchor determine anchor points on anchor-rect and surface to pin together.

The position of anchor-rect’s anchor point can optionally be offset using popup-layout:set-offset, which is equivalent to offsetting the position of surface.

anchor-rect

Passed: a <GdkRectangle>.

the anchor rectangle to align surface with

rect-anchor

Passed: a <GdkGravity>, or one of its symbols.

the point on anchor-rect to align with surface’s anchor point

surface-anchor

Passed: a <GdkGravity>, or one of its symbols.

the point on surface to align with rect’s anchor point

%return

Returned: a <GdkPopupLayout>.

newly created instance of <GdkPopupLayout>

Method: popup-layout:ref self ⇒ %return
Method: ref self ⇒ %return

Increases the reference count of value.

self

Passed: a <GdkPopupLayout>.

a popup layout

%return

Returned: a <GdkPopupLayout>.

the same self

Method: popup-layout:set-anchor-hints self anchor-hints
Method: set-anchor-hints self anchor-hints

Set new anchor hints.

The set anchor-hints determines how surface will be moved if the anchor points cause it to move off-screen. For example, flip-x will replace north-west with north-east and vice versa if surface extends beyond the left or right edges of the monitor.

self

Passed: a <GdkPopupLayout>.

a popup layout

anchor-hints

Passed: a <GdkAnchorHints>, or a list of its symbols, or one of them.

the new anchor hints

Method: popup-layout:set-anchor-rect self anchor-rect
Method: set-anchor-rect self anchor-rect

Set the anchor rectangle.

self

Passed: a <GdkPopupLayout>.

a popup layout

anchor-rect

Passed: a <GdkRectangle>.

the new anchor rectangle

Method: popup-layout:set-offset self dx dy
Method: set-offset self dx dy

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

self

Passed: a <GdkPopupLayout>.

a popup layout

dx

Passed: a 32-bit integer.

x delta to offset the anchor rectangle with

dy

Passed: a 32-bit integer.

y delta to offset the anchor rectangle with

Method: popup-layout:set-rect-anchor self anchor
Method: set-rect-anchor self anchor

Set the anchor on the anchor rectangle.

self

Passed: a <GdkPopupLayout>.

a popup layout

anchor

Passed: a <GdkGravity>, or one of its symbols.

the new rect anchor

Method: popup-layout:set-shadow-width self left right top bottom
Method: set-shadow-width self left right top bottom

Sets the shadow width of the popup.

The shadow width corresponds to the part of the computed surface size that would consist of the shadow margin surrounding the window, would there be any.

self

Passed: a <GdkPopupLayout>.

a popup layout

left

Passed: a 32-bit integer.

width of the left part of the shadow

right

Passed: a 32-bit integer.

width of the right part of the shadow

top

Passed: a 32-bit integer.

height of the top part of the shadow

bottom

Passed: a 32-bit integer.

height of the bottom part of the shadow

Method: popup-layout:set-surface-anchor self anchor
Method: set-surface-anchor self anchor

Set the anchor on the popup surface.

self

Passed: a <GdkPopupLayout>.

a popup layout

anchor

Passed: a <GdkGravity>, or one of its symbols.

the new popup surface anchor

Method: popup-layout:unref self
Method: unref self

Decreases the reference count of value.

self

Passed: a <GdkPopupLayout>.

a popup layout