📄 animationappview.cpp
字号:
/*
============================================================================
Name : AnimationAppView.cpp
Author :
Copyright : Your copyright notice
Description : Application view implementation
============================================================================
*/
// INCLUDE FILES
#include <coemain.h>
#include "AnimationAppView.h"
_LIT(KMBMFile,"C:\\number.mbm");
const TInt KCallBackPeriod = 1000000;
CAnimationAppView* CAnimationAppView::NewL( const TRect& aRect )
{
CAnimationAppView* self = CAnimationAppView::NewLC( aRect );
CleanupStack::Pop( self );
return self;
}
CAnimationAppView* CAnimationAppView::NewLC( const TRect& aRect )
{
CAnimationAppView* self = new ( ELeave ) CAnimationAppView;
CleanupStack::PushL( self );
self->ConstructL( aRect );
return self;
}
void CAnimationAppView::ConstructL( const TRect& aRect )
{
CreateWindowL();
LoadBackgroundBitmapL(KMBMFile,0);
COggControl* c1 = NULL;
c1 = new(ELeave) COggAnimation;
iAnimation = (COggAnimation *) c1;
c1->SetBitmapFile(KMBMFile);
c1->SetPosition(12, 34, 42, 42);
AddControl(c1);
iAnimation->SetFrequency(2);
iAnimation->SetPause(1);
iAnimation->SetBitmaps(1,10);
iAnimation->SetStyle(1);
iAnimation->Start();
Refresh();
iTimer = CPeriodic::NewL(CActive::EPriorityStandard);
iCallBack = new(ELeave) TCallBack(CAnimationAppView::CallBack, this);
SetRect( aRect );
ActivateL();
}
CAnimationAppView::CAnimationAppView()
{
}
CAnimationAppView::~CAnimationAppView()
{
ClearCanvases();
if (iTimer)
iTimer->Cancel();
delete iTimer;
delete iCallBack;
}
void CAnimationAppView::Invalidate()
{
DrawNow();
}
void CAnimationAppView::ClearCanvases()
{
ClearControls();
}
TInt CAnimationAppView::CallBack(TAny* aPtr)
{
CAnimationAppView* self = (CAnimationAppView*) aPtr;
self->HandleCallBack();
return 1;
}
void CAnimationAppView::HandleCallBack()
{
CycleLowFrequencyControls();
Refresh();
}
void CAnimationAppView::StopCallBack()
{
if(iTimer->IsActive())
iTimer->Cancel();
}
void CAnimationAppView::RestartCallBack()
{
iTimer->Cancel();
if (!iTimer->IsActive())
{
iTimer->Start(TTimeIntervalMicroSeconds32(KCallBackPeriod), TTimeIntervalMicroSeconds32(KCallBackPeriod), *iCallBack);
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -