uifw/EikStd/coctlsrc/AknClearer.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 57 be7054131a1e
equal deleted inserted replaced
55:aecbbf00d063 56:d48ab3b357f1
     1 /*
     1 /*
     2 * Copyright (c) 2002-2007 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".
    18 
    18 
    19 #include <eikappui.h>
    19 #include <eikappui.h>
    20 #include <eikspane.h>
    20 #include <eikspane.h>
    21 #include "aknclearer.h"
    21 #include "aknclearer.h"
    22 #include <aknconsts.h>
    22 #include <aknconsts.h>
    23 #include <aknnavi.h>
       
    24 #include <avkon.mbg>
    23 #include <avkon.mbg>
    25 #include <AknLayout.lag>
    24 #include <AknLayout.lag>
    26 #include <AknSgcc.h>
    25 #include <AknSgcc.h>
    27 #include <AknUtils.h>
    26 #include <AknUtils.h>
    28 #include <AknsUtils.h>
    27 #include <AknsUtils.h>
    34 #include <AknsDrawUtils.h>
    33 #include <AknsDrawUtils.h>
    35 #include <mifconvdefs.h>
    34 #include <mifconvdefs.h>
    36 #include <aknlayoutscalable_avkon.cdl.h>
    35 #include <aknlayoutscalable_avkon.cdl.h>
    37 #include <layoutmetadata.cdl.h>
    36 #include <layoutmetadata.cdl.h>
    38 #include <AknStatuspaneUtils.h>
    37 #include <AknStatuspaneUtils.h>
       
    38 #include <alf/alfcompositionutility.h>
    39 
    39 
    40 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    40 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    41 #include <uikon/eikenvinterface.h> 
    41 #include <uikon/eikenvinterface.h> 
    42 #endif
    42 #endif
    43 
    43 
    48 #include <akntransitionutils.h>
    48 #include <akntransitionutils.h>
    49 #endif
    49 #endif
    50 
    50 
    51 enum TAknScreenClearerBaseFlags
    51 enum TAknScreenClearerBaseFlags
    52 	{
    52 	{
    53 	EAknScreenClearerDrawNavi,
    53 	EAknScreenClearerBlankAppStatusPane
    54 	EAknScreenClearerBlankAppStatusPane,
       
    55 	EAknScreenClearerDrawNaviSolid,
       
    56 	};
    54 	};
    57 
    55 
    58 enum 
    56 enum 
    59     {
    57     {
    60     ELayerCbaBackground=0,
    58     ELayerBackground = 0,
    61     ELayerBackground = 1,
    59     ELayerExtension = 1,
    62     ELayerExtension = 2,
    60     ELayerStripe = 2,
    63     ELayerStripe = 3,
    61     ELayerWallpaper = 3,
    64     ELayerWallpaper = 4,
    62     ELayerN = 4
    65     ELayerN = 5
       
    66     };
    63     };
    67 
       
    68     enum 
       
    69         {
       
    70         ELayerStaconCbaBackground=0,
       
    71         ELayerStaconTop = 1,
       
    72         ELayerStaconBottom = 2,
       
    73         ELayerStaconMain = 3,
       
    74         ELayerStaconWallpaper = 4,
       
    75         ELayerStaconN = 5
       
    76         };
       
    77 
    64 
    78 enum 
    65 enum 
    79     {
    66     {
    80     ELayerFlatCbaBackground=0,
    67     ELayerStaconTop = 0,
    81     ELayerFlatBackground = 1,
    68     ELayerStaconBottom = 1,
    82     ELayerFlatTl = 2,
    69     ELayerStaconMain = 2,
    83     ELayerFlatTr = 3,
    70     ELayerStaconWallpaper = 3,
    84     ELayerFlatBl = 4,
    71     ELayerStaconN = 4
    85     ELayerFlatBr = 5,
    72     };
    86     ELayerFlatT = 6,
    73 
    87     ELayerFlatB = 7,
    74 enum 
    88     ELayerFlatR = 8,
    75     {
    89     ELayerFlatL = 9,
    76     ELayerFlatBackground = 0,
    90     ELayerFlatCenter = 10,
    77     ELayerFlatTl = 1,
    91     ELayerFlatMain = 11,
    78     ELayerFlatTr = 2,
    92     ELayerFlatWallpaper = 12,
    79     ELayerFlatBl = 3,
    93     ELayerSCtrl1 = 13,
    80     ELayerFlatBr = 4,
    94     ELayerSCtrl2 = 14,
    81     ELayerFlatT = 5,
    95     ELayerSCtrl3 = 15,
    82     ELayerFlatB = 6,
    96     ELayerSCtrl4 = 16,
    83     ELayerFlatR = 7,
    97     ELayerSCtrl5 = 17,
    84     ELayerFlatL = 8,
    98     ELayerFlatN = 18
    85     ELayerFlatCenter = 9,
       
    86     ELayerFlatMain = 10,
       
    87     ELayerFlatWallpaper = 11,
       
    88     ELayerFlatN = 12
    99     };
    89     };
   100 
    90 
   101 
    91 
   102 class CAknScreenClearerBaseExtension : public CBase
    92 class CAknScreenClearerBaseExtension : public CBase
   103     {
    93     {
   104     public:
    94 public:
   105         ~CAknScreenClearerBaseExtension()
    95     ~CAknScreenClearerBaseExtension()
   106             {
    96         {
   107             delete iNaviWipe;
    97         delete iBgContext;
   108             delete iNaviMask;
    98         }
   109             delete iBgContext;
    99 public:
   110             }
   100     CAknsLayeredBackgroundControlContext* iBgContext;
   111     public:
   101     TInt iOrdinalPosition;
   112 	    CFbsBitmap* iNaviWipe;
   102 	TBool iTransparent;
   113         CFbsBitmap* iNaviMask;
       
   114         CAknsLayeredBackgroundControlContext* iBgContext;
       
   115         TInt iOrdinalPosition;
       
   116     };
   103     };
   117 
   104 
   118 /* THIS FUNCTION IS NOT USED
   105 
   119 
   106 EXPORT_C CAknScreenClearerBase::~CAknScreenClearerBase()
   120 static void LoadAndFlipBitmapL( 
   107 	{
   121     CFbsBitmap* aTrg, const TDesC& aFile, const TInt aIndex )
   108     delete iExtension;
       
   109 	}
       
   110 
       
   111 
       
   112 void CAknScreenClearerBase::CreateExtensionL()
       
   113 	{
       
   114 	if ( !iExtension )
       
   115 		{
       
   116 		iExtension = new (ELeave) CAknScreenClearerBaseExtension;
       
   117 		}
       
   118 	}
       
   119 
       
   120 
       
   121 void CAknScreenClearerBase::SetTransparent( TBool aTransparent )
   122     {
   122     {
   123     User::LeaveIfNull(aTrg);
   123     iExtension->iTransparent = aTransparent;
   124 
       
   125     CFbsBitmap* sourceBitmap = new (ELeave) CFbsBitmap();   
       
   126     CleanupStack::PushL(sourceBitmap);
       
   127     User::LeaveIfError(sourceBitmap->Load(aFile, aIndex, ETrue));    
       
   128     TSize sourceBitmapSize = sourceBitmap->SizeInPixels();
       
   129 
       
   130     User::LeaveIfError(aTrg->Create(sourceBitmapSize, sourceBitmap->DisplayMode()));
       
   131 
       
   132     CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( aTrg );
       
   133     CleanupStack::PushL(destinationDevice);
       
   134 
       
   135     CFbsBitGc* destinationGc;
       
   136     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
   137 
       
   138     TRect sourceBitmapBlittingRect( 0,0,1,sourceBitmapSize.iHeight );  
       
   139 
       
   140     for ( TInt xPos=sourceBitmapSize.iWidth-1; xPos >= 0; xPos-- )
       
   141         {
       
   142         destinationGc->BitBlt( TPoint(xPos,0), sourceBitmap, sourceBitmapBlittingRect );
       
   143         sourceBitmapBlittingRect.iTl.iX++;
       
   144         sourceBitmapBlittingRect.iBr.iX++;
       
   145         }
       
   146 
       
   147     delete destinationGc;  
       
   148     CleanupStack::PopAndDestroy(2); // sourceBitmap, destinationDevice
       
   149     }
   124     }
   150 */
   125 
   151 
       
   152 /* THIS FUNCTION IS NOT USED
       
   153 
       
   154 static CFbsBitmap* FlipBitmapL( CFbsBitmap* aBitmap )
       
   155     {
       
   156     User::LeaveIfNull(aBitmap);   
       
   157 
       
   158     TSize sourceBitmapSize = aBitmap->SizeInPixels();
       
   159 
       
   160     // get a copy of wanted rect of source bitmap to tmpBitmap
       
   161     CFbsBitmap* tmpBitmap = new (ELeave) CFbsBitmap();   
       
   162     CleanupStack::PushL( tmpBitmap );                      
       
   163 
       
   164     User::LeaveIfError( tmpBitmap->Create( sourceBitmapSize, aBitmap->DisplayMode() ) );
       
   165 
       
   166     CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( tmpBitmap );
       
   167     CleanupStack::PushL( destinationDevice );
       
   168     
       
   169     CFbsBitGc* destinationGc;
       
   170     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );           
       
   171     
       
   172     TRect sourceBitmapBlittingRect( 0,0,1,sourceBitmapSize.iHeight );  
       
   173     
       
   174     for ( TInt xPos=sourceBitmapSize.iWidth-1; xPos >= 0; xPos-- )
       
   175         {
       
   176         destinationGc->BitBlt( TPoint(xPos,0), aBitmap, sourceBitmapBlittingRect );
       
   177         sourceBitmapBlittingRect.iTl.iX++;
       
   178         sourceBitmapBlittingRect.iBr.iX++;
       
   179         }
       
   180     
       
   181     delete destinationGc;  
       
   182     CleanupStack::PopAndDestroy(); // destinationDevice
       
   183     CleanupStack::Pop(); // tmpBitmap
       
   184   
       
   185     return tmpBitmap;
       
   186     }
       
   187 */
       
   188 
       
   189 EXPORT_C CAknScreenClearerBase::~CAknScreenClearerBase()
       
   190 	{
       
   191     delete iExtension;
       
   192 	}
       
   193 
   126 
   194 EXPORT_C void CAknScreenClearerBase::ConstructL(RWindowGroup& aParent, TInt aOrdinalPos, TBool aBlankAppStatusPane)
   127 EXPORT_C void CAknScreenClearerBase::ConstructL(RWindowGroup& aParent, TInt aOrdinalPos, TBool aBlankAppStatusPane)
   195 	{
   128 	{
   196     iExtension = new (ELeave) CAknScreenClearerBaseExtension();
   129 	CreateExtensionL();
   197 
   130 
   198 	CreateWindowL(&aParent);
   131 	CreateWindowL(&aParent);
       
   132 
       
   133 	if ( iExtension->iTransparent )
       
   134 		{
       
   135 		EnableWindowTransparency();
       
   136 		}
       
   137 
       
   138     CAlfEffectObserver* alfEffectObserver = CAlfEffectObserver::NewL(); 
       
   139     alfEffectObserver->SetDistractionWindow(*DrawableWindow());
       
   140     delete alfEffectObserver;
   199 
   141 
   200 	iFlags.Assign(EAknScreenClearerBlankAppStatusPane, aBlankAppStatusPane);
   142 	iFlags.Assign(EAknScreenClearerBlankAppStatusPane, aBlankAppStatusPane);
   201 
   143 
   202 	SetShapeL();
   144 	SetShapeL();
   203 
   145 
   224 
   166 
   225 EXPORT_C void CAknScreenClearerBase::Draw(const TRect& /*aRect*/) const
   167 EXPORT_C void CAknScreenClearerBase::Draw(const TRect& /*aRect*/) const
   226 	{
   168 	{
   227 	CWindowGc& gc = SystemGc();
   169 	CWindowGc& gc = SystemGc();
   228     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   170     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   229     AknsDrawUtils::Background( skin, iExtension->iBgContext, this, gc, Rect() );
   171 
   230 
   172     if ( !iExtension->iTransparent )
   231 	if (Layout_Meta_Data::IsPenEnabled() && Layout_Meta_Data::IsLandscapeOrientation())
   173         {
   232 		{
   174         AknsDrawUtils::Background( skin, iExtension->iBgContext, this, gc, Rect() );
   233 #if 0
   175         }
   234 	    TRect application_window( KWholeScreen );
   176     else
   235 		TAknLayoutRect area_side_right_pane;
   177         {
   236 		TInt variety = 0;
   178         gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
   237 		area_side_right_pane.LayoutRect(application_window, AknLayoutScalable_Avkon::area_side_right_pane(variety));
   179         gc.Clear( Rect() );
   238 
   180         gc.Reset();
   239 		CFbsBitmap *mask1 = AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskLsc );
   181         }
   240 		CFbsBitmap *mask5 = AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskLsc );
       
   241 
       
   242 		CFbsBitmap *bitmap = new(ELeave)CFbsBitmap;
       
   243 		CleanupStack::PushL(bitmap);
       
   244 		bitmap->Create(area_side_right_pane.Rect().Size(), EColor16MA);
       
   245         CFbsBitGc* bitmapContext = NULL;
       
   246         CFbsBitmapDevice* bitmapDevice =
       
   247             CFbsBitmapDevice::NewL( bitmap );
       
   248         CleanupStack::PushL( bitmapDevice );
       
   249         bitmapDevice->CreateContext( bitmapContext );
       
   250         CleanupStack::PushL( bitmapContext );
       
   251 
       
   252         TRect area_side_right_pane_rect = area_side_right_pane.Rect();
       
   253         area_side_right_pane_rect.iTl = TPoint(0,0);
       
   254         
       
   255 		TAknLayoutRect sctrl_sk_top_pane;
       
   256 		sctrl_sk_top_pane.LayoutRect(area_side_right_pane_rect, AknLayoutScalable_Avkon::sctrl_sk_top_pane(0));
       
   257 	
       
   258 		TAknLayoutRect sctrl_sk_bottom_pane;
       
   259 		sctrl_sk_bottom_pane.LayoutRect(area_side_right_pane_rect, AknLayoutScalable_Avkon::sctrl_sk_bottom_pane(0));
       
   260 	
       
   261 		TAknLayoutRect grid_sctrl_middle_pane;
       
   262 		grid_sctrl_middle_pane.LayoutRect(area_side_right_pane_rect, AknLayoutScalable_Avkon::grid_sctrl_middle_pane(0));
       
   263 	
       
   264 		TAknLayoutRect cell_sctrl_middle_pane1;
       
   265 		cell_sctrl_middle_pane1.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,0));
       
   266 		TAknLayoutRect cell_sctrl_middle_pane2;
       
   267 		cell_sctrl_middle_pane2.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,1));
       
   268 		TAknLayoutRect cell_sctrl_middle_pane3;
       
   269 		cell_sctrl_middle_pane3.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,2));
       
   270 	
       
   271 		AknsDrawUtils::DrawFrame( skin, *bitmapContext, sctrl_sk_top_pane.Rect(), Convert(sctrl_sk_top_pane.Rect()), KAknsIIDQgnFrSctrlSkButton, KAknsIIDQgnFrSctrlSkButtonCenter);
       
   272 		AknsDrawUtils::DrawFrame( skin, *bitmapContext, cell_sctrl_middle_pane1.Rect(), Convert2(cell_sctrl_middle_pane1.Rect()), KAknsIIDQgnFrSctrlButton, KAknsIIDQgnFrSctrlButtonCenter);
       
   273 		AknsDrawUtils::DrawFrame( skin, *bitmapContext, cell_sctrl_middle_pane2.Rect(), Convert2(cell_sctrl_middle_pane2.Rect()), KAknsIIDQgnFrSctrlButton, KAknsIIDQgnFrSctrlButtonCenter);
       
   274 		AknsDrawUtils::DrawFrame( skin, *bitmapContext, cell_sctrl_middle_pane3.Rect(), Convert2(cell_sctrl_middle_pane3.Rect()), KAknsIIDQgnFrSctrlButton, KAknsIIDQgnFrSctrlButtonCenter);
       
   275 		AknsDrawUtils::DrawFrame( skin, *bitmapContext, sctrl_sk_bottom_pane.Rect(), Convert(sctrl_sk_bottom_pane.Rect()), KAknsIIDQgnFrSctrlSkButton, KAknsIIDQgnFrSctrlSkButtonCenter);
       
   276 
       
   277 		TSize size1 = sctrl_sk_top_pane.Rect().Size();
       
   278 		TSize size5 = sctrl_sk_bottom_pane.Rect().Size();
       
   279         AknIconUtils::SetSize(mask1, size1, EAspectRatioNotPreserved);
       
   280         AknIconUtils::SetSize(mask5, size5, EAspectRatioNotPreserved);
       
   281 
       
   282 		gc.BitBltMasked( area_side_right_pane.Rect().iTl+sctrl_sk_top_pane.Rect().iTl, bitmap, sctrl_sk_top_pane.Rect(), mask1, EFalse);
       
   283         gc.BitBltMasked( area_side_right_pane.Rect().iTl+sctrl_sk_bottom_pane.Rect().iTl, bitmap, sctrl_sk_bottom_pane.Rect(), mask5, EFalse);
       
   284 		
       
   285         CleanupStack::PopAndDestroy(3); // bitmap, bitmapdevice, bitmapcontext
       
   286 #endif
       
   287 		}
       
   288 
       
   289 
   182 
   290     iEikonEnv->WsSession().Flush();
   183     iEikonEnv->WsSession().Flush();
   291     return;
   184     return;
   292 	}
   185 	}
   293 	
   186 	
   316     RRegion appStatuspaneShape;
   209     RRegion appStatuspaneShape;
   317 	CleanupClosePushL(appStatuspaneShape);
   210 	CleanupClosePushL(appStatuspaneShape);
   318 
   211 
   319 	CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
   212 	CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
   320     
   213     
   321     if (iFlags[EAknScreenClearerBlankAppStatusPane])
   214 	// Set the clearer window's size so that it covers the screen in both
   322         {
   215 	// portrait and landscape orientations simultaneously.
   323         shape.AddRect(KWholeScreen);
   216 	// This is done in order to prevent NGA from drawing control groups
       
   217 	// underneath the fullscreen foreground application in cases the clearer
       
   218 	// orientation can't be readily updated during the layout switch, due
       
   219 	// to e.g. application startup taking a long time.
       
   220 	// Note that only the clearer window's size is set to be larger, the
       
   221 	// skin background is still the screen size so that the skin background
       
   222 	// won't get stretched.
       
   223 	TRect screenRect( KWholeScreen );
       
   224 	TRect squareScreenRect( screenRect );
       
   225     if ( squareScreenRect.Width() > squareScreenRect.Height() )
       
   226         {
       
   227         squareScreenRect.SetHeight( squareScreenRect.Width() );
   324         }
   228         }
   325     else
   229     else
   326         {
   230         {
   327         shape.AddRect(KWholeScreen);
   231         squareScreenRect.SetWidth( squareScreenRect.Height() );
   328 		sp->GetShapeL(appStatuspaneShape, !iFlags[EAknScreenClearerBlankAppStatusPane], ETrue);
   232         }
   329         shape.SubRegion(appStatuspaneShape);
   233 	
   330         }
   234     if ( iFlags[EAknScreenClearerBlankAppStatusPane] )
   331 
   235         {
   332 	if (shape.CheckError())
   236         shape.AddRect( squareScreenRect );
   333 		User::Leave(KErrNoMemory);
   237         }
   334 
   238     else
   335 	SetRect(KWholeScreen);
   239         {
   336 	DrawableWindow()->SetShape(shape);
   240         // Square shape is used only if the clearer is used to clear the
   337 
   241         // whole screen.
   338 	CleanupStack::PopAndDestroy(2);		// close shapes	
   242         shape.AddRect( screenRect );
   339 
   243 		sp->GetShapeL( appStatuspaneShape,
   340 	TBool drawNavi =
   244 		               !iFlags[EAknScreenClearerBlankAppStatusPane],
   341 		iFlags[EAknScreenClearerBlankAppStatusPane] && 
   245 		               ETrue );
   342 		sp->IsVisible() && 
   246         shape.SubRegion( appStatuspaneShape );
   343 		sp->PaneCapabilities(TUid::Uid(EEikStatusPaneUidNavi)).IsInCurrentLayout();
   247         }
   344 
   248 
   345 	iFlags.Assign(EAknScreenClearerDrawNavi, drawNavi);
   249 	if ( shape.CheckError() )
       
   250 	    {
       
   251 		User::Leave( KErrNoMemory );
       
   252 	    }
       
   253 
       
   254 	SetRect( iFlags[EAknScreenClearerBlankAppStatusPane] ? squareScreenRect :
       
   255                                                            screenRect );
       
   256 	DrawableWindow()->SetShape( shape );
       
   257 
       
   258 	CleanupStack::PopAndDestroy( 2, &shape ); // close shapes
   346 	}
   259 	}
   347 
   260 
   348 
   261 
   349 
   262 
   350 void CAknScreenClearerBase::SetSkinShapeL()
   263 void CAknScreenClearerBase::SetSkinShapeL()
   352     for (TInt n=0; n<ELayerFlatN; n++)
   265     for (TInt n=0; n<ELayerFlatN; n++)
   353         {
   266         {
   354         iExtension->iBgContext->SetLayerImage( n, KAknsIIDNone );                
   267         iExtension->iBgContext->SetLayerImage( n, KAknsIIDNone );                
   355         }            
   268         }            
   356 
   269 
   357     TBool widescreenPaneUsed(
   270     CAknEnv* aknEnv = AVKONENV;
   358         R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL ==
       
   359             AVKONENV->StatusPaneResIdForCurrentLayout(
       
   360                 R_AVKON_STATUS_PANE_LAYOUT_USUAL ) ||
       
   361         R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE ==
       
   362             AVKONENV->StatusPaneResIdForCurrentLayout(
       
   363                 R_AVKON_STATUS_PANE_LAYOUT_IDLE ) );
       
   364     
   271     
   365     // Check that if in landscape mode statuspane is changed to stacon pane
   272     TInt usualSpLayout =
   366     TBool staconPaneUsedInLandscape = 
   273         aknEnv->StatusPaneResIdForCurrentLayout(
   367         ( ( R_AVKON_STATUS_PANE_LAYOUT_USUAL !=
   274             R_AVKON_STATUS_PANE_LAYOUT_USUAL );
   368                 AVKONENV->StatusPaneResIdForCurrentLayout(
   275     
   369                     R_AVKON_STATUS_PANE_LAYOUT_USUAL ) ) &&
   276     TInt idleSpLayout =
   370           ( R_AVKON_STATUS_PANE_LAYOUT_USUAL_MIRRORED !=
   277         aknEnv->StatusPaneResIdForCurrentLayout(
   371                 AVKONENV->StatusPaneResIdForCurrentLayout(
   278             R_AVKON_STATUS_PANE_LAYOUT_IDLE );
   372                     R_AVKON_STATUS_PANE_LAYOUT_USUAL ) ) );
   279     
   373 
   280     TBool widescreenPaneUsed =
       
   281         ( usualSpLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL ) ||
       
   282         ( idleSpLayout  == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE );
       
   283     
   374     TBool flatStatuspaneusedInLandscape =
   284     TBool flatStatuspaneusedInLandscape =
   375         ( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ==
   285         ( usualSpLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) ||
   376             AVKONENV->StatusPaneResIdForCurrentLayout(
   286         ( usualSpLayout == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT );
   377                 R_AVKON_STATUS_PANE_LAYOUT_USUAL ) );
       
   378     
   287     
   379 
   288 
   380     // TRect application_window = iAvkonAppUi->ApplicationRect();
   289     // TRect application_window = iAvkonAppUi->ApplicationRect();
   381     // This is sometimes needed before iAvkonAppUi->ApplicationRect() is updated
   290     // This is sometimes needed before iAvkonAppUi->ApplicationRect() is updated
   382     TRect application_window( KWholeScreen );
   291     TRect application_window( KWholeScreen );
   539 
   448 
   540             TBool staconPaneRight = EFalse;
   449             TBool staconPaneRight = EFalse;
   541             CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
   450             CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
   542             if (statusPane)
   451             if (statusPane)
   543                 {
   452                 {
   544                 TInt currentStatusPaneLayoutResId = AVKONENV->StatusPaneResIdForCurrentLayout(statusPane->CurrentLayoutResId());
   453                 TInt currentStatusPaneLayoutResId = aknEnv->StatusPaneResIdForCurrentLayout(statusPane->CurrentLayoutResId());
   545 
   454 
   546                 staconPaneRight = ((currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT) ||
   455                 staconPaneRight = ((currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT) ||
   547                                    (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT) ||
   456                                    (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_EMPTY_SOFTKEYS_RIGHT) ||
   548                                    (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT));
   457                                    (currentStatusPaneLayoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT));
   549 
   458 
   564             iExtension->iBgContext->SetLayerImage( 4, KAknsIIDNone );
   473             iExtension->iBgContext->SetLayerImage( 4, KAknsIIDNone );
   565                         
   474                         
   566             iExtension->iBgContext->SetLayerRect( 0, main_pane.Rect() );
   475             iExtension->iBgContext->SetLayerRect( 0, main_pane.Rect() );
   567             iExtension->iBgContext->SetLayerRect( 1, staconTop );
   476             iExtension->iBgContext->SetLayerRect( 1, staconTop );
   568             iExtension->iBgContext->SetLayerRect( 2, staconBottom );
   477             iExtension->iBgContext->SetLayerRect( 2, staconBottom );
   569             }                        
   478             }
   570 
       
   571 	if (Layout_Meta_Data::IsPenEnabled())
       
   572 		{
       
   573 		TAknLayoutRect area_side_right_pane;
       
   574 		TInt variety = 0;
       
   575 		area_side_right_pane.LayoutRect(application_window, AknLayoutScalable_Avkon::area_side_right_pane(variety));
       
   576 
       
   577 		TAknLayoutRect sctrl_sk_top_pane;
       
   578 		sctrl_sk_top_pane.LayoutRect(area_side_right_pane.Rect(), AknLayoutScalable_Avkon::sctrl_sk_top_pane(0));
       
   579 	
       
   580 		TAknLayoutRect sctrl_sk_bottom_pane;
       
   581 		sctrl_sk_bottom_pane.LayoutRect(area_side_right_pane.Rect(), AknLayoutScalable_Avkon::sctrl_sk_bottom_pane(0));
       
   582 	
       
   583 		TAknLayoutRect grid_sctrl_middle_pane;
       
   584 		grid_sctrl_middle_pane.LayoutRect(area_side_right_pane.Rect(), AknLayoutScalable_Avkon::grid_sctrl_middle_pane(0));
       
   585 	
       
   586 		TAknLayoutRect cell_sctrl_middle_pane1;
       
   587 		cell_sctrl_middle_pane1.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,0));
       
   588 		TAknLayoutRect cell_sctrl_middle_pane2;
       
   589 		cell_sctrl_middle_pane2.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,1));
       
   590 		TAknLayoutRect cell_sctrl_middle_pane3;
       
   591 		cell_sctrl_middle_pane3.LayoutRect(grid_sctrl_middle_pane.Rect(), AknLayoutScalable_Avkon::cell_sctrl_middle_pane(0,0,2));
       
   592 	
       
   593 
       
   594 
       
   595 		iExtension->iBgContext->SetLayerImage( ELayerFlatCbaBackground, KAknsIIDQsnBgScreen );
       
   596 
       
   597 
       
   598 		iExtension->iBgContext->SetLayerRect( ELayerFlatCbaBackground, application_window );
       
   599 		}
       
   600 
       
   601 
       
   602 
       
   603 
       
   604         }
   479         }
   605     else
   480     else
   606         {
   481         {
   607         // Default is portrait 
   482         // Default is portrait 
   608         TInt spRes = CEikStatusPaneBase::Current()->CurrentLayoutResId();
   483         TInt spRes = CEikStatusPaneBase::Current()->CurrentLayoutResId();
   740 	CEikonEnv& eikEnv = *static_cast<CEikonEnv*>(self->ControlEnv());
   615 	CEikonEnv& eikEnv = *static_cast<CEikonEnv*>(self->ControlEnv());
   741 	self->ConstructL(eikEnv.RootWin(), 0, aBlankAppStatusPane);
   616 	self->ConstructL(eikEnv.RootWin(), 0, aBlankAppStatusPane);
   742 	return(self);
   617 	return(self);
   743 	}
   618 	}
   744 
   619 
       
   620 
       
   621 EXPORT_C CAknLocalScreenClearer* CAknLocalScreenClearer::NewLC(TBool aBlankAppStatusPane, TBool aTransparent)
       
   622 	{
       
   623 	CAknLocalScreenClearer* self=new(ELeave) CAknLocalScreenClearer;
       
   624 	CleanupStack::PushL(self);
       
   625 	self->CreateExtensionL();
       
   626 	self->SetTransparent(aTransparent);
       
   627 	CEikonEnv& eikEnv = *static_cast<CEikonEnv*>(self->ControlEnv());
       
   628 	self->ConstructL(eikEnv.RootWin(), 0, aBlankAppStatusPane);
       
   629 	return(self);
       
   630 	}
       
   631 
       
   632 
   745 EXPORT_C CAknLocalScreenClearer* CAknLocalScreenClearer::NewL(TBool aBlankAppStatusPane)
   633 EXPORT_C CAknLocalScreenClearer* CAknLocalScreenClearer::NewL(TBool aBlankAppStatusPane)
   746 	{
   634 	{
   747 	CAknLocalScreenClearer* self = CAknLocalScreenClearer::NewLC(aBlankAppStatusPane);
   635 	CAknLocalScreenClearer* self = CAknLocalScreenClearer::NewLC(aBlankAppStatusPane);
   748 	CleanupStack::Pop(self);
   636 	CleanupStack::Pop(self);
   749 	return(self);
   637 	return(self);
   750 	}
   638 	}
   751 	
   639 
       
   640 
       
   641 EXPORT_C CAknLocalScreenClearer* CAknLocalScreenClearer::NewL(TBool aBlankAppStatusPane, TBool aTransparent)
       
   642 	{
       
   643 	CAknLocalScreenClearer* self = CAknLocalScreenClearer::NewLC(aBlankAppStatusPane, aTransparent);
       
   644 	CleanupStack::Pop(self);
       
   645 	return(self);
       
   646 	}
       
   647 
       
   648 
   752 EXPORT_C void CAknLocalScreenClearer::HandleResourceChange(TInt aType)
   649 EXPORT_C void CAknLocalScreenClearer::HandleResourceChange(TInt aType)
   753 	{
   650 	{
   754 	if (aType == KEikDynamicLayoutVariantSwitch)
   651 	if (aType == KEikDynamicLayoutVariantSwitch)
   755 		{
   652 		{
   756 		SetShapeL();
   653         TRAP_IGNORE(
   757 		SetSkinShapeL();
   654             SetShapeL();
       
   655             SetSkinShapeL();
       
   656             );
   758 		DrawDeferred();		
   657 		DrawDeferred();		
   759 		}
   658 		}
   760 	}
   659 	}
   761 	
   660