Pixel Dust Game Engine  v0.9.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Member Functions | Friends | List of all members
EventEmitter Class Reference

Distributes events to event handlers. More...

Inheritance diagram for EventEmitter:
Inheritance graph
[legend]

Public Member Functions

virtual void addHandler (IEventHandler *inHandler, long inType=all_events)
 add a new handler for some event type, or for all events if no type specified
 
virtual void removeHandler (IEventHandler *inHandler, long inType=all_events)
 Remove a handler for some event type, or for all events if no type specified.
 
virtual void clear (bool doRelease=true)
 remove all handlers
 
virtual void blockEvent (long inEventType)
 temporarily ignore all events of a particular type, just drop them on the floor
 
virtual void unblockEvent (long inEventType)
 stop ignoring events of a particular type, no recovery of previously ignored events
 
 EventEmitter ()
 constructor for new event emitter
 
virtual bool postEvent (long inEventType, void *inEventData, EventEmitter *fromEmitter=0)
 post an event for immediate handling locally, or relay it to the EventManger
 

Friends

class EventManager
 

Detailed Description

Distributes events to event handlers.

Distributes events to event handlers. The EventEmitter expects the game developer to implement IEventHandler subclasses and register them to handle various events they are interested in.

See Also
IEventHandler

The EventEmitter expects the game developer to implement IEventHandler subclasses and register them to handle various events they are interested in.

See Also
IEventHandler
EventManager

Constructor & Destructor Documentation

EventEmitter ( )
inline

constructor for new event emitter

Member Function Documentation

virtual void addHandler ( IEventHandler inHandler,
long  inType = all_events 
)
virtual

add a new handler for some event type, or for all events if no type specified

virtual void blockEvent ( long  inEventType)
virtual

temporarily ignore all events of a particular type, just drop them on the floor

Reimplemented in EventManager.

virtual void clear ( bool  doRelease = true)
virtual

remove all handlers

Reimplemented in EventManager.

virtual bool postEvent ( long  inEventType,
void *  inEventData,
EventEmitter fromEmitter = 0 
)
virtual

post an event for immediate handling locally, or relay it to the EventManger

Reimplemented in EventManager.

removeHandler ( IEventHandler inHandler,
long  inType = all_events 
)
virtual

Remove a handler for some event type, or for all events if no type specified.

Remove a handler for some event type, or for all events if no type specified. If the handler is listed multiple times it will only remove it once. inType == all_events doesn't work quite like you might expect. If you have registered a handler for multiple events, but not with all_events, doing removeHandler(handler, all_events) will do nothing. Basically, all_events is a special event type that matches all event types when considering whether to invoke a handler or not. It is safe to call remove handler from within an event handler's handleEvent() call.

If the handler is listed multiple times it will only remove it once.

Note
inType == all_events doesn't work quite like you might expect. If you have registered a handler for multiple events, but not with all_events, doing removeHandler(handler, all_events) will do nothing. Basically, all_events is a special event type that matches all event types when considering whether to invoke a handler or not.

It is safe to call remove handler from within an event handler's handleEvent() call.

Parameters
inHandlerthe handler that is no longer handling events
inTypethe type of events the handler will no longer handle (optional)
virtual void unblockEvent ( long  inEventType)
virtual

stop ignoring events of a particular type, no recovery of previously ignored events

Reimplemented in EventManager.

Friends And Related Function Documentation

friend class EventManager
friend