CEGUI::Event Class Reference

Defines an 'event' which can be subscribed to by interested parties. More...

Collaboration diagram for CEGUI::Event:

Collaboration graph
[legend]

List of all members.

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< BoundSlotConnection
 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 StringgetName (void) const
 Return the name given to this Event object when it was created.
Connection subscribe (const Subscriber &slot)
 Subscribes some function or object to the Event.
Connection subscribe (Group group, const Subscriber &slot)
 Subscribes some function or object to the Event.
void operator() (EventArgs &args)
 Fires the event. All event subscribers get called in the appropriate sequence.

Friends

void CEGUI::BoundSlot::disconnect ()


Detailed Description

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:

bool function_name(const EventArgs& args);
Note:
An Event object may not be copied.

Member Function Documentation

const String& CEGUI::Event::getName ( void   )  const [inline]

Return the name given to this Event object when it was created.

Returns:
String object containing the name of the Event object.

void CEGUI::Event::operator() ( EventArgs args  ) 

Fires the event. All event subscribers get called in the appropriate sequence.

Parameters:
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.
Returns:
Nothing.

References CEGUI::EventArgs::handled.

Event::Connection CEGUI::Event::subscribe ( Event::Group  group,
const Subscriber slot 
)

Subscribes some function or object to the Event.

Parameters:
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.
Returns:
A Connection object which can be used to disconnect (unsubscribe) from the Event, and also to check the connection state.

Event::Connection CEGUI::Event::subscribe ( const Subscriber slot  ) 

Subscribes some function or object to the Event.

Parameters:
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.
Returns:
A Connection object which can be used to disconnect (unsubscribe) from the Event, and also to check the connection state.

Referenced by CEGUI::EventSet::subscribeEvent().


Generated on Thu Nov 27 20:34:27 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1