# CEGUI::Event Class Reference

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

Collaboration diagram for CEGUI::Event:

[legend]
List of all members.

## Public Types

typedef RefPtr< ConnectionInterface > | Connection
typedef SubscriberTemplate< bool, const EventArgs & > | Subscriber
typedef int | Group

## Public Member Functions

| Event (const String &name)
| Constructs a new Event object with the specified name.
virtual | ~Event (void)
| Destructor for Event objects.
const String & | getName (void) const
| Return the name given to this Event object when it was created.
Connection | subscribe (Subscriber subscriber)
| Subscribes some function / object to the Event.
Connection | subscribe (Group group, Subscriber subscriber)
| Subscribes some function / object to the Event.
void | operator() (EventArgs &args)

## Friends

class | ConnectionImpl

## Classes

class | ConnectionInterface
| Interface to be implemented by connection objects. More...
class | GroupSubscriber
struct | ltGroupSubscriber
class | ScopedConnection
| A Connection object that automatically disconnects from the event when the ScropedConnection object goes out of scope (and is deleted). More...

## 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.

Event::Connection CEGUI::Event::subscribe | ( | Group | group,
|  | Subscriber | subscriber
| ) |

Subscribes some function / 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. connections to the same group may be called in any order.
  | subscriber | A function, static member function, or function object, with the signature void function_name(const EventArgs& args)

Returns:
  A Connection which can be used to disconnect (unsubscribe) from the Event, and to check the connection state.

Connection CEGUI::Event::subscribe | ( | Subscriber | subscriber | ) | `[inline]`

Subscribes some function / object to the Event.

Parameters:

  | subscriber | A function, static member function, or function object, with the signature void function_name(const EventArgs& args)

Returns:
  A Connection pointer which can be used to disconnect (unsubscribe) from the Event, and to check the connection state.