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

# Class CL_Timer

Timer signal emitter.
Contained in: global
Derived from: CL_KeepAlive
Derived by: none
Group: Core (System)

#include <ClanLib/core.h>

### public function member index:
### Construction:
`` | `CL_Timer` | `(`unsigned` `long` `interval` = 1000)`;
### Attributes:
``unsigned` `long`` | `get_interval` | `()`;
``bool`` | `is_enabled` | `()`;
### Operations:
``void`` | `set_interval` | `(`unsigned` `long` `interval`)`;
``void`` | `enable` | `()`;
``void`` | `disable` | `()`;
### Signals:
``CL_Signal_v0`&` | `sig_timer` | `()`;
### private function member index:
### Implementation:
``virtual` `void`` | `keep_alive` | `()`;

## Description:

Use this class to emit a signal as a timer event.

## Function Member Descriptions:

CL_Timer::CL_Timer - Constructs and registers the timer as a keep_alive listener.
Note that it is disabled by default, so you need to enable() it.
`` `CL_Timer``(`unsigned` `long` `interval` = 1000)`;

> interval - Interval in millisecs between each signal emit.

CL_Timer::disable - Call this function to disable the timer.
``void`` `disable``()`;

CL_Timer::enable - Call this function to enable the timer.
``void`` `enable``()`;

CL_Timer::get_interval - Returns the current time interval.
``unsigned` `long`` `get_interval``()`;

> Returns - The current time interval.

CL_Timer::is_enabled - Returns true if the timer is enabled, false otherwise.
``bool`` `is_enabled``()`;

CL_Timer::set_interval - Sets a new interval for the timer.
``void`` `set_interval``(`unsigned` `long` `interval`)`;

> interval - Interval in millisecs between each signal emit.

CL_Timer::sig_timer - Signal emitted everytime the interval has elapsed.
``CL_Signal_v0`&` `sig_timer``()`;

## Variable Member Descriptions: