#include <mcllib/MCEvent.h>
Inheritance diagram for MCEvent:
Public Types | |
typedef mcuint32 | MCEventId |
Type of an event id. | |
Public Member Functions | |
MCEventId | getEventId () const |
Get the event Id. | |
const MCString & | getEventName () const |
Get the registered name of the event. | |
MCEvent (const MCEvent &event) | |
Copy constructor. | |
MCEvent (MCEventId eventId, const MCVariantType &vt) | |
Event with data. | |
MCEvent (MCEventId eventId) | |
Event with no data. | |
void | notify () const |
Notify listeners of this event. | |
Static Public Member Functions | |
void | addListener (MCEventId eventId, MCEventListener *pListener) |
Add an event listener. | |
MCEventId | getEventId (const MCString &eventName) |
Get the event Id for a registered event name. | |
const MCString & | getEventName (MCEventId eventId) |
Get the name of an event. | |
MCEventId | registerEvent (const MCString &name) |
Register an event name. | |
void | removeListener (MCEventId eventId, MCEventListener *pListener) |
Remove an event listener. |
Events are sent to all registered listeners. Different types of event can be listened for independently. An event Id is used to distinguish between different types of event. Event Ids are obtained via the registerEvent static method which supplies an event Id given an event name. It is recommended that the following form be used for event names - event.domain (e.g. event.my.com). Do not use the domain miba.co.uk. An event may have data associated with it in the form of a variant. Variants allow arbitrary data to be handled in a run-time type-safe manner. Note: To obtain any stored data use the base class methods (variant type).
|
Event with no data.
|
|
Event with data.
|
|
Add an event listener.
|
|
Get the event Id for a registered event name.
|
|
Get the event Id.
|
|
Get the name of an event.
|
|
Get the registered name of the event. Uses the event id for the event to obtain the name.
|
|
Notify listeners of this event. The method may return before all registered listeners have been notified. |
|
Register an event name.
|
|
Remove an event listener.
|