sdljava.event
Class SDLMouseButtonEvent

java.lang.Object
  extended by sdljava.event.SDLEvent
      extended by sdljava.event.SDLMouseButtonEvent

public class SDLMouseButtonEvent
extends SDLEvent

When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into button, the position of the mouse when this event occured is stored in the x and the y fields. Like SDL_KeyboardEvent, information on whether the event was a press or a release event is stored in both the type and state fields, but this should be obvious.

Mouse wheel events are reported as buttons 4 (up) and 5 (down). Two events are generated i.e. you get a SDL_MOUSEBUTTONDOWN followed by a SDL_MOUSEBUTTONUP event.

Version:
$Id: SDLMouseButtonEvent.java,v 1.12 2005/01/30 05:15:16 ivan_ganza Exp $
Author:
Ivan Z. Ganza

Field Summary
(package private)  SDL_MouseButtonEvent swigMouseButtonEvent
          Reference to the SWIG generated
 
Fields inherited from class sdljava.event.SDLEvent
activeEvent, dummyEvent, exposeEvent, joyAxisEvent, joyBallEvent, joyButtonEvent, joyHatEvent, mouseButtonEvent, mouseMotionEvent, quitEvent, resizeEvent, SDL_ACTIVEEVENT, SDL_ACTIVEEVENTMASK, SDL_ADDEVENT, SDL_APPACTIVE, SDL_APPINPUTFOCUS, SDL_APPMOUSEFOCUS, SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELDOWN, SDL_BUTTON_WHEELUP, SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL, SDL_DISABLE, SDL_ENABLE, SDL_GETEVENT, SDL_IGNORE, SDL_JOYAXISMOTION, SDL_JOYAXISMOTIONMASK, SDL_JOYBALLMOTION, SDL_JOYBALLMOTIONMASK, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONDOWNMASK, SDL_JOYBUTTONUP, SDL_JOYBUTTONUPMASK, SDL_JOYEVENTMASK, SDL_JOYHATMOTION, SDL_JOYHATMOTIONMASK, SDL_KEYDOWN, SDL_KEYDOWNMASK, SDL_KEYUP, SDL_KEYUPMASK, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONDOWNMASK, SDL_MOUSEBUTTONUP, SDL_MOUSEBUTTONUPMASK, SDL_MOUSEEVENTMASK, SDL_MOUSEMOTION, SDL_MOUSEMOTIONMASK, SDL_NOEVENT, SDL_PEEKEVENT, SDL_PRESSED, SDL_QUERY, SDL_QUIT, SDL_QUITMASK, SDL_RELEASED, SDL_SYSWMEVENT, SDL_SYSWMEVENTMASK, SDL_USEREVENT, SDL_VIDEOEXPOSE, SDL_VIDEOEXPOSEMASK, SDL_VIDEORESIZE, SDL_VIDEORESIZEMASK, sdlKeyboardEvent, swigEvent, sysWMEvent, userEvent
 
Constructor Summary
SDLMouseButtonEvent()
           
 
Method Summary
 int getButton()
          The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN)
 SDLPressedState getState()
          Get the state of the button
 SDL_MouseButtonEvent getSwigMouseButtonEvent()
          Gets the value of swigMouseButtonEvent
 int getType()
          The type of the this event
 int getWhich()
          Describe getWhich method here.
 int getX()
          The X co-oridnate
 int getY()
          The Y co-ordinate
 void setSwigMouseButtonEvent(SDL_MouseButtonEvent argSwigMouseButtonEvent)
          Sets the value of swigMouseButtonEvent
 java.lang.String toString()
           
 java.lang.String translateButton(int button)
          Get string represenation of button value
 
Methods inherited from class sdljava.event.SDLEvent
enableKeyRepeat, enableUNICODE, eventState, getAppState, getKeyName, getModState, getMouseState, getRelativeMouseState, joystickEventState, pollEvent, pollEvent, processEvent, pumpEvents, setModState, waitEvent, waitEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

swigMouseButtonEvent

SDL_MouseButtonEvent swigMouseButtonEvent
Reference to the SWIG generated

Constructor Detail

SDLMouseButtonEvent

public SDLMouseButtonEvent()
Method Detail

getSwigMouseButtonEvent

public SDL_MouseButtonEvent getSwigMouseButtonEvent()
Gets the value of swigMouseButtonEvent

Returns:
the value of swigMouseButtonEvent

setSwigMouseButtonEvent

public void setSwigMouseButtonEvent(SDL_MouseButtonEvent argSwigMouseButtonEvent)
Sets the value of swigMouseButtonEvent

Parameters:
argSwigMouseButtonEvent - Value to assign to this.swigMouseButtonEvent

getWhich

public int getWhich()
Describe getWhich method here.

Returns:
a short value

getButton

public int getButton()
The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT, SDL_BUTTON_WHEELUP, SDL_BUTTON_WHEELDOWN)

Returns:
a short value

getState

public SDLPressedState getState()
Get the state of the button

Returns:
the state of the button

getX

public int getX()
The X co-oridnate

Returns:
an int value

getY

public int getY()
The Y co-ordinate

Returns:
an int value

getType

public int getType()
The type of the this event

Specified by:
getType in class SDLEvent
Returns:
The type of event

translateButton

public java.lang.String translateButton(int button)
Get string represenation of button value

Parameters:
button - an int value
Returns:
the string represenation of button value

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a String representation of myself