Package com.ardor3d.input.swt
Class SwtMouseManager
java.lang.Object
com.ardor3d.input.swt.SwtMouseManager
- All Implemented Interfaces:
MouseManager
Implementation of the
MouseManager
interface for use with SWT. This implementation supports
the optional setGrabbed(com.ardor3d.input.GrabbedState)
and setPosition(int, int)
methods. The
constructor takes an SWT Control
instance, for which the cursor is set. In a
multi-canvas application, each canvas can have its own SwtMouseManager instance, or it is possible to use a single
one for the SWT container that includes the control.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates to clients whether or not it is safe to call theMouseManager.setGrabbed(GrabbedState)
method.boolean
Indicates to clients whether or not it is safe to call theMouseManager.setPosition(int, int)
method.void
setCursor
(MouseCursor cursor) Change the mouse cursor presently used.void
setGrabbed
(GrabbedState grabbedState) Optional method for changing the mouse to behave as if it is grabbed or not.void
setPosition
(int x, int y) Optional method for changing the mouse cursor position to the specified coordinates.
-
Constructor Details
-
SwtMouseManager
public SwtMouseManager(org.eclipse.swt.widgets.Control control)
-
-
Method Details
-
setCursor
Description copied from interface:MouseManager
Change the mouse cursor presently used. This is a mandatory operation that all implementing classes must support.- Specified by:
setCursor
in interfaceMouseManager
- Parameters:
cursor
- the cursor to use
-
setPosition
public void setPosition(int x, int y) Description copied from interface:MouseManager
Optional method for changing the mouse cursor position to the specified coordinates. A client can confirm whether or not this method is support by callingMouseManager.isSetPositionSupported()
.- Specified by:
setPosition
in interfaceMouseManager
- Parameters:
x
- x position within the current canvas, 0 = lefty
- y position within the current canvas, 0 = bottom
-
setGrabbed
Description copied from interface:MouseManager
Optional method for changing the mouse to behave as if it is grabbed or not. A client can confirm whether or not this method is support by callingMouseManager.isSetGrabbedSupported()
.- Specified by:
setGrabbed
in interfaceMouseManager
- Parameters:
grabbedState
- the value determines which grabbed state is selected
-
isSetPositionSupported
public boolean isSetPositionSupported()Description copied from interface:MouseManager
Indicates to clients whether or not it is safe to call theMouseManager.setPosition(int, int)
method. Note that if this method returns false, a runtime exception may be thrown by theMouseManager.setPosition(int, int)
method.- Specified by:
isSetPositionSupported
in interfaceMouseManager
- Returns:
- true if the mouse's position can be changed by this implementation, false otherwise.
-
isSetGrabbedSupported
public boolean isSetGrabbedSupported()Description copied from interface:MouseManager
Indicates to clients whether or not it is safe to call theMouseManager.setGrabbed(GrabbedState)
method. Note that if this method returns false, a runtime exception may be thrown by theMouseManager.setGrabbed(GrabbedState)
method.- Specified by:
isSetGrabbedSupported
in interfaceMouseManager
- Returns:
- true if the mouse's grabbed state can be changed by this implementation, false otherwise.
-
getGrabbed
- Specified by:
getGrabbed
in interfaceMouseManager
- Returns:
- current grabbed state of the mouse.
-