aknbitmapanimation.h

Go to the documentation of this file.
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 
00025 #if !defined(__AKNBITMAPANIMATION_H__)
00026 #define __AKNBITMAPANIMATION_H__
00027 
00028 #if !defined(__COECNTRL_H__)
00029 #include <coecntrl.h>
00030 #endif
00031 
00032 #include <bmpancli.h>
00033 #include <AknControl.h>
00034 #include <AknIconUtils.h>
00035 
00046 class RAknBitmapAnim : public RBitmapAnim
00047     {
00048 public:
00054     RAknBitmapAnim(RAnimDll& aAnimDll);
00055 
00059     void StartAndKeepLastFrameL();
00060 
00066     TInt Stop();
00067     };
00068 
00069 // FORWARD DECLARATIONS
00070 class TResourceReader;
00071 class TAknsItemID;
00072 
00073 /*
00074  * A control that can be used to display an animation.
00075  */
00076 NONSHARABLE_CLASS(CAknBitmapAnimation) : public CAknControl
00077     {
00078 public:
00084     IMPORT_C static CAknBitmapAnimation* NewL();
00085 
00089     IMPORT_C virtual ~CAknBitmapAnimation();
00090 
00091 public:
00097     IMPORT_C RBitmapAnim& Animation();
00098 
00104     IMPORT_C CBitmapAnimClientData* BitmapAnimData() const;
00105 
00111     IMPORT_C TInt CancelAnimation();
00112 
00118     IMPORT_C void SetFrameIndexL(TInt aIndex);
00119 
00125     IMPORT_C void SetFrameIntervalL(TInt aFrameIntervalInMilliSeconds);
00126 
00131     IMPORT_C void StartAnimationL();
00132 
00141     IMPORT_C void SetScaleModeForAnimationFrames(TScaleMode aMode);
00142 
00151     IMPORT_C void SetScaleModeForAnimationBackgroundFrame(TScaleMode aMode);
00152 
00169     IMPORT_C void ExcludeAnimationFramesFromCache();
00170     
00171 public: 
00178     TInt AnimationHasStarted(TBool aHasStarted);
00179 
00180 public:
00197     IMPORT_C TBool ConstructFromSkinL( const TAknsItemID& aItemID );
00198 
00199 public: // from CCoeControl
00206     IMPORT_C virtual void ConstructFromResourceL(TResourceReader& aResourceReader);
00207 
00211     IMPORT_C virtual TSize MinimumSize();
00212 
00213 private: // from CCoeControl
00214     
00215     /*
00216      * Size changed.
00217      */
00218     virtual void SizeChanged();
00219     
00220     /*
00221      * Position Changed
00222      */
00223     virtual void PositionChanged();
00224     
00225     /*
00226      * Draw
00227      *
00228      * @parm aRect the drawing rect
00229      */
00230     virtual void Draw(const TRect& aRect) const;
00231 
00232     /*
00233      * Focus Changed
00234      */
00235     virtual void FocusChanged(TDrawNow aDrawNow);
00236 private:
00237 
00238     /* 
00239      * Constructor
00240      */
00241     CAknBitmapAnimation();
00242     
00243     /*
00244      * Second phase construction
00245      */
00246     void ConstructL();
00247     
00248     /*
00249      * Complete animation initialisation. Sets the animation window, 
00250      * the position, and the animation data. Records the fact that 
00251      * initialisation has occurred.
00252      */
00253     void CompleteAnimationInitialisationL();
00254     
00255     /*
00256      * Checks the animation initialisation completion flag
00257      *
00258      * @return the initialisation flag
00259      */
00260     TBool IsInitialisationCompleted();
00261     
00262     /*
00263      * Create frame data, by extracting the interval and position from
00264      * the resource, and the frame data from the animation itself.
00265      *
00266      * @param aFramesReader the resource reader
00267      * @param aFileName the animation file
00268      * @param aVersion version of BMPANIM_DATA
00269      * @return the frame data
00270      */
00271         CBitmapFrameData* CreateFrameDataFromResourceL(TResourceReader& aFramesReader, const TDesC& aFileName, const TInt8 aVersion);
00272     
00273     /*
00274      * Set animation window
00275      */
00276     void SetAnimationWindowL();
00277 
00278 private: // timer
00279     /*
00280      * Callback for the animation timer
00281      *
00282      * @param aPtr pointer to the owning class
00283      * @return any error value from the timer
00284      */
00285     static TInt AnimationStartedCallback(TAny* aPtr);
00286 
00287 private:
00288     CBitmapAnimClientData* iBitmapAnimData;
00289     RAnimDll iAnimDll;
00290     RAknBitmapAnim iAnimation;
00291     TInt iFlags;
00292     CPeriodic* iTimer;
00293     TScaleMode iScaleModeFrames;
00294     TScaleMode iScaleModeBackgroundFrame;
00295     TBool iGainedFocus;
00296     };
00297 
00298 #endif

Copyright © Nokia Corporation 2001-2008
Back to top