Crazy Eddie's GUI System  0.8.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::LinkedEvent Class Reference

LinkedEvent is an Event subclass that provides a mechanism to link or chain Events together, such that when a specified target event is fired, then this event will additionally fire in response. More...

+ Inheritance diagram for CEGUI::LinkedEvent:
+ Collaboration diagram for CEGUI::LinkedEvent:

Public Member Functions

 LinkedEvent (const String &event_name, EventSet *target_event_set)
 Constructor. More...
 
void addLinkedTarget (Event &link_target)
 Add a link target for this event. A link target is an event that will trigger this event. More...
 
- Public Member Functions inherited from CEGUI::Event
 Event (const String &name)
 Constructs a new Event object with the specified name.
 
virtual ~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. 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...
 

Protected Types

typedef std::vector
< Event::Connection
CEGUI_VECTOR_ALLOC(Event::Connection)> 
LinkedConnections
 
- Protected Types inherited from CEGUI::Event
typedef std::multimap< Group,
Connection, std::less< Group >
CEGUI_MULTIMAP_ALLOC(Group,
Connection)> 
SlotContainer
 

Protected Member Functions

bool handler (const EventArgs &args)
 
 LinkedEvent (const LinkedEvent &e)
 
- Protected Member Functions inherited from CEGUI::Event
void unsubscribe (const BoundSlot &slot)
 Disconnects and removes the given BoundSlot from the collection of bound slots attached to this Event, thus 'unsubscribing' it. More...
 
 Event (const Event &)
 
Eventoperator= (const Event &)
 

Protected Attributes

LinkedConnections d_connections
 collection of connection to the linked Events.
 
const EventSetd_owner
 reference to the event set that we added ourself to
 
- Protected Attributes inherited from CEGUI::Event
SlotContainer d_slots
 Collection holding ref-counted bound slots.
 
const String d_name
 Name of this event.
 

Additional Inherited Members

- Public Types inherited from CEGUI::Event
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.
 

Detailed Description

LinkedEvent is an Event subclass that provides a mechanism to link or chain Events together, such that when a specified target event is fired, then this event will additionally fire in response.

The expected use of this mechanism is for container or compound widgets to be able to expose events of component widgets without needing to provide repetetive boilerplate event forwarding code, and also for scenarios where code is not typically provided (i.e. data based skinning scenarios).

Constructor & Destructor Documentation

CEGUI::LinkedEvent::LinkedEvent ( const String event_name,
EventSet target_event_set 
)

Constructor.

Parameters
nameString object describing the name that this Event will use.
target_event_setEventSet that the LinkedEvent should add itself to.

Member Function Documentation

void CEGUI::LinkedEvent::addLinkedTarget ( Event link_target)

Add a link target for this event. A link target is an event that will trigger this event.

Parameters
link_targetReference to an Event that, when fired, will additionally cause this Event to fire.
Note
Once an event link is established it can not currently be broken without destroying this Event completely.