uifw/AvKon/src/aknnavi.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 64 85902f042028
--- a/uifw/AvKon/src/aknnavi.cpp	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/AvKon/src/aknnavi.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"
@@ -57,6 +57,8 @@
 #include "AknDebug.h"
 
 const TInt KAknNaviPaneStackGranularity = 2;
+
+#define Min( x , y ) ((( x ) < ( y )) ? ( x ) : ( y ))
 /**
 * Extension class for CAknNavigationControlContainer.
 */
@@ -67,12 +69,11 @@
     ~CAknNavigationControlContainerExtension(){};
 
 public:
-    TInt                        iCurrentColorScheme;
     CAknNaviForegroundObserver* iForegroundObserver;
     TBool                       iDestructionOngoing;
     CFbsBitmap*                 iNaviColorBitmap;
     TInt                        iPreferredNaviDecoratorLayoutStyle;
-    TBool                       iIsActiveIdle;
+    CEikStatusPaneBase*         iStatusPane;
     };
 
 
@@ -142,10 +143,9 @@
         {
         iExtension =
             new (ELeave) CAknNavigationControlContainerExtension();
-        iExtension->iCurrentColorScheme = ColorScheme();
         iExtension->iForegroundObserver =
             CAknNaviForegroundObserver::NewL( this );
-        iExtension->iIsActiveIdle = AknStatuspaneUtils::IsActiveIdle();
+        iExtension->iStatusPane = CEikStatusPaneBase::Current();
         }
 
     if ( !iNaviPaneControls )
@@ -1396,7 +1396,7 @@
             // Volume popup's position must be set here.
             iNaviPaneControls->At( last )->iDecoratedControl->SetRect(
                 VolumePopupRect() );
-            if( last - 1 >= 0 )
+            if( last - 1 >= 0 && iNaviPaneControls->At( last - 1 ) )
             	{
             		iNaviPaneControls->At( last - 1 )->SetRect( rect );
             	}
@@ -1454,17 +1454,12 @@
         CCoeControl::HandleResourceChange( aType ) ;
         }
 
-    if ( aType == KEikColorResourceChange ||
-         aType == KEikDynamicLayoutVariantSwitch ||
+    if ( aType == KEikDynamicLayoutVariantSwitch ||
          aType == KAknsMessageSkinChange )
         {
-        TInt colorScheme = ColorScheme();
-        if ( colorScheme != iExtension->iCurrentColorScheme ||
-             aType == KEikDynamicLayoutVariantSwitch ||
+        if ( aType == KEikDynamicLayoutVariantSwitch ||
              aType == KAknsMessageSkinChange )
             {
-            iExtension->iCurrentColorScheme = colorScheme;
-
             // updating color bitmap
             TRAP_IGNORE( LoadNaviColorBitmapL() );
             }
@@ -1577,13 +1572,29 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C void CAknNavigationControlContainer::Draw(
-    const TRect& /*aRect*/ ) const
+    const TRect& aRect ) const
     {
-    if ( iExtension->iIsActiveIdle )
+    if ( iExtension->iStatusPane && 
+         iExtension->iStatusPane->IsTransparent() )
         {
+        CWindowGc& gc = SystemGc();
+        TRgb rgb(TRgb::Color16MA(0));
+        gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+        gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
+        gc.SetBrushColor(rgb);
+        gc.Clear(aRect);
         return;
         }
 
+    // Don't allow normal background drawing if
+    // background is already drawn with a background drawer.
+    TBool drawBackground( ETrue );
+    const MCoeControlBackground* backgroundDrawer = FindBackground();
+    if ( backgroundDrawer )
+        {
+        drawBackground = EFalse;
+        }
+
     CWindowGc& gc = SystemGc();
 
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
@@ -1607,7 +1618,8 @@
         // - Navi wipe is never used
         // - No offset in right, left or top
         //
-        if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
+        if ( drawBackground &&
+             !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
             {
             gc.SetPenStyle( CGraphicsContext::ENullPen );
             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
@@ -1633,7 +1645,8 @@
         gc.SetBrushColor(
             AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
 
-        if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
+        if ( drawBackground &&
+             !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
             {
             gc.DrawRect( rect );
             }
@@ -1648,7 +1661,8 @@
         // - Navi wipe is never used
         // - No offset in right, left or top
         //
-        if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
+        if ( drawBackground &&
+             !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
             {
             gc.SetPenStyle( CGraphicsContext::ENullPen );
             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
@@ -1748,40 +1762,43 @@
     //
     else
         {
-        TBool naviWipeUsed = NaviWipeUsed();
-
-        TBool skinnedNaviWipeDrawn  = EFalse;
-        TBool skinnedNaviSolidDrawn = EFalse;
-        TBool defaultNaviWipeDrawn  = EFalse;
-        TBool defaultNaviSolidDrawn = EFalse;
-
-        // If naviwipe is to be used, try first skinned draw...
-        if ( naviWipeUsed )
-            {
-            skinnedNaviWipeDrawn = DrawSkinnedNaviWipe( gc, rect, skin, cc );
-            }
-
-        // If naviwipe is to be used and skinned draw failed,
-        // draw default wipe draw...
-        if ( naviWipeUsed && !skinnedNaviWipeDrawn )
+        if ( drawBackground )
             {
-            defaultNaviWipeDrawn = DrawDefaultNaviWipe( gc, rect );
-            }
+            TBool naviWipeUsed = NaviWipeUsed();
+
+            TBool skinnedNaviWipeDrawn  = EFalse;
+            TBool skinnedNaviSolidDrawn = EFalse;
+            TBool defaultNaviWipeDrawn  = EFalse;
+            TBool defaultNaviSolidDrawn = EFalse;
+
+            // If naviwipe is to be used, try first skinned draw...
+            if ( naviWipeUsed )
+                {
+                skinnedNaviWipeDrawn = DrawSkinnedNaviWipe( gc, rect, skin, cc );
+                }
 
-        // If naviwipe is not to be drawn or the nawiwipe draws has failed for
-        // some reason then draw solid. Try skinned solid draw first...
-        if ( !skinnedNaviWipeDrawn && !defaultNaviWipeDrawn )
-            {
-            skinnedNaviSolidDrawn = DrawSkinnedNaviSolid( gc, rect, skin, cc );
-            }
+            // If naviwipe is to be used and skinned draw failed,
+            // draw default wipe draw...
+            if ( naviWipeUsed && !skinnedNaviWipeDrawn )
+                {
+                defaultNaviWipeDrawn = DrawDefaultNaviWipe( gc, rect );
+                }
 
-        // If not any above is the case, then draw the default solid here.
-        if ( !skinnedNaviWipeDrawn &&
-             !defaultNaviWipeDrawn &&
-             !skinnedNaviSolidDrawn &&
-             !defaultNaviSolidDrawn )
-            {
-            defaultNaviSolidDrawn = DrawDefaultNaviSolid( gc, rect );
+            // If naviwipe is not to be drawn or the nawiwipe draws has failed for
+            // some reason then draw solid. Try skinned solid draw first...
+            if ( !skinnedNaviWipeDrawn && !defaultNaviWipeDrawn )
+                {
+                skinnedNaviSolidDrawn = DrawSkinnedNaviSolid( gc, rect, skin, cc );
+                }
+
+            // If not any above is the case, then draw the default solid here.
+            if ( !skinnedNaviWipeDrawn &&
+                 !defaultNaviWipeDrawn &&
+                 !skinnedNaviSolidDrawn &&
+                 !defaultNaviSolidDrawn )
+                {
+                defaultNaviSolidDrawn = DrawDefaultNaviSolid( gc, rect );
+                }
             }
         }
     }
@@ -1848,7 +1865,7 @@
 //
 void CAknNavigationControlContainer::NotifyNaviWipeStatusL()
     {
-    if ( iExtension && iExtension->iDestructionOngoing )
+    if ( !iExtension || iExtension->iDestructionOngoing )
         {
         return;
         }
@@ -1909,6 +1926,24 @@
                 }
             }
 
+       TInt minOrd = -1;
+       
+       if ( titlewindow )
+           {
+           minOrd = titlewindow->OrdinalPosition();
+           }
+       
+        if( naviwindow )
+           {
+           minOrd = Min( minOrd, naviwindow->OrdinalPosition() );
+           }
+
+       if ( emptywindow )
+           {
+           minOrd = Min( minOrd, emptywindow->OrdinalPosition() );
+           }
+
+     
         const TInt last = iNaviPaneControls->Count() - 1;
         if ( ( last < 0 || !( iNaviPaneControls->At( last ) ) ) ||
              ( last >= 0 &&
@@ -1920,36 +1955,20 @@
             // Minus ordinal ordinal position number always means set
             // the window to be the last one of the windows with the same
             // ordinal priority
-            if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
-            	{
+            
             if ( titlewindow )
                 {
-                titlewindow->SetOrdinalPosition( 4 );
+                titlewindow->SetOrdinalPosition( minOrd );
                 }
             if ( naviwindow )
                 {
-                naviwindow->SetOrdinalPosition( 5 );
+                naviwindow->SetOrdinalPosition( minOrd + 1  );
                 }
             if ( emptywindow )
                 {
-                emptywindow->SetOrdinalPosition( 6 );
-                }
-              }
-           else
-             {
-             if ( titlewindow )
-                {
-                titlewindow->SetOrdinalPosition( -1 );
+                emptywindow->SetOrdinalPosition( minOrd + 2 );
                 }
-            if ( naviwindow )
-                {
-                naviwindow->SetOrdinalPosition( -1 );
-                }
-            if ( emptywindow )
-                {
-                emptywindow->SetOrdinalPosition( -1 );
-                }
-             }
+             
             }
         else
             {
@@ -1957,36 +1976,19 @@
             // Minus ordinal ordinal position number always means set
             // the window to be the last one of the windows with the same
             // ordinal priority
-            if ( iExtension->iIsActiveIdle )//Added for active idle's transparent
-            	{
+           
             if ( naviwindow )
                 {
-                naviwindow->SetOrdinalPosition( 4 );
+                naviwindow->SetOrdinalPosition( minOrd );
                 }
             if ( titlewindow )
                 {
-                titlewindow->SetOrdinalPosition( 5 );
+                titlewindow->SetOrdinalPosition( minOrd + 1 );
                 }
             if ( emptywindow )
                 {
-                emptywindow->SetOrdinalPosition( 6 );
-                }
-              }
-              else
-              	{
-             if ( naviwindow )
-                {
-                naviwindow->SetOrdinalPosition( -1 );
-                }
-            if ( titlewindow )
-                {
-                titlewindow->SetOrdinalPosition( -1 );
-                }
-            if ( emptywindow )
-                {
-                emptywindow->SetOrdinalPosition( -1 );
-                }
-              	}
+                emptywindow->SetOrdinalPosition( minOrd + 2 );
+                }              	
             }
 
         // Finally request titlepane to refresh itself.
@@ -2343,16 +2345,9 @@
     TRect screenRect;
     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
 
-    // app window
-    TAknLayoutRect applicationWindowLayoutRect;
-    applicationWindowLayoutRect.LayoutRect(
-        screenRect,
-        AknLayoutScalable_Avkon::application_window( 0 ) );
-    TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
-
-    // statuspane
+    // statuspane, skip application window because it's the same as screen.
     TAknLayoutRect statusPaneLayoutRect;
-    statusPaneLayoutRect.LayoutRect( applicationWindowRect,
+    statusPaneLayoutRect.LayoutRect( screenRect,
                                      AknLayoutScalable_Avkon::status_pane( 0 ) );
     TRect statusPaneRect( statusPaneLayoutRect.Rect() );