uifw/AknGlobalUI/AknCapServer/src/winchangemonitor.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-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:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include "winchangemonitor.h"
       
    19 #include <apgwgnam.h>
       
    20 #include <featmgr.h>
       
    21 #include <apgtask.h>
       
    22 
       
    23 #include <gfxtranseffect/gfxtranseffect.h>
       
    24 #include <akntranseffect.h> // for Transition effect enumerations
       
    25 #include <akntransitionutils.h>
       
    26 
       
    27 #ifdef WCPLOG
       
    28 #include <flogger.h>
       
    29 #define LOG(x) Log(_L(x))
       
    30 #define LOGF(x, y) Log(_L(x), y);
       
    31 
       
    32 void Log(const TDesC& aStr, TInt aVal = 0)
       
    33     {
       
    34 //#ifdef __WINS__
       
    35     RDebug::Print(_L("%S : %d"), &aStr, aVal);
       
    36 //#else
       
    37     RFileLogger::WriteFormat(
       
    38         _L("effects"),
       
    39         _L("wcp.txt"),
       
    40         EFileLoggingModeOverwrite,
       
    41         _L("%S : %d"), &aStr, aVal);
       
    42 //#endif
       
    43     }
       
    44 #else
       
    45 #define LOG(x)
       
    46 #define LOGF(x, y)
       
    47 #endif  
       
    48    
       
    49 CWindowChangeMonitor* CWindowChangeMonitor::NewL(RWsSession& aSession)
       
    50     {
       
    51     LOG("CWindowChangeMonitor::NewL");
       
    52     if(!FeatureManager::FeatureSupported(KFeatureIdUiTransitionEffects))
       
    53         {
       
    54         // This is only place where flag was used since calling it is slow, after that this ptr
       
    55         // indicates its presense.
       
    56         return NULL; 
       
    57         }
       
    58     LOG("KFeatureIdUiTransitionEffects - ok");
       
    59     CWindowChangeMonitor* wc = new (ELeave) CWindowChangeMonitor(aSession);
       
    60     CleanupStack::PushL(wc);
       
    61     wc->ConstructL();   
       
    62     CleanupStack::Pop();
       
    63     return wc;
       
    64     }
       
    65     
       
    66 CWindowChangeMonitor::CWindowChangeMonitor(RWsSession& aSession) : iSession(aSession)
       
    67     {
       
    68     }
       
    69     
       
    70 void CWindowChangeMonitor::ConstructL()
       
    71     {
       
    72     }
       
    73         
       
    74 CWindowChangeMonitor::~CWindowChangeMonitor()
       
    75     {
       
    76     }
       
    77    
       
    78 void CWindowChangeMonitor::PartialWgChangeL(TInt aWg)   
       
    79     {
       
    80     if(iAborted != 0)
       
    81         {
       
    82         return;
       
    83         }
       
    84     iAborted = aWg;
       
    85     GfxTransEffect::NotifyExternalState( ENotifyGlobalAbort );
       
    86     GfxTransEffect::AbortFullScreen();
       
    87     }
       
    88     
       
    89 void CWindowChangeMonitor::WgChangeL(TInt aFirstWg)
       
    90     {
       
    91     CApaWindowGroupName* name = CApaWindowGroupName::NewLC(iSession, aFirstWg);
       
    92     iNxtUid = name->AppUid();
       
    93     iCurrentWg = aFirstWg; 
       
    94     
       
    95     if(iNxtUid != iCurrentUid)
       
    96         {
       
    97         const TInt flags = AknTransEffect::TParameter::EFlagNone;
       
    98         GfxTransEffect::BeginFullScreen(
       
    99             AknTransEffect::EApplicationActivate, 
       
   100             TRect(0,0,0,0),
       
   101             AknTransEffect::EParameterType, 
       
   102             AknTransEffect::GfxTransParam(iNxtUid, iCurrentUid, flags)); 
       
   103         }
       
   104     CleanupStack::PopAndDestroy();  
       
   105     iAborted = 0;
       
   106     }
       
   107     
       
   108 void  CWindowChangeMonitor::SetWgL(TInt aFirstWg)
       
   109     {
       
   110     if(iCurrentWg != aFirstWg)
       
   111         {
       
   112         iCurrentWg = aFirstWg; 
       
   113         CApaWindowGroupName* name = CApaWindowGroupName::NewLC(iSession, aFirstWg);
       
   114         iNxtUid = name->AppUid();
       
   115         CleanupStack::PopAndDestroy();
       
   116         }
       
   117     iCurrentUid = iNxtUid;
       
   118     iAborted = 0;
       
   119     }
       
   120  
       
   121 // End of file