idlehomescreen/xmluirendering/uiengine/src/xneffectmanager.cpp
branchRCL_3
changeset 11 ff572dfe6d86
parent 1 5315654608de
child 12 9674c1a575e9
equal deleted inserted replaced
9:f966699dea19 11:ff572dfe6d86
    29 #include <aknappui.h>
    29 #include <aknappui.h>
    30 #include <gfxtranseffect/gfxtranseffect.h>  // For transition effects
    30 #include <gfxtranseffect/gfxtranseffect.h>  // For transition effects
    31 #include <akntranseffect.h>                 // For transition effects
    31 #include <akntranseffect.h>                 // For transition effects
    32 
    32 
    33 // CONSTANTS
    33 // CONSTANTS
    34 const TInt KEffectTypeFullscreen = 1;
       
    35 const TInt KEffectTypeControl = 2;
       
    36 
       
    37 const TInt KWaitForLayout = 1;
    34 const TInt KWaitForLayout = 1;
    38 const TInt KEffectStarted = 2;
    35 const TInt KEffectStarted = 2;
    39 
    36 
    40 // ============================ MEMBER FUNCTIONS ===============================
    37 // ============================ MEMBER FUNCTIONS ===============================
    41 
    38 
    77     GfxTransEffect::AbortFullScreen();
    74     GfxTransEffect::AbortFullScreen();
    78     iEffects.ResetAndDestroy();
    75     iEffects.ResetAndDestroy();
    79     }
    76     }
    80 
    77 
    81 // -----------------------------------------------------------------------------
    78 // -----------------------------------------------------------------------------
    82 // CXnEffectManager::BeginControlEffectL
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CXnEffectManager::BeginControlEffectL( TInt /*aId*/, CXnPluginData& /*aPlugin*/ )
       
    86     {
       
    87     /*
       
    88     TXnEffect* effect = new (ELeave) TXnEffect;
       
    89     CleanupStack::PushL( effect );
       
    90     effect->iId = aId;
       
    91     effect->iType = KEffectTypeControl;
       
    92     effect->iNode = aPlugin.Node()->LayoutNode();
       
    93     iEffects.AppendL( effect );
       
    94     CleanupStack::Pop( effect );
       
    95     
       
    96     if ( effect->iNode && !effect->iNode->IsLaidOut() )
       
    97         {
       
    98         effect->iState = KWaitForLayout;
       
    99         }
       
   100     else
       
   101         {
       
   102         DoBeginControlEffect( *effect );
       
   103         }
       
   104     */
       
   105     }
       
   106 
       
   107 // -----------------------------------------------------------------------------
       
   108 // CXnEffectManager::BeginControlEffectL
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CXnEffectManager::BeginControlEffectL( TInt aId,
       
   112                 RPointerArray<CXnPluginData>& aPlugins )
       
   113     {
       
   114     TInt count = aPlugins.Count();
       
   115     for ( TInt i = 0; i < count; i++ )
       
   116         {
       
   117         BeginControlEffectL( aId, *aPlugins[i] );
       
   118         }
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CXnEffectManager::BeginFullscreenEffectL
    79 // CXnEffectManager::BeginFullscreenEffectL
   123 // -----------------------------------------------------------------------------
    80 // -----------------------------------------------------------------------------
   124 //
    81 //
   125 void CXnEffectManager::BeginFullscreenEffectL( TInt aId, CXnViewData& aView )
    82 void CXnEffectManager::BeginFullscreenEffectL( TInt aId, CXnViewData& aView )
   126     {
    83     {
   127     // Only one fullscreen effect at time
    84     // Only one fullscreen effect at time
   128     if ( EffectCount( KEffectTypeFullscreen ) != 0 )
    85     if ( iEffects.Count() != 0 )
   129         {
    86         {
   130         return;
    87         return;
   131         }
    88         }
   132     
    89     
   133     TXnEffect* effect = new (ELeave) TXnEffect;
    90     TXnEffect* effect = new (ELeave) TXnEffect;
   134     CleanupStack::PushL( effect );
    91     CleanupStack::PushL( effect );
   135     effect->iId = aId;
    92     effect->iId = aId;
   136     effect->iType = KEffectTypeFullscreen;
       
   137     effect->iNode = aView.ViewNode();
    93     effect->iNode = aView.ViewNode();
   138     iEffects.AppendL( effect );
    94     iEffects.AppendL( effect );
   139     CleanupStack::Pop( effect );
    95     CleanupStack::Pop( effect );
   140     
    96     
   141     if ( !aView.ViewNode()->IsLaidOut() )
    97     if ( !aView.ViewNode()->IsLaidOut() )
   155 void CXnEffectManager::UiRendered()
   111 void CXnEffectManager::UiRendered()
   156     {
   112     {
   157     for ( TInt i = 0; i < iEffects.Count(); )
   113     for ( TInt i = 0; i < iEffects.Count(); )
   158         {
   114         {
   159         TXnEffect* effect = iEffects[i];
   115         TXnEffect* effect = iEffects[i];
   160         if ( effect && effect->iState == KEffectStarted )
   116         if ( effect &&
   161             {
   117              effect->iState == KEffectStarted )
   162             if ( effect->iType == KEffectTypeFullscreen )
   118             {
   163                 {
   119             GfxTransEffect::EndFullScreen();
   164                 GfxTransEffect::EndFullScreen();
       
   165                 }
       
   166             else if ( effect->iType == KEffectTypeControl )
       
   167                 {
       
   168                 GfxTransEffect::End( effect->iNode->Control() );
       
   169                 }
       
   170             RemoveEffect( effect );
   120             RemoveEffect( effect );
   171             }
   121             }
   172         else
   122         else
   173             {
   123             {
   174             i++;
   124             i++;
   186         {
   136         {
   187         TBool effectStarted = ETrue;
   137         TBool effectStarted = ETrue;
   188         TXnEffect* effect = iEffects[i];
   138         TXnEffect* effect = iEffects[i];
   189         if ( effect && effect->iNode &&
   139         if ( effect && effect->iNode &&
   190              effect->iState == KWaitForLayout &&
   140              effect->iState == KWaitForLayout &&
   191              effect->iNode->IsLaidOut())
   141              effect->iNode->IsLaidOut() )
   192             {
   142             {
   193             if ( effect->iType == KEffectTypeFullscreen )
   143             effectStarted = DoBeginFullscreenEffect( *effect );
   194                 {
       
   195                 effectStarted = DoBeginFullscreenEffect( *effect );
       
   196                 }
       
   197             else if ( effect->iType == KEffectTypeControl )
       
   198                 {
       
   199                 effectStarted = DoBeginControlEffect( *effect );
       
   200                 }
       
   201             }
   144             }
   202         
   145         
   203         if ( effectStarted )
   146         if ( effectStarted )
   204             {
   147             {
   205             i++;
   148             i++;
   238     aEffect.iState = KEffectStarted;
   181     aEffect.iState = KEffectStarted;
   239     return ETrue;
   182     return ETrue;
   240     }
   183     }
   241 
   184 
   242 // -----------------------------------------------------------------------------
   185 // -----------------------------------------------------------------------------
   243 // CXnEffectManager::DoBeginControlEffect
       
   244 // -----------------------------------------------------------------------------
       
   245 //
       
   246 TBool CXnEffectManager::DoBeginControlEffect( TXnEffect& aEffect )
       
   247     {
       
   248     TBool ret = EFalse;
       
   249     CCoeEnv* coe( CCoeEnv::Static() );
       
   250            
       
   251     if ( coe->WsSession().GetFocusWindowGroup() != 
       
   252          coe->RootWin().Identifier() )
       
   253         {
       
   254         // Window group is not focused
       
   255         return ret;
       
   256         }
       
   257 
       
   258     // Set effect begin point
       
   259     if ( aEffect.iNode )
       
   260         {
       
   261         GfxTransEffect::Begin( aEffect.iNode->Control() , aEffect.iId );
       
   262         aEffect.iState = KEffectStarted;
       
   263         ret = ETrue;
       
   264         }
       
   265     
       
   266     return ret;
       
   267     }
       
   268 
       
   269 // -----------------------------------------------------------------------------
       
   270 // CXnEffectManager::RemoveEffect
   186 // CXnEffectManager::RemoveEffect
   271 // -----------------------------------------------------------------------------
   187 // -----------------------------------------------------------------------------
   272 //
   188 //
   273 void CXnEffectManager::RemoveEffect( TXnEffect* aEffect )
   189 void CXnEffectManager::RemoveEffect( TXnEffect* aEffect )
   274     {
   190     {
   279         iEffects.Remove( index );
   195         iEffects.Remove( index );
   280         delete temp;
   196         delete temp;
   281         }
   197         }
   282     }
   198     }
   283 
   199 
   284 // -----------------------------------------------------------------------------
       
   285 // CXnEffectManager::EffectCount
       
   286 // -----------------------------------------------------------------------------
       
   287 //
       
   288 TInt CXnEffectManager::EffectCount( TInt aType )
       
   289     {
       
   290     TInt effectCount = 0;
       
   291     TInt count = iEffects.Count();
       
   292     for ( TInt i = 0; i < count; i++ )
       
   293         {
       
   294         if ( iEffects[i]->iType == aType )
       
   295             {
       
   296             effectCount++;
       
   297             }
       
   298         }
       
   299     return effectCount;
       
   300     }
       
   301 
       
   302 //  End of File
   200 //  End of File