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.

GdkPopups are typically used to implement menus and similar popups. They can be modal, which is indicated by the [propertyGdkPopup:autohide] property.

  • ptr

    Untyped pointer to the underlying GdkPopup instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • popup_ptr Default implementation

    Typed 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)

Popup Interface

  • 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 transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return 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:value:) Extension method

    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

Popup Interface: PopupProtocol extension (methods and fields)

  • getAutohide() Extension method

    Returns whether this popup is set to hide on outside clicks.

    Declaration

    Swift

    @inlinable
    func getAutohide() -> Bool
  • getParent() Extension method

    Returns the parent surface of a popup.

    Declaration

    Swift

    @inlinable
    func getParent() -> SurfaceRef!
  • getPositionX() Extension method

    Obtains the position of the popup relative to its parent.

    Declaration

    Swift

    @inlinable
    func getPositionX() -> Int
  • getPositionY() Extension method

    Obtains the position of the popup relative to its parent.

    Declaration

    Swift

    @inlinable
    func getPositionY() -> Int
  • getRectAnchor() Extension method

    Gets the current popup rectangle anchor.

    The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

    Declaration

    Swift

    @inlinable
    func getRectAnchor() -> GdkGravity
  • getSurfaceAnchor() Extension method

    Gets the current popup surface anchor.

    The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

    Declaration

    Swift

    @inlinable
    func getSurfaceAnchor() -> GdkGravity
  • Present popup after having processed the GdkPopupLayout 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 [signalGdkSurface::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 method

    Whether to hide on outside clicks.

    Declaration

    Swift

    @inlinable
    var autohide: Bool { get }
  • parent Extension method

    The parent surface.

    Declaration

    Swift

    @inlinable
    var parent: SurfaceRef! { get }
  • positionX Extension method

    Obtains the position of the popup relative to its parent.

    Declaration

    Swift

    @inlinable
    var positionX: Int { get }
  • positionY Extension method

    Obtains the position of the popup relative to its parent.

    Declaration

    Swift

    @inlinable
    var positionY: Int { get }
  • rectAnchor Extension method

    Gets the current popup rectangle anchor.

    The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

    Declaration

    Swift

    @inlinable
    var rectAnchor: GdkGravity { get }
  • surfaceAnchor Extension method

    Gets the current popup surface anchor.

    The value returned may change after calling [methodGdk.Popup.present], or after the [signalGdk.Surface::layout] signal is emitted.

    Declaration

    Swift

    @inlinable
    var surfaceAnchor: GdkGravity { get }