|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Test AknBitmapAnimation.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <barsread.h> |
|
20 #include <coeaui.h> |
|
21 #include <testsdkanimation.rsg> |
|
22 #include <eikappui.h> |
|
23 |
|
24 #include "testsdkacontrol.h" |
|
25 #include "testsdkanimation.h" |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 // ----------------------------------------------------------------------------- |
|
29 // CTestControl::NewL |
|
30 // ----------------------------------------------------------------------------- |
|
31 CTestControl* CTestControl::NewL() |
|
32 { |
|
33 CTestControl* self = new (ELeave) CTestControl; |
|
34 CleanupStack::PushL( self ); |
|
35 self->ConstructL(); |
|
36 CleanupStack::Pop( self ); |
|
37 return self; |
|
38 |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // CTestControl::~CTestControl |
|
43 // ----------------------------------------------------------------------------- |
|
44 CTestControl::~CTestControl() |
|
45 { |
|
46 delete iBitmapAnimation; |
|
47 |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CTestControl::TestRunL |
|
52 // ----------------------------------------------------------------------------- |
|
53 void CTestControl::TestRunL() |
|
54 { |
|
55 iBitmapAnimation->SetContainerWindowL( *this ); |
|
56 TResourceReader reader; |
|
57 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_ANIMATION_DATA ); |
|
58 iBitmapAnimation->ConstructFromResourceL( reader ); |
|
59 CleanupStack::PopAndDestroy(); |
|
60 iBitmapAnimation->StartAnimationL(); |
|
61 |
|
62 } |
|
63 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // CTestControl::CTestControl |
|
66 // ----------------------------------------------------------------------------- |
|
67 CTestControl::CTestControl() |
|
68 { |
|
69 |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CTestControl::ConstructL |
|
74 // ----------------------------------------------------------------------------- |
|
75 void CTestControl::ConstructL() |
|
76 { |
|
77 CreateWindowL(); |
|
78 ActivateL(); |
|
79 iBitmapAnimation = CAknBitmapAnimation::NewL(); |
|
80 |
|
81 } |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CTestControl::OfferKeyEventL |
|
85 // ----------------------------------------------------------------------------- |
|
86 TKeyResponse CTestControl::OfferKeyEventL( const TKeyEvent& /*aKeyEvent*/, |
|
87 TEventCode /*aType*/ ) |
|
88 { |
|
89 return EKeyWasConsumed; |
|
90 |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CTestControl::Draw |
|
95 // ----------------------------------------------------------------------------- |
|
96 void CTestControl::Draw( const TRect& /*aRect*/ ) const |
|
97 { |
|
98 |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CTestControl::CountComponentControls |
|
103 // ----------------------------------------------------------------------------- |
|
104 TInt CTestControl::CountComponentControls() const |
|
105 { |
|
106 return 0; |
|
107 |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CTestControl::ComponentControl |
|
112 // ----------------------------------------------------------------------------- |
|
113 CCoeControl* CTestControl::ComponentControl( TInt aIndex ) const |
|
114 { |
|
115 switch( aIndex ) |
|
116 { |
|
117 default: |
|
118 return NULL; |
|
119 } |
|
120 |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CTestControl::SizeChanged |
|
125 // ----------------------------------------------------------------------------- |
|
126 void CTestControl::SizeChanged() |
|
127 { |
|
128 |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CTestControl::SetFrameIndexL |
|
133 // ----------------------------------------------------------------------------- |
|
134 void CTestControl::SetFrameIndexL( TInt aIndex ) |
|
135 { |
|
136 iBitmapAnimation->SetContainerWindowL( *this ); |
|
137 TResourceReader reader; |
|
138 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_ANIMATION_DATA ); |
|
139 iBitmapAnimation->ConstructFromResourceL( reader ); |
|
140 CleanupStack::PopAndDestroy(); |
|
141 iBitmapAnimation->SetFrameIndexL( aIndex ); |
|
142 iBitmapAnimation->StartAnimationL(); |
|
143 |
|
144 |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CTestControl::SetFrameIntervalL |
|
149 // ----------------------------------------------------------------------------- |
|
150 void CTestControl::SetFrameIntervalL( TInt aFrameIntervalInMilliSeconds ) |
|
151 { |
|
152 iBitmapAnimation->SetContainerWindowL( *this ); |
|
153 TResourceReader reader; |
|
154 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_ANIMATION_DATA ); |
|
155 iBitmapAnimation->ConstructFromResourceL( reader ); |
|
156 CleanupStack::PopAndDestroy(); |
|
157 iBitmapAnimation->SetFrameIntervalL( aFrameIntervalInMilliSeconds ); |
|
158 iBitmapAnimation->StartAnimationL(); |
|
159 |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CTestControl::TestCancelL |
|
164 // ----------------------------------------------------------------------------- |
|
165 void CTestControl::TestCancelL() |
|
166 { |
|
167 iBitmapAnimation->SetContainerWindowL( *this ); |
|
168 TResourceReader reader; |
|
169 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_ANIMATION_DATA ); |
|
170 iBitmapAnimation->ConstructFromResourceL( reader ); |
|
171 CleanupStack::PopAndDestroy(); |
|
172 iBitmapAnimation->StartAnimationL(); |
|
173 iBitmapAnimation->CancelAnimation(); |
|
174 |
|
175 } |