idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h
branchRCL_3
changeset 83 5456b4e8b3a8
child 88 3321d3e205b6
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Effect manager.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CXNEFFECTMANAGER_H
       
    21 #define CXNEFFECTMANAGER_H
       
    22 
       
    23 // System incldues
       
    24 #include <e32base.h>
       
    25 
       
    26 // User includes
       
    27 
       
    28 // Forward declarations
       
    29 class CAlfEffectObserver;
       
    30 class CXnAppUiAdapter;
       
    31 class CXnPluginData;
       
    32 class CXnViewData;
       
    33 class CXnNode;
       
    34 
       
    35 // Constants
       
    36 
       
    37 // Control effect context ids
       
    38 #define KGfxContextAddWidget                TUid::Uid( 0x102750F4 )
       
    39 #define KGfxContextRemoveWidget             TUid::Uid( 0x102750F4 )
       
    40 #define KGfxContextActivateNextView         TUid::Uid( 0x102750F1 )
       
    41 #define KGfxContextActivatePrevView         TUid::Uid( 0x102750F2 )
       
    42 #define KGfxContextBgAppear                 TUid::Uid( 0x102750F3 )
       
    43 
       
    44 // Control effect action ids
       
    45 #define KGfxControlActionAppear             3
       
    46 #define KGfxControlActionDisappear          4
       
    47 
       
    48 #define KGfxControlActionAppearPrt          3
       
    49 #define KGfxControlActionDisappearPrt       5
       
    50 #define KGfxControlActionAppearLsc          6
       
    51 #define KGfxControlActionDisappearLsc       7
       
    52 
       
    53 #define KGfxControlActionBgImgToImgAppear   3
       
    54 #define KGfxControlActionBgAnimToImgAppear  5
       
    55 
       
    56 // Full screen effect ids
       
    57 #define KGfxContextOpenWallpaperView        1007
       
    58 #define KGfxContextCloseWallpaperView       1008
       
    59 
       
    60 // Class declaration
       
    61 /**
       
    62  *  Struct which holds needed info of effect.
       
    63  */
       
    64 NONSHARABLE_STRUCT( TXnEffect )
       
    65     {
       
    66     TXnEffect() 
       
    67         : iNode( NULL ), iState( 0 ), iId( 0 ), iExplicitEnd( EFalse )
       
    68         {        
       
    69         }
       
    70         
       
    71     CXnNode* iNode;
       
    72     TBool iExplicitEnd;
       
    73     TInt iState;
       
    74     TInt iId;
       
    75     };
       
    76 
       
    77 /**
       
    78  *  Effect manager.
       
    79  *  Handles starting and ending effects.
       
    80  *
       
    81  *  @since S60 v5.0
       
    82  */
       
    83 NONSHARABLE_CLASS( CXnEffectManager ) : public CTimer    
       
    84     {
       
    85 public:
       
    86     // constructor and destructor
       
    87 
       
    88     /**
       
    89      * Two-phased constructor.
       
    90      * @return new instance of CXnEffectManager.
       
    91      */
       
    92     static CXnEffectManager* NewL( CXnAppUiAdapter& aAppUiAdapter );
       
    93 
       
    94     /**
       
    95      * Destructor.
       
    96      */
       
    97     ~CXnEffectManager();
       
    98 
       
    99 private:
       
   100     // from CTimer
       
   101     
       
   102     /**
       
   103      * @see CTimer
       
   104      */
       
   105     void RunL();
       
   106         
       
   107 public:
       
   108     // new functions
       
   109     
       
   110     /**
       
   111      * Begin handling of fullscreen effect.
       
   112      * 
       
   113      * @since S60 5.2 
       
   114      * @param aId effect id
       
   115      * @aView view data
       
   116      */
       
   117     void BeginFullscreenEffectL( TInt aId, CXnViewData& aView );
       
   118 
       
   119     /**
       
   120      * Begin handling of fullscreen effect.
       
   121      * 
       
   122      * @since S60 5.2 
       
   123      * @param aId effect id
       
   124      */
       
   125     void BeginFullscreenEffectL( TInt aId );
       
   126 
       
   127     /**
       
   128      * Ends fullscreen effect.
       
   129      * 
       
   130      * @since S60 5.2 
       
   131      * @param aId effect id
       
   132      */
       
   133     void EndFullscreenEffect( TInt aId );
       
   134     
       
   135     /**
       
   136      * Begin view change effect
       
   137      * 
       
   138      * @since S60 5.2
       
   139      * @param aThis Active view
       
   140      * @param aOther View to activate
       
   141      * @param aEffect Effect uid 
       
   142      * @return ETrue of effect is started, EFalse otherwise
       
   143      */    
       
   144     TBool BeginActivateViewEffect( const CXnViewData& aThis, 
       
   145         const CXnViewData& aOther, TUid aEffect );
       
   146 
       
   147     /**
       
   148      * End view change effect
       
   149      * 
       
   150      * @since S60 5.2
       
   151      * @param aThis Active view
       
   152      * @param aOther View to activate
       
   153      * @param aEffect Effect uid 
       
   154      */        
       
   155     void EndActivateViewEffect( const CXnViewData& aThis, 
       
   156         const CXnViewData& aOther, TUid aEffect );
       
   157        
       
   158     /**
       
   159      * Begins background appear effect
       
   160      * 
       
   161      * @since S60 5.2
       
   162      * @param aBg Background control
       
   163      * @param aWaitActiveEffect ETrue if active effect is checked, EFalse otherwise
       
   164      */
       
   165     void BgAppearEffect( CCoeControl* aBg, TBool aWaitActiveEffect = EFalse );
       
   166     
       
   167     /**
       
   168      * When UiRendered is called effect is ended and will be drawn
       
   169      * 
       
   170      * @since S60 5.2 
       
   171      */
       
   172     void UiRendered();
       
   173 
       
   174     /**
       
   175      * When UiLayouted is called effect is started if it was not started earlier.
       
   176      * 
       
   177      * @since S60 5.2
       
   178      */
       
   179     void UiLayouted();
       
   180 
       
   181     /**
       
   182      * Checks if effect is active for control
       
   183      * 
       
   184      * @since S60 5.2
       
   185      * @param aControl Control to check
       
   186      * @return ETrue if active, EFalse otherwise
       
   187      */
       
   188     TBool ControlEffectActive( const CCoeControl* aControl ) const;
       
   189     
       
   190     /** 
       
   191      * Updates iLandscape flag
       
   192      * 
       
   193      * @since S60 5.2
       
   194      */
       
   195     void OrientationChanged();
       
   196 
       
   197     /** 
       
   198      * Cleanup control effect
       
   199      * 
       
   200      * @since S60 5.2
       
   201      */    
       
   202     void CleanupControlEffect();
       
   203     
       
   204 private:
       
   205     // new functions
       
   206     
       
   207     /**
       
   208      * Starts fullscreen effect.
       
   209      * 
       
   210      * @since S60 5.2
       
   211      * @param aEffect effect data
       
   212      * @return ETrue if effect started, otherwise EFalse
       
   213      */
       
   214     TBool DoBeginFullscreenEffect( TXnEffect& aEffect );
       
   215     
       
   216     /**
       
   217      * Waits active effects to complete
       
   218      * 
       
   219      * @since S60 5.2
       
   220      * @param aInterval Interval in micro seconds to wait active effects to complete     
       
   221      * @return ETrue if no active effects ongoing when function returns, EFalse otherwise 
       
   222      */
       
   223     TBool WaitActiveEffect( TInt aInterval );
       
   224     
       
   225 private:
       
   226     // constructors
       
   227     
       
   228     /**
       
   229      * C++ default constructor
       
   230      */
       
   231     CXnEffectManager( CXnAppUiAdapter& aAppUiAdapter );
       
   232 
       
   233     /**
       
   234      * 2nd phase constructor 
       
   235      */
       
   236     void ConstructL();
       
   237 
       
   238 private: 
       
   239     // data
       
   240     
       
   241     /** Effect observer, owned */
       
   242     CAlfEffectObserver* iObserver;
       
   243     /** AppUi, not owned */
       
   244     CXnAppUiAdapter& iAppUiAdapter;
       
   245     /** List of started effects, owned */
       
   246     RArray< TXnEffect > iEffects;
       
   247     /** List of controls in current effect, not owned */
       
   248     RPointerArray< CCoeControl > iControls;
       
   249     /** Effect group id */
       
   250     TInt iGroupId;    
       
   251     /** Flag to indicate whether background effect is started */
       
   252     TBool iBgEffect;
       
   253     /** Orientation */
       
   254     TBool iLandscape;
       
   255     };
       
   256 
       
   257 #endif      // CXNEFFECTMANAGER_H
       
   258 
       
   259 // End of File