Package ch.bailu.gtk.gdk
Class Cursor
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gdk.Cursor
- All Implemented Interfaces:
PointerInterface
`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 [method@Gdk.Surface.set_cursor]
or [method@Gdk.Surface.set_device_cursor]. Applications will typically
use higher-level GTK functions such as [method@Gtk.Widget.set_cursor] instead.
Cursors are not bound to a given [class@Gdk.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 [ctor@Gdk.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 [ctor@Gdk.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 [class@Gdk.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.
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 [method@Gdk.Surface.set_cursor]
or [method@Gdk.Surface.set_device_cursor]. Applications will typically
use higher-level GTK functions such as [method@Gtk.Widget.set_cursor] instead.
Cursors are not bound to a given [class@Gdk.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 [ctor@Gdk.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 [ctor@Gdk.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 [class@Gdk.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.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassHandler
Returns the fallback for this @cursor.int
Returns the horizontal offset of the hotspot.int
Returns the vertical offset of the hotspot.static int
getName()
Returns the name of the cursor.static long
static TypeSystem.TypeSize
Returns the texture for the cursor.static long
static TypeSystem.TypeSize
static Cursor
newFromNameCursor
(Str name, Cursor fallback) Creates a new cursor by looking up @name in the current cursor
theme.static Cursor
newFromNameCursor
(String name, Cursor fallback) Creates a new cursor by looking up @name in the current cursor
theme.static Cursor
newFromTextureCursor
(Texture texture, int hotspot_x, int hotspot_y, Cursor fallback) Creates a new cursor from a `GdkTexture`.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Constructor Details
-
Cursor
-
-
Method Details
-
getClassHandler
-
newFromNameCursor
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_cursor.png) "default" | ![](help_cursor.png) "help" | ![](pointer_cursor.png) "pointer" |
| ![](context_menu_cursor.png) "context-menu" | ![](progress_cursor.png) "progress" | ![](wait_cursor.png) "wait" | ![](cell_cursor.png) "cell" |
| ![](crosshair_cursor.png) "crosshair" | ![](text_cursor.png) "text" | ![](vertical_text_cursor.png) "vertical-text" | ![](alias_cursor.png) "alias" |
| ![](copy_cursor.png) "copy" | ![](no_drop_cursor.png) "no-drop" | ![](move_cursor.png) "move" | ![](not_allowed_cursor.png) "not-allowed" |
| ![](grab_cursor.png) "grab" | ![](grabbing_cursor.png) "grabbing" | ![](all_scroll_cursor.png) "all-scroll" | ![](col_resize_cursor.png) "col-resize" |
| ![](row_resize_cursor.png) "row-resize" | ![](n_resize_cursor.png) "n-resize" | ![](e_resize_cursor.png) "e-resize" | ![](s_resize_cursor.png) "s-resize" |
| ![](w_resize_cursor.png) "w-resize" | ![](ne_resize_cursor.png) "ne-resize" | ![](nw_resize_cursor.png) "nw-resize" | ![](sw_resize_cursor.png) "sw-resize" |
| ![](se_resize_cursor.png) "se-resize" | ![](ew_resize_cursor.png) "ew-resize" | ![](ns_resize_cursor.png) "ns-resize" | ![](nesw_resize_cursor.png) "nesw-resize" |
| ![](nwse_resize_cursor.png) "nwse-resize" | ![](zoom_in_cursor.png) "zoom-in" | ![](zoom_out_cursor.png) "zoom-out" | |- Parameters:
name
- the name of the cursorfallback
- %NULL or the `GdkCursor` to fall back to when this one cannot be supported- Returns:
- a new `GdkCursor`, or %NULL if there is no cursor with the given name
-
newFromNameCursor
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_cursor.png) "default" | ![](help_cursor.png) "help" | ![](pointer_cursor.png) "pointer" |
| ![](context_menu_cursor.png) "context-menu" | ![](progress_cursor.png) "progress" | ![](wait_cursor.png) "wait" | ![](cell_cursor.png) "cell" |
| ![](crosshair_cursor.png) "crosshair" | ![](text_cursor.png) "text" | ![](vertical_text_cursor.png) "vertical-text" | ![](alias_cursor.png) "alias" |
| ![](copy_cursor.png) "copy" | ![](no_drop_cursor.png) "no-drop" | ![](move_cursor.png) "move" | ![](not_allowed_cursor.png) "not-allowed" |
| ![](grab_cursor.png) "grab" | ![](grabbing_cursor.png) "grabbing" | ![](all_scroll_cursor.png) "all-scroll" | ![](col_resize_cursor.png) "col-resize" |
| ![](row_resize_cursor.png) "row-resize" | ![](n_resize_cursor.png) "n-resize" | ![](e_resize_cursor.png) "e-resize" | ![](s_resize_cursor.png) "s-resize" |
| ![](w_resize_cursor.png) "w-resize" | ![](ne_resize_cursor.png) "ne-resize" | ![](nw_resize_cursor.png) "nw-resize" | ![](sw_resize_cursor.png) "sw-resize" |
| ![](se_resize_cursor.png) "se-resize" | ![](ew_resize_cursor.png) "ew-resize" | ![](ns_resize_cursor.png) "ns-resize" | ![](nesw_resize_cursor.png) "nesw-resize" |
| ![](nwse_resize_cursor.png) "nwse-resize" | ![](zoom_in_cursor.png) "zoom-in" | ![](zoom_out_cursor.png) "zoom-out" | |- Parameters:
name
- the name of the cursorfallback
- %NULL or the `GdkCursor` to fall back to when this one cannot be supported- Returns:
- a new `GdkCursor`, or %NULL if there is no cursor with the given name
-
newFromTextureCursor
public static Cursor newFromTextureCursor(@Nonnull Texture texture, int hotspot_x, int hotspot_y, @Nullable Cursor fallback) Creates a new cursor from a `GdkTexture`.- Parameters:
texture
- the texture providing the pixel datahotspot_x
- the horizontal offset of the “hotspot” of the cursorhotspot_y
- the vertical offset of the “hotspot” of the cursorfallback
- the `GdkCursor` to fall back to when this one cannot be supported- Returns:
- a new `GdkCursor`
-
getFallback
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.- Returns:
- the fallback of the cursor or %NULL to use the default cursor as fallback
-
getHotspotX
public int getHotspotX()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
[ctor@Gdk.Cursor.new_from_texture].- Returns:
- the horizontal offset of the hotspot or 0 for named cursors
-
getHotspotY
public int getHotspotY()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
[ctor@Gdk.Cursor.new_from_texture].- Returns:
- the vertical offset of the hotspot or 0 for named cursors
-
getName
Returns the name of the cursor.
If the cursor is not a named cursor, %NULL will be returned.- Returns:
- the name of the cursor or %NULL if it is not a named cursor
-
getTexture
Returns the texture for the cursor.
If the cursor is a named cursor, %NULL will be returned.- Returns:
- the texture for cursor or %NULL if it is a named cursor
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-