uifw/AvKon/src/aknindicator.cpp
branchRCL_3
changeset 15 c52421ed5f07
parent 10 3d340a0166ff
child 19 aecbbf00d063
equal deleted inserted replaced
13:a8834a2e9a96 15:c52421ed5f07
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 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".
   857     }
   857     }
   858 
   858 
   859 
   859 
   860 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode )
   860 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode )
   861     {
   861     {
   862     TRect rect( Rect() );
       
   863 
       
   864     TInt indicatorUid = iUid;
   862     TInt indicatorUid = iUid;
   865     if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst &&
   863     if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst &&
   866         indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast)
   864         indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast)
   867         {
   865         {
   868         indicatorUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst;
   866         indicatorUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst;
   869         }
   867         }
   870 
   868 
   871     TSize size(10,10); // default size (every SVG icon needs to be initialized)
   869     TSize size(10,10); // default size (every SVG icon needs to be initialized)
   872     TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved;
   870     TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved;
   873 
   871 
   874     TRect navipaneRect(0,0,0,0);
   872     switch ( indicatorUid )
   875     CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
   876     if (statusPane)
       
   877         {
       
   878         CCoeControl* control = NULL;
       
   879         TRAP_IGNORE(control = statusPane->ControlL(TUid::Uid( EEikStatusPaneUidNavi )));
       
   880         if (control)
       
   881             {
       
   882             navipaneRect.SetSize( control->Size() );
       
   883             }
       
   884         }
       
   885 
       
   886     // If navipane is not found, we get portrait normal navipanerect frop laf data which is usually right enough.
       
   887     if (navipaneRect.Size() == TSize(0,0))
       
   888         {
       
   889         TInt battery = 0;
       
   890         TRect statusPaneRect;
       
   891         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect );
       
   892 
       
   893         if ( AknStatuspaneUtils::IdleLayoutActive() )
       
   894             {
       
   895             if ( ( iIndicatorContext == CAknIndicatorContainer::EQueryEditorIndicators )
       
   896                 && ( statusPaneRect.Size() == TSize(0,0) ) )
       
   897                 {
       
   898                 battery = 0;
       
   899                 }
       
   900             else
       
   901                 {
       
   902                 battery = 1;
       
   903                 }
       
   904             }
       
   905 
       
   906 
       
   907         // Navi pane
       
   908         TAknWindowComponentLayout naviPaneLayout( AknLayoutScalable_Avkon::navi_pane(battery) );
       
   909         TAknLayoutRect naviPaneLayoutRect;
       
   910         naviPaneLayoutRect.LayoutRect(statusPaneRect, naviPaneLayout);
       
   911         navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
       
   912         }
       
   913 
       
   914     // Screen
       
   915     TRect screenRect;
       
   916     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
   917 
       
   918     switch (indicatorUid)
       
   919         {
   873         {
   920         // Status pane's indicators
   874         // Status pane's indicators
   921         case EAknIndicatorIrActive:
   875         case EAknIndicatorIrActive:
   922         case EAknIndicatorEnvelope:
   876         case EAknIndicatorEnvelope:
   923         case EAknIndicatorEmailMessage:
   877         case EAknIndicatorEmailMessage:
   982         case EAknIndicatorUSBMemActive:
   936         case EAknIndicatorUSBMemActive:
   983         case EAknIndicatorStopWatch:
   937         case EAknIndicatorStopWatch:
   984         case EAknIndicatorMecoServiceTab:
   938         case EAknIndicatorMecoServiceTab:
   985         case EAknIndicatorIntegratedIM:
   939         case EAknIndicatorIntegratedIM:
   986             {
   940             {
   987             // Main pane
       
   988             TRect mainPaneRect;
       
   989             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   990                                                mainPaneRect );
       
   991 
       
   992             // statuspane, usual
       
   993             TRect usualStatusPaneRect;
       
   994             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane,
       
   995                                                usualStatusPaneRect );
       
   996 
       
   997             // status indicator pane elements
       
   998             TRect statusIndicatorPaneElementsRect;
       
   999             AknLayoutUtils::LayoutMetricsRect(
       
  1000                 AknLayoutUtils::EIndicatorPane,
       
  1001                 statusIndicatorPaneElementsRect );
       
  1002 
       
  1003             // universal indicator pane (note statuspane as parent)
       
  1004             TAknLayoutRect universalIndicatorPaneLayoutRect;
       
  1005             universalIndicatorPaneLayoutRect.LayoutRect(
       
  1006                 usualStatusPaneRect,
       
  1007                 AknLayoutScalable_Avkon::uni_indicator_pane( 0 ) );
       
  1008             TRect universalIndicatorPaneRect(
       
  1009                 universalIndicatorPaneLayoutRect.Rect() );
       
  1010 
       
  1011             // universal indicator pane elements
       
  1012             TAknLayoutRect universalIndicatorPaneElementsLayoutRect;
       
  1013             universalIndicatorPaneElementsLayoutRect.LayoutRect(
       
  1014                 universalIndicatorPaneRect,
       
  1015                 AknLayoutScalable_Avkon::uni_indicator_pane_g1() );
       
  1016             TRect universalIndicatorPaneElementsRect(
       
  1017                 universalIndicatorPaneElementsLayoutRect.Rect() );
       
  1018 
       
  1019             if ( aLayoutMode == ELayoutModeUsual )
       
  1020                 {
       
  1021                 size = universalIndicatorPaneElementsRect.Size();
       
  1022                 }
       
  1023 
       
  1024             if ( aLayoutMode == ELayoutModeWide )
       
  1025                 {
       
  1026                 size = statusIndicatorPaneElementsRect.Size();
       
  1027                 }
       
  1028 
       
  1029             // Stacon special cases
       
  1030             if ( AknStatuspaneUtils::StaconPaneActive() &&
       
  1031                  !AknStatuspaneUtils::IdleLayoutActive() &&
       
  1032                  !AknStatuspaneUtils::ExtendedStaconPaneActive())
       
  1033                 {
       
  1034                 size = Size();
       
  1035                 }
       
  1036             else if ( AknStatuspaneUtils::ExtendedStaconPaneActive() )
       
  1037                 {
       
  1038                 size = Size();
       
  1039                 }
       
  1040 
       
  1041             // Flat special cases
       
  1042             if ( AknStatuspaneUtils::FlatLayoutActive() )
       
  1043                 {
       
  1044                 size = Size();
       
  1045                 }
       
  1046 
   941 
  1047             // Portrait extended cases
   942             // Portrait extended cases
  1048             if ( AknStatuspaneUtils::ExtendedLayoutActive() )
   943             if ( AknStatuspaneUtils::ExtendedLayoutActive() &&
  1049                 {
   944                  AknStatuspaneUtils::IdleLayoutActive() &&
  1050                 size = Size();
   945                  !AknStatuspaneUtils::HDLayoutActive() )
  1051                 if ( AknStatuspaneUtils::IdleLayoutActive() &&
   946                 {
  1052                      !AknStatuspaneUtils::HDLayoutActive() )
   947                 aspectRatio = EAspectRatioPreserved;
  1053                     {
   948                 }
  1054                     aspectRatio = EAspectRatioPreserved;
   949 
  1055                     }
   950             size = Size();
  1056                 }
       
  1057 
       
  1058             // In landscape idle we use vertical indicators if parent
       
  1059             // is in vertical mode, otherwise horizontal.
       
  1060             if ( AknStatuspaneUtils::IdleLayoutActive() &&
       
  1061                  Layout_Meta_Data::IsLandscapeOrientation() &&
       
  1062                  iParent->Size().iWidth < iParent->Size().iHeight )
       
  1063                 {
       
  1064                 size = Size();
       
  1065                 }
       
  1066 
   951 
  1067             break;
   952             break;
  1068             }
   953             }
  1069 
   954 
  1070         // Navi pane editor indicators
   955         // Navi pane editor indicators
  1160 #ifdef RD_INTELLIGENT_TEXT_INPUT
  1045 #ifdef RD_INTELLIGENT_TEXT_INPUT
  1161         case EAknNaviPaneEditorIndicatorFnKeyPressed:
  1046         case EAknNaviPaneEditorIndicatorFnKeyPressed:
  1162         case EAknNaviPaneEditorIndicatorFnKeyLocked:
  1047         case EAknNaviPaneEditorIndicatorFnKeyLocked:
  1163 #endif
  1048 #endif
  1164             {
  1049             {
  1165             TAknWindowComponentLayout l1 = AknLayoutScalable_Avkon::navi_icon_pane(0);
  1050             TRect navipaneRect( 0, 0, 0, 0 );
  1166             TAknWindowComponentLayout l2 = AknLayoutScalable_Avkon::navi_icon_pane_g1();
  1051             CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  1167             TAknWindowComponentLayout layout = TAknWindowComponentLayout::Compose( l1, l2 );
  1052             if ( statusPane )
       
  1053                 {
       
  1054                 CCoeControl* control = NULL;
       
  1055                 TRAP_IGNORE(
       
  1056                     control = statusPane->ControlL(
       
  1057                         TUid::Uid( EEikStatusPaneUidNavi ) ) );
       
  1058                 if ( control )
       
  1059                     {
       
  1060                     navipaneRect.SetSize( control->Size() );
       
  1061                     }
       
  1062                 }
       
  1063         
       
  1064             // If navi pane is not found, we get portrait normal navi pane
       
  1065             // rect from LAF data which is usually right enough.
       
  1066             if ( navipaneRect.IsEmpty() )
       
  1067                 {
       
  1068                 TRect statusPaneRect;
       
  1069                 AknLayoutUtils::LayoutMetricsRect(
       
  1070                     AknLayoutUtils::EStatusPane, statusPaneRect );
       
  1071 
       
  1072                 // Navi pane
       
  1073                 TAknLayoutRect naviPaneLayoutRect;
       
  1074                 naviPaneLayoutRect.LayoutRect(
       
  1075                     statusPaneRect, AknLayoutScalable_Avkon::navi_pane( 6 ) );
       
  1076                 navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() );
       
  1077                 }
       
  1078             
       
  1079             TAknWindowComponentLayout l1(
       
  1080                 AknLayoutScalable_Avkon::navi_icon_pane( 0 ) );
       
  1081             TAknWindowComponentLayout l2(
       
  1082                 AknLayoutScalable_Avkon::navi_icon_pane_g1() );
       
  1083             TAknWindowComponentLayout layout(
       
  1084                 TAknWindowComponentLayout::Compose( l1, l2 ) );
  1168 
  1085 
  1169             TAknLayoutRect layoutRect;
  1086             TAknLayoutRect layoutRect;
  1170             layoutRect.LayoutRect( navipaneRect, layout );
  1087             layoutRect.LayoutRect( navipaneRect, layout );
  1171             TRect rect( layoutRect.Rect() );
  1088             TRect rect( layoutRect.Rect() );
  1172             size = rect.Size();
  1089             size = rect.Size();
  1176         // Extra application indicators to editor indicator pane
  1093         // Extra application indicators to editor indicator pane
  1177         // in small or nHD status pane layout.
  1094         // in small or nHD status pane layout.
  1178         case EAknNaviPaneEditorIndicatorWaitBar:
  1095         case EAknNaviPaneEditorIndicatorWaitBar:
  1179         case EAknNaviPaneEditorIndicatorProgressBar:
  1096         case EAknNaviPaneEditorIndicatorProgressBar:
  1180             {
  1097             {
       
  1098             TRect rect( Rect() );
       
  1099 
  1181             TAknLayoutRect waitPaneComponentLayoutRect;
  1100             TAknLayoutRect waitPaneComponentLayoutRect;
  1182             waitPaneComponentLayoutRect.LayoutRect(
  1101             waitPaneComponentLayoutRect.LayoutRect(
  1183                 rect,
  1102                 rect,
  1184                 AknLayoutScalable_Avkon::status_small_wait_pane_g2() );
  1103                 AknLayoutScalable_Avkon::status_small_wait_pane_g2() );
  1185             TRect waitPaneComponentRect( waitPaneComponentLayoutRect.Rect() );
  1104             TRect waitPaneComponentRect( waitPaneComponentLayoutRect.Rect() );
  1196         case EAknNaviPaneEditorIndicatorFileSize:
  1115         case EAknNaviPaneEditorIndicatorFileSize:
  1197         case EAknNaviPaneEditorIndicatorWlanAvailable:
  1116         case EAknNaviPaneEditorIndicatorWlanAvailable:
  1198         case EAknNaviPaneEditorIndicatorWlanActive:
  1117         case EAknNaviPaneEditorIndicatorWlanActive:
  1199         case EAknNaviPaneEditorIndicatorWlanActiveSecure:
  1118         case EAknNaviPaneEditorIndicatorWlanActiveSecure:
  1200             {
  1119             {
  1201             // app window
  1120             // Screen
  1202             TAknWindowComponentLayout applicationWindowLayout( AknLayoutScalable_Avkon::application_window(0) );
  1121             TRect screenRect;
  1203             TAknLayoutRect applicationWindowLayoutRect;
  1122             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen,
  1204             applicationWindowLayoutRect.LayoutRect( screenRect, applicationWindowLayout );
  1123                                                screenRect );
  1205             TRect applicationWindowRect( applicationWindowLayoutRect.Rect() );
  1124 
  1206 
  1125             // top area, skip the application window as it's the same
  1207             // top area
  1126             // size as the screen.
  1208             TAknWindowComponentLayout topAreaLayout( AknLayoutScalable_Avkon::area_top_pane(1) );
       
  1209             TAknLayoutRect topAreaLayoutRect;
  1127             TAknLayoutRect topAreaLayoutRect;
  1210             topAreaLayoutRect.LayoutRect( applicationWindowRect, topAreaLayout );
  1128             topAreaLayoutRect.LayoutRect(
       
  1129                 screenRect, AknLayoutScalable_Avkon::area_top_pane( 1 ) );
  1211             TRect topAreaRect( topAreaLayoutRect.Rect() );
  1130             TRect topAreaRect( topAreaLayoutRect.Rect() );
  1212 
  1131 
  1213             // small statuspane
  1132             // small statuspane
  1214             TAknWindowComponentLayout smallStatusPaneLayout( AknLayoutScalable_Avkon::status_small_pane() );
       
  1215             TAknLayoutRect smallStatusPaneLayoutRect;
  1133             TAknLayoutRect smallStatusPaneLayoutRect;
  1216             smallStatusPaneLayoutRect.LayoutRect( topAreaRect, smallStatusPaneLayout );
  1134             smallStatusPaneLayoutRect.LayoutRect(
       
  1135                 topAreaRect, AknLayoutScalable_Avkon::status_small_pane() );
  1217             TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
  1136             TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() );
  1218 
  1137 
  1219             // icon pane
  1138             // icon pane
  1220             TAknWindowComponentLayout iconPaneLayout( AknLayoutScalable_Avkon::status_small_icon_pane() );
       
  1221             TAknLayoutRect iconPaneLayoutRect;
  1139             TAknLayoutRect iconPaneLayoutRect;
  1222             iconPaneLayoutRect.LayoutRect( smallStatusPaneRect, iconPaneLayout );
  1140             iconPaneLayoutRect.LayoutRect(
       
  1141                 smallStatusPaneRect,
       
  1142                 AknLayoutScalable_Avkon::status_small_icon_pane() );
       
  1143 
  1223             TRect iconPaneRect( iconPaneLayoutRect.Rect() );
  1144             TRect iconPaneRect( iconPaneLayoutRect.Rect() );
  1224 
  1145 
  1225             size = iconPaneRect.Size();
  1146             size = iconPaneRect.Size();
  1226             break;
  1147             break;
  1227             }
  1148             }