sl@0: // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Animated Bitmap Window sl@0: // sl@0: // sl@0: sl@0: #include "MBMCMD.H" sl@0: #include "ANIMWIN.H" sl@0: sl@0: sl@0: /*TestWindow11*/ sl@0: sl@0: TestWindow11::TestWindow11() : CTWin() sl@0: { sl@0: } sl@0: sl@0: TestWindow11::~TestWindow11() sl@0: { sl@0: delete iAnim; sl@0: delete iAnimDll; sl@0: } sl@0: sl@0: void TestWindow11::InitWinL() sl@0: { sl@0: iAnimDll=new(ELeave) RAnimDll(Client()->iWs); sl@0: //__ASSERT_DEBUG(iAnimDll,Panic()); sl@0: iAnim=new(ELeave) RMbmAnim(*iAnimDll); sl@0: //__ASSERT_DEBUG(iAnim,Panic()); sl@0: sl@0: CWsBitmap *bitmap=new(ELeave) CWsBitmap(Client()->iWs); sl@0: //__ASSERT_DEBUG(bitmap,Panic()); sl@0: iWin.SetRequiredDisplayMode(EColor256); sl@0: User::LeaveIfError(bitmap->Load(VIDEO_MBM_NAME,0)); sl@0: iVideoSize=bitmap->SizeInPixels(); sl@0: iWin.SetExtent(TPoint(320-(iVideoSize.iWidth>>1),0),iVideoSize); sl@0: delete bitmap; sl@0: TRAP_IGNORE(LoadDllL()); sl@0: } sl@0: sl@0: void TestWindow11::Draw() sl@0: { sl@0: TSize size=Size(); sl@0: TRect rect(size); sl@0: sl@0: iGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: iGc->SetBrushColor(TRgb::Gray2(1)); sl@0: iGc->DrawRect(rect); sl@0: } sl@0: sl@0: void TestWindow11::WinKeyL(const TKeyEvent &aKey,const TTime &) sl@0: { sl@0: if (aKey.iCode=='p' || aKey.iCode=='P') sl@0: { sl@0: CheckWindowSize(); sl@0: iAnim->Activate(); sl@0: } sl@0: else if (aKey.iCode=='s' || aKey.iCode=='S') sl@0: iAnim->Deactivate(); sl@0: else if (aKey.iCode==',' || aKey.iCode=='<') sl@0: iAnim->SlowDown(); sl@0: else if (aKey.iCode=='.' || aKey.iCode=='>') sl@0: iAnim->SpeedUp(); sl@0: } sl@0: sl@0: void TestWindow11::LoadDllL() sl@0: { sl@0: _LIT(DllName,"MbmAnim.DLL"); sl@0: iAnimDll->Load(DllName); sl@0: iAnim->ConstructL(iWin); sl@0: TBuf<32> name(VIDEO_MBM_NAME); sl@0: iAnim->SetMbmFile(name); sl@0: } sl@0: sl@0: void TestWindow11::CheckWindowSize() sl@0: { sl@0: TSize size=iWin.Size(); sl@0: if (size.iWidth>1),0),iVideoSize); sl@0: } sl@0: sl@0: sl@0: /*RMbmAnim*/ sl@0: sl@0: void RMbmAnim::ConstructL(const RWindowBase &aDevice) sl@0: { sl@0: TPtrC8 des(NULL,0); sl@0: User::LeaveIfError(RAnim::Construct(aDevice,0,des)); sl@0: } sl@0: sl@0: void RMbmAnim::SetMbmFile(const TBuf<32>& aFileName) sl@0: { sl@0: TPckgBuf > param; sl@0: param()=aFileName; sl@0: Command(EMbmOpSetFileName,param); sl@0: } sl@0: sl@0: void RMbmAnim::Activate() sl@0: { sl@0: Command(EMbmOpActivate); sl@0: } sl@0: sl@0: void RMbmAnim::Deactivate() sl@0: { sl@0: Command(EMbmOpDeactivate); sl@0: } sl@0: sl@0: void RMbmAnim::SpeedUp() sl@0: { sl@0: Command(EMbmOpFaster); sl@0: } sl@0: sl@0: void RMbmAnim::SlowDown() sl@0: { sl@0: Command(EMbmOpSlower); sl@0: }