Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

Broadcaster Class Reference

Stores a list of Listener objects and broadcasts events to them. More...

#include <Broadcaster.h>

Inheritance diagram for Broadcaster:
Control Gui SystemEventHandler Button CheckBox Container DropDown Label ListItem ProgressBar Slider TextField Window

List of all members.

Public Member Functions

 Broadcaster ()
virtual ~Broadcaster ()
void pump ()
void notify ()
void addListener (Listener *listener)
void removeListener (Listener *listener)
int getQueSize ()

Protected Member Functions

void addEvent (Event *event)
void removeEvent ()

Protected Attributes

vector< Listener * > mListenerList
deque< Event * > mEventQue

Private Member Functions

virtual void handleEvent ()

Detailed Description

Stores a list of Listener objects and broadcasts events to them.

The Broadcaster class is intended to be inherited from. It maintains a list of Listener objects to which it broadcasts messages in the form of Event objects. In its base form, the Broadcaster will transmit basic input Event messages, in particular keyboard and mouse input as well as important system messages like application Quit events and such.

Todo:
Complete the description of how to properly work with a Broadcaster.

Constructor & Destructor Documentation

Broadcaster::Broadcaster (  ) 
Broadcaster::~Broadcaster (  )  [virtual]

Member Function Documentation

void Broadcaster::addEvent ( Event event  )  [protected]

Adds an event to the back of the Event list.

Parameters:
event A pointer to an Event. Must not be NULL.
void Broadcaster::addListener ( Listener listener  ) 

Adds a listener to internal list.

Todo:
Verify that the find function works properly.
int Broadcaster::getQueSize (  )  [inline]

Returns the number of Events currently in the Event Que.

virtual void Broadcaster::handleEvent (  )  [inline, private, virtual]

This function is called during the Pump cycle before Listeners are notified of events.

This event is useful if you have a Broadcaster that needs to handle events before Listeners are notified of events.

Reimplemented in SystemEventHandler.

void Broadcaster::notify (  ) 

Notifies any listeners of events that are in the queue.

Todo:
This function is sloppy. Let's clean it up.
void Broadcaster::pump (  ) 

Pumps the event handling cycle and notifies any listeners if any events occur.

void Broadcaster::removeEvent (  )  [protected]

Removes an event from the front of the Event list.

void Broadcaster::removeListener ( Listener listener  ) 

Member Data Documentation

deque<Event*> Broadcaster::mEventQue [protected]
vector<Listener*> Broadcaster::mListenerList [protected]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines