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

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 Methods

 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 Methods

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

TargetManagermTargetManager
PositionTargetmFocus
 The current PositionTarget that has focus that is being hosted by this GuiContainer.

PositionTargetmMouseDragSource
 The current PositionTarget, over which, the current drag operation originated.

PositionTargetmKeyCursorOn
 PositionTarget the Keycursor is on.

PositionTargetmTargetLastEntered
 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
 

Definition at line 37 of file OgreEventDispatcher.cpp.

References mDragDropActive, mDragDropOn, mDragging, mEventMask, mFocus, mKeyCursorOn, mMouseDragSource, mMouseX, mMouseY, and mTargetLastEntered.

Ogre::EventDispatcher::~EventDispatcher   [virtual]
 

Definition at line 53 of file OgreEventDispatcher.cpp.


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

Definition at line 58 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::isEventBetween(), processKeyEvent(), and processMouseEvent().

Referenced by Ogre::OverlayManager::processEvent().

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.

Referenced by Ogre::OverlayManager::getMouseX().

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.

Referenced by Ogre::OverlayManager::getMouseY().

bool Ogre::EventDispatcher::processKeyEvent KeyEvent   e [protected]
 

Definition at line 83 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::isConsumed(), mKeyCursorOn, and Ogre::EventTarget::processEvent().

Referenced by dispatchEvent().

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.

Definition at line 93 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::getID(), Ogre::TargetManager::getPositionTargetAt(), Ogre::MouseEvent::getX(), Ogre::MouseEvent::getY(), Ogre::InputEvent::isConsumed(), mDragDropActive, mDragging, mMouseDragSource, mMouseX, mMouseY, mTargetManager, retargetMouseEvent(), trackKeyEnterExit(), and trackMouseEnterExit().

Referenced by dispatchEvent().

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.

Definition at line 206 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::getModifiers(), Ogre::InputEvent::getWhen(), and Ogre::EventTarget::processEvent().

Referenced by trackKeyEnterExit().

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.

Definition at line 181 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::consume(), Ogre::MouseEvent::getButtonID(), Ogre::MouseEvent::getClickCount(), Ogre::InputEvent::getModifiers(), Ogre::InputEvent::getWhen(), Ogre::MouseEvent::getX(), Ogre::MouseEvent::getY(), Ogre::MouseEvent::getZ(), and Ogre::EventTarget::processEvent().

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.

Definition at line 157 of file OgreEventDispatcher.cpp.

References Ogre::InputEvent::consume(), Ogre::MouseEvent::getButtonID(), Ogre::MouseEvent::getClickCount(), Ogre::InputEvent::getID(), Ogre::InputEvent::getModifiers(), Ogre::InputEvent::getWhen(), Ogre::MouseEvent::getX(), Ogre::MouseEvent::getY(), Ogre::MouseEvent::getZ(), and Ogre::EventTarget::processEvent().

Referenced by processMouseEvent(), and trackMouseEnterExit().

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.

Definition at line 77 of file OgreEventDispatcher.cpp.

References mDragDropOn.

Referenced by Ogre::OverlayManager::setDragDrop().

void Ogre::EventDispatcher::trackKeyEnterExit PositionTarget   targetOver,
MouseEvent   e
[protected]
 

Definition at line 259 of file OgreEventDispatcher.cpp.

References Ogre::PositionTarget::isKeyEnabled(), mKeyCursorOn, and retargetKeyEvent().

Referenced by processMouseEvent().

void Ogre::EventDispatcher::trackMouseEnterExit PositionTarget   targetOver,
MouseEvent   e
[protected]
 

Definition at line 224 of file OgreEventDispatcher.cpp.

References mDragging, mMouseDragSource, mTargetLastEntered, and retargetMouseEvent().

Referenced by processMouseEvent().


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.

Referenced by EventDispatcher(), and processMouseEvent().

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.

Referenced by EventDispatcher(), and setDragDrop().

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.

Referenced by EventDispatcher(), processMouseEvent(), and trackMouseEnterExit().

int Ogre::EventDispatcher::mEventMask [protected]
 

Definition at line 114 of file OgreEventDispatcher.h.

Referenced by EventDispatcher().

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.

Referenced by EventDispatcher().

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

PositionTarget the Keycursor is on.

Definition at line 80 of file OgreEventDispatcher.h.

Referenced by EventDispatcher(), processKeyEvent(), and trackKeyEnterExit().

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.

Referenced by EventDispatcher(), processMouseEvent(), and trackMouseEnterExit().

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.

Referenced by EventDispatcher(), and processMouseEvent().

Real Ogre::EventDispatcher::mMouseY [protected]
 

Definition at line 92 of file OgreEventDispatcher.h.

Referenced by EventDispatcher(), and processMouseEvent().

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

The last PositionTarget entered.

Definition at line 85 of file OgreEventDispatcher.h.

Referenced by EventDispatcher(), and trackMouseEnterExit().

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

Definition at line 61 of file OgreEventDispatcher.h.

Referenced by processMouseEvent().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:26:05 2004