fmradio/fmradio/inc/fmradioalfbitmapanimation.h
changeset 0 f3d95d9c00ab
equal deleted inserted replaced
-1:000000000000 0:f3d95d9c00ab
       
     1 /*
       
     2 * Copyright (c) 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:  Tuning animation for RadioGaGa
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CMFRADIOALFBITMAPANIMATION_H
       
    20 #define CMFRADIOALFBITMAPANIMATION_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 
       
    25 #include <alf/alfcontrol.h>
       
    26 
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 
       
    30 class CAlfImageVisual;
       
    31 class CAlfAnchorLayout;
       
    32 
       
    33 
       
    34 // CONSTANTS
       
    35 
       
    36 
       
    37 /**
       
    38  * Alf control to show tuning animation
       
    39  */
       
    40 class CFMRadioAlfBitmapAnimation : public CAlfControl
       
    41     {
       
    42 
       
    43 	public:			
       
    44 	    /**
       
    45 	     * Two-phased constructor.
       
    46 	     * @param aEnv Alf environment
       
    47 	    */
       
    48 	    static CFMRadioAlfBitmapAnimation* NewL( CAlfEnv& aEnv );	    
       
    49 	    /**
       
    50 	     * Destructor.
       
    51 	     */
       
    52 	    virtual ~CFMRadioAlfBitmapAnimation();
       
    53 			
       
    54 	public: // from base class 
       
    55 		/**
       
    56  	     * From CAlfControl, takes care of alfred event handling.
       
    57  	     */
       
    58 		TBool OfferEventL( const TAlfEvent& aEvent );	
       
    59 
       
    60 	public: // New functions
       
    61 				/**
       
    62 		* Shows the indicator with the defined opacity value.
       
    63 		* @param aShowWithFading ETrue if the indicator will be shown with fading; EFalse otherwise.
       
    64 		* @see SetOpacityInVisibleState()
       
    65 		*/
       
    66 		void Show( TBool aShowWithFading );
       
    67 		/**
       
    68 		* Hides the indicator with the defined opacity value.
       
    69 		* @param aHideWithFading ETrue if the indicator will be hidden with fading; EFalse otherwise. 
       
    70 		* @see SetOpacityInHiddenState()
       
    71 		*/
       
    72 		void Hide( TBool aHideWithFading );								
       
    73 		/** 
       
    74 		* Sets the indicator rectangle
       
    75 		* @param aRect Rectangle to the indicator
       
    76 	    */	
       
    77 		void SetRect( const TRect& aRect );
       
    78 		/**
       
    79 		* Starts bitmap animation after delay and
       
    80 		* fades it in while animation is running
       
    81 		*/
       
    82 		void StartBmpAnimation();
       
    83 		/**
       
    84 		* Stops bitmap animation after delay and
       
    85 		* fades it out while animation is running		
       
    86 		*/
       
    87 		void StopBmpAnimation();
       
    88 
       
    89 	private:
       
    90 		// Custom events for the bitmap animation. 
       
    91 		enum TBmpAnimationCustomEvent
       
    92 			{
       
    93 			EBmpAnimationStart,
       
    94 			EBmpAnimationContinue,
       
    95 			EBmpAnimationStop
       
    96 			};
       
    97 				
       
    98 		enum TBmpAnimationRunningState
       
    99 		    {
       
   100 		    EBmpAnimationStopped,
       
   101 		    EBmpAnimationStartup,
       
   102 		    EBmpAnimationRunning
       
   103 		    };
       
   104 		
       
   105 		void StartAnimation();
       
   106 
       
   107 	    CFMRadioAlfBitmapAnimation();
       
   108 
       
   109 	    void ConstructL( CAlfEnv& aEnv );
       
   110 	
       
   111 		void CreateImageAnimationVisualL();
       
   112 		
       
   113 		void CreateBitmapAnimationArrayL();	
       
   114 						
       
   115 		void ContinueBmpAnimation();
       
   116 		
       
   117 		/**
       
   118 	    * Sets absolute rect of the anchor by top left and bottom right points.
       
   119 	    * @param aAnchor Anchor layout for setting placement
       
   120 	    * @param aOrdinal Index of visual element
       
   121 	    * @param aTopLeftPosition Top left point of the rect
       
   122 	    * @param aBottomRightPosition Bottom right point of the rect
       
   123 	    */
       
   124 		void SetAbsoluteCornerAnchors( CAlfAnchorLayout* aAnchor,
       
   125 									   TInt aOrdinal,
       
   126 								       const TPoint& aTopLeftPosition,
       
   127 									   const TPoint& aBottomRightPosition );
       
   128 
       
   129 	private: // data
       
   130 
       
   131 		// Visual containing current frame
       
   132 		CAlfImageVisual* iAnimationImageVisual;
       
   133 		// Animation frame array
       
   134 		RArray<TAlfImage> iFrames;
       
   135 		// Interval to change frames
       
   136 		TInt iFrameInterval;
       
   137 		// mbm file for bitmaps
       
   138 		HBufC* iBitmapFileName;			    	 
       
   139 	    /** Anchor layout for Bmpanimation */
       
   140 	    CAlfAnchorLayout* iBmpAnimationAnchor;
       
   141 	    TInt iCurrentFrameIndex;
       
   142 	   	/** Bmpanimation opacity in visible state */
       
   143 	    TReal iOpacityInVisibleState;
       
   144 	    /** Bmpanimation opacity in hidden state */
       
   145 	    TReal iOpacityInHiddenState;
       
   146 	   	/** Bmpanimation rectangle */
       
   147 	    TRect iRect;
       
   148 	    /** Animation state */
       
   149 	    TBmpAnimationRunningState iAnimationState;
       
   150 	    
       
   151 	    	
       
   152     };
       
   153 
       
   154 
       
   155 #endif // CMFRADIOALFBITMAPANIMATION_H