CursorRef

public struct CursorRef : CursorProtocol, GWeakCapturing

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

A GdkCursor represents a cursor. Its contents are private.

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

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

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

Cursor Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GdkCursor>?)
  • 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 CursorProtocol

    Declaration

    Swift

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

    Declaration

    Swift

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

    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 CursorProtocol.

    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 CursorProtocol.

    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 CursorProtocol.

    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 CursorProtocol.

    Declaration

    Swift

    @inlinable
    init(opaquePointer: OpaquePointer)
  • Creates a new cursor from the set of builtin cursors for the default display.
    

    See gdk_cursor_new_for_display().

    To make the cursor invisible, use GDK_BLANK_CURSOR.

    new is deprecated: Use gdk_cursor_new_for_display() instead.

    Declaration

    Swift

    @available(*, deprecated)
    @inlinable
    init(cursorType: GdkCursorType)
  • Creates a new cursor from the set of builtin cursors.

    Declaration

    Swift

    @inlinable
    init<DisplayT>(display: DisplayT, cursorType: GdkCursorType) where DisplayT : DisplayProtocol
  • Creates a new cursor by looking up name in the current cursor theme.

    A recommended set of cursor names that will work across different platforms can be found in the CSS specification:

    • “none”
    • “default”
    • “help”
    • “pointer”
    • “context-menu”
    • “progress”
    • “wait”
    • “cell”
    • “crosshair”
    • “text”
    • “vertical-text”
    • “alias”
    • “copy”
    • “no-drop”
    • “move”
    • “not-allowed”
    • “grab”
    • “grabbing”
    • “all-scroll”
    • “col-resize”
    • “row-resize”
    • “n-resize”
    • “e-resize”
    • “s-resize”
    • “w-resize”
    • “ne-resize”
    • “nw-resize”
    • “sw-resize”
    • “se-resize”
    • “ew-resize”
    • “ns-resize”
    • “nesw-resize”
    • “nwse-resize”
    • “zoom-in”
    • “zoom-out”

    Declaration

    Swift

    @inlinable
    init<DisplayT>(name display: DisplayT, name: UnsafePointer<gchar>!) where DisplayT : DisplayProtocol
  • Creates a new cursor from a pixbuf.

    Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

    If x or y are -1, the pixbuf must have options named “x_hot” and “y_hot”, resp., containing integer values between 0 and the width resp. height of the pixbuf. (Since: 3.0)

    On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

    Declaration

    Swift

    @inlinable
    init<DisplayT, PixbufT>(pixbuf display: DisplayT, pixbuf: PixbufT, x: Int, y: Int) where DisplayT : DisplayProtocol, PixbufT : PixbufProtocol
  • Creates a new cursor from a cairo image surface.

    Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

    On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

    Declaration

    Swift

    @inlinable
    init<DisplayT, SurfaceT>(surface display: DisplayT, surface: SurfaceT, x: Double, y: Double) where DisplayT : DisplayProtocol, SurfaceT : SurfaceProtocol
  • Creates a new cursor from the set of builtin cursors.

    Declaration

    Swift

    @inlinable
    static func newFor<DisplayT>(display: DisplayT, cursorType: GdkCursorType) -> CursorRef! where DisplayT : DisplayProtocol
  • Creates a new cursor by looking up name in the current cursor theme.

    A recommended set of cursor names that will work across different platforms can be found in the CSS specification:

    • “none”
    • “default”
    • “help”
    • “pointer”
    • “context-menu”
    • “progress”
    • “wait”
    • “cell”
    • “crosshair”
    • “text”
    • “vertical-text”
    • “alias”
    • “copy”
    • “no-drop”
    • “move”
    • “not-allowed”
    • “grab”
    • “grabbing”
    • “all-scroll”
    • “col-resize”
    • “row-resize”
    • “n-resize”
    • “e-resize”
    • “s-resize”
    • “w-resize”
    • “ne-resize”
    • “nw-resize”
    • “sw-resize”
    • “se-resize”
    • “ew-resize”
    • “ns-resize”
    • “nesw-resize”
    • “nwse-resize”
    • “zoom-in”
    • “zoom-out”

    Declaration

    Swift

    @inlinable
    static func newFrom<DisplayT>(name display: DisplayT, name: UnsafePointer<gchar>!) -> CursorRef! where DisplayT : DisplayProtocol
  • Creates a new cursor from a pixbuf.

    Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

    If x or y are -1, the pixbuf must have options named “x_hot” and “y_hot”, resp., containing integer values between 0 and the width resp. height of the pixbuf. (Since: 3.0)

    On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

    Declaration

    Swift

    @inlinable
    static func newFrom<DisplayT, PixbufT>(pixbuf display: DisplayT, pixbuf: PixbufT, x: Int, y: Int) -> CursorRef! where DisplayT : DisplayProtocol, PixbufT : PixbufProtocol
  • Creates a new cursor from a cairo image surface.

    Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. The functions gdk_display_supports_cursor_alpha() and gdk_display_supports_cursor_color() can be used to determine whether RGBA cursors are supported; gdk_display_get_default_cursor_size() and gdk_display_get_maximal_cursor_size() give information about cursor sizes.

    On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.

    Declaration

    Swift

    @inlinable
    static func newFrom<DisplayT, SurfaceT>(surface display: DisplayT, surface: SurfaceT, x: Double, y: Double) -> CursorRef! where DisplayT : DisplayProtocol, SurfaceT : SurfaceProtocol