uifw/AvKon/src/AknViewAppUi.cpp
branchRCL_3
changeset 20 d48ab3b357f1
parent 19 aecbbf00d063
equal deleted inserted replaced
19:aecbbf00d063 20:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    25 #include <eikcolib.h>
    25 #include <eikcolib.h>
    26 #include <eikapp.h>
    26 #include <eikapp.h>
    27 #include <aknclearer.h>
    27 #include <aknclearer.h>
    28 #include <AknUtils.h>
    28 #include <AknUtils.h>
    29 #include <akntoolbar.h>
    29 #include <akntoolbar.h>
       
    30 #include <akntranseffect.h>
       
    31 #include <centralrepository.h>
       
    32 
       
    33 
    30 #include "aknview.h"
    34 #include "aknview.h"
    31 #include "aknshut.h"
    35 #include "aknshut.h"
    32 #include "aknenv.h"
    36 #include "aknenv.h"
    33 #include "AknPanic.h"
    37 #include "AknPanic.h"
    34 #ifdef RD_SPLIT_VIEW
    38 #ifdef RD_SPLIT_VIEW
    41 #include "aknViewAppUi.h"
    45 #include "aknViewAppUi.h"
    42 
    46 
    43 // CONSTANTS
    47 // CONSTANTS
    44 const TInt KAknAppUiViewsGranularity = 1;
    48 const TInt KAknAppUiViewsGranularity = 1;
    45 const TInt KAknViewAsyncPriority = EActivePriorityRedrawEvents + 10;
    49 const TInt KAknViewAsyncPriority = EActivePriorityRedrawEvents + 10;
       
    50 
       
    51 
    46 #ifdef RD_SPLIT_VIEW
    52 #ifdef RD_SPLIT_VIEW
    47 const TInt KAknSplitViewSize = 2;
    53 const TInt KAknSplitViewSize = 2;
    48 
    54 
    49 // MODULE DATA STRUCTURES
    55 // MODULE DATA STRUCTURES
    50 enum TAknViewAppUiFlags
    56 enum TAknViewAppUiFlags
   226 	    
   232 	    
   227 #ifdef RD_SPLIT_VIEW
   233 #ifdef RD_SPLIT_VIEW
   228 	iExtension->iNavigator = new ( ELeave ) CAknViewNavigator( this );
   234 	iExtension->iNavigator = new ( ELeave ) CAknViewNavigator( this );
   229 	AddToStackL( iExtension->iNavigator, ECoeStackPriorityDefault - 1, ECoeStackFlagRefusesFocus );
   235 	AddToStackL( iExtension->iNavigator, ECoeStackPriorityDefault - 1, ECoeStackFlagRefusesFocus );
   230 #endif // RD_SPLIT_VIEW
   236 #endif // RD_SPLIT_VIEW
   231 	
   237 
   232 	if ( iEikonEnv->RootWin().OrdinalPosition() == 0 && // only clear the window for foreground apps
   238 	// Only clear the window for foreground apps.
       
   239 	if ( iEikonEnv->RootWin().OrdinalPosition() == 0 &&
   233 	     iExtension->iUseDefaultScreenClearer )
   240 	     iExtension->iUseDefaultScreenClearer )
   234 		{
   241         {
   235 		iClearer = CAknLocalScreenClearer::NewL( ETrue );
   242 	    if ( !iEikonEnv->StartedAsServerApp() )
   236 		}
   243             {
       
   244             iClearer = CAknLocalScreenClearer::NewL( ETrue );
       
   245             }
       
   246         else
       
   247             {
       
   248             iClearer = CAknLocalScreenClearer::NewL( ETrue, ETrue );
       
   249             }
       
   250         }
   237 	}
   251 	}
   238 
   252 
   239 // -----------------------------------------------------------------------------
   253 // -----------------------------------------------------------------------------
   240 // CAknViewAppUi::~CAknViewAppUi
   254 // CAknViewAppUi::~CAknViewAppUi
   241 // Destructor.
   255 // Destructor.
   245 	{
   259 	{
   246 #ifdef RD_SPLIT_VIEW
   260 #ifdef RD_SPLIT_VIEW
   247 	if (iExtension && iExtension->iNavigator )
   261 	if (iExtension && iExtension->iNavigator )
   248 	    RemoveFromStack( iExtension->iNavigator );
   262 	    RemoveFromStack( iExtension->iNavigator );
   249 #endif // RD_SPLIT_VIEW
   263 #endif // RD_SPLIT_VIEW
   250 	
   264 
   251     // Hide application toolbar to prevent it from showing 
   265     // Hide application toolbar to prevent it from showing 
   252     // after views are deleted
   266     // after views are deleted
   253     if ( CAknAppUi::CurrentFixedToolbar() )
   267     if ( CAknAppUi::CurrentFixedToolbar() )
   254         {
   268         {
   255         CAknAppUi::CurrentFixedToolbar()->SetToolbarVisibility( EFalse );   
   269         CAknAppUi::CurrentFixedToolbar()->SetToolbarVisibility( EFalse );
   256         }
   270         }
   257 
   271 
   258 	delete iClearer;
   272     delete iClearer;
   259 	delete iShutter;
   273     delete iShutter;
   260 	delete iActivationTick;
   274     delete iActivationTick;
   261 	
   275 
   262 	if ( iActivationQueue )
   276 	if ( iActivationQueue )
   263 		{
   277 		{
   264 		iActivationQueue->ResetAndDestroy();
   278 		iActivationQueue->ResetAndDestroy();
   265 		delete iActivationQueue;
   279 		delete iActivationQueue;
   266 		}
   280 		}
   310 	{
   324 	{
   311 	const TInt count( iViews->Count() );
   325 	const TInt count( iViews->Count() );
   312 	
   326 	
   313 	for ( TInt i = 0; i < count; ++i )
   327 	for ( TInt i = 0; i < count; ++i )
   314 		{
   328 		{
   315 		CAknView* view( iViews->At( i ) );
   329         CAknView* view( iViews->At( i ) );
   316 		
   330         if ( view->Id() == aViewId )
   317 		if ( view->Id() == aViewId )
   331             {
   318 			{
   332             // remove the deleted view from iExtensione's list. Or the pointer 
   319 			iViews->Delete( i );
   333             // is invalid 
   320 			CCoeAppUi::DeregisterView( *view );
   334             TInt index = iExtension->iActiveViews.Find(view);
   321 			delete view;
   335             if ( index >= 0 && index < iExtension->iActiveViews.Count() )
   322 			return;
   336                 {
   323 			}
   337                 iExtension->iActiveViews.Remove(index);
       
   338                 view->AknViewDeactivated();
       
   339                 } 
       
   340                 
       
   341                 iViews->Delete( i );
       
   342                 CCoeAppUi::DeregisterView( *view );
       
   343                 delete view;
       
   344                 return;
       
   345             }
   324 		}
   346 		}
   325 	}
   347 	}
   326 
   348 
   327 // -----------------------------------------------------------------------------
   349 // -----------------------------------------------------------------------------
   328 // CAknViewAppUi::View
   350 // CAknViewAppUi::View
   609             
   631             
   610             // Number of views is always smaller than already reserved array 
   632             // Number of views is always smaller than already reserved array 
   611             // (default granularity is 8) -> no memory allocation failures.
   633             // (default granularity is 8) -> no memory allocation failures.
   612             if ( splitView )
   634             if ( splitView )
   613                 {
   635                 {
   614                 iExtension->iActiveViews.Append( View( splitView->iViewIds[0] ) );
   636                 error = iExtension->iActiveViews.Append( View( splitView->iViewIds[0] ) );
   615                 iExtension->iActiveViews.Append( View( splitView->iViewIds[1] ) );
   637                 if (KErrNone == error)
       
   638                     {
       
   639                     error = iExtension->iActiveViews.Append( View( splitView->iViewIds[1] ) );
       
   640                     }
   616                 }
   641                 }
   617             else
   642             else
   618                 {
   643                 {
   619                 iExtension->iActiveViews.Append( item->iNewView );
   644                 error = iExtension->iActiveViews.Append( item->iNewView );
   620                 }
   645                 }
   621 
   646 
   622             iView = item->iNewView;
   647             iView = item->iNewView;
   623             }
   648             }
   624         else
   649         else