pictographs/AknPictograph/inc/AknPictographAnimator.h
changeset 0 05e9090e2422
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Pictograph animator. Owns the timer that is used to animate
       
    15 *                pictographs.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef AKN_PICTOGRAPH_ANIMATOR_H
       
    23 #define AKN_PICTOGRAPH_ANIMATOR_H
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <coemain.h>
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // CCoeStatic UID
       
    32 const TUid KUidAknPictographAnimator = {0x101F8616};
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 class CAknPictographDrawer;
       
    36 class CUserActivityManager;
       
    37 class CFbsBitmap;
       
    38 class CFbsBitGc;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * Pictograph animator
       
    44 */
       
    45 NONSHARABLE_CLASS(CAknPictographAnimator) :
       
    46     public CCoeStatic,
       
    47     public MCoeForegroundObserver
       
    48 	{
       
    49     public:  // Constructors and destructor
       
    50         
       
    51         /**
       
    52         * Creates singleton.
       
    53         */
       
    54         static CAknPictographAnimator* CreateSingletonL();
       
    55         
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         virtual ~CAknPictographAnimator();
       
    60 
       
    61     public: // New functions
       
    62 
       
    63         void AddClientL( CAknPictographDrawer& aDrawer );
       
    64         TInt RemoveClient( CAknPictographDrawer& aDrawer );
       
    65 
       
    66         // From the client's point of view
       
    67         inline void Start();
       
    68         inline void Stop();
       
    69         inline TUint Counter();
       
    70         inline RPointerArray<CFbsBitmap>* Bitmaps();
       
    71         inline RPointerArray<CFbsBitmap>* Masks();
       
    72         inline CFbsBitmap* WhiteBitmap();
       
    73         inline CFbsBitmap* WhiteBitmapMask();
       
    74         inline CFbsBitGc*  WhiteBitmapMaskGc();
       
    75         static TInt TimerCallBack( TAny* aParameter );
       
    76         void AnimationTick();
       
    77 
       
    78     private: // New functions
       
    79 
       
    80         static TInt ActiveCallBack( TAny* aParameter );
       
    81         static TInt InactiveCallBack( TAny* aParameter );
       
    82 
       
    83         void HandleActiveCallBack();
       
    84         void HandleInactiveCallBack();
       
    85 
       
    86     private: // Functions from MCoeForegroundObserver
       
    87 
       
    88 	    /**
       
    89 	    * Handles the application coming to the foreground.
       
    90 	    */
       
    91 	    void HandleGainingForeground();
       
    92 
       
    93 	    /**
       
    94 	    * Handles the application going into the background.
       
    95 	    */
       
    96 	    void HandleLosingForeground();
       
    97 
       
    98     private:
       
    99 
       
   100         /**
       
   101         * C++ default constructor.
       
   102         */
       
   103         CAknPictographAnimator();
       
   104 
       
   105         /**
       
   106         * 2nd phase constructor.
       
   107         */
       
   108         void ConstructL();
       
   109 
       
   110     private:    // Data
       
   111 
       
   112 
       
   113         /**
       
   114         * Pictograph collection bitmaps for all supported heights, owned.
       
   115         */
       
   116         RPointerArray<CFbsBitmap>* iBitmaps;
       
   117 
       
   118         /**
       
   119         * Pictograph collection masks for all supported heights, owned.
       
   120         */
       
   121         RPointerArray<CFbsBitmap>* iMasks;
       
   122 
       
   123         /**
       
   124         * White bitmap, owned.
       
   125         */
       
   126         CFbsBitmap* iWhiteBitmap;
       
   127 
       
   128         /**
       
   129         * White bitmap mask, owned.
       
   130         */
       
   131         CFbsBitmap* iWhiteBitmapMask;
       
   132 
       
   133         /**
       
   134         * White bitmap mask bitmap device, owned.
       
   135         */
       
   136         CFbsBitmapDevice* iWhiteBitmapMaskDevice;
       
   137 
       
   138         /**
       
   139         * White bitmap mask graphics context, owned.
       
   140         */
       
   141         CFbsBitGc* iWhiteBitmapMaskGc;
       
   142 
       
   143         /**
       
   144         * Owned user activity manager.
       
   145         * Used to start and stop animations based on user activity.
       
   146         */
       
   147         CUserActivityManager* iUserActivityManager;
       
   148 
       
   149         /*
       
   150         * Owned animation timer
       
   151         */
       
   152         CPeriodic* iTimer;
       
   153 
       
   154         /*
       
   155         * Timer increases this counter
       
   156         */
       
   157         TUint iCounter;
       
   158 
       
   159         /*
       
   160         * Array of pictograph drawer clients
       
   161         */
       
   162         RPointerArray<CAknPictographDrawer> iClients;
       
   163 
       
   164         /*
       
   165         * Number of currently animating clients. Updated in Start and Stop calls.
       
   166         */
       
   167         TInt iAnimatedClients;
       
   168     };
       
   169 
       
   170 #include "AknPictographAnimator.inl"
       
   171 
       
   172 #endif      // AKN_PICTOGRAPH_ANIMATOR_H
       
   173             
       
   174 // End of File