org.eclipse.swt.graphics
Class Cursor
java.lang.Object
|
+--org.eclipse.swt.graphics.Cursor
- public final class Cursor
- extends Object
Safe: 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.
Application code must explicitly invoke the Cursor.dispose()
method to release the operating system resources managed by each instance
when those instances are no longer required.
- Styles:
-
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
Note: Only one of the above styles may be specified.
Field Summary
(package private) Device
device
the device where this cursor was created
(package private) static byte[]
HAND_SOURCE
data used to create a HAND cursor.
int
handle
Suppressed: the handle to the OS cursor resource
(Warning: This field is platform dependent)
Constructor Summary
(package private)
Cursor()
Prevents uninitialized instances from being created outside the package.
Cursor(Device device,
ImageData source,
ImageData mask,
int hotspotX,
int hotspotY)
Enabled:
Constructs a new cursor given a device, image and mask
data describing the desired cursor appearance, and the x
and y co-ordinates of the
hotspot (that is, the point
within the area covered by the cursor which is considered
to be where the on-screen pointer is "pointing").
Cursor(Device device,
int style)
Enabled:
Constructs a new cursor given a device and a style
constant describing the desired cursor appearance.
Method Summary
void
dispose()
Enabled: Disposes of the operating system resources associated with
the cursor.
boolean
equals(Object object)
Suppressed: Compares the argument to the receiver, and returns true
if they represent the
same object using a class
specific comparison.
int
hashCode()
Suppressed: Returns an integer hash code for the receiver.
boolean
isDisposed()
Enabled: Returns
true if the cursor has been disposed,
and
false otherwise.
String
toString()
Suppressed: Returns a string containing a concise, human-readable
description of the receiver.
static Cursor
win32_new(Device device,
int handle)
Suppressed:
Invokes platform specific functionality to allocate a new cursor.
Methods inherited from class java.lang.Object
Field Detail
handle
public int handle
- Suppressed: the handle to the OS cursor resource
(Warning: This field is platform dependent)
device
Device device
- the device where this cursor was created
HAND_SOURCE
static final byte[] HAND_SOURCE
- data used to create a HAND cursor.
HAND_MASK
static final byte[] HAND_MASK
Constructor Detail
Cursor
Cursor()
- Prevents uninitialized instances from being created outside the package.
Cursor
public Cursor(Device device,
int style)
- Enabled:
Constructs a new cursor given a device and a style
constant describing the desired cursor appearance.
You must dispose the cursor when it is no longer required.
- Parameters:
device - the device on which to allocate the cursorstyle - the style of cursor to allocate- See Also:
SWT.CURSOR_ARROW,
SWT.CURSOR_WAIT,
SWT.CURSOR_CROSS,
SWT.CURSOR_APPSTARTING,
SWT.CURSOR_HELP,
SWT.CURSOR_SIZEALL,
SWT.CURSOR_SIZENESW,
SWT.CURSOR_SIZENS,
SWT.CURSOR_SIZENWSE,
SWT.CURSOR_SIZEWE,
SWT.CURSOR_SIZEN,
SWT.CURSOR_SIZES,
SWT.CURSOR_SIZEE,
SWT.CURSOR_SIZEW,
SWT.CURSOR_SIZENE,
SWT.CURSOR_SIZESE,
SWT.CURSOR_SIZESW,
SWT.CURSOR_SIZENW,
SWT.CURSOR_UPARROW,
SWT.CURSOR_IBEAM,
SWT.CURSOR_NO,
SWT.CURSOR_HAND
Cursor
public Cursor(Device device,
ImageData source,
ImageData mask,
int hotspotX,
int hotspotY)
- Enabled:
Constructs a new cursor given a device, image and mask
data describing the desired cursor appearance, and the x
and y co-ordinates of the hotspot (that is, the point
within the area covered by the cursor which is considered
to be where the on-screen pointer is "pointing").
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.
You must dispose the cursor when it is no longer required.
- Parameters:
device - the device on which to allocate the cursorsource - the color data for the cursormask - the mask data for the cursor (or null)hotspotX - the x coordinate of the cursor's hotspothotspotY - the y coordinate of the cursor's hotspot
Method Detail
dispose
public void dispose()
- Enabled: Disposes of the operating system resources associated with
the cursor. Applications must dispose of all cursors which
they allocate.
-
equals
public boolean equals(Object object)
- Suppressed: Compares the argument to the receiver, and returns true
if they represent the same object using a class
specific comparison.
- Overrides:
equals in class Object
- Parameters:
object - the object to compare with this object
- Returns:
true if the object is the same as this object and false otherwise- See Also:
hashCode()
hashCode
public int hashCode()
- Suppressed: Returns an integer hash code for the receiver. Any two
objects which return
true when passed to
equals must return the same value for this
method.
- Overrides:
hashCode in class Object
- Returns:
- the receiver's hash
- See Also:
equals(java.lang.Object)
isDisposed
public boolean isDisposed()
- Enabled: Returns
true if the cursor has been disposed,
and false otherwise.
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.
- Returns:
true when the cursor is disposed and false otherwise
toString
public String toString()
- Suppressed: Returns a string containing a concise, human-readable
description of the receiver.
- Overrides:
toString in class Object
- Returns:
- a string representation of the receiver
win32_new
public static Cursor win32_new(Device device,
int handle)
- Suppressed:
Invokes platform specific functionality to allocate a new cursor.
IMPORTANT: This method is not part of the public
API for Cursor. 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.
- Parameters:
device - the device on which to allocate the colorhandle - the handle for the cursor