PopupLayout
open class PopupLayout : PopupLayoutProtocol
The PopupLayout type acts as a reference-counted owner of an underlying GdkPopupLayout instance.
It provides the methods that can operate on this data type through PopupLayoutProtocol conformance.
Use PopupLayout as a strong reference or owner of a GdkPopupLayout instance.
The GdkPopupLayout struct contains information that is
necessary position a [interfaceGdk.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.

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
[methodGdk.Popup.get_position_x], [methodGdk.Popup.get_position_y],
[methodGdk.Popup.get_rect_anchor] and [methodGdk.Popup.get_surface_anchor]
after the popup has been presented. This can be used to adjust the rendering.
For example, [classGtk.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.
-
Untyped pointer to the underlying `GdkPopupLayout` instance.For type-safe access, use the generated, typed pointer
popup_layout_ptrproperty instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer! -
Designated initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GdkPopupLayout>)Parameters
oppointer to the underlying object
-
Designated initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GdkPopupLayout>)Parameters
oppointer to the underlying object
-
Optional initialiser from a non-mutating
gpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init!(gpointer op: gpointer?)Parameters
opgpointer to the underlying object
-
Optional initialiser from a non-mutating
gconstpointerto the underlyingCdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init!(gconstpointer op: gconstpointer?)Parameters
oppointer to the underlying object
-
Optional initialiser from a constant pointer to the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GdkPopupLayout>?)Parameters
oppointer to the underlying object
-
Optional initialiser from the underlying
Cdata type. This creates an instance without performing an unbalanced retain i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GdkPopupLayout>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGdkPopupLayout. i.e., ownership is transferred to thePopupLayoutinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GdkPopupLayout>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
PopupLayoutProtocolWill retainGdkPopupLayout.Declaration
Swift
@inlinable public init<T>(_ other: T) where T : PopupLayoutProtocolParameters
otheran instance of a related type that implements
PopupLayoutProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init<T>(cPointer p: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe typed, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init<T>(retainingCPointer cPointer: UnsafeMutablePointer<T>)Parameters
cPointerpointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init(raw p: UnsafeRawPointer)Parameters
praw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init(retainingRaw raw: UnsafeRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public required init(raw p: UnsafeMutableRawPointer)Parameters
pmutable raw pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init(retainingRaw raw: UnsafeMutableRawPointer)Parameters
rawmutable raw pointer to the underlying object
-
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init(opaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Unsafe untyped, retaining initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
PopupLayoutProtocol.Declaration
Swift
@inlinable public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Create a popup layout description.
Used together with [method
Gdk.Popup.present] to describe how a popup surface should be placed and behave on-screen.anchor_rectis relative to the top-left corner of the surface’s parent.rect_anchorandsurface_anchordetermine anchor points onanchor_rectand surface to pin together.The position of
anchor_rect‘s anchor point can optionally be offset using [methodGdk.PopupLayout.set_offset], which is equivalent to offsetting the position of surface.Declaration
Swift
@inlinable public init<RectangleT>(anchorRect: RectangleT, rectAnchor: GdkGravity, surfaceAnchor: GdkGravity) where RectangleT : RectangleProtocol
View on GitHub
Install in Dash
PopupLayout Class Reference