simpleclock.h

来自「基于Symbianos的手机开发与应用中的GUIClock源码」· C头文件 代码 · 共 63 行

H
63
字号
#include <e32base.h>

#ifndef  _SIMPLE_CLOCK_
#define _SIMPLE_CLOCK_

class MClockObserver
{
public:
	virtual void UpdateClock(TTime aTime) = 0;
};

//////////////////////////////////////////////////////////////////////////////
//
// -----> CSimpleClock (definition)
//
//////////////////////////////////////////////////////////////////////////////
class CSimpleClock : public CTimer
{
public:
	// Construction
	CSimpleClock();
	// Destruction
	~CSimpleClock();
	
public:
	// Static construction
	static CSimpleClock* NewL();
	static CSimpleClock* NewLC(const TTime & aTime);
	static CSimpleClock* NewL(const TTime & aTime);
	
public:
	// Second phase construction
	void ConstructL(const TTime & aTime);
	
	
	// Cancel request
	// Defined as pure virtual by CActive;
	// implementation provided by this class.
	void DoCancel();
	
	// service completed request.
	// Defined as pure virtual by CActive;
	// implementation provided by this class.
	void RunL();

	void Start() ;
	void Stop(){iStop = TRUE;}
	//void SetObserver(MClockObserver * aObserver){iObserver = aObserver;}
	void AddObserver(MClockObserver * aObserver);
	void RemoveObserver(MClockObserver *aObserver);

	void SetCurTime(TTime aTime) {iTime = aTime;}
	TTime CurTime(){return iTime;}
protected:
	// issue request
	void IssueRequest(); 
private:
	TTime iTime;
	TBool iStop;
	CArrayFixFlat<MClockObserver *>  * iObservers;
};

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?