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". |
606 { |
613 { |
607 layoutMode = ELayoutModeUsual; |
614 layoutMode = ELayoutModeUsual; |
608 } |
615 } |
609 |
616 |
610 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
617 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
618 |
|
619 if ( iIndicatorBitmaps[layoutMode]->Count() <= 0 || !iIndicatorBitmaps[layoutMode]->At( 0 ) ) |
|
620 { |
|
621 |
|
622 __ASSERT_DEBUG( EFalse, User::Panic( _L("indicatorcount"),iIndicatorBitmaps[layoutMode]->Count())); |
|
623 return; |
|
624 } |
611 TSize iconSize( iIndicatorBitmaps[layoutMode]->At( 0 )->SizeInPixels() ); |
625 TSize iconSize( iIndicatorBitmaps[layoutMode]->At( 0 )->SizeInPixels() ); |
612 TInt iconWidth = iconSize.iWidth; |
626 TInt iconWidth = iconSize.iWidth; |
613 TInt iconHeight = iconSize.iHeight; |
627 TInt iconHeight = iconSize.iHeight; |
614 |
628 |
615 if ( iState != EAknIndicatorStateOff ) |
629 if ( iState != EAknIndicatorStateOff ) |
650 } |
664 } |
651 iconWidth = progressInPixels; |
665 iconWidth = progressInPixels; |
652 } |
666 } |
653 } |
667 } |
654 |
668 |
655 if ( iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ) && |
669 if ( ( iAnimState * 2 + 1 ) < iIndicatorBitmaps[layoutMode]->Count() |
656 iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 + 1 ) ) |
670 && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2) |
|
671 && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2 + 1)) |
657 { |
672 { |
658 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 + 1 ); |
673 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 + 1 ); |
659 if ( iExtension && iExtension->iFader ) |
674 if ( iExtension && iExtension->iFader ) |
660 { |
675 { |
661 mask = iExtension->iFader->FadeMask( |
676 mask = iExtension->iFader->FadeMask( |
669 iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ), |
684 iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ), |
670 TRect( 0, 0, iconWidth, iconHeight), |
685 TRect( 0, 0, iconWidth, iconHeight), |
671 mask, |
686 mask, |
672 ETrue ); |
687 ETrue ); |
673 } |
688 } |
674 else if ( iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ) ) |
689 else if (( iAnimState * 2 ) < iIndicatorBitmaps[layoutMode]->Count() |
|
690 && iIndicatorBitmaps[layoutMode]->At(iAnimState * 2) ) |
675 { |
691 { |
676 // Draw editor indicator bitmap without mask |
692 // Draw editor indicator bitmap without mask |
677 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ); |
693 CFbsBitmap* mask = iIndicatorBitmaps[layoutMode]->At( iAnimState * 2 ); |
678 if ( iExtension && iExtension->iFader ) |
694 if ( iExtension && iExtension->iFader ) |
679 { |
695 { |
841 } |
857 } |
842 |
858 |
843 |
859 |
844 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode ) |
860 void CAknIndicator::SetSvgIconSize( CFbsBitmap*& aBitmap, TInt aLayoutMode ) |
845 { |
861 { |
846 TRect rect( Rect() ); |
|
847 |
|
848 TInt indicatorUid = iUid; |
862 TInt indicatorUid = iUid; |
849 if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst && |
863 if (indicatorUid >= EAknNaviPaneEditorIndicatorDynamicUidRangeFirst && |
850 indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast) |
864 indicatorUid <= EAknNaviPaneEditorIndicatorDynamicUidRangeLast) |
851 { |
865 { |
852 indicatorUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst; |
866 indicatorUid = EAknNaviPaneEditorIndicatorDynamicUidRangeFirst; |
853 } |
867 } |
854 |
868 |
855 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) |
856 TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved; |
870 TScaleMode aspectRatio = EAspectRatioPreservedAndUnusedSpaceRemoved; |
857 |
871 |
858 TRect navipaneRect(0,0,0,0); |
872 switch ( indicatorUid ) |
859 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
860 if (statusPane) |
|
861 { |
|
862 CCoeControl* control = NULL; |
|
863 TRAP_IGNORE(control = statusPane->ControlL(TUid::Uid( EEikStatusPaneUidNavi ))); |
|
864 if (control) |
|
865 { |
|
866 navipaneRect.SetSize( control->Size() ); |
|
867 } |
|
868 } |
|
869 |
|
870 // If navipane is not found, we get portrait normal navipanerect frop laf data which is usually right enough. |
|
871 if (navipaneRect.Size() == TSize(0,0)) |
|
872 { |
|
873 TInt battery = 0; |
|
874 TRect statusPaneRect; |
|
875 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect ); |
|
876 |
|
877 if ( AknStatuspaneUtils::IdleLayoutActive() ) |
|
878 { |
|
879 if ( ( iIndicatorContext == CAknIndicatorContainer::EQueryEditorIndicators ) |
|
880 && ( statusPaneRect.Size() == TSize(0,0) ) ) |
|
881 { |
|
882 battery = 0; |
|
883 } |
|
884 else |
|
885 { |
|
886 battery = 1; |
|
887 } |
|
888 } |
|
889 |
|
890 |
|
891 // Navi pane |
|
892 TAknWindowComponentLayout naviPaneLayout( AknLayoutScalable_Avkon::navi_pane(battery) ); |
|
893 TAknLayoutRect naviPaneLayoutRect; |
|
894 naviPaneLayoutRect.LayoutRect(statusPaneRect, naviPaneLayout); |
|
895 navipaneRect.SetSize( naviPaneLayoutRect.Rect().Size() ); |
|
896 } |
|
897 |
|
898 // Screen |
|
899 TRect screenRect; |
|
900 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect ); |
|
901 |
|
902 switch (indicatorUid) |
|
903 { |
873 { |
904 // Status pane's indicators |
874 // Status pane's indicators |
905 case EAknIndicatorIrActive: |
875 case EAknIndicatorIrActive: |
906 case EAknIndicatorEnvelope: |
876 case EAknIndicatorEnvelope: |
907 case EAknIndicatorEmailMessage: |
877 case EAknIndicatorEmailMessage: |
964 case EAknIndicatorMissedCalendarAlarm: |
934 case EAknIndicatorMissedCalendarAlarm: |
965 case EAknIndicatorUSBMemConnected: |
935 case EAknIndicatorUSBMemConnected: |
966 case EAknIndicatorUSBMemActive: |
936 case EAknIndicatorUSBMemActive: |
967 case EAknIndicatorStopWatch: |
937 case EAknIndicatorStopWatch: |
968 case EAknIndicatorMecoServiceTab: |
938 case EAknIndicatorMecoServiceTab: |
969 { |
939 case EAknIndicatorIntegratedIM: |
970 // Main pane |
940 { |
971 TRect mainPaneRect; |
|
972 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, |
|
973 mainPaneRect ); |
|
974 |
|
975 // statuspane, usual |
|
976 TRect usualStatusPaneRect; |
|
977 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, |
|
978 usualStatusPaneRect ); |
|
979 |
|
980 // status indicator pane elements |
|
981 TRect statusIndicatorPaneElementsRect; |
|
982 AknLayoutUtils::LayoutMetricsRect( |
|
983 AknLayoutUtils::EIndicatorPane, |
|
984 statusIndicatorPaneElementsRect ); |
|
985 |
|
986 // universal indicator pane (note statuspane as parent) |
|
987 TAknLayoutRect universalIndicatorPaneLayoutRect; |
|
988 universalIndicatorPaneLayoutRect.LayoutRect( |
|
989 usualStatusPaneRect, |
|
990 AknLayoutScalable_Avkon::uni_indicator_pane( 0 ) ); |
|
991 TRect universalIndicatorPaneRect( |
|
992 universalIndicatorPaneLayoutRect.Rect() ); |
|
993 |
|
994 // universal indicator pane elements |
|
995 TAknLayoutRect universalIndicatorPaneElementsLayoutRect; |
|
996 universalIndicatorPaneElementsLayoutRect.LayoutRect( |
|
997 universalIndicatorPaneRect, |
|
998 AknLayoutScalable_Avkon::uni_indicator_pane_g1() ); |
|
999 TRect universalIndicatorPaneElementsRect( |
|
1000 universalIndicatorPaneElementsLayoutRect.Rect() ); |
|
1001 |
|
1002 if ( aLayoutMode == ELayoutModeUsual ) |
|
1003 { |
|
1004 size = universalIndicatorPaneElementsRect.Size(); |
|
1005 } |
|
1006 |
|
1007 if ( aLayoutMode == ELayoutModeWide ) |
|
1008 { |
|
1009 size = statusIndicatorPaneElementsRect.Size(); |
|
1010 } |
|
1011 |
|
1012 // Stacon special cases |
|
1013 if ( AknStatuspaneUtils::StaconPaneActive() && |
|
1014 !AknStatuspaneUtils::IdleLayoutActive() && |
|
1015 !AknStatuspaneUtils::ExtendedStaconPaneActive()) |
|
1016 { |
|
1017 size = Size(); |
|
1018 } |
|
1019 else if ( AknStatuspaneUtils::ExtendedStaconPaneActive() ) |
|
1020 { |
|
1021 size = Size(); |
|
1022 } |
|
1023 |
|
1024 // Flat special cases |
|
1025 if ( AknStatuspaneUtils::FlatLayoutActive() ) |
|
1026 { |
|
1027 size = Size(); |
|
1028 } |
|
1029 |
941 |
1030 // Portrait extended cases |
942 // Portrait extended cases |
1031 if ( AknStatuspaneUtils::ExtendedLayoutActive() ) |
943 if ( AknStatuspaneUtils::ExtendedLayoutActive() && |
1032 { |
944 AknStatuspaneUtils::IdleLayoutActive() && |
1033 size = Size(); |
945 !AknStatuspaneUtils::HDLayoutActive() ) |
1034 if ( AknStatuspaneUtils::IdleLayoutActive() && |
946 { |
1035 !AknStatuspaneUtils::HDLayoutActive() ) |
947 aspectRatio = EAspectRatioPreserved; |
1036 { |
948 } |
1037 aspectRatio = EAspectRatioPreserved; |
949 |
1038 } |
950 size = Size(); |
1039 } |
|
1040 |
|
1041 // In landscape idle we use vertical indicators if parent |
|
1042 // is in vertical mode, otherwise horizontal. |
|
1043 if ( AknStatuspaneUtils::IdleLayoutActive() && |
|
1044 Layout_Meta_Data::IsLandscapeOrientation() && |
|
1045 iParent->Size().iWidth < iParent->Size().iHeight ) |
|
1046 { |
|
1047 size = Size(); |
|
1048 } |
|
1049 |
951 |
1050 break; |
952 break; |
1051 } |
953 } |
1052 |
954 |
1053 // Navi pane editor indicators |
955 // Navi pane editor indicators |
1143 #ifdef RD_INTELLIGENT_TEXT_INPUT |
1045 #ifdef RD_INTELLIGENT_TEXT_INPUT |
1144 case EAknNaviPaneEditorIndicatorFnKeyPressed: |
1046 case EAknNaviPaneEditorIndicatorFnKeyPressed: |
1145 case EAknNaviPaneEditorIndicatorFnKeyLocked: |
1047 case EAknNaviPaneEditorIndicatorFnKeyLocked: |
1146 #endif |
1048 #endif |
1147 { |
1049 { |
1148 TAknWindowComponentLayout l1 = AknLayoutScalable_Avkon::navi_icon_pane(0); |
1050 TRect navipaneRect( 0, 0, 0, 0 ); |
1149 TAknWindowComponentLayout l2 = AknLayoutScalable_Avkon::navi_icon_pane_g1(); |
1051 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
1150 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 ) ); |
1151 |
1085 |
1152 TAknLayoutRect layoutRect; |
1086 TAknLayoutRect layoutRect; |
1153 layoutRect.LayoutRect( navipaneRect, layout ); |
1087 layoutRect.LayoutRect( navipaneRect, layout ); |
1154 TRect rect( layoutRect.Rect() ); |
1088 TRect rect( layoutRect.Rect() ); |
1155 size = rect.Size(); |
1089 size = rect.Size(); |
1159 // Extra application indicators to editor indicator pane |
1093 // Extra application indicators to editor indicator pane |
1160 // in small or nHD status pane layout. |
1094 // in small or nHD status pane layout. |
1161 case EAknNaviPaneEditorIndicatorWaitBar: |
1095 case EAknNaviPaneEditorIndicatorWaitBar: |
1162 case EAknNaviPaneEditorIndicatorProgressBar: |
1096 case EAknNaviPaneEditorIndicatorProgressBar: |
1163 { |
1097 { |
|
1098 TRect rect( Rect() ); |
|
1099 |
1164 TAknLayoutRect waitPaneComponentLayoutRect; |
1100 TAknLayoutRect waitPaneComponentLayoutRect; |
1165 waitPaneComponentLayoutRect.LayoutRect( |
1101 waitPaneComponentLayoutRect.LayoutRect( |
1166 rect, |
1102 rect, |
1167 AknLayoutScalable_Avkon::status_small_wait_pane_g2() ); |
1103 AknLayoutScalable_Avkon::status_small_wait_pane_g2() ); |
1168 TRect waitPaneComponentRect( waitPaneComponentLayoutRect.Rect() ); |
1104 TRect waitPaneComponentRect( waitPaneComponentLayoutRect.Rect() ); |
1179 case EAknNaviPaneEditorIndicatorFileSize: |
1115 case EAknNaviPaneEditorIndicatorFileSize: |
1180 case EAknNaviPaneEditorIndicatorWlanAvailable: |
1116 case EAknNaviPaneEditorIndicatorWlanAvailable: |
1181 case EAknNaviPaneEditorIndicatorWlanActive: |
1117 case EAknNaviPaneEditorIndicatorWlanActive: |
1182 case EAknNaviPaneEditorIndicatorWlanActiveSecure: |
1118 case EAknNaviPaneEditorIndicatorWlanActiveSecure: |
1183 { |
1119 { |
1184 // app window |
1120 // Screen |
1185 TAknWindowComponentLayout applicationWindowLayout( AknLayoutScalable_Avkon::application_window(0) ); |
1121 TRect screenRect; |
1186 TAknLayoutRect applicationWindowLayoutRect; |
1122 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, |
1187 applicationWindowLayoutRect.LayoutRect( screenRect, applicationWindowLayout ); |
1123 screenRect ); |
1188 TRect applicationWindowRect( applicationWindowLayoutRect.Rect() ); |
1124 |
1189 |
1125 // top area, skip the application window as it's the same |
1190 // top area |
1126 // size as the screen. |
1191 TAknWindowComponentLayout topAreaLayout( AknLayoutScalable_Avkon::area_top_pane(1) ); |
|
1192 TAknLayoutRect topAreaLayoutRect; |
1127 TAknLayoutRect topAreaLayoutRect; |
1193 topAreaLayoutRect.LayoutRect( applicationWindowRect, topAreaLayout ); |
1128 topAreaLayoutRect.LayoutRect( |
|
1129 screenRect, AknLayoutScalable_Avkon::area_top_pane( 1 ) ); |
1194 TRect topAreaRect( topAreaLayoutRect.Rect() ); |
1130 TRect topAreaRect( topAreaLayoutRect.Rect() ); |
1195 |
1131 |
1196 // small statuspane |
1132 // small statuspane |
1197 TAknWindowComponentLayout smallStatusPaneLayout( AknLayoutScalable_Avkon::status_small_pane() ); |
|
1198 TAknLayoutRect smallStatusPaneLayoutRect; |
1133 TAknLayoutRect smallStatusPaneLayoutRect; |
1199 smallStatusPaneLayoutRect.LayoutRect( topAreaRect, smallStatusPaneLayout ); |
1134 smallStatusPaneLayoutRect.LayoutRect( |
|
1135 topAreaRect, AknLayoutScalable_Avkon::status_small_pane() ); |
1200 TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() ); |
1136 TRect smallStatusPaneRect( smallStatusPaneLayoutRect.Rect() ); |
1201 |
1137 |
1202 // icon pane |
1138 // icon pane |
1203 TAknWindowComponentLayout iconPaneLayout( AknLayoutScalable_Avkon::status_small_icon_pane() ); |
|
1204 TAknLayoutRect iconPaneLayoutRect; |
1139 TAknLayoutRect iconPaneLayoutRect; |
1205 iconPaneLayoutRect.LayoutRect( smallStatusPaneRect, iconPaneLayout ); |
1140 iconPaneLayoutRect.LayoutRect( |
|
1141 smallStatusPaneRect, |
|
1142 AknLayoutScalable_Avkon::status_small_icon_pane() ); |
|
1143 |
1206 TRect iconPaneRect( iconPaneLayoutRect.Rect() ); |
1144 TRect iconPaneRect( iconPaneLayoutRect.Rect() ); |
1207 |
1145 |
1208 size = iconPaneRect.Size(); |
1146 size = iconPaneRect.Size(); |
1209 break; |
1147 break; |
1210 } |
1148 } |