idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h
branchRCL_3
changeset 47 7be2816dbabd
parent 38 79311d856354
--- a/idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h	Tue Apr 27 16:26:12 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/inc/xneffectmanager.h	Tue May 11 16:02:39 2010 +0300
@@ -26,6 +26,8 @@
 // User includes
 
 // Forward declarations
+class CAlfEffectObserver;
+class CXnAppUiAdapter;
 class CXnPluginData;
 class CXnViewData;
 class CXnNode;
@@ -33,27 +35,27 @@
 // Constants
 
 // Control effect context ids
-#define KGfxContextAddWidget            TUid::Uid( 0x102750F4 )
-#define KGfxContextRemoveWidget         TUid::Uid( 0x102750F4 )
-#define KGfxContextActivateNextView     TUid::Uid( 0x102750F1 )
-#define KGfxContextActivatePrevView     TUid::Uid( 0x102750F2 )
-#define KGfxContextBgAppear             TUid::Uid( 0x102750F3 )
+#define KGfxContextAddWidget                TUid::Uid( 0x102750F4 )
+#define KGfxContextRemoveWidget             TUid::Uid( 0x102750F4 )
+#define KGfxContextActivateNextView         TUid::Uid( 0x102750F1 )
+#define KGfxContextActivatePrevView         TUid::Uid( 0x102750F2 )
+#define KGfxContextBgAppear                 TUid::Uid( 0x102750F3 )
 
 // Control effect action ids
-#define KGfxControlActionAppear         3
-#define KGfxControlActionDisappear      4
+#define KGfxControlActionAppear             3
+#define KGfxControlActionDisappear          4
 
-#define KGfxControlActionAppearPrt         3
-#define KGfxControlActionDisappearPrt      5
-#define KGfxControlActionAppearLsc         6
-#define KGfxControlActionDisappearLsc      7
+#define KGfxControlActionAppearPrt          3
+#define KGfxControlActionDisappearPrt       5
+#define KGfxControlActionAppearLsc          6
+#define KGfxControlActionDisappearLsc       7
 
 #define KGfxControlActionBgImgToImgAppear   3
 #define KGfxControlActionBgAnimToImgAppear  5
 
 // Full screen effect ids
-#define KGfxContextOpenWallpaperView    1007
-#define KGfxContextCloseWallpaperView   1008
+#define KGfxContextOpenWallpaperView        1007
+#define KGfxContextCloseWallpaperView       1008
 
 // Class declaration
 /**
@@ -61,7 +63,13 @@
  */
 NONSHARABLE_STRUCT( TXnEffect )
     {
+    TXnEffect() 
+        : iNode( NULL ), iState( 0 ), iId( 0 ), iExplicitEnd( EFalse )
+        {        
+        }
+        
     CXnNode* iNode;
+    TBool iExplicitEnd;
     TInt iState;
     TInt iId;
     };
@@ -72,7 +80,7 @@
  *
  *  @since S60 v5.0
  */
-NONSHARABLE_CLASS( CXnEffectManager ) : public CBase
+NONSHARABLE_CLASS( CXnEffectManager ) : public CTimer    
     {
 public:
     // constructor and destructor
@@ -81,13 +89,21 @@
      * Two-phased constructor.
      * @return new instance of CXnEffectManager.
      */
-    static CXnEffectManager* NewL();
+    static CXnEffectManager* NewL( CXnAppUiAdapter& aAppUiAdapter );
 
     /**
      * Destructor.
      */
     ~CXnEffectManager();
 
+private:
+    // from CTimer
+    
+    /**
+     * @see CTimer
+     */
+    void RunL();
+        
 public:
     // new functions
     
@@ -99,6 +115,54 @@
      * @aView view data
      */
     void BeginFullscreenEffectL( TInt aId, CXnViewData& aView );
+
+    /**
+     * Begin handling of fullscreen effect.
+     * 
+     * @since S60 5.2 
+     * @param aId effect id
+     */
+    void BeginFullscreenEffectL( TInt aId );
+
+    /**
+     * Ends fullscreen effect.
+     * 
+     * @since S60 5.2 
+     * @param aId effect id
+     */
+    void EndFullscreenEffect( TInt aId );
+    
+    /**
+     * Begin view change effect
+     * 
+     * @since S60 5.2
+     * @param aThis Active view
+     * @param aOther View to activate
+     * @param aEffect Effect uid 
+     * @return ETrue of effect is started, EFalse otherwise
+     */    
+    TBool BeginActivateViewEffect( const CXnViewData& aThis, 
+        const CXnViewData& aOther, TUid aEffect );
+
+    /**
+     * End view change effect
+     * 
+     * @since S60 5.2
+     * @param aThis Active view
+     * @param aOther View to activate
+     * @param aEffect Effect uid 
+     */        
+    void EndActivateViewEffect( const CXnViewData& aThis, 
+        const CXnViewData& aOther, TUid aEffect );
+       
+    /**
+     * Begins background appear effect
+     * 
+     * @since S60 5.2
+     * @param aBg Background control
+     * @param aWaitActiveEffect ETrue if active effect is checked, EFalse otherwise
+     */
+    void BgAppearEffect( CCoeControl* aBg, TBool aWaitActiveEffect = EFalse );
     
     /**
      * When UiRendered is called effect is ended and will be drawn
@@ -114,6 +178,29 @@
      */
     void UiLayouted();
 
+    /**
+     * Checks if effect is active for control
+     * 
+     * @since S60 5.2
+     * @param aControl Control to check
+     * @return ETrue if active, EFalse otherwise
+     */
+    TBool ControlEffectActive( const CCoeControl* aControl ) const;
+    
+    /** 
+     * Updates iLandscape flag
+     * 
+     * @since S60 5.2
+     */
+    void OrientationChanged();
+
+    /** 
+     * Cleanup control effect
+     * 
+     * @since S60 5.2
+     */    
+    void CleanupControlEffect();
+    
 private:
     // new functions
     
@@ -127,12 +214,13 @@
     TBool DoBeginFullscreenEffect( TXnEffect& aEffect );
     
     /**
-     * Removes and destroys effect from effect list.
+     * Waits active effects to complete
      * 
      * @since S60 5.2
-     * @param aEffect effect data
+     * @param aInterval Interval in micro seconds to wait active effects to complete     
+     * @return ETrue if no active effects ongoing when function returns, EFalse otherwise 
      */
-    void RemoveEffect( TXnEffect* aEffect );
+    TBool WaitActiveEffect( TInt aInterval );
     
 private:
     // constructors
@@ -140,7 +228,7 @@
     /**
      * C++ default constructor
      */
-    CXnEffectManager();
+    CXnEffectManager( CXnAppUiAdapter& aAppUiAdapter );
 
     /**
      * 2nd phase constructor 
@@ -150,8 +238,20 @@
 private: 
     // data
     
+    /** Effect observer, owned */
+    CAlfEffectObserver* iObserver;
+    /** AppUi, not owned */
+    CXnAppUiAdapter& iAppUiAdapter;
     /** List of started effects, owned */
-    RPointerArray<TXnEffect> iEffects;    
+    RArray< TXnEffect > iEffects;
+    /** List of controls in current effect, not owned */
+    RPointerArray< CCoeControl > iControls;
+    /** Effect group id */
+    TInt iGroupId;    
+    /** Flag to indicate whether background effect is started */
+    TBool iBgEffect;
+    /** Orientation */
+    TBool iLandscape;
     };
 
 #endif      // CXNEFFECTMANAGER_H