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:

Ogre::MouseListener Ogre::ActionListener Ogre::EventListener Ogre::EventListener List of all members.

Public Methods

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

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

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

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

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

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

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

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

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

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

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

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


Static Public Methods

MouseListener * add (MouseListener *a, MouseListener *b)
 Adds action-listener-a with action-listener-b and returns the resulting multicast listener. More...

ActionListener * add (ActionListener *a, ActionListener *b)
MouseMotionListener * add (MouseMotionListener *a, MouseMotionListener *b)
ListSelectionListener * add (ListSelectionListener *a, ListSelectionListener *b)
ActionListener * remove (ActionListener *l, ActionListener *oldl)
 Removes the old action-listener from action-listener-l and returns the resulting multicast listener. More...

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

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

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


Static Protected Methods

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

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

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

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


Protected Attributes

EventListener * mA
EventListener * mB

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.


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


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.

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

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

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

MouseListener * Ogre::EventMulticaster::add (  MouseListener *    a,
MouseListener *    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

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

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.

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

bool Ogre::EventMulticaster::isMulticaster (    )  [virtual]
 

Returns whether or not the listener is a multicaster.

Reimplemented from Ogre::EventListener.

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

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.

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.

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.

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.

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.

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

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

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

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

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

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


Member Data Documentation

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

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

Copyright © 2002 by The OGRE Team