CursorProtocol
public protocol CursorProtocol : ObjectProtocolThe CursorProtocol protocol exposes the methods and properties of an underlying GdkCursor 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 Cursor.
Alternatively, use CursorRef as a lighweight, unowned reference if you already have an instance you just want to use.
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.
- 
                  
                  Untyped pointer to the underlying GdkCursorinstance.DeclarationSwift var ptr: UnsafeMutableRawPointer! { get }
- 
                  cursor_ptrDefault implementationTyped pointer to the underlying GdkCursorinstance.Default ImplementationReturn the stored, untyped pointer as a typed pointer to the GdkCursorinstance.DeclarationSwift var cursor_ptr: UnsafeMutablePointer<GdkCursor>! { get }
- 
                  
                  Required Initialiser for types conforming to CursorProtocolDeclarationSwift init(raw: UnsafeMutableRawPointer)
- 
                  bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a CursorPropertyNamesource property to a given target object.DeclarationSwift @discardableResult @inlinable func bind<Q, T>(property source_property: CursorPropertyName, 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 : ObjectProtocolParameterssource_propertythe source property to bind targetthe target object to bind to target_propertythe target property to bind to flagsthe flags to pass to the Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Valuebinding reference or nilin case of an error
- 
                  get(property:Extension method) Get the value of a Cursor property DeclarationSwift @inlinable func get(property: CursorPropertyName) -> GLibObject.ValueParameterspropertythe property to get the value for Return Valuethe value of the named property 
- 
                  set(property:Extension methodvalue: ) Set the value of a Cursor property. Note that this will only have an effect on properties that are writable and not construct-only! DeclarationSwift @inlinable func set(property: CursorPropertyName, value v: GLibObject.Value)Parameterspropertythe property to get the value for Return Valuethe value of the named property 
- 
                  getFallback()Extension methodReturns the fallback for this cursor.The fallback will be used if this cursor is not available on a given GdkDisplay. For named cursors, this can happen when using nonstandard names or when using an incomplete cursor theme. For textured cursors, this can happen when the texture is too large or when theGdkDisplayit is used on does not support textured cursors.DeclarationSwift @inlinable func getFallback() -> CursorRef!
- 
                  getHotspotX()Extension methodReturns the horizontal offset of the hotspot. The hotspot indicates the pixel that will be directly above the cursor. Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with [ctor Gdk.Cursor.new_from_texture].DeclarationSwift @inlinable func getHotspotX() -> Int
- 
                  getHotspotY()Extension methodReturns the vertical offset of the hotspot. The hotspot indicates the pixel that will be directly above the cursor. Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with [ctor Gdk.Cursor.new_from_texture].DeclarationSwift @inlinable func getHotspotY() -> Int
- 
                  getName()Extension methodReturns the name of the cursor. If the cursor is not a named cursor, nilwill be returned.DeclarationSwift @inlinable func getName() -> String!
- 
                  getTexture()Extension methodReturns the texture for the cursor. If the cursor is a named cursor, nilwill be returned.DeclarationSwift @inlinable func getTexture() -> TextureRef!
- 
                  fallbackExtension methodCursor to fall back to if this cursor cannot be displayed. DeclarationSwift @inlinable var fallback: CursorRef! { get }
- 
                  hotspotXExtension methodReturns the horizontal offset of the hotspot. The hotspot indicates the pixel that will be directly above the cursor. Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with [ctor Gdk.Cursor.new_from_texture].DeclarationSwift @inlinable var hotspotX: Int { get }
- 
                  hotspotYExtension methodReturns the vertical offset of the hotspot. The hotspot indicates the pixel that will be directly above the cursor. Note that named cursors may have a nonzero hotspot, but this function will only return the hotspot position for cursors created with [ctor Gdk.Cursor.new_from_texture].DeclarationSwift @inlinable var hotspotY: Int { get }
- 
                  nameExtension methodName of this this cursor. The name will be nilif the cursor was created from a texture.DeclarationSwift @inlinable var name: String! { get }
- 
                  textureExtension methodThe texture displayed by this cursor. The texture will be nilif the cursor was created from a name.DeclarationSwift @inlinable var texture: TextureRef! { get }
 View on GitHub
            View on GitHub
           Install in Dash
            Install in Dash
           CursorProtocol Protocol Reference
      CursorProtocol Protocol Reference