Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::MouseEvent Class Reference

An event which indicates that a mouse action occurred in a MouseTarget (e.g. More...

#include <OgreMouseEvent.h>

Inheritance diagram for Ogre::MouseEvent:

Ogre::InputEvent List of all members.

Public Types

enum  { ME_FIRST_EVENT = 500, ME_LAST_EVENT = 510 }
enum  {
  ME_MOUSE_CLICKED = ME_FIRST_EVENT, ME_MOUSE_PRESSED, ME_MOUSE_RELEASED, ME_MOUSE_MOVED,
  ME_MOUSE_ENTERED, ME_MOUSE_EXITED, ME_MOUSE_DRAGGED, ME_MOUSE_DRAGENTERED,
  ME_MOUSE_DRAGEXITED, ME_MOUSE_DRAGMOVED, ME_MOUSE_DRAGDROPPED
}
enum  {
  SHIFT_MASK = 1 << 0, CTRL_MASK = 1 << 1, META_MASK = 1 << 2, ALT_MASK = 1 << 3,
  BUTTON0_MASK = 1 << 4, BUTTON1_MASK = 1 << 5, BUTTON2_MASK = 1 << 6, BUTTON3_MASK = 1 << 7,
  BUTTON_ANY_MASK = 0xF << 4
}

Public Member Functions

 MouseEvent (PositionTarget *source, int id, int whichButton, Real when, int modifiers, Real x, Real y, Real z, int clickCount)
 Constructs a MouseEvent object with the specified source MouseTarget, type, modifiers, coordinates, and click count.

 MouseEvent (PositionTarget *source, int id, int whichButton, Real when, int modifiers, Real x, Real y, Real z, Real relx, Real rely, Real relz, int clickCount)
int getClickCount ()
 Return the number of mouse clicks associated with this event.

Real getX () const
 Returns the horizontal x position of the event relative to the source MouseTarget.

Real getY () const
 Returns the vertical y position of the event relative to the source MouseTarget.

Real getZ () const
 Returns the scrollwheel z position of the event relative to the source MouseTarget.

Real getRelX () const
 get relative X cursor movement

Real getRelY () const
 get relative Y cursor movement

Real getRelZ () const
 get relative Z cursor movement

String paramString () const
 Returns a parameter string identifying this event.

void translatePoint (Real x, Real y)
 Translates the event's coordinates to a new position by adding specified x (horizontal) and y (veritcal) offsets.

int getButtonID () const
 return the ID of the button

void consume ()
 Consumes this event so that it will not be processed in the default manner by the source which originated it.

int getModifiers () const
 Returns the modifiers flag for this event.

Real getWhen () const
 Returns the timestamp of when this event occurred.

bool isAltDown () const
 Returns whether or not the Alt modifier is down on this event.

bool isConsumed () const
 Returns whether or not this event has been consumed.

bool isControlDown () const
 Returns whether or not the Control modifier is down on this event.

bool isMetaDown () const
 Returns whether or not the Meta modifier is down on this event.

bool isShiftDown () const
 Returns whether or not the Shift modifier is down on this event.

bool isEventBetween (int start, int end) const
int getID () const
EventTargetgetSource () const

Protected Attributes

Real mX
 The mouse events x coordinate.

Real mY
 The mouse events y coordinate.

Real mZ
 The mouse events z coordinate.

Real mRelX
Real mRelY
Real mRelZ
int mButtonID
 Which button was pressed.

int mClickCount
 not implemented yet

Real mWhen
 Not implemented yet.

int mModifiers
 The state of the modifier keys at the time the input event was fired.

EventTargetmSource
 The target to process the event.

int mId
 The ID of the event.

bool mConsumed
 whether the event has been consumed


Detailed Description

An event which indicates that a mouse action occurred in a MouseTarget (e.g.

MouseTarget).

Remarks:
This event is used both for mouse events (click, enter, exit) and mouse motion events (moves and drags).
This low-level event is generated by a MouseTarget object for:

A MouseEvent object is passed to every MouseListener object which registered to receive the "interesting" mouse events using MouseTarget's addMouseListener method.

A MouseEvent object is also passed to every MouseMotionListener object which registered to receive mouse motion events using the MouseTarget's addMouseMotionListener method

When a mouse button is clicked, events are generated and sent to the registered MouseListeners, with the button mask set in the modifier field. For example, if the first mouse button is pressed, events are sent in the following order:

MOUSE_PRESSED: BUTTON1_MASK MOUSE_RELEASED: BUTTON1_MASK MOUSE_CLICKED: BUTTON1_MASK
When multiple mouse buttons are pressed, each press, release, and click results in a separate event. The button mask in the modifier field reflects only the button that changed state, not the current state of all buttons.

For example, if the user presses button 1 followed by button 2 and releases them in the same order, the following sequence of events is generated:

MOUSE_PRESSED: BUTTON1_MASK MOUSE_PRESSED: BUTTON2_MASK MOUSE_RELEASED: BUTTON1_MASK MOUSE_CLICKED: BUTTON1_MASK MOUSE_RELEASED: BUTTON2_MASK MOUSE_CLICKED: BUTTON2_MASK
If button2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.

Definition at line 158 of file OgreMouseEvent.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
ME_FIRST_EVENT 
ME_LAST_EVENT 

Definition at line 201 of file OgreMouseEvent.h.

anonymous enum
 

Enumeration values:
ME_MOUSE_CLICKED 
ME_MOUSE_PRESSED 
ME_MOUSE_RELEASED 
ME_MOUSE_MOVED 
ME_MOUSE_ENTERED 
ME_MOUSE_EXITED 
ME_MOUSE_DRAGGED 
ME_MOUSE_DRAGENTERED 
ME_MOUSE_DRAGEXITED 
ME_MOUSE_DRAGMOVED 
ME_MOUSE_DRAGDROPPED 

Definition at line 207 of file OgreMouseEvent.h.

anonymous enum [inherited]
 

Enumeration values:
SHIFT_MASK  This flag indicates that the Shift key was down when the event occurred.

CTRL_MASK  This flag indicates that the Control key was down when the event occurred.

META_MASK  This flag indicates that the Meta key was down when the event occurred.

For mouse events, this flag indicates that the right button was pressed or released.

ALT_MASK  This flag indicates that the Alt key was down when the event occurred.

For mouse events, this flag indicates that the middle mouse button was pressed or released.

BUTTON0_MASK 
BUTTON1_MASK 
BUTTON2_MASK 
BUTTON3_MASK 
BUTTON_ANY_MASK 

Definition at line 93 of file OgreInputEvent.h.


Constructor & Destructor Documentation

Ogre::MouseEvent::MouseEvent PositionTarget source,
int  id,
int  whichButton,
Real  when,
int  modifiers,
Real  x,
Real  y,
Real  z,
int  clickCount
 

Constructs a MouseEvent object with the specified source MouseTarget, type, modifiers, coordinates, and click count.

Parameters:
source the MouseTarget that originated the event
id the integer that identifies the event
when a long int that gives the time the event occurred
modifiers the modifier keys down during event (shift, ctrl, alt, meta)
x the horizontal x coordinate for the mouse location
y the vertical y coordinate for the mouse location
clickCount the number of mouse clicks associated with event

Ogre::MouseEvent::MouseEvent PositionTarget source,
int  id,
int  whichButton,
Real  when,
int  modifiers,
Real  x,
Real  y,
Real  z,
Real  relx,
Real  rely,
Real  relz,
int  clickCount
 


Member Function Documentation

void Ogre::InputEvent::consume  )  [inherited]
 

Consumes this event so that it will not be processed in the default manner by the source which originated it.

int Ogre::MouseEvent::getButtonID  )  const
 

return the ID of the button

int Ogre::MouseEvent::getClickCount  ) 
 

Return the number of mouse clicks associated with this event.

Returns:
integer value for the number of clicks - NOT IMPLEMENTED

int Ogre::InputEvent::getID  )  const [inherited]
 

int Ogre::InputEvent::getModifiers  )  const [inherited]
 

Returns the modifiers flag for this event.

Real Ogre::MouseEvent::getRelX  )  const
 

get relative X cursor movement

Definition at line 277 of file OgreMouseEvent.h.

References Ogre::Real.

Real Ogre::MouseEvent::getRelY  )  const
 

get relative Y cursor movement

Definition at line 280 of file OgreMouseEvent.h.

References Ogre::Real.

Real Ogre::MouseEvent::getRelZ  )  const
 

get relative Z cursor movement

Definition at line 283 of file OgreMouseEvent.h.

References Ogre::Real.

EventTarget* Ogre::InputEvent::getSource  )  const [inherited]
 

Real Ogre::InputEvent::getWhen  )  const [inherited]
 

Returns the timestamp of when this event occurred.

Not implemented yet

Real Ogre::MouseEvent::getX  )  const
 

Returns the horizontal x position of the event relative to the source MouseTarget.

Returns:
x an integer indicating horizontal position relative to the MouseTarget

Real Ogre::MouseEvent::getY  )  const
 

Returns the vertical y position of the event relative to the source MouseTarget.

Returns:
y an integer indicating vertical position relative to the MouseTarget

Real Ogre::MouseEvent::getZ  )  const
 

Returns the scrollwheel z position of the event relative to the source MouseTarget.

Returns:
y an integer indicating scrollwheel position relative to the MouseTarget

bool Ogre::InputEvent::isAltDown  )  const [inherited]
 

Returns whether or not the Alt modifier is down on this event.

bool Ogre::InputEvent::isConsumed  )  const [inherited]
 

Returns whether or not this event has been consumed.

See also:
consume

bool Ogre::InputEvent::isControlDown  )  const [inherited]
 

Returns whether or not the Control modifier is down on this event.

bool Ogre::InputEvent::isEventBetween int  start,
int  end
const [inherited]
 

bool Ogre::InputEvent::isMetaDown  )  const [inherited]
 

Returns whether or not the Meta modifier is down on this event.

bool Ogre::InputEvent::isShiftDown  )  const [inherited]
 

Returns whether or not the Shift modifier is down on this event.

String Ogre::MouseEvent::paramString  )  const
 

Returns a parameter string identifying this event.

This method is useful for event-logging and for debugging.

Returns:
a string identifying the event and its attributes

void Ogre::MouseEvent::translatePoint Real  x,
Real  y
 

Translates the event's coordinates to a new position by adding specified x (horizontal) and y (veritcal) offsets.

Parameters:
x the horizontal x value to add to the current x coordinate position
y the vertical y value to add to the current y coordinate position


Member Data Documentation

int Ogre::MouseEvent::mButtonID [protected]
 

Which button was pressed.

Definition at line 190 of file OgreMouseEvent.h.

int Ogre::MouseEvent::mClickCount [protected]
 

not implemented yet

Definition at line 194 of file OgreMouseEvent.h.

bool Ogre::InputEvent::mConsumed [protected, inherited]
 

whether the event has been consumed

Definition at line 88 of file OgreInputEvent.h.

int Ogre::InputEvent::mId [protected, inherited]
 

The ID of the event.

Definition at line 83 of file OgreInputEvent.h.

int Ogre::InputEvent::mModifiers [protected, inherited]
 

The state of the modifier keys at the time the input event was fired.

Definition at line 72 of file OgreInputEvent.h.

Real Ogre::MouseEvent::mRelX [protected]
 

Definition at line 182 of file OgreMouseEvent.h.

Real Ogre::MouseEvent::mRelY [protected]
 

Definition at line 183 of file OgreMouseEvent.h.

Real Ogre::MouseEvent::mRelZ [protected]
 

Definition at line 184 of file OgreMouseEvent.h.

EventTarget* Ogre::InputEvent::mSource [protected, inherited]
 

The target to process the event.

This is ususally found by the dispatcher

Definition at line 78 of file OgreInputEvent.h.

Real Ogre::InputEvent::mWhen [protected, inherited]
 

Not implemented yet.

Definition at line 67 of file OgreInputEvent.h.

Real Ogre::MouseEvent::mX [protected]
 

The mouse events x coordinate.

The x value is relative to the MouseTarget that fired the event.

Definition at line 166 of file OgreMouseEvent.h.

Real Ogre::MouseEvent::mY [protected]
 

The mouse events y coordinate.

The y value is relative to the MouseTarget that fired the event.

Definition at line 172 of file OgreMouseEvent.h.

Real Ogre::MouseEvent::mZ [protected]
 

The mouse events z coordinate.

The z value is relative to the MouseTarget that fired the event.

Definition at line 179 of file OgreMouseEvent.h.


The documentation for this class was generated from the following file:

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:40:27 2006