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 gtk_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.
Fallback_Property : constant Glib.Properties.Property_Boxed;
Type: Cursor Cursor to fall back to if this cursor cannot be displayed.
type Gdk_Cursor is access all Gdk_Cursor_Record'Class;
function Gdk_Cursor_New_From_Name
(Name : UTF8_String;
Fallback : access Gdk_Cursor_Record'Class) return Gdk_Cursor
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" | No cursor | |
| "default" | The default cursor | |
| "help" | Help is available | |
| "pointer" | Indicates a link or interactive element | |
|"context-menu" | A context menu is available | |
| "progress" | Progress indicator | |
| "wait" | Busy cursor | |
| "cell" | Cell(s) may be selected | |
| "crosshair" | Simple crosshair | |
| "text" | Text may be selected | |
| "vertical-text" | Vertical text may be selected | |
| "alias" | DND: Something will be linked | |
| "copy" | DND: Something will be copied | |
| "move" | DND: Something will be moved | |
| "dnd-ask" | DND: User can choose action to be carried out | |
| "no-drop" | DND: Can't drop here | |
| "not-allowed" | DND: Action will not be carried out | |
| "grab" | DND: Something can be grabbed | |
| "grabbing" | DND: Something is being grabbed | |
| "n-resize" | Resizing: Move north border | |
| "e-resize" | Resizing: Move east border | |
| "s-resize" | Resizing: Move south border | |
| "w-resize" | Resizing: Move west border | |
| "ne-resize" | Resizing: Move north-east corner | |
| "nw-resize" | Resizing: Move north-west corner | |
| "sw-resize" | Resizing: Move south-west corner | |
| "se-resize" | Resizing: Move south-east corner | |
| "col-resize" | Resizing: Move an item or border horizontally | |
| "row-resize" | Resizing: Move an item or border vertically | |
| "ew-resize" | Moving: Something can be moved horizontally | |
| "ns-resize" | Moving: Something can be moved vertically | |
| "nesw-resize" | Moving: Something can be moved diagonally, north-east to south-west | |
| "nwse-resize" | Moving: something can be moved diagonally, north-west to south-east | |
| "all-resize" | Moving: Something can be moved in any direction | |
| "all-scroll" | Can scroll in any direction | |
| "zoom-in" | Zoom in | |
| "zoom-out" | Zoom out |
the name of the cursor
null or the GdkCursor to fall back to when this one cannot be supported
type Gdk_Cursor_Record is new GObject_Record with null record;
procedure Gdk_New_From_Name
(Self : out Gdk_Cursor;
Name : UTF8_String;
Fallback : access Gdk_Cursor_Record'Class)
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" | No cursor | |
| "default" | The default cursor | |
| "help" | Help is available | |
| "pointer" | Indicates a link or interactive element | |
|"context-menu" | A context menu is available | |
| "progress" | Progress indicator | |
| "wait" | Busy cursor | |
| "cell" | Cell(s) may be selected | |
| "crosshair" | Simple crosshair | |
| "text" | Text may be selected | |
| "vertical-text" | Vertical text may be selected | |
| "alias" | DND: Something will be linked | |
| "copy" | DND: Something will be copied | |
| "move" | DND: Something will be moved | |
| "dnd-ask" | DND: User can choose action to be carried out | |
| "no-drop" | DND: Can't drop here | |
| "not-allowed" | DND: Action will not be carried out | |
| "grab" | DND: Something can be grabbed | |
| "grabbing" | DND: Something is being grabbed | |
| "n-resize" | Resizing: Move north border | |
| "e-resize" | Resizing: Move east border | |
| "s-resize" | Resizing: Move south border | |
| "w-resize" | Resizing: Move west border | |
| "ne-resize" | Resizing: Move north-east corner | |
| "nw-resize" | Resizing: Move north-west corner | |
| "sw-resize" | Resizing: Move south-west corner | |
| "se-resize" | Resizing: Move south-east corner | |
| "col-resize" | Resizing: Move an item or border horizontally | |
| "row-resize" | Resizing: Move an item or border vertically | |
| "ew-resize" | Moving: Something can be moved horizontally | |
| "ns-resize" | Moving: Something can be moved vertically | |
| "nesw-resize" | Moving: Something can be moved diagonally, north-east to south-west | |
| "nwse-resize" | Moving: something can be moved diagonally, north-west to south-east | |
| "all-resize" | Moving: Something can be moved in any direction | |
| "all-scroll" | Can scroll in any direction | |
| "zoom-in" | Zoom in | |
| "zoom-out" | Zoom out |
the name of the cursor
null or the GdkCursor to fall back to when this one cannot be supported
function Get_Fallback
(Self : not null access Gdk_Cursor_Record) return Gdk_Cursor
Returns 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 the GdkDisplay it is used on does not support textured cursors.
the fallback of the cursor or null to use the default cursor as fallback. Has transfer-ownership='none'.
function Get_Hotspot_X
(Self : not null access Gdk_Cursor_Record) return Glib.Gint
Returns 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 [ctorGdk.Cursor.new_from_texture].
the horizontal offset of the hotspot or 0 for named cursors
function Get_Hotspot_Y
(Self : not null access Gdk_Cursor_Record) return Glib.Gint
Returns 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 [ctorGdk.Cursor.new_from_texture].
the vertical offset of the hotspot or 0 for named cursors
function Get_Name
(Self : not null access Gdk_Cursor_Record) return UTF8_String
Returns the name of the cursor. If the cursor is not a named cursor, null will be returned.
the name of the cursor or null if it is not a named cursor
function Get_Type return Glib.GType
Hotspot_X_Property : constant Glib.Properties.Property_Int;
X position of the cursor hotspot in the cursor image.
Hotspot_Y_Property : constant Glib.Properties.Property_Int;
Y position of the cursor hotspot in the cursor image.
procedure Initialize_From_Name
(Self : not null access Gdk_Cursor_Record'Class;
Name : UTF8_String;
Fallback : access Gdk_Cursor_Record'Class)
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" | No cursor | |
| "default" | The default cursor | |
| "help" | Help is available | |
| "pointer" | Indicates a link or interactive element | |
|"context-menu" | A context menu is available | |
| "progress" | Progress indicator | |
| "wait" | Busy cursor | |
| "cell" | Cell(s) may be selected | |
| "crosshair" | Simple crosshair | |
| "text" | Text may be selected | |
| "vertical-text" | Vertical text may be selected | |
| "alias" | DND: Something will be linked | |
| "copy" | DND: Something will be copied | |
| "move" | DND: Something will be moved | |
| "dnd-ask" | DND: User can choose action to be carried out | |
| "no-drop" | DND: Can't drop here | |
| "not-allowed" | DND: Action will not be carried out | |
| "grab" | DND: Something can be grabbed | |
| "grabbing" | DND: Something is being grabbed | |
| "n-resize" | Resizing: Move north border | |
| "e-resize" | Resizing: Move east border | |
| "s-resize" | Resizing: Move south border | |
| "w-resize" | Resizing: Move west border | |
| "ne-resize" | Resizing: Move north-east corner | |
| "nw-resize" | Resizing: Move north-west corner | |
| "sw-resize" | Resizing: Move south-west corner | |
| "se-resize" | Resizing: Move south-east corner | |
| "col-resize" | Resizing: Move an item or border horizontally | |
| "row-resize" | Resizing: Move an item or border vertically | |
| "ew-resize" | Moving: Something can be moved horizontally | |
| "ns-resize" | Moving: Something can be moved vertically | |
| "nesw-resize" | Moving: Something can be moved diagonally, north-east to south-west | |
| "nwse-resize" | Moving: something can be moved diagonally, north-west to south-east | |
| "all-resize" | Moving: Something can be moved in any direction | |
| "all-scroll" | Can scroll in any direction | |
| "zoom-in" | Zoom in | |
| "zoom-out" | Zoom out | Initialize_From_Name does nothing if the object was already created with another call to Initialize* or G_New.
the name of the cursor
null or the GdkCursor to fall back to when this one cannot be supported
Name_Property : constant Glib.Properties.Property_String;
Name of this this cursor.
The name will be null if the cursor was created from a texture.
Texture_Property : constant Glib.Properties.Property_Boxed;
Type: Texture The texture displayed by this cursor.
The texture will be null if the cursor was created from a name.