Entire Class Index | Main Class Index | Cross Index | Global Index

# Class CL_EventListener

Event Listener Class
Contained in: global
Derived from: none
Derived by: none
Group: Core (System)

#include <ClanLib/core.h>

### public function member index:

### Construction:

`` | `CL_EventListener` | `()`;
`` | `CL_EventListener` | `(`CL_EventTrigger`* `trigger`)`;
``virtual`` | `~CL_EventListener` | `()`;

### Operations:

``void`` | `add_trigger` | `(`CL_EventTrigger`* `trigger`)`;
``void`` | `remove_trigger` | `(`CL_EventTrigger`* `trigger`)`;
``void`` | `clear` | `()`;
``void`` | `reset_all` | `()`;
``bool`` | `wait` | `(`int` `timeout` = -1)`;

## Description:

The event listener is used to collect a set of events, identified as CL_EventTrigger, and wait for one of them to occur. This is analog to the lowlevel C socket select() function, except that this one operates on clanlib objects.

## Function Member Descriptions:

CL_EventListener::CL_EventListener - Constructs an empty event listener object.
`` `CL_EventListener` `()`;

CL_EventListener::CL_EventListener - Constructs an event listener with one trigger in it.
`` `CL_EventListener` `(`CL_EventTrigger`* `trigger`)`;

CL_EventListener::add_trigger - Adds an event trigger to the listener.
``void`` `add_trigger` `(`CL_EventTrigger`* `trigger`)`;

CL_EventListener::clear - Removes all event triggers from the listener.
``void`` `clear` `()`;

CL_EventListener::remove_trigger - Removes an event trigger from the listener.
``void`` `remove_trigger` `(`CL_EventTrigger`* `trigger`)`;

CL_EventListener::reset_all - Resets all event triggers added to the listener.
``void`` `reset_all` `()`;

CL_EventListener::wait - Wait until one of the events triggers.
The timeout is in milliseconds.
``bool`` `wait` `(`int` `timeout` = -1)`;

> If timeout = -1, this function will not timeout.
> Returns true if an event triggered, false if it timed out.

CL_EventListener::~CL_EventListener - Event Listener Destructor
``virtual`` `~CL_EventListener` `()`;

## Variable Member Descriptions: