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

Ogre::EventMulticaster Class Reference

This class implements efficient and thread-safe multi-cast event dispatching. More...

#include <OgreEventMulticaster.h>

Inheritance diagram for Ogre::EventMulticaster:

Inheritance graph
[legend]
Collaboration diagram for Ogre::EventMulticaster:

Collaboration graph
[legend]
List of all members.

Public Methods

 EventMulticaster (EventListener *a, EventListener *b)
 Creates an event multicaster instance which chains listener-a with listener-b.

void listSelected (ListSelectionEvent *e)
 Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.

void actionPerformed (ActionEvent *e)
 Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.

void scrollPerformed (ScrollEvent *e)
 Handles the scrollPerformed event by invoking the scrollPerformed methods on listener-a and listener-b.

void keyPressed (KeyEvent *e)
 Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.

void keyReleased (KeyEvent *e)
 Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.

void keyClicked (KeyEvent *e)
 Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.

void mouseClicked (MouseEvent *e)
 Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.

void mouseDragged (MouseEvent *e)
 Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.

void mouseEntered (MouseEvent *e)
 Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.

void mouseExited (MouseEvent *e)
 Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.

void mouseMoved (MouseEvent *e)
 Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.

void mousePressed (MouseEvent *e)
 Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.

void mouseReleased (MouseEvent *e)
 Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.

EventListenerremove (EventListener *oldl, bool &deleteSelf)
 Removes a listener from this multicaster and returns the resulting multicast listener.

virtual bool isMulticaster () const
 Returns whether or not the listener is a multicaster.

virtual void mouseDragEntered (MouseEvent *e)
virtual void mouseDragExited (MouseEvent *e)
virtual void mouseDragDropped (MouseEvent *e)

Static Public Methods

KeyListeneradd (KeyListener *a, KeyListener *b)
 Adds action-listener-a with action-listener-b and returns the resulting multicast listener.

MouseListeneradd (MouseListener *a, MouseListener *b)
ActionListeneradd (ActionListener *a, ActionListener *b)
MouseMotionListeneradd (MouseMotionListener *a, MouseMotionListener *b)
ListSelectionListeneradd (ListSelectionListener *a, ListSelectionListener *b)
ScrollListeneradd (ScrollListener *a, ScrollListener *b)
ActionListenerremove (ActionListener *l, ActionListener *oldl)
 Removes the old action-listener from action-listener-l and returns the resulting multicast listener.

ScrollListenerremove (ScrollListener *l, ScrollListener *oldl)
 Removes the old scroll-listener from scroll-listener-l and returns the resulting multicast listener.

ListSelectionListenerremove (ListSelectionListener *l, ListSelectionListener *oldl)
 Removes the old listSlection-listener from action-listener-l and returns the resulting multicast listener.

KeyListenerremove (KeyListener *l, KeyListener *oldl)
 Removes the old key-listener from key-listener-l and returns the resulting multicast listener.

MouseMotionListenerremove (MouseMotionListener *l, MouseMotionListener *oldl)
 Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.

MouseListenerremove (MouseListener *l, MouseListener *oldl)
 Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.


Static Protected Methods

EventListenerremoveInternal (EventListener *l, EventListener *oldl)
 Returns the resulting multicast listener after removing the old listener from listener-l.

EventListeneraddInternal (EventListener *a, EventListener *b)
 Returns the resulting multicast listener from adding listener-a and listener-b together.

EventListenerconvertMultiToListener (EventMulticaster *m)
 Converts a EventMulticaster to the base parent class EventListener.

EventMulticaster * convertListenerToMulti (EventListener *l)
 Converts a EventListener to the class EventMulticaster .


Protected Attributes

EventListenermA
EventListenermB

Detailed Description

This class implements efficient and thread-safe multi-cast event dispatching.

Remarks:
It manages an immutable structure consisting of a binary chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation.

Definition at line 81 of file OgreEventMulticaster.h.


Constructor & Destructor Documentation

Ogre::EventMulticaster::EventMulticaster EventListener   a,
EventListener   b
 

Creates an event multicaster instance which chains listener-a with listener-b.

Input parameters a and b should not be null, though implementations may vary in choosing whether or not to throw NullPointerException in that case.

Parameters:
a  listener-a
b  listener-b

Definition at line 33 of file OgreEventMulticaster.cpp.

References mA, and mB.

Referenced by addInternal().


Member Function Documentation

void Ogre::EventMulticaster::actionPerformed ActionEvent   e [virtual]
 

Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.

Parameters:
e  the action event

Implements Ogre::ActionListener.

Definition at line 79 of file OgreEventMulticaster.cpp.

ScrollListener * Ogre::EventMulticaster::add ScrollListener   a,
ScrollListener   b
[static]
 

Definition at line 56 of file OgreEventMulticaster.cpp.

References addInternal().

ListSelectionListener * Ogre::EventMulticaster::add ListSelectionListener   a,
ListSelectionListener   b
[static]
 

Definition at line 61 of file OgreEventMulticaster.cpp.

References addInternal().

MouseMotionListener * Ogre::EventMulticaster::add MouseMotionListener   a,
MouseMotionListener   b
[static]
 

Definition at line 46 of file OgreEventMulticaster.cpp.

References addInternal().

ActionListener * Ogre::EventMulticaster::add ActionListener   a,
ActionListener   b
[static]
 

Definition at line 51 of file OgreEventMulticaster.cpp.

References addInternal().

MouseListener * Ogre::EventMulticaster::add MouseListener   a,
MouseListener   b
[static]
 

Definition at line 38 of file OgreEventMulticaster.cpp.

References addInternal().

KeyListener * Ogre::EventMulticaster::add KeyListener   a,
KeyListener   b
[static]
 

Adds action-listener-a with action-listener-b and returns the resulting multicast listener.

Parameters:
a  action-listener-a
b  action-listener-b

Definition at line 42 of file OgreEventMulticaster.cpp.

References addInternal().

EventListener * Ogre::EventMulticaster::addInternal EventListener   a,
EventListener   b
[static, protected]
 

Returns the resulting multicast listener from adding listener-a and listener-b together.

If listener-a is null, it returns listener-b; If listener-b is null, it returns listener-a If neither are null, then it creates and returns a new EventMulticaster instance which chains a with b.

Parameters:
a  event listener-a
b  event listener-b

Definition at line 66 of file OgreEventMulticaster.cpp.

References convertMultiToListener(), and EventMulticaster().

Referenced by add(), and remove().

EventMulticaster * Ogre::EventMulticaster::convertListenerToMulti EventListener   l [static, protected]
 

Converts a EventListener to the class EventMulticaster .

Since multicaster has many parent listeners (Action,Mouse etc), it has multiple EventListeners, so choose 1 (Action arbitrary) to reach the EventListener. This method throws an exception if the listener isn't a multicaster.

Definition at line 233 of file OgreEventMulticaster.cpp.

References Except, and Ogre::EventListener::isMulticaster().

Referenced by removeInternal().

EventListener * Ogre::EventMulticaster::convertMultiToListener EventMulticaster *    m [static, protected]
 

Converts a EventMulticaster to the base parent class EventListener.

Since multicaster has many parent listeners (Action,Mouse etc), it has multiple EventListeners, so choose 1 (Action arbitrary) to reach the EventListener

Definition at line 222 of file OgreEventMulticaster.cpp.

Referenced by addInternal(), and remove().

bool Ogre::EventMulticaster::isMulticaster   const [virtual]
 

Returns whether or not the listener is a multicaster.

Reimplemented from Ogre::EventListener.

Definition at line 216 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::keyClicked KeyEvent   e
 

Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.

Parameters:
e  the key event

Definition at line 97 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::keyPressed KeyEvent   e
 

Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.

Parameters:
e  the key event

Definition at line 126 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::keyReleased KeyEvent   e
 

Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.

Parameters:
e  the key event

Definition at line 132 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::listSelected ListSelectionEvent   e
 

Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.

Parameters:
e  the action event

Definition at line 73 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::mouseClicked MouseEvent   e [virtual]
 

Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.

Parameters:
e  the mouse event

Implements Ogre::MouseListener.

Definition at line 91 of file OgreEventMulticaster.cpp.

virtual void Ogre::MouseListener::mouseDragDropped MouseEvent   e [virtual, inherited]
 

Definition at line 104 of file OgreEventListeners.h.

Referenced by Ogre::MouseTarget::processMouseEvent().

virtual void Ogre::MouseListener::mouseDragEntered MouseEvent   e [virtual, inherited]
 

Definition at line 102 of file OgreEventListeners.h.

Referenced by Ogre::MouseTarget::processMouseEvent().

virtual void Ogre::MouseListener::mouseDragExited MouseEvent   e [virtual, inherited]
 

Definition at line 103 of file OgreEventListeners.h.

Referenced by Ogre::MouseTarget::processMouseEvent().

void Ogre::EventMulticaster::mouseDragged MouseEvent   e
 

Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.

Parameters:
e  the mouse event

void Ogre::EventMulticaster::mouseEntered MouseEvent   e [virtual]
 

Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.

Parameters:
e  the mouse event

Implements Ogre::MouseListener.

Definition at line 103 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::mouseExited MouseEvent   e [virtual]
 

Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.

Parameters:
e  the mouse event

Implements Ogre::MouseListener.

Definition at line 109 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::mouseMoved MouseEvent   e
 

Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.

Parameters:
e  the mouse event

void Ogre::EventMulticaster::mousePressed MouseEvent   e [virtual]
 

Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.

Parameters:
e  the mouse event

Implements Ogre::MouseListener.

Definition at line 115 of file OgreEventMulticaster.cpp.

void Ogre::EventMulticaster::mouseReleased MouseEvent   e [virtual]
 

Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.

Parameters:
e  the mouse event

Implements Ogre::MouseListener.

Definition at line 121 of file OgreEventMulticaster.cpp.

EventListener * Ogre::EventMulticaster::remove EventListener   oldl,
bool &    deleteSelf
 

Removes a listener from this multicaster and returns the resulting multicast listener.

Parameters:
oldl  the listener to be removed

Definition at line 168 of file OgreEventMulticaster.cpp.

References addInternal(), convertMultiToListener(), mA, mB, and removeInternal().

MouseListener * Ogre::EventMulticaster::remove MouseListener   l,
MouseListener   oldl
[static]
 

Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.

Parameters:
l  mouse-listener-l
oldl  the mouse-listener being removed

Definition at line 154 of file OgreEventMulticaster.cpp.

References removeInternal().

MouseMotionListener * Ogre::EventMulticaster::remove MouseMotionListener   l,
MouseMotionListener   oldl
[static]
 

Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.

Parameters:
l  mouse-listener-l
oldl  the mouse-listener being removed

Definition at line 163 of file OgreEventMulticaster.cpp.

References removeInternal().

KeyListener * Ogre::EventMulticaster::remove KeyListener   l,
KeyListener   oldl
[static]
 

Removes the old key-listener from key-listener-l and returns the resulting multicast listener.

Parameters:
l  key-listener-l
oldl  the key-listener being removed

Definition at line 158 of file OgreEventMulticaster.cpp.

References removeInternal().

ListSelectionListener * Ogre::EventMulticaster::remove ListSelectionListener   l,
ListSelectionListener   oldl
[static]
 

Removes the old listSlection-listener from action-listener-l and returns the resulting multicast listener.

Parameters:
l  action-listener-l
oldl  the action-listener being removed

Definition at line 138 of file OgreEventMulticaster.cpp.

References removeInternal().

ScrollListener * Ogre::EventMulticaster::remove ScrollListener   l,
ScrollListener   oldl
[static]
 

Removes the old scroll-listener from scroll-listener-l and returns the resulting multicast listener.

Parameters:
l  scroll-listener-l
oldl  the scroll-listener being removed

Definition at line 149 of file OgreEventMulticaster.cpp.

References removeInternal().

ActionListener * Ogre::EventMulticaster::remove ActionListener   l,
ActionListener   oldl
[static]
 

Removes the old action-listener from action-listener-l and returns the resulting multicast listener.

Parameters:
l  action-listener-l
oldl  the action-listener being removed

Definition at line 144 of file OgreEventMulticaster.cpp.

References removeInternal().

Referenced by removeInternal().

EventListener * Ogre::EventMulticaster::removeInternal EventListener   l,
EventListener   oldl
[static, protected]
 

Returns the resulting multicast listener after removing the old listener from listener-l.

If listener-l equals the old listener OR listener-l is null, returns null. Else if listener-l is an instance of EventMulticaster, then it removes the old listener from it. Else, returns listener l.

Parameters:
l  the listener being removed from
oldl  the listener being removed

Definition at line 191 of file OgreEventMulticaster.cpp.

References convertListenerToMulti(), Ogre::EventListener::isMulticaster(), and remove().

Referenced by remove().

void Ogre::EventMulticaster::scrollPerformed ScrollEvent   e
 

Handles the scrollPerformed event by invoking the scrollPerformed methods on listener-a and listener-b.

Parameters:
e  the action event

Definition at line 85 of file OgreEventMulticaster.cpp.


Member Data Documentation

EventListener* Ogre::EventMulticaster::mA [protected]
 

Definition at line 276 of file OgreEventMulticaster.h.

Referenced by EventMulticaster(), and remove().

EventListener* Ogre::EventMulticaster::mB [protected]
 

Definition at line 277 of file OgreEventMulticaster.h.

Referenced by EventMulticaster(), and remove().


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

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:17:21 2004