ScummVM API documentation
Common::EventDispatcher Class Reference

#include <events.h>

Public Member Functions

void dispatch ()
 
void clearEvents ()
 
void registerMapper (EventMapper *mapper, bool autoFree)
 
void unregisterMapper (EventMapper *mapper)
 
void registerSource (EventSource *source, bool autoFree)
 
void unregisterSource (EventSource *source)
 
void ignoreSources (bool ignore)
 
void registerObserver (EventObserver *obs, uint priority, bool autoFree, bool listenPolls=false)
 
void unregisterObserver (EventObserver *obs)
 

Detailed Description

Dispatch events from various sources to various observers.

EventDispatcher uses a priority-based approach. Observers with higher priority are notified before observers with lower priority. Note that observers might 'eat' events, and thus not all observers might be notified.

Another speciality is the support for an event mapper that will catch events and create new events out of them. This mapper will be processed before an event is sent to the observers.

Member Function Documentation

◆ dispatch()

void Common::EventDispatcher::dispatch ( )

Attempt to catch events from the registered event sources and dispatch them to the observers.

This dispatches all events the sources offer.

◆ clearEvents()

void Common::EventDispatcher::clearEvents ( )

Clear all events currently in the event queue. The cleared events are not dispatched and are simply discarded.

◆ registerMapper()

void Common::EventDispatcher::registerMapper ( EventMapper mapper,
bool  autoFree 
)

Register a new EventMapper with the dispatcher.

◆ unregisterMapper()

void Common::EventDispatcher::unregisterMapper ( EventMapper mapper)

Unregister an EventMapper.

This takes the "autoFree" flag passed to registerSource into account.

◆ registerSource()

void Common::EventDispatcher::registerSource ( EventSource source,
bool  autoFree 
)

Register a new EventSource with the Dispatcher.

◆ unregisterSource()

void Common::EventDispatcher::unregisterSource ( EventSource source)

Unregister an EventSource.

This takes the "autoFree" flag passed to registerSource into account.

◆ ignoreSources()

void Common::EventDispatcher::ignoreSources ( bool  ignore)

Ignore some event sources and don't poll them. This is useful for e.g. the EventRecorder where you don't want the other EventSource instances to interfer with the serialized events.

◆ registerObserver()

void Common::EventDispatcher::registerObserver ( EventObserver obs,
uint  priority,
bool  autoFree,
bool  listenPolls = false 
)

Register a new EventObserver with the Dispatcher.

Parameters
listenPollsIf set, then all pollEvent() calls are passed to the observer. Currently, it is used by keyMapper.

◆ unregisterObserver()

void Common::EventDispatcher::unregisterObserver ( EventObserver obs)

Unregister an EventObserver.

This takes the "autoFree" flag passed to registerObserver into account.


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