#include <ktimer.h>
Inheritance diagram for KernelTimer:
Public Member Functions | |
KernelTimer (CCRuntimeClass *BroadcastClass=NULL) | |
~KernelTimer () | |
void | SetBroadcastClass (CCRuntimeClass *BroadcastClass) |
CCRuntimeClass * | GetBroadcastClass () 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 | |
CCRuntimeClass * | m_BroadcastClass |
CamTimer | m_Timer |
Classes | |
class | CamTimer |
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.
|
Definition at line 180 of file ktimer.h. 00180 : m_BroadcastClass (BroadcastClass), m_Timer(this) {}
|
|
Definition at line 181 of file ktimer.h.
|
|
|
|
Definition at line 184 of file ktimer.h. 00184 {return m_BroadcastClass;}
|
|
Definition at line 208 of file ktimer.h. 00208 { return m_Timer.GetInterval(); }
|
|
Definition at line 209 of file ktimer.h. 00209 { return m_Timer.IsOneShot(); }
|
|
Definition at line 210 of file ktimer.h. 00210 { return m_Timer.IsRunning(); }
|
|
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 }
|
|
Definition at line 183 of file ktimer.h. 00183 {m_BroadcastClass = BroadcastClass;}
|
|
Definition at line 211 of file ktimer.h. 00211 { return m_Timer.Start(milliseconds, OneShot); }
|
|
Definition at line 212 of file ktimer.h. 00212 { m_Timer.Stop(); }
|
|
|
|
|