# Ogre::EventDispatcher Class Reference

Handles the Dispatching of events to a EventTarget (mainly a PositionTarget for mouse moving). More...

`#include <OgreEventDispatcher.h>`

List of all members.

## Public Member Functions

| EventDispatcher (TargetManager *pTargetManager)
virtual | ~EventDispatcher ()
bool | dispatchEvent (InputEvent *e)
| Dispatches an event to a PositionTarget if necessary, and returns whether or not the event was forwarded to a sub-PositionTarget.
void | setDragDrop (bool dragDropOn)
| Enables or disables the mouse drag/drop events on the next mouse drag sequence.
Real | getMouseX () const
| Returns the X screen coordinate of the current mouse position.
Real | getMouseY () const
| Returns the Y screen coordinate of the current mouse position.

## Protected Member Functions

bool | processKeyEvent (KeyEvent *e)
bool | processMouseEvent (MouseEvent *e)
| This method attempts to distribute a mouse event to a lightweight PositionTarget.
void | retargetMouseEvent (PositionTarget *target, MouseEvent *e)
| Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent.
void | retargetMouseEvent (PositionTarget *target, int id, MouseEvent *e, bool consume=false)
| Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent.
void | retargetKeyEvent (PositionTarget *target, int id, MouseEvent *e)
| Sends a key event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent.
void | trackMouseEnterExit (PositionTarget *targetOver, MouseEvent *e)
void | trackKeyEnterExit (PositionTarget *targetOver, MouseEvent *e)

## Protected Attributes

TargetManager * | mTargetManager
PositionTarget * | mFocus
| The current PositionTarget that has focus that is being hosted by this GuiContainer.
PositionTarget * | mMouseDragSource
| The current PositionTarget, over which, the current drag operation originated.
PositionTarget * | mKeyCursorOn
| PositionTarget the Keycursor is on.
PositionTarget * | mTargetLastEntered
| The last PositionTarget entered.
Real | mMouseX
| Screen coordinates of the last (or current) mouse event.
Real | mMouseY
bool | mDragging
| Indicates if the mouse pointer is currently being dragged...
bool | mDragDropOn
| Indicates whether or not Drag/Drop event will be generated during the next drag sequence.
bool | mDragDropActive
| Indicates whether or not Drag/Drop events are currently being generated.
int | mEventMask

## Detailed Description

Handles the Dispatching of events to a EventTarget (mainly a PositionTarget for mouse moving).

Remarks:
  A EventDispatcher is needed for each TargetManager. ie 1 dispatcher for the OverlayManager, for managing the 2D GUI components, and another EventDispatcher for a SceneManager managing the 3D objects.(NOTE currently the SceneManager isn't a TargetManager.. this is a TODO).

Definition at line 58 of file OgreEventDispatcher.h.

## Constructor & Destructor Documentation

Ogre::EventDispatcher::EventDispatcher | ( | TargetManager * | pTargetManager | ) |

virtual Ogre::EventDispatcher::~EventDispatcher | ( |  | ) | `[virtual]`

## Member Function Documentation

bool Ogre::EventDispatcher::dispatchEvent | ( | InputEvent * | e | ) |

Dispatches an event to a PositionTarget if necessary, and returns whether or not the event was forwarded to a sub-PositionTarget.

Parameters:

  e | the event

Real Ogre::EventDispatcher::getMouseX | ( |  | ) | const

| Returns the X screen coordinate of the current mouse position. Definition at line 202 of file OgreEventDispatcher.h. References Ogre::Real.

Real Ogre::EventDispatcher::getMouseY | ( |  | ) | const

| Returns the Y screen coordinate of the current mouse position. Definition at line 206 of file OgreEventDispatcher.h. References Ogre::Real.

bool Ogre::EventDispatcher::processKeyEvent | ( | KeyEvent * | e | ) | `[protected]`

bool Ogre::EventDispatcher::processMouseEvent | ( | MouseEvent * | e | ) | `[protected]`

| This method attempts to distribute a mouse event to a lightweight PositionTarget. It tries to avoid doing any unnecessary probes down into the PositionTarget tree to minimize the overhead of determining where to route the event, since mouse movement events tend to come in large and frequent amounts.

void Ogre::EventDispatcher::retargetKeyEvent | ( | PositionTarget * | target,
|  | int | id,
|  | MouseEvent * | e
| ) | `[protected]`

| Sends a key event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent.

void Ogre::EventDispatcher::retargetMouseEvent | ( | PositionTarget * | target,
|  | int | id,
|  | MouseEvent * | e,
|  | bool | consume = false
| ) | `[protected]`

| Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent. If the mouse event target is still in the PositionTarget tree, the coordinates of the event are translated to those of the target. If the target has been removed, we don't bother to send the message.

void Ogre::EventDispatcher::retargetMouseEvent | ( | PositionTarget * | target,
|  | MouseEvent * | e
| ) | `[protected]`

| Sends a mouse event to the current mouse event recipient using the given event (sent to the windowed host) as a srcEvent. If the mouse event target is still in the PositionTarget tree, the coordinates of the event are translated to those of the target. If the target has been removed, we don't bother to send the message.

void Ogre::EventDispatcher::setDragDrop | ( | bool | dragDropOn | ) |

Enables or disables the mouse drag/drop events on the next mouse drag sequence.

It has no effect on the current drag sequence, if any. Drag/drop events are typically enabled when the mouse enters the area of a particular PositionTarget.

Parameters:

  dragDropOn | Indicates whether or not the drag/drop events should be enabled.

void Ogre::EventDispatcher::trackKeyEnterExit | ( | PositionTarget * | targetOver,
|  | MouseEvent * | e
| ) | `[protected]`

void Ogre::EventDispatcher::trackMouseEnterExit | ( | PositionTarget * | targetOver,
|  | MouseEvent * | e
| ) | `[protected]`

## Member Data Documentation

bool Ogre::EventDispatcher::mDragDropActive `[protected]`

| Indicates whether or not Drag/Drop events are currently being generated. Definition at line 112 of file OgreEventDispatcher.h.

bool Ogre::EventDispatcher::mDragDropOn `[protected]`

Indicates whether or not Drag/Drop event will be generated during the next drag sequence.

See also:
  setDragDrop

Definition at line 107 of file OgreEventDispatcher.h.

bool Ogre::EventDispatcher::mDragging `[protected]`

| Indicates if the mouse pointer is currently being dragged... this is needed because we may receive exit events while dragging and need to keep the current mouse target in this case. Definition at line 99 of file OgreEventDispatcher.h.

int Ogre::EventDispatcher::mEventMask `[protected]`

| Definition at line 114 of file OgreEventDispatcher.h.

PositionTarget* Ogre::EventDispatcher::mFocus `[protected]`

| The current PositionTarget that has focus that is being hosted by this GuiContainer. If this is a null reference then there is currently no focus on a PositionTarget being hosted by this GuiContainer Definition at line 69 of file OgreEventDispatcher.h.

PositionTarget* Ogre::EventDispatcher::mKeyCursorOn `[protected]`

| PositionTarget the Keycursor is on. Definition at line 80 of file OgreEventDispatcher.h.

PositionTarget* Ogre::EventDispatcher::mMouseDragSource `[protected]`

| The current PositionTarget, over which, the current drag operation originated. Only valid when mDragging is true. May be null. Definition at line 75 of file OgreEventDispatcher.h.

Real Ogre::EventDispatcher::mMouseX `[protected]`

| Screen coordinates of the last (or current) mouse event. Will eventually be useful for managing mouse cursors. Definition at line 91 of file OgreEventDispatcher.h.

Real Ogre::EventDispatcher::mMouseY `[protected]`

| Definition at line 92 of file OgreEventDispatcher.h.

PositionTarget* Ogre::EventDispatcher::mTargetLastEntered `[protected]`

| The last PositionTarget entered. Definition at line 85 of file OgreEventDispatcher.h.

TargetManager* Ogre::EventDispatcher::mTargetManager `[protected]`

| Definition at line 61 of file OgreEventDispatcher.h.

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

- OgreEventDispatcher.h

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:00:25 2006