KernelTimer Class Reference

A class exposing a timer to the kernel Notes: In the OIL See Also:. More...

#include <ktimer.h>

Inheritance diagram for KernelTimer:

CCObject SimpleCCObject DlgEvtTimer NameGallery::NameGalleryTimer PreviewDialog::PreviewTimer StatusLine::StatusTimer List of all members.

Public Member Functions

 KernelTimer (CCRuntimeClass *BroadcastClass=NULL)
 ~KernelTimer ()
void SetBroadcastClass (CCRuntimeClass *BroadcastClass)
CCRuntimeClassGetBroadcastClass () const
INT32 GetInterval () const
BOOL IsOneShost () const
BOOL IsRunning () const
BOOL Start (INT32 milliseconds=-1, BOOL OneShot=FALSE)
void Stop ()

Protected Member Functions

virtual void Notify ()

Private Member Functions

 CC_DECLARE_DYNAMIC (KernelTimer)

Private Attributes

CCRuntimeClassm_BroadcastClass
CamTimer m_Timer

Classes

class  CamTimer

Detailed Description

A class exposing a timer to the kernel Notes: In the OIL See Also:.

Author:
Alex_Bligh <alex@alex.org.uk>
Date:
25/04/2005
This class provides a kernel timer object, with an OIL-layer independent interface layer. Currently it uses wxTimer, though any timer interface could be used.

There are two main ways of using this class: 1. As is, in which case it will broadcast timer events 2. By deriving a class from it, and overriding Notify()

If you know exactly where the notifcation should go, then in your class definition do something like the following, which will avoid any broadcasts.

class MyClass : public CCObject { MyClass() : m_Timer(this); void OnTimer();

private: class MyTimer : public KernelTimer { public: MyTimer(MyClass * pOwner) : m_pOwner(pOwner) {} virtual void Notify() {m_pOwner->OnTimer();} MyClass * m_pOwner; }; MyTimer m_Timer; };

Definition at line 172 of file ktimer.h.


Constructor & Destructor Documentation

KernelTimer::KernelTimer CCRuntimeClass BroadcastClass = NULL  )  [inline]
 

Definition at line 180 of file ktimer.h.

00180 : m_BroadcastClass (BroadcastClass), m_Timer(this) {}

KernelTimer::~KernelTimer  )  [inline]
 

Definition at line 181 of file ktimer.h.

00181 {}


Member Function Documentation

KernelTimer::CC_DECLARE_DYNAMIC KernelTimer   )  [private]
 

CCRuntimeClass* KernelTimer::GetBroadcastClass  )  const [inline]
 

Definition at line 184 of file ktimer.h.

00184 {return m_BroadcastClass;}

INT32 KernelTimer::GetInterval  )  const [inline]
 

Definition at line 208 of file ktimer.h.

00208 { return m_Timer.GetInterval(); }

BOOL KernelTimer::IsOneShost  )  const [inline]
 

Definition at line 209 of file ktimer.h.

00209 { return m_Timer.IsOneShot(); }

BOOL KernelTimer::IsRunning  )  const [inline]
 

Definition at line 210 of file ktimer.h.

00210 { return m_Timer.IsRunning(); }

virtual void KernelTimer::Notify  )  [inline, protected, virtual]
 

Reimplemented in NameGallery::NameGalleryTimer, PreviewDialog::PreviewTimer, StatusLine::StatusTimer, and DlgEvtTimer.

Definition at line 187 of file ktimer.h.

00188     {
00189         Msg * pMsg = new TimerMsg(TimerMsg::NOTIFY, this);
00190         if (pMsg)
00191             MessageHandler::Broadcast(pMsg, m_BroadcastClass);
00192     }

void KernelTimer::SetBroadcastClass CCRuntimeClass BroadcastClass  )  [inline]
 

Definition at line 183 of file ktimer.h.

00183 {m_BroadcastClass = BroadcastClass;}

BOOL KernelTimer::Start INT32  milliseconds = -1,
BOOL  OneShot = FALSE
[inline]
 

Definition at line 211 of file ktimer.h.

00211 { return m_Timer.Start(milliseconds, OneShot); }

void KernelTimer::Stop  )  [inline]
 

Definition at line 212 of file ktimer.h.

00212 { m_Timer.Stop(); }


Member Data Documentation

CCRuntimeClass* KernelTimer::m_BroadcastClass [private]
 

Definition at line 177 of file ktimer.h.

CamTimer KernelTimer::m_Timer [private]
 

Definition at line 205 of file ktimer.h.


The documentation for this class was generated from the following file:
Generated on Sat Nov 10 03:55:41 2007 for Camelot by  doxygen 1.4.4