uifw/EikStd/coctlsrc/eikspane.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 64 85902f042028
--- a/uifw/EikStd/coctlsrc/eikspane.cpp	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/EikStd/coctlsrc/eikspane.cpp	Wed Sep 01 12:16:19 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -69,8 +69,6 @@
 /** This flag is used to turn redraw storing on/off in status pane. */
 const TInt KEnableRedrawStoring = ETrue;
 
-const TUid KActiveIdle2Uid = {0x102750F0};
-
 inline void CEikStatusPaneBase::TPaneCapabilities::SetPresent()
     {
     iFlags |= KStatusPaneCapsPresentBit;
@@ -301,6 +299,24 @@
 	return EFalse;
 	}
 
+// ----------------------------------------------------------------------------
+// Sets the container control for the specified control and updates the
+// the whole parent hierarchy.
+// ----------------------------------------------------------------------------
+//
+static void SetContainersL( CCoeControl& aControl,
+                            const CCoeControl& aContainer )
+    {
+    aControl.SetContainerWindowL( aContainer );
+
+    TInt count = aControl.CountComponentControls();
+
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CCoeControl* child = aControl.ComponentControl( i );
+        SetContainersL( *child, aControl );
+        }
+    }
 
 // ---------------------------------------------------------------------------
 // Helper method to compose two layout lines together.
@@ -1146,6 +1162,39 @@
     */
     void HandleResourceChange( TInt aType );
 
+    /**
+     * Sets the parent window of the container control and the child controls
+     * inside it.
+     * 
+     * @param  aParentWindowGroup   If not @c NULL, then the control is made
+     *                              window-owning with this window group
+     *                              as parent.
+     * @param  aParentControl       Control to be set as parent. Note that
+     *                              specifying this parameter has no effect
+     *                              if the @c aParentWindowGroup is not
+     *                              @c NULL.
+     * @param  aRedrawStoreHandler  Pointer to the redraw store handler should
+     *                              be also passed if @c aParentWindowGroup
+     *                              is specified.
+     * @param  aTransparent         Whether or not the control is transparent.
+     * @param  aIsFaded             Whether or not the control's window should
+     *                              be faded or not.
+     */
+    void SetParentWindowL( RWindowGroup* aParentWindowGroup,
+                           CCoeControl* aParentControl,
+                           CRedrawStoreHandler* aRedrawStoreHandler,
+                           TBool aTransparent,
+                           TBool aIsFaded );
+    
+    /**
+     * Sets the container control transparency.
+     * The background drawer is used if transparency is not enabled.
+     * 
+     * @param  aBackground  The background drawer.
+     */
+    void SetTransparency( TBool aTransparent,
+                          MCoeControlBackground* aBackground );
+
 public: // From base class @c CCoeControl.
 
     /**
@@ -1341,19 +1390,6 @@
     SetMopParent( iEikonEnv->EikAppUi() );
 
     CreateWindowL( aParent );
-    
-    //This is added for homescreen transparent
-    CEikApplication* app = iEikonEnv->EikAppUi()->Application();
-    if ( app && app->AppDllUid() == KActiveIdle2Uid  )
-        {
-        if( KErrNone == Window().SetTransparencyAlphaChannel())
-            Window().SetBackgroundColor(~0);
-        }
-    else
-        {
-        Window().SetBackgroundColor(
-        iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) );
-        }
 
     // This helps for unsyncronized undimming problems.
     aRedrawStoreHandler.SetStore( &Window(), KEnableRedrawStoring );
@@ -2237,105 +2273,194 @@
         case R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT:
         case R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT: // fallthrough
             {
-            TBool idleLayout =
-                aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT;
-
-            TAknLayoutRect flatWideStatusPane;
-            flatWideStatusPane.LayoutRect(
-                application_window,
-                DoCompose( AknLayoutScalable_Avkon::area_top_pane( 19 ),
-                           AknLayoutScalable_Avkon::status_pane( 4 ) ).LayoutLine() );
-            TRect spRect( flatWideStatusPane.Rect() );
-
-            if ( idleLayout )
+            if ( aContextNumber == 0 )
                 {
-                aBgContext->SetLayerImage( ELayerFlatWallpaper, KAknsIIDWallpaper );
-                aBgContext->SetLayerRect( ELayerFlatWallpaper, screen );
-                maskIID  = KAknsIIDQgnGrafBgLscTopMaskIcon;
-                maskRect = spRect;
+                // We use frame as layered context so that we can avoid having
+                // two separate background contexts in this class.
+                // In any case frame context is implemented using layered
+                // context so this should be quite ok thing to do.
+
+                TAknLayoutRect layoutRect;
+                layoutRect.LayoutRect(
+                    application_window,
+                    AknLayoutScalable_Avkon::area_top_pane( 2 ) );
+                TRect topLayoutRect( layoutRect.Rect() );
+
+                layoutRect.LayoutRect(
+                    topLayoutRect,
+                    AknLayoutScalable_Avkon::status_pane( 1 ) );
+                TRect spRect( layoutRect.Rect() );
+
+                layoutRect.LayoutRect(
+                    spRect,
+                    AknLayoutScalable_Avkon::bg_status_flat_pane( 0 ) );
+                TRect bgRect( layoutRect.Rect() );
+
+                if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
+                    {
+                    TAknLayoutRect extension;
+                    extension.LayoutRect(
+                        application_window,
+                        AknLayoutScalable_Avkon::main_pane( 4 ) );
+
+                    // Wallpaper
+                    aBgContext->SetLayerImage( ELayerFlatWallpaper,
+                                               KAknsIIDWallpaper );
+                    aBgContext->SetLayerRect(  ELayerFlatWallpaper, screen );
+
+                    // Main pane
+                    aBgContext->SetLayerImage( ELayerFlatMain,
+                                               KAknsIIDQsnBgAreaMainIdle );
+                    aBgContext->SetLayerRect( ELayerFlatMain,
+                                              extension.Rect() );
+
+                    // Skin background, transparency support
+                    aBgContext->SetLayerImage( ELayerFlatBackground,
+                                               KAknsIIDQsnBgScreenIdle );
+                    aBgContext->SetLayerRect(  ELayerFlatBackground,
+                                               topLayoutRect );
+
+                    // CBA area
+                    aBgContext->SetLayerImage( ELayerFlatCba,
+                                               KAknsIIDQsnBgAreaControlIdle );
+                    aBgContext->SetLayerRect( ELayerFlatCba, cbaRect );
+                    }
+                 else
+                    { // Not Idle.
+                    // Main pane
+                    aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
+
+                    // Wallpaper
+                    aBgContext->SetLayerImage( ELayerFlatWallpaper,
+                                               KAknsIIDNone );
+
+                    // Skin background, transparency support
+                    aBgContext->SetLayerImage( ELayerFlatBackground,
+                                               KAknsIIDQsnBgScreen );
+                    aBgContext->SetLayerRect( ELayerFlatBackground, screen );
+
+                    // CBA area
+                    aBgContext->SetLayerImage( ELayerFlatCba, aCbaBgID );
+                    aBgContext->SetLayerRect( ELayerFlatCba, cbaRect );
+                    }
+
+                MAknsSkinInstance* si = AknsUtils::SkinInstance();
+                CAknsItemData* idata  = NULL;
+                if ( si )
+                    {
+                    TRAP_IGNORE(
+                        idata = si->CreateUncachedItemDataL(
+                            KAknsIIDQsnFrStatusFlat, EAknsITImageTable ) );
+                    }
+
+                if ( idata ) // 9 piece frame used
+                    {
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g2() );
+                    aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
+                    aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g3() );
+                    aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
+                    aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g4() );
+                    aBgContext->SetLayerImage( ELayerFlatBl, KAknsIIDQsnFrStatusFlatCornerBl );
+                    aBgContext->SetLayerRect( ELayerFlatBl, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g5() );
+                    aBgContext->SetLayerImage( ELayerFlatBr, KAknsIIDQsnFrStatusFlatCornerBr );
+                    aBgContext->SetLayerRect( ELayerFlatBr, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g6() );
+                    aBgContext->SetLayerImage( ELayerFlatT,  KAknsIIDQsnFrStatusFlatSideT);
+                    aBgContext->SetLayerRect( ELayerFlatT, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g7() );
+                    aBgContext->SetLayerImage( ELayerFlatB, KAknsIIDQsnFrStatusFlatSideB );
+                    aBgContext->SetLayerRect( ELayerFlatB, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g9() );
+                    aBgContext->SetLayerImage( ELayerFlatR, KAknsIIDQsnFrStatusFlatSideR );
+                    aBgContext->SetLayerRect( ELayerFlatR, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g8() );
+                    aBgContext->SetLayerImage( ELayerFlatL, KAknsIIDQsnFrStatusFlatSideL );
+                    aBgContext->SetLayerRect( ELayerFlatL, layoutRect.Rect() );
+
+                    layoutRect.LayoutRect( bgRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g1() );
+                    aBgContext->SetLayerImage( ELayerFlatCenter, KAknsIIDQsnFrStatusFlatCenter );
+                    aBgContext->SetLayerRect( ELayerFlatCenter, layoutRect.Rect() );
+
+                    if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
+                        {
+                        maskIID = KAknsIIDQgnGrafBgLscTopMaskIcon;
+                        maskRect = spRect;
+                        }
+                    }
+                else // handle one piece version here
+                    {
+                    if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
+                        {
+                        // Wallpaper
+                        aBgContext->SetLayerImage( ELayerFlatWallpaper,
+                                                   KAknsIIDWallpaper );
+                        aBgContext->SetLayerRect( ELayerFlatWallpaper,
+                                                  staconTop );
+
+                        // Skin background
+                        aBgContext->SetLayerImage( ELayerFlatBackground,
+                                                   KAknsIIDQsnFrStatusFlat );
+                        aBgContext->SetLayerRect( ELayerFlatBackground,
+                                                  bgRect );
+
+                        // Set all other frame parts empty as they
+                        // might already be filled with something
+                        for ( TInt n = ELayerFlatBackground + 1; n <= ELayerFlatCenter; n++ )
+                           {
+                           aBgContext->SetLayerImage( n, KAknsIIDNone );
+                           }
+
+                        maskIID = KAknsIIDQgnGrafBgLscTopMaskIcon;
+                        maskRect = spRect;
+                        }
+                    else
+                        {
+                        aBgContext->SetLayerImage( ELayerFlatWallpaper,
+                                                   KAknsIIDQsnFrStatusFlat );
+                        aBgContext->SetLayerRect( ELayerFlatWallpaper,
+                                                  bgRect );
+
+                        // Set all other frame parts empty as they
+                        // might already be filled with something
+                        for ( TInt n = ELayerFlatBackground; n <= ELayerFlatCenter; n++ )
+                            {
+                            aBgContext->SetLayerImage( n, KAknsIIDNone );
+                            }
+                        }
+                    }
+
+                delete idata;
                 }
-
-            aBgContext->SetLayerImage( ELayerFlatMain, KAknsIIDNone );
-
-            aBgContext->SetLayerImage( ELayerFlatCba, KAknsIIDNone );
-
-            MAknsSkinInstance* si = AknsUtils::SkinInstance();
-            CAknsItemData* idata = NULL;
-            if ( si )
+            else // context == 1 - this is the area removed from CBA for clock
+                 // and indicator panes.
                 {
-                TRAP_IGNORE(
-                    idata = si->CreateUncachedItemDataL( KAknsIIDQsnFrStatusFlat,
-                                                         EAknsITImageTable ) );
-                }
-
-            if ( idata ) // 9 piece frame used
-                {
-                if ( aCbaBgID == KAknsIIDQsnBgAreaControlMp )
+                if ( aLayoutId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT )
                     {
-                    aBgContext->SetLayerImage( ELayerFlatBackground,
-                                               KAknsIIDQsnBgScreenMp );
+                    aBgContext->SetLayerImage( ELayerFlatCbaWp,
+                                               KAknsIIDWallpaper );
+                    aBgContext->SetLayerRect( ELayerFlatCbaWp, screen );
+
+                    maskIID = KAknsIIDQgnGrafBgLscBottomMaskIcon;
+                    maskRect = cbaRect;
                     }
                 else
                     {
-                    aBgContext->SetLayerImage(
-                        ELayerFlatBackground,
-                        idleLayout ? KAknsIIDQsnBgScreenIdle :
-                                     KAknsIIDQsnBgScreen );
+                    aBgContext->SetLayerImage( ELayerFlatCbaWp, KAknsIIDNone );
                     }
-                aBgContext->SetLayerRect( ELayerFlatBackground, screen );
-
-                TAknWindowLineLayout layout( AknLayoutScalable_Avkon::bg_status_flat_pane_g2().LayoutLine() );
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatTl, KAknsIIDQsnFrStatusFlatCornerTl );
-                aBgContext->SetLayerRect( ELayerFlatTl, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g3().LayoutLine();
-                layoutRect.LayoutRect( spRect, AknLayoutScalable_Avkon::bg_status_flat_pane_g3() );
-                aBgContext->SetLayerImage( ELayerFlatTr, KAknsIIDQsnFrStatusFlatCornerTr );
-                aBgContext->SetLayerRect( ELayerFlatTr, layoutRect.Rect());
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g4().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatBl, KAknsIIDQsnFrStatusFlatCornerBl );
-                aBgContext->SetLayerRect( ELayerFlatBl, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g5().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatBr, KAknsIIDQsnFrStatusFlatCornerBr );
-                aBgContext->SetLayerRect( ELayerFlatBr, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g6().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatT,  KAknsIIDQsnFrStatusFlatSideT);
-                aBgContext->SetLayerRect( ELayerFlatT, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g7().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatB, KAknsIIDQsnFrStatusFlatSideB );
-                aBgContext->SetLayerRect( ELayerFlatB, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g9().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatR, KAknsIIDQsnFrStatusFlatSideR );
-                aBgContext->SetLayerRect( ELayerFlatR, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g8().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatL, KAknsIIDQsnFrStatusFlatSideL );
-                aBgContext->SetLayerRect( ELayerFlatL, layoutRect.Rect() );
-
-                layout = AknLayoutScalable_Avkon::bg_status_flat_pane_g1().LayoutLine();
-                layoutRect.LayoutRect( spRect, layout );
-                aBgContext->SetLayerImage( ELayerFlatCenter, KAknsIIDQsnFrStatusFlatCenter );
-                aBgContext->SetLayerRect( ELayerFlatCenter, layoutRect.Rect() );
-
-                delete idata;
-                }
-            else
-                {
-                aBgContext->SetLayerImage( ELayerFlatBackground,
-                                           KAknsIIDQsnFrStatusFlat );
-                aBgContext->SetLayerRect( ELayerFlatBackground, spRect );
+
+                aBgContext->SetLayerImage( ELaterFlatCbaSkin,
+                                           KAknsIIDQsnBgAreaControlIdle );
+                aBgContext->SetLayerRect( ELaterFlatCbaSkin, cbaRect );
                 }
 
             break;
@@ -2474,6 +2599,106 @@
 
 
 // ---------------------------------------------------------------------------
+// Sets the parent window of the container control and the child controls
+// inside it.
+// ---------------------------------------------------------------------------
+//
+void CEikStatusPaneContainer::SetParentWindowL(
+    RWindowGroup* aParentWindowGroup,
+    CCoeControl* aParentControl,
+    CRedrawStoreHandler* aRedrawStoreHandler,
+    TBool aTransparent,
+    TBool aIsFaded )
+    {
+    if ( aParentWindowGroup )
+        {
+            
+        SetMopParent( iEikonEnv->EikAppUi() );
+        SetParent( NULL );
+
+        // Maintain the window's ordinal position.
+        TInt ordinalPos = Window().OrdinalPosition();
+
+        if ( OwnsWindow() )
+            {
+            CloseWindow();
+            }
+
+        CreateWindowL( aParentWindowGroup );
+        
+		RWindow& window = Window();
+        if ( aRedrawStoreHandler )
+            {
+            aRedrawStoreHandler->SetStore( &window, KEnableRedrawStoring );
+            }
+        
+        // Enable the transparency only in HomeScreen where it's needed
+        // for performance reasons.
+        if ( aTransparent && window.SetTransparencyAlphaChannel() == KErrNone )
+            {
+            window.SetBackgroundColor( ~0 );
+            }
+        else
+            {
+            window.SetBackgroundColor(
+                iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) );
+            }
+        
+        window.SetPointerGrab( ETrue );
+        window.SetShadowDisabled( ETrue );
+        window.SetNonFading( !LafStatusPaneContainer::AllowFading() );
+        EnableDragEvents();
+
+        SetContainersL( *iControl, *this );
+
+        //these 2 lines is to fix the error ou1cimx1#390645
+        MakeVisible( ETrue );
+        MakeVisible( EFalse );
+		
+        window.SetFaded( aIsFaded, RWindowTreeNode::EFadeIncludeChildren );
+        window.SetOrdinalPosition( ordinalPos );
+        
+        ActivateL();
+        }
+    else if ( aParentControl )
+        {
+        SetContainersL( *this, *aParentControl );
+        MakeVisible( aParentControl->IsVisible() );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Sets the container control transparency.
+// ---------------------------------------------------------------------------
+//
+void CEikStatusPaneContainer::SetTransparency(
+    TBool aTransparent,
+    MCoeControlBackground* aBackground )
+    {
+    RWindow& window = Window();
+
+    if ( aTransparent )
+        {
+        if ( window.SetTransparencyAlphaChannel() == KErrNone )
+            {
+            window.SetBackgroundColor( ~0 );
+            }
+        }
+    else
+        {
+        window.SetBackgroundColor(
+            iEikonEnv->ControlColor( EColorStatusPaneBackground, *this ) );
+        }
+    
+    // Skin background is not drawn for the subpane if it's transparent
+    // OR if it's a child of another subpane.
+    TBool drawBackground( Parent() ? NULL : !aTransparent );
+    SetBackground( drawBackground ? aBackground : NULL );
+    }
+
+
+// ---------------------------------------------------------------------------
 // CEikStatusPaneContainer::Draw
 // Draws the pane.
 // ---------------------------------------------------------------------------
@@ -2653,7 +2878,8 @@
 /**
  * Internal extension class
  */
-class CEikStatusPaneBaseExtension : public CBase
+class CEikStatusPaneBaseExtension : public CBase,
+                                    public MCoeControlBackground
     {
 public:
     static CEikStatusPaneBaseExtension* NewL()
@@ -2675,6 +2901,24 @@
         {
         };
 
+    // From base class MCoeControlBackground
+    // This is used for drawing background of all status pane containers.
+    void Draw( CWindowGc& aGc,
+               const CCoeControl& aControl,
+               const TRect& aRect ) const
+        {
+        if ( iCommonBgContext )
+            {
+            AknsDrawUtils::DrawBackground( AknsUtils::SkinInstance(),
+                                           AknsDrawUtils::ControlContext( &aControl ),
+                                           &aControl,
+                                           aGc,
+                                           aRect.iTl,
+                                           aRect,
+                                           KAknsDrawParamNoClearUnderImage );
+            }
+        }
+		
 public:
 
     /** Resource id that last has been reuqested by app using switch layout. */
@@ -2800,6 +3044,11 @@
 	    	}
     	}
 
+    // Check if combined pane was used in the previous status pane layout
+    // to avoid unnecessary subpane parent hierarchy changes.
+    TBool combinedPaneInOldLayout(
+        PaneCapabilities(
+            TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
 
     // If AknLayout system is used for placing statuspane elements, then
     // we need to be less strict when new layout is applied or size change
@@ -2831,6 +3080,16 @@
 		// Need to refresh the model's layout.
 	    iModel->AknLayoutRefresh();
 
+        // Update the combined pane's subpane parent hierarchy if necessary. 
+        TBool combinedPaneInCurrentLayout(
+            PaneCapabilities(
+                TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
+        if ( !COMPARE_BOOLS( combinedPaneInOldLayout,
+                             combinedPaneInCurrentLayout ) )
+            {
+            SetCombinedPaneVisibilityL( combinedPaneInCurrentLayout );
+            }
+
         TBool drawNavi = ETrue;
 
 		if ( clearer )
@@ -2992,7 +3251,65 @@
 		}
 
 	CCoeControl* oldControl = cont->Control();
+	
+	// Make the old control invisible and effectively remove it from data
+    // subscriber's observer array. This ensures that:
+	//
+	// 1. Old control won't receive messages about layout switch etc.
+	// 2. Old control doesn't try to draw. It must be prevented because its
+	//    window might be invalid due to layout change.
+	if ( oldControl )
+	    {
+        oldControl->MakeVisible( EFalse );
+        
+        TInt count = oldControl->CountComponentControls();
+        
+        for ( TInt i = 0; i < count; ++i )
+            {
+            CCoeControl* child = oldControl->ComponentControl( i );
+            
+            if ( child )
+                {
+                child->MakeVisible( EFalse );
+                }
+            }
+	    }
+	
+	// Make the new control visible and so that it gets added to data
+	// subscriber's observer array. This is only done if the new control is
+    // properly constructed before swapping, i.e. it already
+    // has a container window set.
+	if ( aNewControl && aNewControl->DrawableWindow() )
+	    {
+        SetContainersL( *aNewControl, *cont );
+
+        if ( cont->IsVisible() )
+            {
+            aNewControl->MakeVisible( ETrue );
+
+            TInt count = aNewControl->CountComponentControls();
+            
+            for ( TInt i = 0; i < count; ++i )
+                {
+                CCoeControl* child = aNewControl->ComponentControl( i );
+                
+                if ( child )
+                    {
+                    child->MakeVisible( ETrue );
+                    }
+                }
+            }
+	    }
+	
 	cont->SetControl( aNewControl );
+	
+	// ensure that indicator's priorities etc are up-to-date
+	CAknStatusPaneDataSubscriber* subscriber = DataSubscriber();
+	
+	if ( subscriber )
+	    {
+        subscriber->RefreshDataL();
+	    }
 
 	return oldControl;
 	}
@@ -3081,6 +3398,11 @@
 	iControls =
 	    new (ELeave) CContainerControls( KEikStatusPaneControlGranularity );
 	CreatePanesL();
+	
+	SetCombinedPaneVisibilityL(
+	    PaneCapabilities(
+            TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() );
+	
 	ApplyLayoutL( iModel->CurrentLayout(), ENoDraw );
 
 	// Clearer is not needed anymore if all panes are drawn in app side.
@@ -3129,6 +3451,9 @@
             iExtension->iCommonBgContext->GetControlContext( 1 ) ),
         iExtension->iDataSubscriber,
         *iExtension->iRedrawStoreHandler );
+
+    cont->SetBackground( iExtension );
+
     CleanupStack::PushL( cont );
     iControls->AppendL( cont );
     CleanupStack::Pop( cont );
@@ -3164,7 +3489,9 @@
     // has two background contextes.
     if ( ( layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_LEFT ||
            layoutResId == R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT ||
-           layoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ) )
+           layoutResId == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ||
+           layoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT ||
+           layoutResId == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) )
         {
         partOfCombinedContext =
             iExtension->iCommonBgContext->GetControlContext( 1 );
@@ -3510,6 +3837,66 @@
     }
 
 
+// ---------------------------------------------------------------------------
+// CEikStatusPaneBase::SetCombinedPaneVisibility
+// Updates the parent hierarchy of subpanes in the combined pane based
+// on whether or not the combined pane is used in the current status pane
+// layout.
+// ---------------------------------------------------------------------------
+//
+void CEikStatusPaneBase::SetCombinedPaneVisibilityL( TBool aVisible )
+    {
+    CEikStatusPaneContainer* combinedPane =
+        Find( TUid::Uid( EEikStatusPaneUidCombined ) );
+    if ( combinedPane )
+        {
+        CCoeControl* combinedPaneControl = combinedPane->Control();
+        
+        TBool transparencyEnabled( IsTransparent() );
+        
+        // The subpane container controls inside combined pane are it's
+        // component controls.
+        TInt count( combinedPaneControl->CountComponentControls() );
+
+        TBool isFaded( IsFaded() );
+
+        for ( TInt i = 0; i < count; ++i )
+            {
+            CEikStatusPaneContainer* subPane =
+                static_cast<CEikStatusPaneContainer*>(
+                    combinedPaneControl->ComponentControl( i ) );
+            if ( subPane )
+                {
+                if ( aVisible )
+                    {
+                    subPane->SetParentWindowL( NULL,
+                                               combinedPaneControl,
+                                               NULL,
+                                               transparencyEnabled,
+                                               isFaded );
+
+                    // Background is drawn by the combined pane so remove
+                    // the subpane's own background drawer. 
+                    subPane->SetBackground( NULL );
+                    }
+                else
+                    {
+                    subPane->SetParentWindowL(
+                        iParentWindowGroup,
+                        NULL,
+                        iExtension ? iExtension->iRedrawStoreHandler : NULL,
+                        transparencyEnabled,
+                        isFaded );
+
+                    subPane->SetBackground( transparencyEnabled ? NULL :
+                                                                  iExtension );
+                    }
+                }
+            }
+        }
+    }
+
+
 /**
  * Visitor class for collecting the sub-pane areas to a single region.
  */
@@ -3601,8 +3988,52 @@
 	{
 	MakeVisible( aFlags & KEikStatusPaneBaseVisibleBit );
 	SetDimmed( aFlags & KEikStatusPaneBaseDimmedBit );
+	EnableTransparent( aFlags & KStatusPaneTransparentBit );
 	}
 
+// ---------------------------------------------------------------------------
+// CEikStatusPaneBase::EnableTransparent
+// Enables transparency in the status pane.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CEikStatusPaneBase::EnableTransparent( TBool aTransparent )
+    {
+    if ( COMPARE_BOOLS( aTransparent, IsTransparent() ) )
+        {
+        return;
+        }
+
+    if ( aTransparent )
+        {
+        iFlags |= KStatusPaneTransparentBit;
+        }
+    else
+        {
+        iFlags &= ~KStatusPaneTransparentBit;
+        }
+
+    // Change the subpane window background colour and background drawer
+    // based on the transparency.
+    const TInt count = iControls->Count();
+    for ( TInt ii = 0; ii < count; ++ii )
+        {
+        iControls->At( ii )->SetTransparency( aTransparent, iExtension );
+        }
+    
+    DoDrawNow( EDrawDeferred );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CEikStatusPaneBase::IsTransparent
+// Checks if the status pane has transparency enabled.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CEikStatusPaneBase::IsTransparent() const
+    {
+    return iFlags & KStatusPaneTransparentBit;
+    }
+
 
 // ---------------------------------------------------------------------------
 // CEikStatusPaneBase::Flags