Cursor
open class Cursor : GLibObject.Object, CursorProtocol
The Cursor type acts as a reference-counted owner of an underlying GdkCursor instance.
It provides the methods that can operate on this data type through CursorProtocol conformance.
Use Cursor as a strong reference or owner of a GdkCursor instance.
GdkCursor is used to create and destroy cursors.
Cursors are immutable objects, so once you created them, there is no way to modify them later. You should create a new cursor when you want to change something about it.
Cursors by themselves are not very interesting: they must be bound to a
window for users to see them. This is done with [methodGdk.Surface.set_cursor]
or [methodGdk.Surface.set_device_cursor]. Applications will typically
use higher-level GTK functions such as [methodGtk.Widget.set_cursor]`
instead.
Cursors are not bound to a given [classGdk.Display], so they can be shared.
However, the appearance of cursors may vary when used on different
platforms.
Named and texture cursors
There are multiple ways to create cursors. The platform’s own cursors
can be created with [ctorGdk.Cursor.new_from_name]. That function lists
the commonly available names that are shared with the CSS specification.
Other names may be available, depending on the platform in use. On some
platforms, what images are used for named cursors may be influenced by
the cursor theme.
Another option to create a cursor is to use [ctorGdk.Cursor.new_from_texture]
and provide an image to use for the cursor.
To ease work with unsupported cursors, a fallback cursor can be provided.
If a [classGdk.Surface] cannot use a cursor because of the reasons mentioned
above, it will try the fallback cursor. Fallback cursors can themselves have
fallback cursors again, so it is possible to provide a chain of progressively
easier to support cursors. If none of the provided cursors can be supported,
the default cursor will be the ultimate fallback.
-
Designated initialiser from the underlying `C` data type.This creates an instance without performing an unbalanced retain i.e., ownership is transferred to the
Cursorinstance.Declaration
Swift
@inlinable public init(_ op: UnsafeMutablePointer<GdkCursor>)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 theCursorinstance.Declaration
Swift
@inlinable public init(_ op: UnsafePointer<GdkCursor>)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 theCursorinstance.Declaration
Swift
@inlinable override 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 theCursorinstance.Declaration
Swift
@inlinable override 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 theCursorinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafePointer<GdkCursor>?)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 theCursorinstance.Declaration
Swift
@inlinable public init!(_ op: UnsafeMutablePointer<GdkCursor>?)Parameters
oppointer to the underlying object
-
Designated initialiser from the underlying
Cdata type. Will retainGdkCursor. i.e., ownership is transferred to theCursorinstance.Declaration
Swift
@inlinable public init(retaining op: UnsafeMutablePointer<GdkCursor>)Parameters
oppointer to the underlying object
-
Reference intialiser for a related type that implements
CursorProtocolWill retainGdkCursor.Declaration
Swift
@inlinable public init<T>(cursor other: T) where T : CursorProtocolParameters
otheran instance of a related type that implements
CursorProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
CursorProtocol.Declaration
Swift
@inlinable override 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
CursorProtocol.Declaration
Swift
@inlinable override 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
CursorProtocol.Declaration
Swift
@inlinable override 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
CursorProtocol.Declaration
Swift
@inlinable override public init(retainingRaw 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 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
CursorProtocol.Declaration
Swift
@inlinable required 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
CursorProtocol.Declaration
Swift
@inlinable override 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
CursorProtocol.Declaration
Swift
@inlinable override public init(retainingOpaquePointer p: OpaquePointer)Parameters
popaque pointer to the underlying object
-
Creates a new cursor by looking up
namein 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 public init<CursorT>(name: UnsafePointer<CChar>!, fallback: CursorT?) where CursorT : CursorProtocol -
Creates a new cursor from a
GdkTexture.Declaration
Swift
@inlinable public init<CursorT, TextureT>(texture: TextureT, hotspotX: Int, hotspotY: Int, fallback: CursorT?) where CursorT : CursorProtocol, TextureT : TextureProtocol -
Creates a new cursor by looking up
namein 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 public static func newFrom<CursorT>(name: UnsafePointer<CChar>!, fallback: CursorT?) -> Cursor! where CursorT : CursorProtocol -
Creates a new cursor from a
GdkTexture.Declaration
Swift
@inlinable public static func newFrom<CursorT, TextureT>(texture: TextureT, hotspotX: Int, hotspotY: Int, fallback: CursorT?) -> Cursor! where CursorT : CursorProtocol, TextureT : TextureProtocol
View on GitHub
Install in Dash
Cursor Class Reference