Polycode::EventDispatcher Class Reference

Can dispatch events. More...

Inherits Polycode::EventHandler.

Inherited by Polycode::Core, Polycode::CoreInput, Polycode::CoreServices, Polycode::Scene, Polycode::SceneEntity, Polycode::Screen, Polycode::ScreenEntity, Polycode::ScreenManager, Polycode::Timer, and Polycode::Tween.

List of all members.

Public Member Functions

 EventDispatcher ()
 Default constructor.
void removeAllHandlers ()
 Removes all current event handlers from this dispatcher.
void removeAllHandlersForListener (void *listener)
 Removes all current event handlers from this dispatcher for a specific event listener.
void addEventListener (EventHandler *handler, int eventCode)
 Adds an event listener for a specific event code.
void removeEventListener (EventHandler *handler, int eventCode)
 Removes a listener for a specific handler and event code.
void dispatchEvent (Event *event, int eventCode)
 Dispatches an event to all handlers listening for the event code specified.

Detailed Description

Can dispatch events.

The event dispatcher is base class which allows its subclass to dispatch custom events which EventHandler subclasses can then listen to. EventDispatcher and EventHandler are the two main classes in the Polycode event system. If you are familiar with ActionScript3's event system, you will find this to be very similar, except that it uses integers for event codes for speed, rather than strings.


Member Function Documentation

void Polycode::EventDispatcher::addEventListener ( EventHandler handler,
int  eventCode 
)

Adds an event listener for a specific event code.

Once a listener is registered for a specific event code, that listener will start getting event callbacks into the handleEvent() method.

Parameters:
handler The event handler to add as a listener
eventCode The requested event code to listen to.
See also:
EventHandler
void Polycode::EventDispatcher::dispatchEvent ( Event event,
int  eventCode 
)

Dispatches an event to all handlers listening for the event code specified.

Parameters:
event Event class to dispatch to listeners. You can subclass the Event class to send data in your events.
eventCode The event code to dispatch the event for.
See also:
Event
EventHandler
void Polycode::EventDispatcher::removeAllHandlersForListener ( void *  listener  ) 

Removes all current event handlers from this dispatcher for a specific event listener.

Parameters:
Event listener to remove handlers for.
void Polycode::EventDispatcher::removeEventListener ( EventHandler handler,
int  eventCode 
)

Removes a listener for a specific handler and event code.

Parameters:
handler The event handler to remove as a listener
eventCode The requested event code to remove listener for.
See also:
EventHandler
Generated on Sat Aug 11 18:04:11 2012 for Polycode by  doxygen 1.6.3