Class SwtMouseManager

java.lang.Object
com.ardor3d.input.swt.SwtMouseManager
All Implemented Interfaces:
MouseManager

public class SwtMouseManager extends Object implements 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 Details

    • SwtMouseManager

      public SwtMouseManager(org.eclipse.swt.widgets.Control control)
  • Method Details

    • setCursor

      public void setCursor(MouseCursor cursor)
      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 interface MouseManager
      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 calling MouseManager.isSetPositionSupported().
      Specified by:
      setPosition in interface MouseManager
      Parameters:
      x - x position within the current canvas, 0 = left
      y - y position within the current canvas, 0 = bottom
    • setGrabbed

      public void setGrabbed(GrabbedState grabbedState)
      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 calling MouseManager.isSetGrabbedSupported().
      Specified by:
      setGrabbed in interface MouseManager
      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 the MouseManager.setPosition(int, int) method. Note that if this method returns false, a runtime exception may be thrown by the MouseManager.setPosition(int, int) method.
      Specified by:
      isSetPositionSupported in interface MouseManager
      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 the MouseManager.setGrabbed(GrabbedState) method. Note that if this method returns false, a runtime exception may be thrown by the MouseManager.setGrabbed(GrabbedState) method.
      Specified by:
      isSetGrabbedSupported in interface MouseManager
      Returns:
      true if the mouse's grabbed state can be changed by this implementation, false otherwise.
    • getGrabbed

      public GrabbedState getGrabbed()
      Specified by:
      getGrabbed in interface MouseManager
      Returns:
      current grabbed state of the mouse.