|
1 /* |
|
2 * Copyright (c) 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: CMmDrawerAnimator declaration |
|
15 * Version : %version: MM_17.1.10 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_MMDRAWERANIMATOR_H |
|
21 #define C_MMDRAWERANIMATOR_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32std.h> |
|
25 |
|
26 #ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
27 #include <aknlistloadertfx.h> |
|
28 #include <aknlistboxtfxinternal.h> |
|
29 #include <aknlistboxtfx.h> |
|
30 #endif |
|
31 class CMmListBoxItemDrawer; |
|
32 class TMmFloatingItem; |
|
33 |
|
34 /** |
|
35 * Zoom ratio when no zooming is performed. |
|
36 */ |
|
37 const TReal KNormalStateZoomRatio = 1.0f; |
|
38 |
|
39 /** |
|
40 * Zoom ratio when zooming is performed. |
|
41 */ |
|
42 const TReal KZoomStateZoomRatio = 1.25f; |
|
43 |
|
44 /** |
|
45 * Used by Multimedia Menu to draw Animated items. |
|
46 * Drawer animator is an active object, that forces refreshes |
|
47 * while floating items are available in the associated CListBoxItemDrawer. |
|
48 * When no items are available the drawer ceases to redraw the screen. |
|
49 * Active object becomes active when a new animation is triggered. |
|
50 * |
|
51 * @code |
|
52 * @endcode |
|
53 * @lib mmwidgets |
|
54 * @since S60 v5.0 |
|
55 * @see CListBoxItemDrawer |
|
56 * @ingroup group_mmwidgets |
|
57 */ |
|
58 NONSHARABLE_CLASS( CMmDrawerAnimator ) : public CActive |
|
59 { |
|
60 |
|
61 public: |
|
62 /** |
|
63 * Two-phased constructor. |
|
64 * |
|
65 * @since S60 v5.0 |
|
66 * @param aDrawer Item drawer used to draw item. |
|
67 */ |
|
68 static CMmDrawerAnimator* NewL( CMmListBoxItemDrawer& aDrawer ); |
|
69 |
|
70 /** |
|
71 * Two-phased constructor. |
|
72 * |
|
73 * @since S60 v5.0 |
|
74 * @param aDrawer Item drawer used to draw item. |
|
75 */ |
|
76 static CMmDrawerAnimator* NewLC( CMmListBoxItemDrawer& aDrawer ); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 * |
|
81 * @since S60 v5.0 |
|
82 */ |
|
83 virtual ~CMmDrawerAnimator(); |
|
84 |
|
85 /** |
|
86 * Animates transition of the dragged item. |
|
87 * The animation starts in the current position of EDrag |
|
88 * floating item, and end in the original place of dragging |
|
89 * or destination place, if reorder occured. |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 */ |
|
93 void AnimateDragItemTransitionL( ); |
|
94 |
|
95 /** |
|
96 * Animates an item with index aItemFrom into position |
|
97 * indexed by aItemTo. |
|
98 * |
|
99 * @since S60 v5.0 |
|
100 * @param aItemFrom Which item should be animated. |
|
101 * @param aItemTo Where to should the item be animated. |
|
102 */ |
|
103 void AnimateItemSwapL( TInt aItemFrom, TInt aItemTo ); |
|
104 |
|
105 /** |
|
106 * Animates zooming of an item. |
|
107 * |
|
108 * @since S60 v3.0 |
|
109 * @param aItemIndex Index of item to be zoomed. |
|
110 * @param aZoomIn Is zooming in or out. |
|
111 */ |
|
112 void AnimateItemZoomL( TInt aItemIndex, TBool aZoomIn ); |
|
113 |
|
114 /** |
|
115 * Checks if system is ready for new animation. |
|
116 * |
|
117 * @since S60 v5.0 |
|
118 * @return Is system ready so new animation can proceed. |
|
119 */ |
|
120 TBool IsReadyForNewAnimation(); |
|
121 |
|
122 /** |
|
123 * Cancel currently running or pending animations. |
|
124 * |
|
125 * @since S60 v5.0 |
|
126 */ |
|
127 void CancelAnimationsL(); |
|
128 |
|
129 /** |
|
130 * Triggers animation. |
|
131 * This methods sets the Activeobject into active state |
|
132 * if floating items are available |
|
133 * |
|
134 * @since S60 v5.0 |
|
135 * @return Error code |
|
136 */ |
|
137 TInt Trigger(); |
|
138 |
|
139 /** |
|
140 * Make the next animation redraw the whole screen; |
|
141 */ |
|
142 void SetNextRedrawToWholeScreen(); |
|
143 |
|
144 /** |
|
145 * Indicates that draweranimator is in garbage. |
|
146 * This is used when suite model has been destroyed so there isn't |
|
147 * anything to draw, therefore any animator attempts should be |
|
148 * dropped. |
|
149 */ |
|
150 void PrepareForGarbage(); |
|
151 |
|
152 /** |
|
153 * Calls move event. |
|
154 */ |
|
155 void TriggerMoveItemL(); |
|
156 |
|
157 /** |
|
158 * Animates transition of the dragged item. |
|
159 * The animation starts in the original place of dragging item, |
|
160 * and end in the EDrag floating item position, when item had been start drag. |
|
161 * |
|
162 * @since S60 v5.0 |
|
163 * @param aDraggedIndex Draged item index to be animated. |
|
164 * @param aPoint End position of animated item. |
|
165 */ |
|
166 void AnimateDragItemStartL( TInt aDraggedIndex, TPoint aPoint ); |
|
167 |
|
168 private: |
|
169 |
|
170 /** |
|
171 * Default constructor. |
|
172 * |
|
173 * @since S60 v3.0 |
|
174 * @param aDrawer Object used to draw items in widgets. |
|
175 */ |
|
176 CMmDrawerAnimator( CMmListBoxItemDrawer& aDrawer ); |
|
177 |
|
178 /** |
|
179 * 2nd phase constructor. |
|
180 * |
|
181 * @since S60 v3.0 |
|
182 */ |
|
183 void ConstructL(); |
|
184 |
|
185 private: // From CActive |
|
186 |
|
187 /** |
|
188 * Draws next animation phase. |
|
189 * |
|
190 * @since S60 v3.0 |
|
191 */ |
|
192 void RunL(); |
|
193 |
|
194 /** |
|
195 * Cancels animation timer. Stops animation. |
|
196 * |
|
197 * @since S60 v3.0 |
|
198 */ |
|
199 void DoCancel(); |
|
200 |
|
201 /** |
|
202 * Handles error if error an error occured. |
|
203 * |
|
204 * @since S60 v3.0 |
|
205 * @param aError Error code which occurred. |
|
206 * @return Error code for error handling. |
|
207 */ |
|
208 TInt RunError( TInt aError ); |
|
209 |
|
210 /** |
|
211 * Adjusts rect to non touch. |
|
212 * |
|
213 * @since S60 v3.0 |
|
214 * @param aRefreshRect Refresh rect. |
|
215 * @return Adjusted rect. |
|
216 */ |
|
217 TRect AdjustRefreshRectToNonTouch( const TRect& aRefreshRect ); |
|
218 |
|
219 private: // Data |
|
220 |
|
221 /** |
|
222 * Timer |
|
223 */ |
|
224 RTimer iTimer; |
|
225 |
|
226 /** |
|
227 * Associated item drawer. |
|
228 */ |
|
229 CMmListBoxItemDrawer& iDrawer; |
|
230 |
|
231 /** |
|
232 * Number of animation frames |
|
233 */ |
|
234 TInt iAnimateFrames; |
|
235 |
|
236 /** |
|
237 * Delay between redrawing. |
|
238 */ |
|
239 TTimeIntervalMicroSeconds iDelay; |
|
240 |
|
241 /** |
|
242 * Last redraw time |
|
243 */ |
|
244 TTime iLastRedrawTime; |
|
245 |
|
246 /** |
|
247 * Effects api. |
|
248 */ |
|
249 MAknListBoxTfx *iTransTfx; |
|
250 |
|
251 /** |
|
252 * Effects api. |
|
253 */ |
|
254 MAknListBoxTfxInternal *iTransTfxInternal; |
|
255 |
|
256 /** |
|
257 * Highlight noted when last redraw occured. |
|
258 */ |
|
259 TInt iLastNotedHighlight; |
|
260 |
|
261 /** |
|
262 * Top item index noted when last redraw occured. |
|
263 */ |
|
264 TInt iLastNotedTopItem; |
|
265 |
|
266 /** |
|
267 * Vertical offset noted when last redraw occured. |
|
268 */ |
|
269 TInt iLastNotedVerticalOffset; |
|
270 |
|
271 /** |
|
272 * Holds the previous animation refresh rectangle. |
|
273 */ |
|
274 TRect iPreviousRefreshRect; |
|
275 |
|
276 /** |
|
277 * Holds the number of frames to animate. |
|
278 */ |
|
279 const TInt iUsualAnimationFramesCount; |
|
280 |
|
281 /** |
|
282 * Holds the previous animation refresh rectangle. |
|
283 */ |
|
284 TBool iPreparedForGarbage; |
|
285 }; |
|
286 |
|
287 #endif // MMDRAWERANIMATOR_H |