Crazy Eddies GUI System
0.7.2
|
Defines an 'event' which can be subscribed to by interested parties. More...
Classes | |
class | ScopedConnection |
Event::Connection wrapper that automatically disconnects the connection when the object is deleted (or goes out of scope). More... | |
Public Types | |
typedef RefCounted< BoundSlot > | Connection |
Connection object. This is a thin 'smart pointer' wrapper around the actual BoundSlot that represents the connection. You can use this object to inspect the current connection state and also to disconnect from the event. | |
typedef CEGUI::SubscriberSlot | Subscriber |
Subscriber object type. This is now just a typedef to SubscriberSlot, the use of the name Event::Subscriber is maintained for hostorical and compatability reasons. | |
typedef unsigned int | Group |
Type for a subscriber group. You can use the subscriber group to order calls to multiple subscribers. Groups are called in ascending order, with subscribers with no group called last. | |
Public Member Functions | |
Event (const String &name) | |
Constructs a new Event object with the specified name. | |
~Event () | |
Destructor for Event objects. Note that this is non-virtual and so you should not sub-class Event. | |
const String & | getName (void) const |
Return the name given to this Event object when it was created. More... | |
Connection | subscribe (const Subscriber &slot) |
Subscribes some function or object to the Event. More... | |
Connection | subscribe (Group group, const Subscriber &slot) |
Subscribes some function or object to the Event. More... | |
void | operator() (EventArgs &args) |
Fires the event. All event subscribers get called in the appropriate sequence. More... | |
Friends | |
void | CEGUI::BoundSlot::disconnect () |
Defines an 'event' which can be subscribed to by interested parties.
An Event can be subscribed by a function, a member function, or a function object. Whichever option is taken, the function signature needs to be as follows:
|
inline |
void CEGUI::Event::operator() | ( | EventArgs & | args | ) |
Fires the event. All event subscribers get called in the appropriate sequence.
args | An object derived from EventArgs to be passed to each event subscriber. The 'handled' field will be set to true if any of the called subscribers return that they handled the event. |
Connection CEGUI::Event::subscribe | ( | const Subscriber & | slot | ) |
Subscribes some function or object to the Event.
subscriber | A function, static member function, or function object, with the signature void function_name(const EventArgs& args). To subscribe a member function you should explicitly create an Event::Subscriber as this parameter. |
Connection CEGUI::Event::subscribe | ( | Group | group, |
const Subscriber & | slot | ||
) |
Subscribes some function or object to the Event.
group | The Event group to subscribe to, subscription groups are called in ascending order, followed by subscriptions with no group. Note that calling order of connections to the same group is unspecified. |
subscriber | A function, static member function, or function object, with the signature void function_name(const EventArgs& args). To subscribe a member function you should explicitly create an Event::Subscriber as this parameter. |