uifw/AvKon/inc/AknSmileyImage.h
changeset 0 2f259fa3e83a
child 9 aabf2c525e0f
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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:  AVKON smiley image.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef AKNSMILEYIMAGE_H
       
    22 #define AKNSMILEYIMAGE_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <AknIconObserver.h> 
       
    26 
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 class CSmileyImage;
       
    31 
       
    32 ////////////////////////////////////////////////////////////////////
       
    33 
       
    34 _LIT(KSmileyMif, "z:\\resource\\apps\\smiley.mif");
       
    35 _LIT(KSmileyRsc, "z:\\resource\\smiley.rsc");
       
    36 
       
    37 class SmileyUtils
       
    38     {
       
    39 public:
       
    40     static void GetCustomizableResPath(TDes& aResPath, const TDesC& aDefaultResPath);
       
    41     };
       
    42 
       
    43 ////////////////////////////////////////////////////////////////////
       
    44 
       
    45 class MSmileyImageObserver
       
    46     {
       
    47 public:
       
    48     virtual void BitmapChanged(CSmileyImage* aSmileyImage, CFbsBitmap* aBitmap)=0;
       
    49     };
       
    50 
       
    51 ////////////////////////////////////////////////////////////////////
       
    52 
       
    53 class CSmileyImage : public CBase, public MAknIconObserver
       
    54     {
       
    55 public:
       
    56     static CSmileyImage* NewL(const TAknsItemID& aSkinImage, TInt aPkgImage, TBool aIsAnimation, MSmileyImageObserver* aObserver);
       
    57     virtual ~CSmileyImage();
       
    58 
       
    59 private:
       
    60     CSmileyImage(const TAknsItemID& aSkinImage, TInt aPkgImage, TBool aIsAnimation, MSmileyImageObserver* aObserver);
       
    61     void ConstructL();
       
    62 
       
    63 public:
       
    64     void LoadL(TInt aRepeat=0, TInt aDelay=0); // can load static and animation image
       
    65     void Release();
       
    66     void SetSize(const TSize& aSize);
       
    67     const TSize& Size() const;
       
    68     
       
    69 public:
       
    70     TBool ReadyToDraw() const;
       
    71     const CFbsBitmap* Image() const;
       
    72     const CFbsBitmap* Mask() const;
       
    73 
       
    74 private: // from MAknIconObserver
       
    75     void BitmapChanged(CFbsBitmap* aBitmap);
       
    76 
       
    77 private:
       
    78     void DoLoadL();
       
    79     void DoRelease();
       
    80     void StopAnyAsynchronousTask();
       
    81 
       
    82     void MonitorAnimationEndedL();
       
    83     void HandleAnimationEndedL();
       
    84 
       
    85 private:
       
    86     void StartLoadAsynchronousL(TInt aRepeat, TInt aDelayMicroSeconds=0);
       
    87     static TInt StartLoadAsynchronousCallBackL(TAny* aPtr);
       
    88     
       
    89 private:
       
    90     void StopAnimationAsynchronousL(TInt aDelayMicroSeconds=0);
       
    91     static TInt StopAnimationAsynchronousCallBackL(TAny* aPtr);
       
    92 
       
    93 private:
       
    94     TAknsItemID             iImageSkinItem;
       
    95     TInt                    iImagePkgItem;
       
    96     const TBool             iIsAnimation;
       
    97     TSize                   iSize;
       
    98     MSmileyImageObserver*   iImageObserver;
       
    99     CPeriodic*              iAsynchronousTaskTimer;
       
   100 
       
   101 private:
       
   102     CFbsBitmap*             iFrame;
       
   103     CFbsBitmap*             iFrameMask;
       
   104     
       
   105 private:
       
   106     CFbsBitmap*             iFrameSnap;
       
   107     TInt                    iFrameCounter;
       
   108     TInt                    iSameFrameCounter;
       
   109 
       
   110 private:
       
   111     TBool                   iReadyToDraw;
       
   112     TInt                    iRepeatCount;
       
   113 
       
   114     };
       
   115 
       
   116 
       
   117 #endif // AKNSMILEYSVGRES_H