# CEGUI::EventSet Class Reference

Class that collects together a set of Event objects. More...

Inheritance diagram for CEGUI::EventSet:

[legend]
List of all members.

## Public Types

typedef ConstBaseIterator< EventMap > | EventIterator

## Public Member Functions

| EventSet ()
| Constructor for EventSet objects.
virtual | ~EventSet (void)
| Destructor for EventSet objects.
void | addEvent (const String &name)
| Add a new Event to the EventSet with the given name.
void | removeEvent (const String &name)
| Removes the Event with the given name. All connections to the event are disconnected.
void | removeAllEvents (void)
| Remove all Event objects from the EventSet.
bool | isEventPresent (const String &name)
| Checks to see if an Event with the given name is present in the EventSet.
virtual Event::Connection | subscribeEvent (const String &name, Event::Subscriber subscriber)
| Subscribes the named Event.
virtual Event::Connection | subscribeEvent (const String &name, Event::Group group, Event::Subscriber subscriber)
| Subscribes the specified group of the named Event.
virtual Event::Connection | subscribeScriptedEvent (const String &name, const String &subscriber_name)
| Subscribes the named Event to a scripted funtion.
virtual Event::Connection | subscribeScriptedEvent (const String &name, Event::Group group, const String &subscriber_name)
| Subscribes the specified group of the named Event to a scripted funtion.
virtual void | fireEvent (const String &name, EventArgs &args, const String &eventNamespace="")
| Fires the named event passing the given EventArgs object.
bool | isMuted (void) const
| Return whether the EventSet is muted or not.
void | setMutedState (bool setting)
| Set the mute state for this EventSet.
EventIterator | getIterator (void) const
| Return a EventSet::EventIterator object to iterate over the available events.

## Protected Types

typedef std::map< String, Event * > | EventMap

## Protected Member Functions

| EventSet (EventSet &e)
EventSet & | operator= (EventSet &e)

## Protected Attributes

EventMap | d_events
bool | d_muted
| true if events for this EventSet have been muted.

## Detailed Description

Class that collects together a set of Event objects.

The EventSet used to collect Event objects together, and allow access to them by a unique name

## Member Function Documentation

void CEGUI::EventSet::addEvent | ( | const String & | name | ) |

Add a new Event to the EventSet with the given name.

Parameters:

  | name | String object containing the name to give the new Event. The name must be unique for the EventSet.

Returns:
  Nothing

Exceptions:

  | AlreadyExistsException | Thrown if an Event already exists named name.

void CEGUI::EventSet::fireEvent | ( | const String & | name,
|  | EventArgs & | args,
|  | const String & | eventNamespace = `""`
| ) | `[virtual]`

Fires the named event passing the given EventArgs object.

Parameters:

  | name | String object holding the name of the Event that is to be fired (triggered)
  | args | The EventArgs (or derived) object that is to be bassed to each subscriber of the Event. Once all subscribers have been called the 'handled' field of the event is updated appropriately.
  | eventNamespace | String object describing the global event namespace prefix for this event.

Returns:
  Nothing.

Exceptions:

  | UnknownObjectException | Thrown if no Event named name was found in the EventSet.

Reimplemented in CEGUI::GlobalEventSet.

bool CEGUI::EventSet::isEventPresent | ( | const String & | name | ) |

Checks to see if an Event with the given name is present in the EventSet.

Returns:
  true if an Event named name was found, or false if the Event was not found

bool CEGUI::EventSet::isMuted | ( | void |  | ) | const

Return whether the EventSet is muted or not.

Returns:
  - true if the EventSet is muted. All requests to fire events will be ignored.
  - false if the EventSet is not muted. All requests to fire events are processed as normal.

void CEGUI::EventSet::removeAllEvents | ( | void |  | ) |

Remove all Event objects from the EventSet.

Returns:
  Nothing

void CEGUI::EventSet::removeEvent | ( | const String & | name | ) |

Removes the Event with the given name. All connections to the event are disconnected.

Parameters:

  | name | String object containing the name of the Event to remove. If no such Event exists, nothing happens.

Returns:
  Nothing.

void CEGUI::EventSet::setMutedState | ( | bool | setting | ) |

Set the mute state for this EventSet.

Parameters:

  setting

  - true if the EventSet is to be muted (no further event firing requests will be honoured until EventSet is unmuted).
  - false if the EventSet is not to be muted and all events should fired as requested.

Returns:
  Nothing.

Event::Connection CEGUI::EventSet::subscribeEvent | ( | const String & | name,
|  | Event::Group | group,
|  | Event::Subscriber | subscriber
| ) | `[virtual]`

Subscribes the specified group of the named Event.

Parameters:

  | name | String object containing the name of the Event to subscribe to.
  | group | Group which is to be subscribed to. Subscription groups are called in ascending order.
  | subscriber | Function or object that is to be subscribed to the Event.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Reimplemented in CEGUI::GlobalEventSet.

Event::Connection CEGUI::EventSet::subscribeEvent | ( | const String & | name,
|  | Event::Subscriber | subscriber
| ) | `[virtual]`

Subscribes the named Event.

Parameters:

  | name | String object containing the name of the Event to subscribe to.
  | subscriber | Function or object that is to be subscribed to the Event.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Reimplemented in CEGUI::GlobalEventSet.

Event::Connection CEGUI::EventSet::subscribeScriptedEvent | ( | const String & | name,
|  | Event::Group | group,
|  | const String & | subscriber_name
| ) | `[virtual]`

Subscribes the specified group of the named Event to a scripted funtion.

Parameters:

  | name | String object containing the name of the Event to subscribe to.
  | group | Group which is to be subscribed to. Subscription groups are called in ascending order.
  | subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Event::Connection CEGUI::EventSet::subscribeScriptedEvent | ( | const String & | name,
|  | const String & | subscriber_name
| ) | `[virtual]`

Subscribes the named Event to a scripted funtion.

Parameters:

  | name | String object containing the name of the Event to subscribe to.
  | subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet