?? simpleclock.cpp
字號:
// SimpleClock.cpp
//
// Copyright (c) 2000 Symbian Ltd. All rights reserved.
// Asynchronous keyboard processing with messenger program.
// A single CWriteKeyProcessor active object (derived from
// class CActiveConsole) which accepts and prints keyboard
// input to a console.
#include "SimpleClock.h"
//////////////////////////////////////////////////////////////////////////////
//
// -----> CSimpleClock (implementation)
//
//////////////////////////////////////////////////////////////////////////////
CSimpleClock::CSimpleClock()
: CTimer(CActive::EPriorityStandard)
// Construct standard-priority active object
{
iStop = FALSE;
iObserver = NULL;
};
CSimpleClock* CSimpleClock::NewL()
{
TTime tm;
tm.UniversalTime();
return CSimpleClock::NewL(tm);
}
CSimpleClock* CSimpleClock::NewLC(const TTime & aTime)
{
CSimpleClock* self=new (ELeave) CSimpleClock();
CleanupStack::PushL(self);
self->ConstructL(aTime);
return self;
}
CSimpleClock* CSimpleClock::NewL(const TTime & aTime)
{
CSimpleClock* self = NewLC(aTime);
CleanupStack::Pop();
return self;
}
void CSimpleClock::ConstructL(const TTime & aTime)
{
iTime = aTime;
// Base class second-phase construction.
CTimer::ConstructL();
CActiveScheduler::Add(this);
}
CSimpleClock::~CSimpleClock()
{
// Make sure we're cancelled
Cancel();
}
void CSimpleClock::DoCancel()
{
// Base class
CTimer::DoCancel();
}
void CSimpleClock::IssueRequest()
{
if(IsActive())
return;
CTimer::After(900000);
}
void CSimpleClock::RunL()
{
if (iStop == FALSE)
{
iTime += TTimeIntervalSeconds(1);
TDateTime dt = iTime.DateTime();
if(iObserver)
iObserver->UpdateClock(iTime);
IssueRequest();
}
}
void CSimpleClock::Start()
{
iTime.UniversalTime();
iTime += TTimeIntervalHours(8);
IssueRequest();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -