uifw/AvKon/src/aknindicator.cpp
branchRCL_3
changeset 55 aecbbf00d063
parent 38 c52421ed5f07
child 56 d48ab3b357f1
--- a/uifw/AvKon/src/aknindicator.cpp	Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/AvKon/src/aknindicator.cpp	Tue Aug 31 15:28:30 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2008 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"
@@ -279,18 +279,11 @@
     if ( iState == EAknIndicatorStateOn )
         {
         iAnimState = iCountOfAnimStates - 1;
-        this->MakeVisible(ETrue);
         }
     else if ( iState == EAknIndicatorStateOff )
         {
-        this->MakeVisible(EFalse);
         DeleteBitmaps();
         }
-    else if (iState == EAknIndicatorStateAnimate )
-        {
-        MakeVisible( ETrue );
-        }
-        
     SizeChanged();
     }
 
@@ -615,13 +608,6 @@
             }
 
         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-        
-        if ( iIndicatorBitmaps[layoutMode]->Count() <= 0 || !iIndicatorBitmaps[layoutMode]->At( 0 ) )
-            {
-            
-            __ASSERT_DEBUG( EFalse, User::Panic( _L("indicatorcount"),iIndicatorBitmaps[layoutMode]->Count()));
-            return;
-            }
         TSize iconSize( iIndicatorBitmaps[layoutMode]->At( 0 )->SizeInPixels() );
         TInt iconWidth  = iconSize.iWidth;
         TInt iconHeight = iconSize.iHeight;
@@ -666,9 +652,8 @@
                     }
                 }
 
-             if ( ( iAnimState * 2 + 1 ) < iIndicatorBitmaps[layoutMode]->Count()
-                    && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2)
-                    && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2 + 1))
+            if ( iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ) &&
+                 iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 + 1 ) )
                 {
                 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 + 1 );
                 if ( iExtension && iExtension->iFader )
@@ -686,8 +671,7 @@
                                  mask,
                                  ETrue );
                 }
-             else if (( iAnimState * 2 ) < iIndicatorBitmaps[layoutMode]->Count()
-                    && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2) )
+        else if ( iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ) )
                 {
                 // Draw editor indicator bitmap without mask
                 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 );
@@ -859,6 +843,8 @@
 
 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode )
     {
+    TRect rect( Rect() );
+
     TInt indicatorUid = iUid;
     if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst &&
         indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast)
@@ -869,7 +855,51 @@
     TSize size(10,10); // default size (every SVG icon needs to be initialized)
     TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved;
 
-    switch ( indicatorUid )
+    TRect navipaneRect(0,0,0,0);
+    CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
+    if (statusPane)
+        {
+        CCoeControl* control = NULL;
+        TRAP_IGNORE(control = statusPane->ControlL(TUid::Uid( EEikStatusPaneUidNavi )));
+        if (control)
+            {
+            navipaneRect.SetSize( control->Size() );
+            }
+        }
+
+    // If navipane is not found, we get portrait normal navipanerect frop laf data which is usually right enough.
+    if (navipaneRect.Size() == TSize(0,0))
+        {
+        TInt battery = 0;
+        TRect statusPaneRect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect );
+
+        if ( AknStatuspaneUtils::IdleLayoutActive() )
+            {
+            if ( ( iIndicatorContext == CAknIndicatorContainer::EQueryEditorIndicators )
+                && ( statusPaneRect.Size() == TSize(0,0) ) )
+                {
+                battery = 0;
+                }
+            else
+                {
+                battery = 1;
+                }
+            }
+
+
+        // Navi pane
+        TAknWindowComponentLayout naviPaneLayout( AknLayoutScalable_Avkon::navi_pane(battery) );
+        TAknLayoutRect naviPaneLayoutRect;
+        naviPaneLayoutRect.LayoutRect(statusPaneRect, naviPaneLayout);
+        navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
+        }
+
+    // Screen
+    TRect screenRect;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
+
+    switch (indicatorUid)
         {
         // Status pane's indicators
         case EAknIndicatorIrActive:
@@ -936,18 +966,86 @@
         case EAknIndicatorUSBMemActive:
         case EAknIndicatorStopWatch:
         case EAknIndicatorMecoServiceTab:
-        case EAknIndicatorIntegratedIM:
             {
+            // Main pane
+            TRect mainPaneRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
+                                               mainPaneRect );
+
+            // statuspane, usual
+            TRect usualStatusPaneRect;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane,
+                                               usualStatusPaneRect );
+
+            // status indicator pane elements
+            TRect statusIndicatorPaneElementsRect;
+            AknLayoutUtils::LayoutMetricsRect(
+                AknLayoutUtils::EIndicatorPane,
+                statusIndicatorPaneElementsRect );
+
+            // universal indicator pane (note statuspane as parent)
+            TAknLayoutRect universalIndicatorPaneLayoutRect;
+            universalIndicatorPaneLayoutRect.LayoutRect(
+                usualStatusPaneRect,
+                AknLayoutScalable_Avkon::uni_indicator_pane( 0 ) );
+            TRect universalIndicatorPaneRect(
+                universalIndicatorPaneLayoutRect.Rect() );
+
+            // universal indicator pane elements
+            TAknLayoutRect universalIndicatorPaneElementsLayoutRect;
+            universalIndicatorPaneElementsLayoutRect.LayoutRect(
+                universalIndicatorPaneRect,
+                AknLayoutScalable_Avkon::uni_indicator_pane_g1() );
+            TRect universalIndicatorPaneElementsRect(
+                universalIndicatorPaneElementsLayoutRect.Rect() );
+
+            if ( aLayoutMode == ELayoutModeUsual )
+                {
+                size = universalIndicatorPaneElementsRect.Size();
+                }
+
+            if ( aLayoutMode == ELayoutModeWide )
+                {
+                size = statusIndicatorPaneElementsRect.Size();
+                }
+
+            // Stacon special cases
+            if ( AknStatuspaneUtils::StaconPaneActive() &&
+                 !AknStatuspaneUtils::IdleLayoutActive() &&
+                 !AknStatuspaneUtils::ExtendedStaconPaneActive())
+                {
+                size = Size();
+                }
+            else if ( AknStatuspaneUtils::ExtendedStaconPaneActive() )
+                {
+                size = Size();
+                }
+
+            // Flat special cases
+            if ( AknStatuspaneUtils::FlatLayoutActive() )
+                {
+                size = Size();
+                }
 
             // Portrait extended cases
-            if ( AknStatuspaneUtils::ExtendedLayoutActive() &&
-                 AknStatuspaneUtils::IdleLayoutActive() &&
-                 !AknStatuspaneUtils::HDLayoutActive() )
+            if ( AknStatuspaneUtils::ExtendedLayoutActive() )
                 {
-                aspectRatio = EAspectRatioPreserved;
+                size = Size();
+                if ( AknStatuspaneUtils::IdleLayoutActive() &&
+                     !AknStatuspaneUtils::HDLayoutActive() )
+                    {
+                    aspectRatio = EAspectRatioPreserved;
+                    }
                 }
 
-            size = Size();
+            // In landscape idle we use vertical indicators if parent
+            // is in vertical mode, otherwise horizontal.
+            if ( AknStatuspaneUtils::IdleLayoutActive() &&
+                 Layout_Meta_Data::IsLandscapeOrientation() &&
+                 iParent->Size().iWidth < iParent->Size().iHeight )
+                {
+                size = Size();
+                }
 
             break;
             }
@@ -1047,41 +1145,9 @@
         case EAknNaviPaneEditorIndicatorFnKeyLocked:
 #endif
             {
-            TRect navipaneRect( 0, 0, 0, 0 );
-            CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
-            if ( statusPane )
-                {
-                CCoeControl* control = NULL;
-                TRAP_IGNORE(
-                    control = statusPane->ControlL(
-                        TUid::Uid( EEikStatusPaneUidNavi ) ) );
-                if ( control )
-                    {
-                    navipaneRect.SetSize( control->Size() );
-                    }
-                }
-        
-            // If navi pane is not found, we get portrait normal navi pane
-            // rect from LAF data which is usually right enough.
-            if ( navipaneRect.IsEmpty() )
-                {
-                TRect statusPaneRect;
-                AknLayoutUtils::LayoutMetricsRect(
-                    AknLayoutUtils::EStatusPane, statusPaneRect );
-
-                // Navi pane
-                TAknLayoutRect naviPaneLayoutRect;
-                naviPaneLayoutRect.LayoutRect(
-                    statusPaneRect, AknLayoutScalable_Avkon::navi_pane( 6 ) );
-                navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
-                }
-            
-            TAknWindowComponentLayout l1(
-                AknLayoutScalable_Avkon::navi_icon_pane( 0 ) );
-            TAknWindowComponentLayout l2(
-                AknLayoutScalable_Avkon::navi_icon_pane_g1() );
-            TAknWindowComponentLayout layout(
-                TAknWindowComponentLayout::Compose( l1, l2 ) );
+            TAknWindowComponentLayout l1 = AknLayoutScalable_Avkon::navi_icon_pane(0);
+            TAknWindowComponentLayout l2 = AknLayoutScalable_Avkon::navi_icon_pane_g1();
+            TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( l1, l2 );
 
             TAknLayoutRect layoutRect;
             layoutRect.LayoutRect( navipaneRect, layout );
@@ -1095,8 +1161,6 @@
         case EAknNaviPaneEditorIndicatorWaitBar:
         case EAknNaviPaneEditorIndicatorProgressBar:
             {
-            TRect rect( Rect() );
-
             TAknLayoutRect waitPaneComponentLayoutRect;
             waitPaneComponentLayoutRect.LayoutRect(
                 rect,
@@ -1117,30 +1181,28 @@
         case EAknNaviPaneEditorIndicatorWlanActive:
         case EAknNaviPaneEditorIndicatorWlanActiveSecure:
             {
-            // Screen
-            TRect screenRect;
-            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen,
-                                               screenRect );
+            // app window
+            TAknWindowComponentLayout applicationWindowLayout( AknLayoutScalable_Avkon::application_window(0) );
+            TAknLayoutRect applicationWindowLayoutRect;
+            applicationWindowLayoutRect.LayoutRect( screenRect, applicationWindowLayout );
+            TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
 
-            // top area, skip the application window as it's the same
-            // size as the screen.
+            // top area
+            TAknWindowComponentLayout topAreaLayout( AknLayoutScalable_Avkon::area_top_pane(1) );
             TAknLayoutRect topAreaLayoutRect;
-            topAreaLayoutRect.LayoutRect(
-                screenRect, AknLayoutScalable_Avkon::area_top_pane( 1 ) );
+            topAreaLayoutRect.LayoutRect( applicationWindowRect, topAreaLayout );
             TRect topAreaRect( topAreaLayoutRect.Rect() );
 
             // small statuspane
+            TAknWindowComponentLayout smallStatusPaneLayout( AknLayoutScalable_Avkon::status_small_pane() );
             TAknLayoutRect smallStatusPaneLayoutRect;
-            smallStatusPaneLayoutRect.LayoutRect(
-                topAreaRect, AknLayoutScalable_Avkon::status_small_pane() );
+            smallStatusPaneLayoutRect.LayoutRect( topAreaRect, smallStatusPaneLayout );
             TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
 
             // icon pane
+            TAknWindowComponentLayout iconPaneLayout( AknLayoutScalable_Avkon::status_small_icon_pane() );
             TAknLayoutRect iconPaneLayoutRect;
-            iconPaneLayoutRect.LayoutRect(
-                smallStatusPaneRect,
-                AknLayoutScalable_Avkon::status_small_icon_pane() );
-
+            iconPaneLayoutRect.LayoutRect( smallStatusPaneRect, iconPaneLayout );
             TRect iconPaneRect( iconPaneLayoutRect.Rect() );
 
             size = iconPaneRect.Size();