00001 /* 00002 * ============================================================================ 00003 * Name : AknBitmapAnimation.h 00004 * Part of : Avkon 00005 * 00006 * Description:A control that can be used to display an animation. It can be constructed from 00007 * a skin, or from resource. 00008 * 00009 * Version: 00010 * 00011 * Copyright © 2002, 2006 Nokia Corporation. 00012 * This material, including documentation and any related 00013 * computer programs, is protected by copyright controlled by 00014 * Nokia Corporation. All rights are reserved. Copying, 00015 * including reproducing, storing, adapting or translating, any 00016 * or all of this material requires the prior written consent of 00017 * Nokia Corporation. This material also contains confidential 00018 * information which may not be disclosed to others without the 00019 * prior written consent of Nokia Corporation. 00020 * ============================================================================ 00021 */ 00022 // AKNBITMAPANIMATION.H 00023 // 00024 // Copyright (c) 1997-2001 Symbian Ltd. All rights reserved. 00025 // 00026 00027 #if !defined(__AKNBITMAPANIMATION_H__) 00028 #define __AKNBITMAPANIMATION_H__ 00029 00030 #if !defined(__COECNTRL_H__) 00031 #include <coecntrl.h> 00032 #endif 00033 00034 #include <bmpancli.h> 00035 #include <AknControl.h> 00036 #start_since SINCE_3_1_SDK 00037 #include <AknIconUtils.h> 00038 #end_since SINCE_3_1_SDK 00039 00050 class RAknBitmapAnim : public RBitmapAnim 00051 { 00052 public: 00058 RAknBitmapAnim(RAnimDll& aAnimDll); 00059 00063 void StartAndKeepLastFrameL(); 00064 00070 TInt Stop(); 00071 }; 00072 00073 // FORWARD DECLARATIONS 00074 class TResourceReader; 00075 class TAknsItemID; 00076 00077 /* 00078 * A control that can be used to display an animation. 00079 */ 00080 NONSHARABLE_CLASS(CAknBitmapAnimation) : public CAknControl 00081 { 00082 public: 00088 IMPORT_C static CAknBitmapAnimation* NewL(); 00089 00093 IMPORT_C virtual ~CAknBitmapAnimation(); 00094 00095 public: 00101 IMPORT_C RBitmapAnim& Animation(); 00102 00108 IMPORT_C CBitmapAnimClientData* BitmapAnimData() const; 00109 00115 IMPORT_C TInt CancelAnimation(); 00116 00122 IMPORT_C void SetFrameIndexL(TInt aIndex); 00123 00129 IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds); 00130 00135 IMPORT_C void StartAnimationL(); 00136 00137 #start_since SINCE_3_1_SDK 00138 00147 IMPORT_C void SetScaleModeForAnimationFrames(TScaleMode aMode); 00148 #end_since SINCE_3_1_SDK 00149 #start_since SINCE_3_1_SDK 00150 00159 IMPORT_C void SetScaleModeForAnimationBackgroundFrame(TScaleMode aMode); 00160 #end_since SINCE_3_1_SDK 00161 #start_since SINCE_3_1_SDK 00162 00179 IMPORT_C void ExcludeAnimationFramesFromCache(); 00180 #end_since SINCE_3_1_SDK 00181 public: 00188 TInt AnimationHasStarted(TBool aHasStarted); 00189 00190 public: 00207 IMPORT_C TBool ConstructFromSkinL( const TAknsItemID& aItemID ); 00208 00209 public: // from CCoeControl 00216 IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader); 00217 00221 IMPORT_C virtual TSize MinimumSize(); 00222 00223 private: // from CCoeControl 00224 00225 /* 00226 * Size changed. 00227 */ 00228 virtual void SizeChanged(); 00229 00230 /* 00231 * Position Changed 00232 */ 00233 virtual void PositionChanged(); 00234 00235 /* 00236 * Draw 00237 * 00238 * @parm aRect the drawing rect 00239 */ 00240 virtual void Draw(const TRect& aRect) const; 00241 00242 private: 00243 00244 /* 00245 * Constructor 00246 */ 00247 CAknBitmapAnimation(); 00248 00249 /* 00250 * Second phase construction 00251 */ 00252 void ConstructL(); 00253 00254 /* 00255 * Complete animation initialisation. Sets the animation window, 00256 * the position, and the animation data. Records the fact that 00257 * initialisation has occurred. 00258 */ 00259 void CompleteAnimationInitialisationL(); 00260 00261 /* 00262 * Checks the animation initialisation completion flag 00263 * 00264 * @return the initialisation flag 00265 */ 00266 TBool IsInitialisationCompleted(); 00267 00268 /* 00269 * Create frame data, by extracting the interval and position from 00270 * the resource, and the frame data from the animation itself. 00271 * 00272 * @param aFramesReader the resource reader 00273 * @param aFileName the animation file 00274 * @param aVersion version of BMPANIM_DATA 00275 * @return the frame data 00276 */ 00277 CBitmapFrameData* CreateFrameDataFromResourceL(TResourceReader& aFramesReader, const TDesC& aFileName, const TInt8 aVersion); 00278 00279 /* 00280 * Set animation window 00281 */ 00282 void SetAnimationWindowL(); 00283 00284 private: // timer 00285 /* 00286 * Callback for the animation timer 00287 * 00288 * @param aPtr pointer to the owning class 00289 * @return any error value from the timer 00290 */ 00291 static TInt AnimationStartedCallback(TAny* aPtr); 00292 00293 private: 00294 CBitmapAnimClientData* iBitmapAnimData; 00295 RAnimDll iAnimDll; 00296 RAknBitmapAnim iAnimation; 00297 TInt iFlags; 00298 CPeriodic* iTimer; 00299 TScaleMode iScaleModeFrames; 00300 TScaleMode iScaleModeBackgroundFrame; 00301 }; 00302 00303 #endif