PopupProtocol
public protocol PopupProtocol : SurfaceProtocol
The PopupProtocol
protocol exposes the methods and properties of an underlying GdkPopup
instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see Popup
.
Alternatively, use PopupRef
as a lighweight, unowned
reference if you already have an instance you just want to use.
A GdkPopup
is a surface that is attached to another surface.
The GdkPopup
is positioned relative to its parent surface.
GdkPopup
s are typically used to implement menus and similar popups.
They can be modal, which is indicated by the [propertyGdkPopup:autohide
]
property.
-
Untyped pointer to the underlying
GdkPopup
instance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get }
-
popup_ptr
Default implementationTyped pointer to the underlying
GdkPopup
instance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GdkPopup
instance.Declaration
Swift
var popup_ptr: UnsafeMutablePointer<GdkPopup>! { get }
-
Required Initialiser for types conforming to
PopupProtocol
Declaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:
Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
PopupPropertyName
source property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: PopupPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol
Parameters
source_property
the source property to bind
target
the target object to bind to
target_property
the target property to bind to
flags
the flags to pass to the
Binding
transform_from
ValueTransformer
to use for forward transformationtransform_to
ValueTransformer
to use for backwards transformationReturn Value
binding reference or
nil
in case of an error -
get(property:
Extension method) Get the value of a Popup property
Declaration
Swift
@inlinable func get(property: PopupPropertyName) -> GLibObject.Value
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
set(property:
Extension methodvalue: ) Set the value of a Popup property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: PopupPropertyName, value v: GLibObject.Value)
Parameters
property
the property to get the value for
Return Value
the value of the named property
-
getAutohide()
Extension methodReturns whether this popup is set to hide on outside clicks.
Declaration
Swift
@inlinable func getAutohide() -> Bool
-
getParent()
Extension methodReturns the parent surface of a popup.
Declaration
Swift
@inlinable func getParent() -> SurfaceRef!
-
getPositionX()
Extension methodObtains the position of the popup relative to its parent.
Declaration
Swift
@inlinable func getPositionX() -> Int
-
getPositionY()
Extension methodObtains the position of the popup relative to its parent.
Declaration
Swift
@inlinable func getPositionY() -> Int
-
getRectAnchor()
Extension methodGets the current popup rectangle anchor.
The value returned may change after calling [method
Gdk.Popup.present
], or after the [signalGdk.Surface::layout
] signal is emitted.Declaration
Swift
@inlinable func getRectAnchor() -> GdkGravity
-
getSurfaceAnchor()
Extension methodGets the current popup surface anchor.
The value returned may change after calling [method
Gdk.Popup.present
], or after the [signalGdk.Surface::layout
] signal is emitted.Declaration
Swift
@inlinable func getSurfaceAnchor() -> GdkGravity
-
present(width:
Extension methodheight: layout: ) Present
popup
after having processed theGdkPopupLayout
rules.If the popup was previously now showing, it will be showed, otherwise it will change position according to
layout
.After calling this function, the result should be handled in response to the [signal
GdkSurface::layout
] signal being emitted. The resulting popup position can be queried using [methodGdk.Popup.get_position_x
], [methodGdk.Popup.get_position_y
], and the resulting size will be sent as parameters in the layout signal. Use [methodGdk.Popup.get_rect_anchor
] and [methodGdk.Popup.get_surface_anchor
] to get the resulting anchors.Presenting may fail, for example if the
popup
is set to autohide and is immediately hidden upon being presented. If presenting failed, the [signalGdk.Surface::layout
] signal will not me emitted.Declaration
Swift
@inlinable func present<PopupLayoutT>(width: Int, height: Int, layout: PopupLayoutT) -> Bool where PopupLayoutT : PopupLayoutProtocol
-
autohide
Extension methodWhether to hide on outside clicks.
Declaration
Swift
@inlinable var autohide: Bool { get }
-
parent
Extension methodThe parent surface.
Declaration
Swift
@inlinable var parent: SurfaceRef! { get }
-
positionX
Extension methodObtains the position of the popup relative to its parent.
Declaration
Swift
@inlinable var positionX: Int { get }
-
positionY
Extension methodObtains the position of the popup relative to its parent.
Declaration
Swift
@inlinable var positionY: Int { get }
-
rectAnchor
Extension methodGets the current popup rectangle anchor.
The value returned may change after calling [method
Gdk.Popup.present
], or after the [signalGdk.Surface::layout
] signal is emitted.Declaration
Swift
@inlinable var rectAnchor: GdkGravity { get }
-
surfaceAnchor
Extension methodGets the current popup surface anchor.
The value returned may change after calling [method
Gdk.Popup.present
], or after the [signalGdk.Surface::layout
] signal is emitted.Declaration
Swift
@inlinable var surfaceAnchor: GdkGravity { get }