de.lessvoid.nifty
Interface NiftyMouse

All Known Implementing Classes:
NiftyMouseImpl

public interface NiftyMouse

This gives you access to the mouse from within Nifty. Its main purpose is to change the shape of the current mouse pointer.

Author:
void

Method Summary
 void enableMouseCursor(String id)
          Enable the given MouseCursor.
 String getCurrentId()
          Get the current mouse cursor id or null if no mouse cursor is set.
 long getNoMouseMovementTime()
          This returns the time in ms that no mouse movement has occurred.
 int getX()
          Get the current mouse position x coordinate.
 int getY()
          Get the current mouse position y coordinate.
 void registerMouseCursor(String id, String filename, int hotspotX, int hotspotY)
          Register, load and prepare the given file for use as a mouse cursor later.
 void resetMouseCursor()
          Reset the mouse cursor back to the native one.
 void setMousePosition(int x, int y)
          Set the mouse position to the given x, y coordinate with (0,0) being the upper left corner of the screen.
 void unregisterAll()
          This unregisters all mouse cursors and disposes all resources that might have been allocated.
 

Method Detail

registerMouseCursor

void registerMouseCursor(String id,
                         String filename,
                         int hotspotX,
                         int hotspotY)
                         throws IOException
Register, load and prepare the given file for use as a mouse cursor later.

Parameters:
id - id of mouse cursor for later reference
filename - the image to load.
hotspotX - the hotspot x coordinate of the cursor image with 0 being left
hotspotY - the hotspot y coordinate of the cursor image with 0 being top
Throws:
IOException

getCurrentId

String getCurrentId()
Get the current mouse cursor id or null if no mouse cursor is set.

Returns:
mouse cursor id or null

unregisterAll

void unregisterAll()
This unregisters all mouse cursors and disposes all resources that might have been allocated.


resetMouseCursor

void resetMouseCursor()
Reset the mouse cursor back to the native one. This disables a currently enabled custom mouse cursor.


enableMouseCursor

void enableMouseCursor(String id)
Enable the given MouseCursor.

Parameters:
id - the cursor id to enable

setMousePosition

void setMousePosition(int x,
                      int y)
Set the mouse position to the given x, y coordinate with (0,0) being the upper left corner of the screen.

Parameters:
x - x coordinate
y - y coordinage

getX

int getX()
Get the current mouse position x coordinate.

Returns:
x mouse x coordinate

getY

int getY()
Get the current mouse position y coordinate.

Returns:
y mouse y coordinate

getNoMouseMovementTime

long getNoMouseMovementTime()
This returns the time in ms that no mouse movement has occurred.

Returns:
the time in ms between now and the last time the mouse have been moved


Copyright © 2011. All Rights Reserved.