NativeRef

public struct NativeRef : NativeProtocol, GWeakCapturing

GtkNative is the interface implemented by all widgets that have their own GdkSurface.

The obvious example of a GtkNative is GtkWindow.

Every widget that is not itself a GtkNative is contained in one, and you can get it with [methodGtk.Widget.get_native].

To get the surface of a GtkNative, use [methodGtk.Native.get_surface]. It is also possible to find the GtkNative to which a surface belongs, with [funcGtk.Native.get_for_surface].

In addition to a [classGdk.Surface], a GtkNative also provides a [classGsk.Renderer] for rendering on that surface. To get the renderer, use [methodGtk.Native.get_renderer].

The NativeRef type acts as a lightweight Swift reference to an underlying GtkNative instance. It exposes methods that can operate on this data type through NativeProtocol conformance. Use NativeRef only as an unowned reference to an existing GtkNative instance.

  • ptr
    Untyped pointer to the underlying `GtkNative` instance.
    

    For type-safe access, use the generated, typed pointer native_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Native Interface

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkNative>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkNative>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkNative>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkNative>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements NativeProtocol

    Declaration

    Swift

    @inlinable
    init<T>(_ other: T) where T : NativeProtocol
  • This factory is syntactic sugar for setting weak pointers wrapped in GWeak<T>

    Declaration

    Swift

    @inlinable
    static func unowned<T>(_ other: T) -> NativeRef where T : NativeProtocol
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to NativeProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(cPointer: UnsafeMutablePointer<T>)
  • Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to NativeProtocol.

    Declaration

    Swift

    @inlinable
    init<T>(constPointer: UnsafePointer<T>)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to NativeProtocol.

    Declaration

    Swift

    @inlinable
    init(mutating raw: UnsafeRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to NativeProtocol.

    Declaration

    Swift

    @inlinable
    init(raw: UnsafeMutableRawPointer)
  • Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to NativeProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Finds the GtkNative associated with the surface.

    Declaration

    Swift

    @inlinable
    static func getFor<SurfaceT>(surface: SurfaceT) -> NativeRef! where SurfaceT : SurfaceProtocol