Garmin Fleet Management Controller  2.19.0
Event Class Reference

Event dispatcher. More...

#include <Event.h>

Static Public Member Functions

static void addListener (EventListener *aListener)
 Adds a window that is interested in receiving events. More...
 
static void post (EventId aEventId, uint32 aEventData=0, void *aEventDataPtr=NULL, BOOL handleNow=FALSE)
 Posts a message to all windows that have registered to get events. More...
 
static void removeListener (EventListener *aListener)
 Remove a target window from the interested object list. More...
 

Static Private Attributes

static std::list< EventListener * > mListeners
 List of listeners that should receive event notifications. More...
 

Detailed Description

Event dispatcher.

The Event class manages event posting between objects. To post an event, call Event::post(). The event will then be dispatched to all EventListener objects that have registered themselves via the addListener interface.

An event dispatcher is not always strictly required (direct callbacks can usually be used instead) but use of an event system improves maintainability, as it decouples event senders from receivers, and allows code to be written more expressively, in terms of real-world things that have happened.

Definition at line 35 of file Event.h.

Member Function Documentation

void Event::addListener ( EventListener aTarget)
static

Adds a window that is interested in receiving events.

Parameters
aTargetThe object that is interested in events

Definition at line 24 of file Event.cpp.

References removeListener().

Referenced by EventListener::EventListener().

void Event::post ( EventId  aEventId,
uint32  aEventData = 0,
void *  aEventDataPtr = NULL,
BOOL  handleNow = FALSE 
)
static
void Event::removeListener ( EventListener aTarget)
static

Remove a target window from the interested object list.

Parameters
aTargetThe object that is no longer interested

Definition at line 40 of file Event.cpp.

References post().

Referenced by addListener(), and EventListener::~EventListener().

Member Data Documentation

std::list< EventListener * > Event::mListeners
staticprivate

List of listeners that should receive event notifications.

Definition at line 58 of file Event.h.


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