📄 bitmaprotatorcontainer.cpp
字号:
/*
* ============================================================================
* Name : CBitmapRotatorContainer from BitmapRotatorContainer.h
* Part of : BitmapRotator
* Created : 30.01.2006 by ToBeReplacedByAuthor
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version :
* Copyright: ToBeReplacedByCopyright
* ============================================================================
*/
// INCLUDE FILES
#include <eikenv.h>
#include <eikappui.h>
#include <eikapp.h>
#include <BitmapRotator.mbg>
#include "BitmapRotatorContainer.h"
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CBitmapRotatorContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CBitmapRotatorContainer::ConstructL(const TRect& aRect)
{
CreateWindowL();
CEikonEnv* eikonEnv = CEikonEnv::Static();
TFileName mbmFile = eikonEnv->EikAppUi()->Application()->BitmapStoreName();
iBitmap = eikonEnv->CreateBitmapL(mbmFile, EMbmBitmaprotatorArrow);
iBitmapRotatorEngine = CBitmapRotatorEngine::NewL(*this);
SetRect(aRect);
ActivateL();
}
// Destructor
CBitmapRotatorContainer::~CBitmapRotatorContainer()
{
if(iBitmapRotatorEngine!=NULL)
{
delete iBitmapRotatorEngine;
}
delete iBitmap;
}
TKeyResponse CBitmapRotatorContainer::OfferKeyEventL(
const TKeyEvent& aKeyEvent,TEventCode aType)
{
TKeyResponse response = EKeyWasNotConsumed;
if(aType==EEventKey)
{
response = EKeyWasConsumed;
switch(aKeyEvent.iScanCode)
{
case EStdKeyLeftArrow:
{
iBitmapRotatorEngine->Rotate(*iBitmap,
CBitmapRotator::ERotation270DegreesClockwise);
break;
}
case EStdKeyRightArrow:
{
iBitmapRotatorEngine->Rotate(*iBitmap,
CBitmapRotator::ERotation90DegreesClockwise);
break;
}
case EStdKeyUpArrow:
{
iBitmapRotatorEngine->Rotate(*iBitmap,
CBitmapRotator::EMirrorHorizontalAxis);
break;
}
case EStdKeyDownArrow:
{
iBitmapRotatorEngine->Rotate(*iBitmap,
CBitmapRotator::EMirrorVerticalAxis);
break;
}
default:
{
response = EKeyWasNotConsumed;
break;
}
}
}
return response;
}
void CBitmapRotatorContainer::OnCompleteL(TInt/*aError*/)
{
DrawDeferred();
}
// ---------------------------------------------------------
// CBitmapRotatorContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CBitmapRotatorContainer::Draw(const TRect&/* aRect*/) const
{
if(iBitmapRotatorEngine->IsActive())
{
return;
}
CWindowGc& gc = SystemGc();
gc.BitBlt(TPoint(16,0), iBitmap);
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -