Update contrib.
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Animated Bitmap Window
24 TestWindow11::TestWindow11() : CTWin()
28 TestWindow11::~TestWindow11()
34 void TestWindow11::InitWinL()
36 iAnimDll=new(ELeave) RAnimDll(Client()->iWs);
37 //__ASSERT_DEBUG(iAnimDll,Panic());
38 iAnim=new(ELeave) RMbmAnim(*iAnimDll);
39 //__ASSERT_DEBUG(iAnim,Panic());
41 CWsBitmap *bitmap=new(ELeave) CWsBitmap(Client()->iWs);
42 //__ASSERT_DEBUG(bitmap,Panic());
43 iWin.SetRequiredDisplayMode(EColor256);
44 User::LeaveIfError(bitmap->Load(VIDEO_MBM_NAME,0));
45 iVideoSize=bitmap->SizeInPixels();
46 iWin.SetExtent(TPoint(320-(iVideoSize.iWidth>>1),0),iVideoSize);
48 TRAP_IGNORE(LoadDllL());
51 void TestWindow11::Draw()
56 iGc->SetPenStyle(CGraphicsContext::ENullPen);
57 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
58 iGc->SetBrushColor(TRgb::Gray2(1));
62 void TestWindow11::WinKeyL(const TKeyEvent &aKey,const TTime &)
64 if (aKey.iCode=='p' || aKey.iCode=='P')
69 else if (aKey.iCode=='s' || aKey.iCode=='S')
71 else if (aKey.iCode==',' || aKey.iCode=='<')
73 else if (aKey.iCode=='.' || aKey.iCode=='>')
77 void TestWindow11::LoadDllL()
79 _LIT(DllName,"MbmAnim.DLL");
80 iAnimDll->Load(DllName);
81 iAnim->ConstructL(iWin);
82 TBuf<32> name(VIDEO_MBM_NAME);
83 iAnim->SetMbmFile(name);
86 void TestWindow11::CheckWindowSize()
88 TSize size=iWin.Size();
89 if (size.iWidth<iVideoSize.iWidth || size.iHeight<iVideoSize.iHeight)
90 iWin.SetExtent(TPoint(320-(iVideoSize.iWidth>>1),0),iVideoSize);
96 void RMbmAnim::ConstructL(const RWindowBase &aDevice)
99 User::LeaveIfError(RAnim::Construct(aDevice,0,des));
102 void RMbmAnim::SetMbmFile(const TBuf<32>& aFileName)
104 TPckgBuf<TBuf<32> > param;
106 Command(EMbmOpSetFileName,param);
109 void RMbmAnim::Activate()
111 Command(EMbmOpActivate);
114 void RMbmAnim::Deactivate()
116 Command(EMbmOpDeactivate);
119 void RMbmAnim::SpeedUp()
121 Command(EMbmOpFaster);
124 void RMbmAnim::SlowDown()
126 Command(EMbmOpSlower);