emailuis/emailui/inc/FreestyleEmailUiStatusIndicator.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 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:  FreestyleEmailUi status indicator definition
       
    15 *
       
    16 */
       
    17 
       
    18  
       
    19     
       
    20 #ifndef __FREESTYLEEMAILUI_STATUSINDICATOR_H__
       
    21 #define __FREESTYLEEMAILUI_STATUSINDICATOR_H__
       
    22 
       
    23 //<cmail> SF
       
    24 #include <alf/alftextvisual.h>
       
    25 #include <alf/alfanchorlayout.h>
       
    26 //</cmail>
       
    27 #include "FreestyleEmailUiUtilities.h"	// FSEmailUiGenericTimer
       
    28 
       
    29 class CFreestyleEmailUiAppUi;
       
    30 
       
    31 typedef RPointerArray<CAlfTexture> TFsEmailUiStatusIconArray;
       
    32 
       
    33 /**
       
    34  *  Generic indicator class.
       
    35  *
       
    36  *  Shows an indication in bottom of the screen. Indication can have one icon
       
    37  *  and/or one line of text.
       
    38  *
       
    39  */
       
    40 class CFSEmailUiStatusIndicator : public CAlfControl,
       
    41 								  public MFSEmailUiGenericTimerCallback
       
    42 	{
       
    43 public:
       
    44     // These special values are supposed to be less than zero
       
    45 	enum TStatusIndicationDuration
       
    46 		{
       
    47 		/* Use indicator default duration (currently 3 seconds) */
       
    48 		EIndicationDefaultDuration = -1000,
       
    49 		
       
    50 		/* Indicator is not hided automatically, caller needs to hide it
       
    51 		   manually by calling HideIndicatorL() */
       
    52 		EIndicationNoAutomaticHiding,
       
    53 		
       
    54 		/* Indicator is first shown fully opague and then it fades out 
       
    55 		   partially so that it becomes partially transparent.
       
    56 		   Indicator is not hided automatically, caller needs to hide it
       
    57 		   manually by calling HideIndicatorL(). */
       
    58 		EIndicationNoAutomaticHidingFading,
       
    59 		
       
    60         /* For internal use. Shows the indicator with changed layout values,
       
    61            without any additional move/fade effects. Original duration is
       
    62            not affected. */
       
    63         EIndicationLayoutUpdated
       
    64 		};
       
    65 
       
    66 	/* Built-in indication types */
       
    67 	enum TStatusIndicationTypes 
       
    68 		{
       
    69 		EIndicationSynchronising,
       
    70 		EIndicationConnected,
       
    71 		EIndicationConnecting,
       
    72 		EIndicationDisconnectedGeneral,
       
    73 		EIndicationDisconnectedError,
       
    74 		EIndicationDisconnectedLowBattery,
       
    75 		EIndicationMailSent,
       
    76 		EIndicationCancelSynchronising,
       
    77 		EIndicationDownloadStarted,
       
    78 		EIndicationDownloadProgress
       
    79 		};
       
    80 	
       
    81 public:
       
    82 
       
    83     /**
       
    84      * Symbian two-phased constructor. Constructs an instance of
       
    85      * CFSEmailUiStatusIndicator and adds it to given control group. The
       
    86      * ownership of constructed instance is not returned to caller.
       
    87      */
       
    88     static CFSEmailUiStatusIndicator* NewL( CAlfEnv& aEnv,
       
    89         CAlfControlGroup& aControlGroup, CFreestyleEmailUiAppUi* aAppUi );
       
    90 
       
    91     /**
       
    92      * Destructor.
       
    93      */
       
    94 	~CFSEmailUiStatusIndicator();
       
    95 
       
    96     /**
       
    97      * Show one of the built in indications defined by TStatusIndicationTypes.
       
    98      *
       
    99      * @param aIndicationType Indicator type
       
   100      * @param aFirstLineText Text shown in first line (e.g. mail box name).
       
   101      *                       If NULL (default parameter), then only the default text is shown.
       
   102      * @param aDuration How long the indication is shown. If not specified, uses
       
   103      *                  the default duration. If set to EIndicationNoAutomaticHiding,
       
   104      *                  need to be hided manually by calling HideIndicatorL().
       
   105      */
       
   106 	void ShowIndicatorL( TStatusIndicationTypes aIndicationType,
       
   107 						 const TDesC* aFirstLineText = NULL,
       
   108 	                     TInt aDuration = EIndicationDefaultDuration );
       
   109 
       
   110     /**
       
   111      * Show custom indication defined by parameters.
       
   112      *
       
   113      * @param aFirstLineText Indication first line text. Set to NULL if no text in indication.
       
   114      * @param aSecondLineText Indication second line text.If NULL (default parameter),
       
   115      *                        only one line of text is shown.
       
   116      * @param aIconTexture Icon texture. Set to NULL (default parameter) if no
       
   117      *                     icon in indication.
       
   118      * @param aDuration How long the indication is shown. If not specified, uses
       
   119      *                  the default duration (3 seconds). If set to
       
   120      *                  EIndicationNoAutomaticHiding, need to be hided manually
       
   121      *                  by calling HideIndicatorL().
       
   122      */
       
   123 	void ShowIndicatorL( TDesC* aFirstLineText,
       
   124 						 TDesC* aSecondLineText = NULL,
       
   125 						 CAlfTexture* aIconTexture = NULL,
       
   126 	                     TInt aDuration = EIndicationDefaultDuration );
       
   127 	                     
       
   128     /**
       
   129      * Resets the contents of the indicator.
       
   130      *
       
   131      * @param aFirstLineText Indication first line text. Set to NULL if the text should not be changed.
       
   132      * @param aSecondLineText Indication second line text. Set to NULL (default parameter) 
       
   133      *                        if the text should not be changed.
       
   134      * @param aIconTexture Icon texture. Set to NULL (default parameter) if icon should not be changed.
       
   135      */
       
   136     void SetContentsL( const TDesC* aFirstLineText,
       
   137                        const TDesC* aSecondLineText = NULL,
       
   138                        const CAlfTexture* aIconTexture = NULL );
       
   139 
       
   140     /**
       
   141      * Hide currently shown indicator.
       
   142      * @param   aDelayBeforeHidingInMs  Hiding happens after this amount on milliseconds. Defaults to 0.
       
   143      */
       
   144     void HideIndicator( TInt aDelayBeforeHidingInMs = 0 );
       
   145 
       
   146 	TBool IsVisible();
       
   147 	
       
   148 	/**
       
   149 	 * This function should be used to notify the notifier about changes in screen layout.
       
   150 	 */
       
   151 	void NotifyLayoutChange();
       
   152 	
       
   153 	// Handle foreground event (called by mail viewer visualiser for download screen and appui for connect popup)
       
   154 	void HandleForegroundEventL();
       
   155 	
       
   156 public: // From base class CAlfControl
       
   157 
       
   158 	void HandleCommandL(TInt aCommand);
       
   159 
       
   160 	TBool OfferEventL(const TAlfEvent& aEvent);
       
   161 
       
   162 public: // From base class MFSEmailUiGenericTimerCallback
       
   163 
       
   164     /**
       
   165      * Timer callback function.
       
   166      */
       
   167 	void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer );
       
   168 	
       
   169 private:
       
   170 	CFSEmailUiStatusIndicator(CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aControlGroup );
       
   171 	void ConstructL();
       
   172 
       
   173 	void DoShowIndicator( TInt aDuration );
       
   174 	void PositionVisuals();
       
   175 	void CalculateSizeAttributes();
       
   176 	void LoadIconsL();
       
   177 	void SetTextByResourceIdL( TInt aResourceId, CAlfTextVisual* aTextVisual );
       
   178 	void SetOpacity( TReal aOpacity, TInt aTransitionTime );
       
   179 	void RotateImageL();
       
   180 	
       
   181 	void DoFirstStartL();
       
   182 	
       
   183 private: // data
       
   184 
       
   185     CAlfEnv& iEnv;
       
   186 	CFreestyleEmailUiAppUi* iAppUi;
       
   187 	CAlfControlGroup& iControlGroup;
       
   188 	CAlfLayout* iParentLayout;
       
   189 	CAlfAnchorLayout* iContentLayout;
       
   190 	
       
   191    	TRect iParentRect;
       
   192 	TInt iContentHeight;
       
   193 	TInt iIconWidth;
       
   194 
       
   195 	TInt iTextPadding;
       
   196 	TInt iBorderPadding;
       
   197 	
       
   198 	TBool iHasIcon;
       
   199 	TBool iHasSecondTextLine;
       
   200 	TBool iVisible;
       
   201 	TBool iUseCompactLayout;
       
   202 
       
   203 	TFsEmailUiStatusIconArray iIconArray;
       
   204 	
       
   205 	CAlfTextVisual* iFirstTextVisual;
       
   206 	CAlfTextVisual* iSecondTextVisual;
       
   207 	CAlfImageVisual* iImageVisual;
       
   208 	CAlfTexture* iIconSynchronisation;
       
   209 
       
   210 	CFSEmailUiGenericTimer* iTimer;
       
   211 	TBool iFadeOutAfterTimeOut;
       
   212 	TBool iFirstStartCompleted;
       
   213 };
       
   214 
       
   215 #endif //__FREESTYLEEMAILUI_STATUSINDICATOR_H__