Cursor

Instances of this class manage operating system resources that specify the appearance of the on-screen pointer. To create a cursor you specify the device and either a simple cursor style describing one of the standard operating system provided cursors or the image and mask data for the desired appearance. <p> Application code must explicitly invoke the <code>Cursor.dispose()</code> method to release the operating system resources managed by each instance when those instances are no longer required. </p> <dl> <dt><b>Styles:</b></dt> <dd> CURSOR_ARROW, CURSOR_WAIT, CURSOR_CROSS, CURSOR_APPSTARTING, CURSOR_HELP, CURSOR_SIZEALL, CURSOR_SIZENESW, CURSOR_SIZENS, CURSOR_SIZENWSE, CURSOR_SIZEWE, CURSOR_SIZEN, CURSOR_SIZES, CURSOR_SIZEE, CURSOR_SIZEW, CURSOR_SIZENE, CURSOR_SIZESE, CURSOR_SIZESW, CURSOR_SIZENW, CURSOR_UPARROW, CURSOR_IBEAM, CURSOR_NO, CURSOR_HAND </dd> </dl> <p> Note: Only one of the above styles may be specified. </p>

@see <a href="http://www.eclipse.org/swt/snippets/#cursor">Cursor snippets</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

Constructors

this
this(Device device, int style)

Constructs a new cursor given a device and a style constant describing the desired cursor appearance. <p> You must dispose the cursor when it is no longer required. </p>

this
this(Device device, ImageData source, ImageData mask, int hotspotX, int hotspotY)

Constructs a new cursor given a device, image and mask data describing the desired cursor appearance, and the x and y coordinates of the <em>hotspot</em> (that is, the point within the area covered by the cursor which is considered to be where the on-screen pointer is "pointing"). <p> The mask data is allowed to be null, but in this case the source must be an ImageData representing an icon that specifies both color data and mask data. <p> You must dispose the cursor when it is no longer required. </p>

this
this(Device device, ImageData source, int hotspotX, int hotspotY)

Constructs a new cursor given a device, image data describing the desired cursor appearance, and the x and y coordinates of the <em>hotspot</em> (that is, the point within the area covered by the cursor which is considered to be where the on-screen pointer is "pointing"). <p> You must dispose the cursor when it is no longer required. </p>

Members

Functions

isDisposed
bool isDisposed()

Returns <code>true</code> if the cursor has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the cursor. When a cursor has been disposed, it is an error to invoke any other method using the cursor.

opEquals
equals_t opEquals(Object object)

Compares the argument to the receiver, and returns true if they represent the <em>same</em> object using a class specific comparison.

toHash
hash_t toHash()

Returns an integer hash code for the receiver. Any two objects that return <code>true</code> when passed to <code>equals</code> must return the same value for this method.

toString
String toString()

Returns a string containing a concise, human-readable description of the receiver.

Static functions

gtk_new
Cursor gtk_new(Device device, GdkCursor* handle)

Invokes platform specific functionality to allocate a new cursor. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Cursor</code>. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms, and should never be called from application code. </p>

Variables

handle
GdkCursor* handle;

the handle to the OS cursor resource (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>

Inherited Members

From Resource

device
Device device;

the device where this resource was created

dispose
void dispose()

Disposes of the operating system resources associated with this resource. Applications must dispose of all resources which they allocate.

getDevice
Device getDevice()

Returns the <code>Device</code> where this resource was created.

isDisposed
bool isDisposed()

Returns <code>true</code> if the resource has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the resource. When a resource has been disposed, it is an error to invoke any other method using the resource.

Meta