72 #include <touchfeedback.h> |
75 #include <touchfeedback.h> |
73 |
76 |
74 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, |
77 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, |
75 TAknWindowComponentLayout aLine2) |
78 TAknWindowComponentLayout aLine2) |
76 { |
79 { |
|
80 _AKNTRACE_FUNC_ENTER; |
|
81 _AKNTRACE_FUNC_EXIT; |
77 return TAknWindowComponentLayout::Compose(aLine1, aLine2); |
82 return TAknWindowComponentLayout::Compose(aLine1, aLine2); |
78 } |
83 } |
79 |
84 |
80 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, |
85 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, |
81 TAknTextComponentLayout aLine2) |
86 TAknTextComponentLayout aLine2) |
82 { |
87 { |
|
88 _AKNTRACE_FUNC_ENTER; |
|
89 _AKNTRACE_FUNC_EXIT; |
83 return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); |
90 return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); |
84 } |
91 } |
85 |
92 |
86 /** |
93 /** |
87 * Checks if right side pane is active. |
94 * Checks if right side pane is active. |
88 * @return ETrue if right side pane is active, EFalse otherwise. |
95 * @return ETrue if right side pane is active, EFalse otherwise. |
89 */ |
96 */ |
90 static TBool IsAreaSideRightPaneActive() |
97 static TBool IsAreaSideRightPaneActive() |
91 { |
98 { |
|
99 _AKNTRACE_FUNC_ENTER; |
|
100 _AKNTRACE_FUNC_EXIT; |
92 return EFalse; |
101 return EFalse; |
93 } |
102 } |
94 |
103 |
95 |
104 |
96 /** |
105 /** |
97 * Checks if MSK-enabled layout is in use. |
106 * Checks if MSK-enabled layout is in use. |
98 */ |
107 */ |
99 static TBool IsMskEnabledLayoutActive() |
108 static TBool IsMskEnabledLayoutActive() |
100 { |
109 { |
|
110 _AKNTRACE_FUNC_ENTER; |
101 TBool result( EFalse ); |
111 TBool result( EFalse ); |
102 |
112 |
103 if ( Layout_Meta_Data::IsMSKEnabled() ) |
113 if ( Layout_Meta_Data::IsMSKEnabled() ) |
104 { |
114 { |
105 // First check if MSK is enabled in the layout metadata. |
115 // First check if MSK is enabled in the layout metadata. |
236 iCbaBgIIDSetExt( EFalse ) |
252 iCbaBgIIDSetExt( EFalse ) |
237 ,iLeftFrameMask( NULL ), |
253 ,iLeftFrameMask( NULL ), |
238 iRightFrameMask( NULL ), |
254 iRightFrameMask( NULL ), |
239 iItemActionMenu( NULL ) |
255 iItemActionMenu( NULL ) |
240 { |
256 { |
|
257 _AKNTRACE_FUNC_ENTER; |
|
258 _AKNTRACE_FUNC_EXIT; |
241 }; |
259 }; |
242 |
260 |
243 static CEikCbaExtension* NewL( CEikCba& aOwner ) |
261 static CEikCbaExtension* NewL( CEikCba& aOwner ) |
244 { |
262 { |
|
263 _AKNTRACE_FUNC_ENTER; |
245 CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner ); |
264 CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner ); |
246 CleanupStack::PushL( self ); |
265 CleanupStack::PushL( self ); |
247 self->ConstructL(); |
266 self->ConstructL(); |
248 CleanupStack::Pop( self ); |
267 CleanupStack::Pop( self ); |
|
268 _AKNTRACE_FUNC_EXIT; |
249 return self; |
269 return self; |
250 } |
270 } |
251 |
271 |
252 void ConstructL() |
272 void ConstructL() |
253 { |
273 { |
|
274 _AKNTRACE_FUNC_ENTER; |
254 // Wallpaper is not drawn by embedded CBA. |
275 // Wallpaper is not drawn by embedded CBA. |
255 if ( !iOwner.Flags().IsSet( ECbaEmbedded ) ) |
276 if ( !iOwner.Flags().IsSet( ECbaEmbedded ) ) |
256 { |
277 { |
257 iRepository = CRepository::NewL( KCRUidPersonalisation ); |
278 iRepository = CRepository::NewL( KCRUidPersonalisation ); |
258 iRepository->Get( KPslnWallpaperType, iWallpaperInUse ); |
279 iRepository->Get( KPslnWallpaperType, iWallpaperInUse ); |
682 aLeftButton ); |
715 aLeftButton ); |
683 UpdatePostingOverlayBitmapL( |
716 UpdatePostingOverlayBitmapL( |
684 iRskPostingOverlayBitmap, |
717 iRskPostingOverlayBitmap, |
685 rightSoftKeyButtonRect, |
718 rightSoftKeyButtonRect, |
686 aRightButton ); |
719 aRightButton ); |
|
720 _AKNTRACE_FUNC_EXIT; |
|
721 } |
|
722 |
|
723 /** |
|
724 * Returns ETrue if the command cancels multiple marking and should not |
|
725 * be forwarded to actual command observer. |
|
726 * |
|
727 * @return ETrue if multiple marking was cancelled. |
|
728 */ |
|
729 TBool CancelMultipleMarking( TInt aCommandId ) |
|
730 { |
|
731 _AKNTRACE_FUNC_ENTER; |
|
732 TBool cancelled( EFalse ); |
|
733 if ( aCommandId == EAknSoftkeyCancel |
|
734 && iItemActionMenu |
|
735 && iOwner.Flags().IsSet( ECbaMultipleMarkingActive ) ) |
|
736 { |
|
737 iItemActionMenu->MarkingMode().SetCollectionMultipleMarkingState( |
|
738 EFalse ); |
|
739 cancelled = ETrue; |
|
740 } |
|
741 _AKNTRACE_FUNC_EXIT; |
|
742 return cancelled; |
687 } |
743 } |
688 |
744 |
689 /** |
745 /** |
690 * From MAknCollectionObserver. |
746 * From MAknCollectionObserver. |
691 * This method is used to set the item action menu to observer. |
747 * This method is used to set the item action menu to observer. |
692 * |
748 * |
693 * @param aItemActionMenu Item action menu. |
749 * @param aItemActionMenu Item action menu. |
694 */ |
750 */ |
695 void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu ) |
751 void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu ) |
696 { |
752 { |
|
753 _AKNTRACE_FUNC_ENTER; |
697 iItemActionMenu = aItemActionMenu; |
754 iItemActionMenu = aItemActionMenu; |
|
755 _AKNTRACE_FUNC_EXIT; |
698 } |
756 } |
699 |
757 |
700 /** |
758 /** |
701 * From MAknCollectionObserver. |
759 * From MAknCollectionObserver. |
702 * This method is called when there are changes in collection state. |
760 * This method is called when there are changes in collection state. |
704 * |
762 * |
705 * @param aCollectionVisible ETrue if changed collection is visible. |
763 * @param aCollectionVisible ETrue if changed collection is visible. |
706 */ |
764 */ |
707 void CollectionChanged( TBool aCollectionVisible ) |
765 void CollectionChanged( TBool aCollectionVisible ) |
708 { |
766 { |
|
767 _AKNTRACE_FUNC_ENTER; |
709 // Do not update state if invisible collection tries to enable sk |
768 // Do not update state if invisible collection tries to enable sk |
710 if ( aCollectionVisible |
769 if ( aCollectionVisible |
711 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) ) |
770 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) ) |
712 { |
771 { |
713 iOwner.UpdateItemSpecificSoftkey(); |
772 iOwner.UpdateItemSpecificSoftkey(); |
714 } |
773 } |
|
774 |
|
775 iOwner.UpdateMultipleMarkingSoftkey(); |
|
776 _AKNTRACE_FUNC_EXIT; |
715 } |
777 } |
716 |
778 |
717 /** |
779 /** |
718 * From MAknCollectionObserver. |
780 * From MAknCollectionObserver. |
719 * This method returns ETrue if collection observer is active. |
781 * This method returns ETrue if collection observer is active. |
720 * |
782 * |
721 * @return ETrue if observer is active. |
783 * @return ETrue if observer is active. |
722 */ |
784 */ |
723 TBool Active() const |
785 TBool Active() const |
724 { |
786 { |
|
787 _AKNTRACE_FUNC_ENTER; |
|
788 _AKNTRACE_FUNC_EXIT; |
725 return iOwner.IsVisible() && !iOwner.IsEmpty(); |
789 return iOwner.IsVisible() && !iOwner.IsEmpty(); |
726 } |
790 } |
727 |
791 |
728 /* |
792 /* |
729 * Using the special theme Id draw background |
793 * Using the special theme Id draw background |
730 */ |
794 */ |
731 void DrawSemiTransparencyL(CWindowGc& aGc, |
795 void DrawSemiTransparency( CWindowGc& aGc ) |
732 const TRect& aRect) |
796 { |
733 { |
797 _AKNTRACE_FUNC_ENTER; |
734 //Temporary inner rectangal value |
798 |
735 TRect innerRect = aRect; |
799 TAknsItemID SemiButtonID = KAknsIIDQgnFrSctrlSkButton; |
736 innerRect.Shrink( 5, 5 ); |
800 TAknsItemID SemiButtonCenterID = KAknsIIDQgnFrSctrlSkButtonCenter; |
737 if ( iSemiBgID != KAknsIIDNone ) |
801 TAknsItemID SemiButtonPressedID = KAknsIIDQgnFrSctrlSkButtonPressed; |
738 { |
802 TAknsItemID SemiButtonPressedCenterID = KAknsIIDQgnFrSctrlSkButtonCenterPressed; |
739 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
803 |
740 aGc, aRect, innerRect, iSemiBgID, iSemiBgCenterID ); |
804 CEikCbaButton* button1 = static_cast<CEikCbaButton*> |
741 } |
805 (iOwner.Control(KControlArrayCBAButton1Posn)); |
742 } |
806 CEikCbaButton* button2 = static_cast<CEikCbaButton*> |
743 |
807 (iOwner.Control(KControlArrayCBAButton2Posn)); |
|
808 |
|
809 if (IsMskEnabledLayoutActive()) |
|
810 { |
|
811 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*> |
|
812 (iOwner.Control(KControlArrayCBAButtonMSKPosn)); |
|
813 |
|
814 if (buttonMSK && buttonMSK->PressedDown()) |
|
815 { |
|
816 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
817 iMiddleFrameOuterRect, |
|
818 iMiddleFrameInnerRect, |
|
819 SemiButtonPressedID, |
|
820 SemiButtonPressedCenterID); |
|
821 } |
|
822 else |
|
823 { |
|
824 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
825 iMiddleFrameOuterRect, |
|
826 iMiddleFrameInnerRect, |
|
827 SemiButtonID, |
|
828 SemiButtonCenterID); |
|
829 } |
|
830 } |
|
831 |
|
832 if (button1 && button1->PressedDown()) |
|
833 { |
|
834 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
835 iLeftFrameOuterRect, |
|
836 iLeftFrameInnerRect, |
|
837 SemiButtonPressedID, |
|
838 SemiButtonPressedCenterID); |
|
839 } |
|
840 else |
|
841 { |
|
842 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
843 iLeftFrameOuterRect, |
|
844 iLeftFrameInnerRect, |
|
845 SemiButtonID, |
|
846 SemiButtonCenterID); |
|
847 } |
|
848 |
|
849 if (button2 && button2->PressedDown()) |
|
850 { |
|
851 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
852 iRightFrameOuterRect, |
|
853 iRightFrameInnerRect, |
|
854 SemiButtonPressedID, |
|
855 SemiButtonPressedCenterID); |
|
856 } |
|
857 else |
|
858 { |
|
859 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc, |
|
860 iRightFrameOuterRect, |
|
861 iRightFrameInnerRect, |
|
862 SemiButtonID, |
|
863 SemiButtonCenterID); |
|
864 } |
|
865 _AKNTRACE_FUNC_EXIT; |
|
866 } |
744 public: |
867 public: |
745 |
868 |
746 CEikCba& iOwner; |
869 CEikCba& iOwner; |
747 CRepository* iRepository; |
870 CRepository* iRepository; |
748 CCenRepNotifyHandler* iCRListener; |
871 CCenRepNotifyHandler* iCRListener; |
824 |
942 |
825 |
943 |
826 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
944 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
827 RWindowGroup* aParentWg) |
945 RWindowGroup* aParentWg) |
828 { |
946 { |
|
947 _AKNTRACE_FUNC_ENTER; |
829 CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static |
948 CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static |
830 CleanupStack::Pop( self ); |
949 CleanupStack::Pop( self ); |
|
950 _AKNTRACE_FUNC_EXIT; |
831 return self; |
951 return self; |
832 } |
952 } |
833 |
953 |
834 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, |
954 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, |
835 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
955 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
836 { |
956 { |
|
957 _AKNTRACE_FUNC_ENTER; |
837 CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static |
958 CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static |
838 CleanupStack::Pop( self ); |
959 CleanupStack::Pop( self ); |
|
960 _AKNTRACE_FUNC_EXIT; |
839 return self; |
961 return self; |
840 } |
962 } |
841 |
963 |
842 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
964 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
843 RWindowGroup* aParentWg) |
965 RWindowGroup* aParentWg) |
844 { |
966 { |
|
967 _AKNTRACE_FUNC_ENTER; |
|
968 _AKNTRACE_FUNC_EXIT; |
845 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static |
969 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static |
846 } |
970 } |
847 |
971 |
848 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, |
972 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, |
849 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
973 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
850 TUint aFlags) |
974 TUint aFlags) |
851 { |
975 { |
|
976 _AKNTRACE_FUNC_ENTER; |
|
977 _AKNTRACE_FUNC_EXIT; |
852 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, |
978 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, |
853 aParentWg, aFlags); |
979 aParentWg, aFlags); |
854 } |
980 } |
855 |
981 |
856 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
982 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
857 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
983 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
858 { |
984 { |
|
985 _AKNTRACE_FUNC_ENTER; |
859 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static |
986 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static |
860 CleanupStack::PushL(self); |
987 CleanupStack::PushL(self); |
861 self->ConstructL(aResourceId); |
988 self->ConstructL(aResourceId); |
862 AKNTASHOOK_ADDL( self, "CEikCba" ); |
989 AKNTASHOOK_ADDL( self, "CEikCba" ); |
|
990 _AKNTRACE_FUNC_EXIT; |
863 return self; |
991 return self; |
864 } |
992 } |
865 |
993 |
866 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
994 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
867 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
995 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
868 TUint aFlags) |
996 TUint aFlags) |
869 { |
997 { |
|
998 _AKNTRACE_FUNC_ENTER; |
870 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, |
999 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, |
871 aParentWg, aFlags); |
1000 aParentWg, aFlags); |
872 CleanupStack::PushL(self); |
1001 CleanupStack::PushL(self); |
873 self->ConstructL(aResourceId); |
1002 self->ConstructL(aResourceId); |
874 AKNTASHOOK_ADDL( self, "CEikCba" ); |
1003 AKNTASHOOK_ADDL( self, "CEikCba" ); |
|
1004 _AKNTRACE_FUNC_EXIT; |
875 return self; |
1005 return self; |
876 } |
1006 } |
877 |
1007 |
878 |
1008 |
879 /** |
1009 /** |
880 * Destructor. |
1010 * Destructor. |
881 */ |
1011 */ |
882 CEikCba::~CEikCba() |
1012 CEikCba::~CEikCba() |
883 { |
1013 { |
|
1014 _AKNTRACE_FUNC_ENTER; |
884 AKNTASHOOK_REMOVE(); |
1015 AKNTASHOOK_REMOVE(); |
885 // Revert the clock and indicator pane area of status pane |
1016 // Revert the clock and indicator pane area of status pane |
886 // to use the previous skin background. |
1017 // to use the previous skin background. |
887 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
1018 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
888 if ( sp && |
1019 if ( sp && |
923 #ifdef RD_ENHANCED_CBA |
1054 #ifdef RD_ENHANCED_CBA |
924 delete iCommandTable; |
1055 delete iCommandTable; |
925 #endif // RD_ENHANCED_CBA |
1056 #endif // RD_ENHANCED_CBA |
926 |
1057 |
927 delete iExtension; |
1058 delete iExtension; |
|
1059 _AKNTRACE_FUNC_EXIT; |
928 } |
1060 } |
929 |
1061 |
930 /** |
1062 /** |
931 * Constructor. |
1063 * Constructor. |
932 */ |
1064 */ |
933 CEikCba::CEikCba(const CEikCba* aPrevious, |
1065 CEikCba::CEikCba(const CEikCba* aPrevious, |
934 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
1066 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
935 TUint aFlags) |
1067 TUint aFlags) |
936 : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg) |
1068 : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg) |
937 { |
1069 { |
|
1070 _AKNTRACE_FUNC_ENTER; |
938 if (aFlags & CEikButtonGroupContainer::EIsEmbedded) |
1071 if (aFlags & CEikButtonGroupContainer::EIsEmbedded) |
939 { |
1072 { |
940 // CBA is embedded in another component (eg. dialog/popup/setting page |
1073 // CBA is embedded in another component (eg. dialog/popup/setting page |
941 iFlags.Set(ECbaEmbedded); |
1074 iFlags.Set(ECbaEmbedded); |
942 } |
1075 } |
943 |
1076 |
|
1077 if ( aFlags & CEikButtonGroupContainer::EAlwaysShown ) |
|
1078 { |
|
1079 iFlags.Set( ECbaKeepItemSoftkeyVisible ); |
|
1080 } |
|
1081 |
944 if ( aFlags & CEikButtonGroupContainer::EParentIsControl ) |
1082 if ( aFlags & CEikButtonGroupContainer::EParentIsControl ) |
945 { |
1083 { |
946 iFlags.Set( ECbaParentAsControl ); |
1084 iFlags.Set( ECbaParentAsControl ); |
947 } |
1085 } |
948 |
1086 |
949 if ( aFlags & CEikButtonGroupContainer::EDelayActivation ) |
1087 if ( aFlags & CEikButtonGroupContainer::EDelayActivation ) |
950 { |
1088 { |
951 iFlags.Set( ECbaActivationDelayed ); |
1089 iFlags.Set( ECbaActivationDelayed ); |
952 } |
1090 } |
953 |
1091 |
954 CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() ); |
1092 CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() ); |
1219 TRect( 0, 0, 1, 1 ), |
1354 TRect( 0, 0, 1, 1 ), |
1220 ETrue, |
1355 ETrue, |
1221 2 ); |
1356 2 ); |
1222 |
1357 |
1223 // Other context for staconpane |
1358 // Other context for staconpane |
1224 |
1359 if ( AknStatuspaneUtils::StaconPaneActive() ) |
1225 // There is a need for two layers in each context: one for wallpaper, |
1360 { |
1226 // the other for skin graphics. |
1361 CheckAndCreateStaconContextsL(); |
1227 iStaconBgContextTop = CAknsMaskedLayerBackgroundControlContext::NewL( |
1362 } |
1228 KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN ); |
|
1229 iStaconBgContextBottom = CAknsMaskedLayerBackgroundControlContext::NewL( |
|
1230 KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN ); |
|
1231 |
|
1232 for ( TInt i = 0; i < ECbaLayerN; i++ ) |
|
1233 { |
|
1234 iStaconBgContextBottom->SetLayerImage( i, KAknsIIDNone ); |
|
1235 } |
|
1236 |
|
1237 TAknWindowLineLayout layout( AknLayoutScalable_Avkon::area_top_pane(2).LayoutLine() ); |
|
1238 TAknLayoutRect layoutRect; |
|
1239 layoutRect.LayoutRect( screen, layout ); |
|
1240 TRect staconTop( layoutRect.Rect() ); |
|
1241 |
|
1242 layout = AknLayoutScalable_Avkon::area_bottom_pane(2).LayoutLine(); |
|
1243 layoutRect.LayoutRect( screen, layout ); |
|
1244 TRect staconBottom( layoutRect.Rect() ); |
|
1245 |
|
1246 // Set layers to stacon contexts. |
|
1247 // Set bottom as parent to top, so that top is re-drawn, if bottom is drawn. |
|
1248 iStaconBgContextTop->SetLayerImage( ECbaLayerWallpaper, KAknsIIDWallpaper ); |
|
1249 iStaconBgContextTop->SetLayerRect( ECbaLayerWallpaper, screen ); |
|
1250 iStaconBgContextTop->SetLayerImage( ECbaLayerBackground, KAknsIIDQsnBgAreaStaconRt ); |
|
1251 iStaconBgContextTop->SetLayerRect( ECbaLayerBackground, staconTop ); |
|
1252 |
|
1253 iStaconBgContextBottom->SetLayerImage( ECbaLayerWallpaper, KAknsIIDWallpaper ); |
|
1254 iStaconBgContextBottom->SetLayerRect( ECbaLayerWallpaper, screen ); |
|
1255 iStaconBgContextBottom->SetLayerImage( ECbaLayerBackground, KAknsIIDQsnBgAreaStaconRb ); |
|
1256 iStaconBgContextBottom->SetLayerRect( ECbaLayerBackground, staconBottom ); |
|
1257 iStaconBgContextBottom->SetParentPos( TPoint( 0, 0 ) ); |
|
1258 |
|
1259 iStaconBgContextTop->SetParentContext( iStaconBgContextBottom ); |
|
1260 |
|
1261 TBool idle = AknLayoutFlags() & EAknLayoutCbaInStaconPaneIdle; |
|
1262 if ( idle ) |
|
1263 { |
|
1264 iStaconBgContextTop->SetLayerMaskAndSizeL( KAknsIIDQgnGrafBgLscTopMaskIcon, staconTop ); |
|
1265 iStaconBgContextBottom->SetLayerMaskAndSizeL( KAknsIIDQgnGrafBgLscBottomMaskIcon, staconBottom ); |
|
1266 } |
|
1267 |
|
1268 } |
1363 } |
1269 |
1364 |
1270 iExtension->UpdateSoftkeyFrameL( EFalse ); |
1365 iExtension->UpdateSoftkeyFrameL( EFalse ); |
1271 |
1366 |
1272 CRepository* cenRep = NULL; |
1367 CRepository* cenRep = NULL; |
1580 { |
1677 { |
1581 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL(); |
1678 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL(); |
1582 } |
1679 } |
1583 } |
1680 } |
1584 |
1681 |
1585 // Set CBA faded in case the softkeys are empty. |
1682 _AKNTRACE_FUNC_EXIT; |
1586 SetFadeState(); |
|
1587 } |
1683 } |
1588 |
1684 |
1589 |
1685 |
1590 TInt CEikCba::MaxCommands() const |
1686 TInt CEikCba::MaxCommands() const |
1591 { |
1687 { |
|
1688 _AKNTRACE_FUNC_ENTER; |
|
1689 _AKNTRACE_FUNC_EXIT; |
1592 return KMaxSeries60Softkeys; |
1690 return KMaxSeries60Softkeys; |
1593 } |
1691 } |
1594 |
1692 |
1595 TInt CEikCba::MSKEnabledInPlatform() const |
1693 TInt CEikCba::MSKEnabledInPlatform() const |
1596 { |
1694 { |
|
1695 _AKNTRACE_FUNC_ENTER; |
|
1696 _AKNTRACE_FUNC_EXIT; |
1597 return iMSKEnabledInPlatform; |
1697 return iMSKEnabledInPlatform; |
1598 } |
1698 } |
1599 |
1699 |
1600 |
1700 |
1601 // --------------------------------------------------------------------------- |
1701 // --------------------------------------------------------------------------- |
1602 // Sets the middle softkey icon. |
1702 // Sets the middle softkey icon. |
1603 // --------------------------------------------------------------------------- |
1703 // --------------------------------------------------------------------------- |
1604 // |
1704 // |
1605 void CEikCba::SetMSKIconL() |
1705 void CEikCba::SetMSKIconL() |
1606 { |
1706 { |
|
1707 _AKNTRACE_FUNC_ENTER; |
1607 // MSK is not supported by dialog-embedded CBAs. |
1708 // MSK is not supported by dialog-embedded CBAs. |
1608 if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) ) |
1709 if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) ) |
1609 { |
1710 { |
|
1711 _AKNTRACE_FUNC_EXIT; |
1610 return; |
1712 return; |
1611 } |
1713 } |
1612 |
1714 |
1613 if ( !MskAllowed() ) |
1715 if ( !MskAllowed() ) |
1614 { |
1716 { |
|
1717 _AKNTRACE_FUNC_EXIT; |
1615 return; |
1718 return; |
1616 } |
1719 } |
1617 |
1720 |
1618 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1721 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1619 if ( !skin ) |
1722 if ( !skin ) |
1620 { |
1723 { |
|
1724 _AKNTRACE_FUNC_EXIT; |
1621 return; |
1725 return; |
1622 } |
1726 } |
1623 if( iExtension->iIfMskIconSet ) |
1727 if( iExtension->iIfMskIconSet ) |
1624 { |
1728 { |
1625 // UpdateIconL(); |
1729 // UpdateIconL(); |
1626 return; |
1730 _AKNTRACE_FUNC_EXIT; |
|
1731 return; |
1627 } |
1732 } |
1628 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
1733 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
1629 |
1734 |
1630 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
1735 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
1631 if ( !button ) |
1736 if ( !button ) |
1632 { |
1737 { |
|
1738 _AKNTRACE_FUNC_EXIT; |
1633 return; |
1739 return; |
1634 } |
1740 } |
1635 |
1741 |
1636 CFbsBitmap *bitmap = NULL; |
1742 CFbsBitmap *bitmap = NULL; |
1637 CFbsBitmap *mask = NULL; |
1743 CFbsBitmap *mask = NULL; |
1638 |
1744 |
1639 TAknLayoutRect qgn_graf_sk_msk; |
1745 TAknLayoutRect qgn_graf_sk_msk; |
1640 TRect rect; |
1746 TRect rect; |
|
1747 TInt graphicMSKVariety = 1; |
|
1748 if ( iCbaFlags & EEikCbaFlagAppMskIcon ) |
|
1749 { |
|
1750 graphicMSKVariety = 0 ; |
|
1751 } |
1641 qgn_graf_sk_msk.LayoutRect( |
1752 qgn_graf_sk_msk.LayoutRect( |
1642 rect, |
1753 rect, |
1643 AknLayoutScalable_Avkon::control_pane_g4( 0 ).LayoutLine() ); |
1754 AknLayoutScalable_Avkon::control_pane_g4( graphicMSKVariety ).LayoutLine() ); |
1644 |
1755 |
1645 TSize iconSize( qgn_graf_sk_msk.Rect().Width(), |
1756 TSize iconSize( qgn_graf_sk_msk.Rect().Width(), |
1646 qgn_graf_sk_msk.Rect().Height() ); |
1757 qgn_graf_sk_msk.Rect().Height() ); |
1647 TInt leftId = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
1758 TInt leftId = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
1648 |
1759 |
1856 } |
1977 } |
1857 } |
1978 } |
1858 // Change of text may affect layout. |
1979 // Change of text may affect layout. |
1859 SizeChanged(); |
1980 SizeChanged(); |
1860 DrawDeferred() ; |
1981 DrawDeferred() ; |
|
1982 _AKNTRACE_FUNC_EXIT; |
1861 } |
1983 } |
1862 |
1984 |
1863 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver) |
1985 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver) |
1864 { |
1986 { |
|
1987 _AKNTRACE_FUNC_ENTER; |
1865 if(iSBFrame) |
1988 if(iSBFrame) |
1866 { |
1989 { |
1867 iSBFrame->SetScrollBarFrameObserver(aObserver); |
1990 iSBFrame->SetScrollBarFrameObserver(aObserver); |
1868 } |
1991 } |
|
1992 _AKNTRACE_FUNC_EXIT; |
1869 } |
1993 } |
1870 |
1994 |
1871 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel) |
1995 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel) |
1872 { |
1996 { |
|
1997 _AKNTRACE_FUNC_ENTER; |
1873 if(iSBFrame) |
1998 if(iSBFrame) |
1874 { |
1999 { |
1875 VScrollBarAsControl()->SetModelL(aModel); |
2000 VScrollBarAsControl()->SetModelL(aModel); |
1876 } |
2001 } |
|
2002 _AKNTRACE_FUNC_EXIT; |
1877 } |
2003 } |
1878 |
2004 |
1879 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const |
2005 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const |
1880 { |
2006 { |
|
2007 _AKNTRACE_FUNC_ENTER; |
|
2008 _AKNTRACE_FUNC_EXIT; |
1881 return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); |
2009 return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); |
1882 } |
2010 } |
1883 |
2011 |
1884 CAknScrollBar* CEikCba::VScrollBarAsControl() |
2012 CAknScrollBar* CEikCba::VScrollBarAsControl() |
1885 { |
2013 { |
|
2014 _AKNTRACE_FUNC_ENTER; |
|
2015 _AKNTRACE_FUNC_EXIT; |
1886 return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl); |
2016 return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl); |
1887 } |
2017 } |
1888 |
2018 |
1889 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex) |
2019 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex) |
1890 { |
2020 { |
|
2021 _AKNTRACE_FUNC_ENTER; |
1891 iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point. |
2022 iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point. |
|
2023 _AKNTRACE_FUNC_EXIT; |
1892 } |
2024 } |
1893 |
2025 |
1894 |
2026 |
1895 void CEikCba::SetCommandL( TInt aPosition, |
2027 void CEikCba::SetCommandL( TInt aPosition, |
1896 TInt aCommandId, |
2028 TInt aCommandId, |
1897 const TDesC* aText, |
2029 const TDesC* aText, |
1898 const CFbsBitmap* /*aBitmap*/, |
2030 const CFbsBitmap* /*aBitmap*/, |
1899 const CFbsBitmap* /*aMask*/ ) |
2031 const CFbsBitmap* /*aMask*/ ) |
1900 { |
2032 { |
1901 // We need to check if this call changes the softkeys from being |
2033 _AKNTRACE_FUNC_ENTER; |
1902 // empty to having a command or vice versa to be able to maintain |
2034 |
1903 // correct fade state. |
|
1904 TBool isEmptyBefore( IsEmpty() ); |
|
1905 |
|
1906 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2035 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
1907 groupCtrl.iId = aCommandId; |
2036 groupCtrl.iId = aCommandId; |
1908 groupCtrl.iLongId = 0; |
2037 groupCtrl.iLongId = 0; |
1909 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
2038 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
1910 { |
2039 { |
1981 TPtrC text = reader.ReadTPtrC(); |
2105 TPtrC text = reader.ReadTPtrC(); |
1982 SetCommandL(aPosition, commandId, &text, NULL, NULL); |
2106 SetCommandL(aPosition, commandId, &text, NULL, NULL); |
1983 CleanupStack::PopAndDestroy(); // reader |
2107 CleanupStack::PopAndDestroy(); // reader |
1984 |
2108 |
1985 ReportContentChangedEvent(); |
2109 ReportContentChangedEvent(); |
|
2110 _AKNTRACE_FUNC_EXIT; |
1986 } |
2111 } |
1987 |
2112 |
1988 /** |
2113 /** |
1989 * Installs a new set of commands to be associated with the cba buttons. |
2114 * Installs a new set of commands to be associated with the cba buttons. |
1990 * The previous command set is restored if there is an error while adding |
2115 * The previous command set is restored if there is an error while adding |
1991 * the new command set. |
2116 * the new command set. |
1992 */ |
2117 */ |
1993 void CEikCba::SetCommandSetL(TInt aResourceId) |
2118 void CEikCba::SetCommandSetL(TInt aResourceId) |
1994 { |
2119 { |
|
2120 _AKNTRACE_FUNC_ENTER; |
1995 TResourceReader reader; |
2121 TResourceReader reader; |
1996 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
2122 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
1997 |
2123 |
1998 iCbaFlags = reader.ReadInt32(); |
2124 iCbaFlags = reader.ReadInt32(); |
1999 |
2125 |
2000 if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) |
2126 if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) |
2001 { |
2127 { |
2002 CleanupStack::PopAndDestroy(); // reader |
2128 CleanupStack::PopAndDestroy(); // reader |
2003 OfferCommandListL( aResourceId ); |
2129 OfferCommandListL( aResourceId ); |
|
2130 _AKNTRACE_FUNC_EXIT; |
2004 return; |
2131 return; |
2005 } |
2132 } |
2006 |
2133 |
2007 SetButtonGroupFlags( iCbaFlags ); |
2134 SetButtonGroupFlags( iCbaFlags ); |
2008 reader.ReadInt16(); // Skip width resource. |
2135 reader.ReadInt16(); // Skip width resource. |
2100 CleanupStack::PopAndDestroy(); // reader |
2227 CleanupStack::PopAndDestroy(); // reader |
2101 |
2228 |
2102 // Force labels to be re-formatted... |
2229 // Force labels to be re-formatted... |
2103 SizeChanged(); |
2230 SizeChanged(); |
2104 ReportContentChangedEvent(); |
2231 ReportContentChangedEvent(); |
|
2232 _AKNTRACE_FUNC_EXIT; |
2105 } |
2233 } |
2106 |
2234 |
2107 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, |
2235 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, |
2108 const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/) |
2236 const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/) |
2109 { |
2237 { |
|
2238 _AKNTRACE_FUNC_ENTER; |
2110 User::Leave(KErrNotSupported); |
2239 User::Leave(KErrNotSupported); |
|
2240 _AKNTRACE_FUNC_EXIT; |
2111 } |
2241 } |
2112 |
2242 |
2113 |
2243 |
2114 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition, |
2244 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition, |
2115 TInt aCommandId, |
2245 TInt aCommandId, |
2116 const TDesC* aText) |
2246 const TDesC* aText) |
2117 { |
2247 { |
2118 // We need to check if this call changes the softkeys from being |
2248 _AKNTRACE_FUNC_ENTER; |
2119 // empty to having a command or vice versa to be able to maintain |
2249 |
2120 // correct fade state. |
2250 if ( !CommandChangeAllowed() ) |
2121 TBool isEmptyBefore( IsEmpty() ); |
2251 { |
|
2252 _AKNTRACE_FUNC_EXIT; |
|
2253 return; |
|
2254 } |
2122 |
2255 |
2123 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2256 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2124 |
2257 |
2125 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
2258 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
2126 { |
2259 { |
2127 CAknButton* button = static_cast<CAknButton*>( groupCtrl.iControl ); |
2260 CAknButton* button = static_cast<CAknButton*>( groupCtrl.iControl ); |
|
2261 |
|
2262 if ( aCommandId == EAknSoftkeyEmergencyCall ) |
|
2263 { |
|
2264 // Change the button to use "call button" (green) frame graphics |
|
2265 // in case of ECS call command to highlight the possibility |
|
2266 // of making an emergency call from the query. |
|
2267 button->SetBackgroundIds( KAknsIIDQsnFrButtonNormalAnswer, |
|
2268 KAknsIIDNone, |
|
2269 KAknsIIDNone, |
|
2270 KAknsIIDQsnFrButtonPressedAnswer, |
|
2271 KAknsIIDNone ); |
|
2272 } |
|
2273 else |
|
2274 { |
|
2275 // Revert the frame graphics back to normal in case that a |
|
2276 // new command is added to the stack on top of the emergency |
|
2277 // call command (shouldn't happen though). |
|
2278 button->SetBackgroundIds( KAknsIIDQsnFrFunctionButtonNormal, |
|
2279 KAknsIIDQsnFrFunctionButtonPressed, |
|
2280 KAknsIIDQsnFrFunctionButtonInactive, |
|
2281 KAknsIIDQsnFrFunctionButtonPressed, |
|
2282 KAknsIIDQsnFrFunctionButtonInactive ); |
|
2283 } |
|
2284 |
2128 button->AddStateL( NULL, NULL, NULL, NULL, *aText, KNullDesC, 0, aCommandId ); |
2285 button->AddStateL( NULL, NULL, NULL, NULL, *aText, KNullDesC, 0, aCommandId ); |
2129 |
2286 |
2130 if ( aText->Length() == 0 || !aText->Compare( _L(" ") ) ) |
2287 if ( aText->Length() == 0 || !aText->Compare( _L(" ") ) ) |
2131 { |
2288 { |
2132 button->SetDimmed( ETrue ); |
2289 button->SetDimmed( ETrue ); |
2152 { |
2309 { |
2153 iMSKset = ETrue; |
2310 iMSKset = ETrue; |
2154 } |
2311 } |
2155 SetMSKIconL(); // If MSK id was changed, this sets MSK icon accordingly. |
2312 SetMSKIconL(); // If MSK id was changed, this sets MSK icon accordingly. |
2156 |
2313 |
2157 TBool isEmptyAfter( IsEmpty() ); |
|
2158 |
|
2159 if ( !COMPARE_BOOLS( isEmptyBefore, isEmptyAfter ) ) |
|
2160 { |
|
2161 SetFadeState(); |
|
2162 } |
|
2163 |
|
2164 ReportContentChangedEvent(); |
2314 ReportContentChangedEvent(); |
|
2315 _AKNTRACE_FUNC_EXIT; |
2165 } |
2316 } |
2166 |
2317 |
2167 void CEikCba::AddCommandToStackL( TInt aPosition, |
2318 void CEikCba::AddCommandToStackL( TInt aPosition, |
2168 TInt aCommandId, |
2319 TInt aCommandId, |
2169 const TDesC* aText, |
2320 const TDesC* aText, |
2170 const CFbsBitmap* /*aBitmap*/, |
2321 const CFbsBitmap* /*aBitmap*/, |
2171 const CFbsBitmap* /*aMask*/ ) |
2322 const CFbsBitmap* /*aMask*/ ) |
2172 { |
2323 { |
|
2324 _AKNTRACE_FUNC_ENTER; |
2173 |
2325 |
2174 AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText); |
2326 AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText); |
2175 // Force labels to be re-formatted... |
2327 // Force labels to be re-formatted... |
2176 SizeChanged(); |
2328 SizeChanged(); |
|
2329 _AKNTRACE_FUNC_EXIT; |
2177 } |
2330 } |
2178 |
2331 |
2179 |
2332 |
2180 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId) |
2333 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId) |
2181 { |
2334 { |
|
2335 _AKNTRACE_FUNC_ENTER; |
2182 TResourceReader reader; |
2336 TResourceReader reader; |
2183 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2337 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2184 TUint8 version = (TUint8)reader.ReadInt8(); |
2338 TUint8 version = (TUint8)reader.ReadInt8(); |
2185 TInt commandId(0); |
2339 TInt commandId(0); |
2186 if (version == KAknCbaVersion) |
2340 if (version == KAknCbaVersion) |
2268 CleanupStack::PopAndDestroy(); // reader |
2424 CleanupStack::PopAndDestroy(); // reader |
2269 |
2425 |
2270 // Force labels to be re-formatted... |
2426 // Force labels to be re-formatted... |
2271 SizeChanged(); |
2427 SizeChanged(); |
2272 ReportContentChangedEvent(); |
2428 ReportContentChangedEvent(); |
|
2429 _AKNTRACE_FUNC_EXIT; |
2273 } |
2430 } |
2274 |
2431 |
2275 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/) |
2432 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/) |
2276 { |
2433 { |
|
2434 _AKNTRACE_FUNC_ENTER; |
|
2435 _AKNTRACE_FUNC_EXIT; |
2277 } |
2436 } |
2278 |
2437 |
2279 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/) |
2438 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/) |
2280 { |
2439 { |
|
2440 _AKNTRACE_FUNC_ENTER; |
|
2441 _AKNTRACE_FUNC_EXIT; |
2281 return MinimumSize(); |
2442 return MinimumSize(); |
2282 } |
2443 } |
2283 |
2444 |
2284 |
2445 |
2285 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId ) |
2446 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId ) |
2286 { |
2447 { |
|
2448 _AKNTRACE_FUNC_ENTER; |
2287 // We need to check if this call changes the softkeys from being |
2449 // We need to check if this call changes the softkeys from being |
2288 // empty to having a command or vice versa to be able to maintain |
2450 // empty to having a command or vice versa to be able to maintain |
2289 // correct fade state. |
2451 // correct fade state. |
2290 TBool isEmptyBefore( IsEmpty() ); |
2452 TBool isEmptyBefore( IsEmpty() ); |
2291 |
2453 |
2326 |
2498 |
2327 // Force labels to be re-formatted... |
2499 // Force labels to be re-formatted... |
2328 SizeChanged(); |
2500 SizeChanged(); |
2329 |
2501 |
2330 TBool isEmptyAfter( IsEmpty() ); |
2502 TBool isEmptyAfter( IsEmpty() ); |
2331 |
|
2332 if ( !COMPARE_BOOLS( isEmptyBefore, isEmptyAfter ) ) |
|
2333 { |
|
2334 SetFadeState(); |
|
2335 } |
|
2336 |
2503 |
2337 DrawDeferred(); |
2504 DrawDeferred(); |
2338 ReportContentChangedEvent(); |
2505 ReportContentChangedEvent(); |
|
2506 _AKNTRACE_FUNC_EXIT; |
2339 } |
2507 } |
2340 |
2508 |
2341 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition) |
2509 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition) |
2342 { |
2510 { |
|
2511 _AKNTRACE_FUNC_ENTER; |
2343 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2512 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2344 STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand(); |
2513 STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand(); |
|
2514 _AKNTRACE_FUNC_EXIT; |
2345 } |
2515 } |
2346 |
2516 |
2347 void CEikCba::RemovePreviousCommand(TInt aPosition) |
2517 void CEikCba::RemovePreviousCommand(TInt aPosition) |
2348 { |
2518 { |
|
2519 _AKNTRACE_FUNC_ENTER; |
2349 RemovePreviousCommandWithoutSizeChanged( aPosition ); |
2520 RemovePreviousCommandWithoutSizeChanged( aPosition ); |
2350 // If MSK or left CBA was changed, this sets MSK icon accordingly. |
2521 // If MSK or left CBA was changed, this sets MSK icon accordingly. |
2351 TRAP_IGNORE( SetMSKIconL() ); |
2522 TRAP_IGNORE( SetMSKIconL() ); |
2352 |
2523 |
2353 // Force labels to be re-formatted... |
2524 // Force labels to be re-formatted... |
2354 SizeChanged(); |
2525 SizeChanged(); |
2355 ReportContentChangedEvent(); |
2526 ReportContentChangedEvent(); |
|
2527 _AKNTRACE_FUNC_EXIT; |
2356 } |
2528 } |
2357 |
2529 |
2358 |
2530 |
2359 TInt CEikCba::CommandPos(TInt aCommandId) const |
2531 TInt CEikCba::CommandPos(TInt aCommandId) const |
2360 { |
2532 { |
|
2533 _AKNTRACE_FUNC_ENTER; |
|
2534 _AKNTRACE_FUNC_EXIT; |
2361 return IndexById(aCommandId); |
2535 return IndexById(aCommandId); |
2362 } |
2536 } |
2363 |
2537 |
2364 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed) |
2538 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed) |
2365 { |
2539 { |
|
2540 _AKNTRACE_FUNC_ENTER; |
2366 CCoeControl* control( ButtonById( aCommandId ) ); |
2541 CCoeControl* control( ButtonById( aCommandId ) ); |
2367 if ( control ) |
2542 if ( control ) |
2368 { |
2543 { |
2369 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) ) |
2544 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) ) |
2370 { |
2545 { |
2371 control->SetDimmed( aDimmed ); |
2546 control->SetDimmed( aDimmed ); |
2372 } |
2547 } |
2373 } |
2548 } |
|
2549 _AKNTRACE_FUNC_EXIT; |
2374 } |
2550 } |
2375 |
2551 |
2376 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const |
2552 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const |
2377 { |
2553 { |
|
2554 _AKNTRACE_FUNC_ENTER; |
2378 if( ButtonById(aCommandId) ) |
2555 if( ButtonById(aCommandId) ) |
2379 { |
2556 { |
|
2557 _AKNTRACE_FUNC_EXIT; |
2380 return ButtonById(aCommandId)->IsDimmed(); |
2558 return ButtonById(aCommandId)->IsDimmed(); |
2381 } |
2559 } |
|
2560 _AKNTRACE_FUNC_EXIT; |
2382 return EFalse; |
2561 return EFalse; |
2383 } |
2562 } |
2384 |
2563 |
2385 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible) |
2564 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible) |
2386 { |
2565 { |
|
2566 _AKNTRACE_FUNC_ENTER; |
2387 CCoeControl* control( ButtonById( aCommandId ) ); |
2567 CCoeControl* control( ButtonById( aCommandId ) ); |
2388 if ( control ) |
2568 if ( control ) |
2389 { |
2569 { |
2390 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) ) |
2570 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) ) |
2391 { |
2571 { |
2392 control->MakeVisible( aVisible ); |
2572 control->MakeVisible( aVisible ); |
2393 } |
2573 } |
2394 } |
2574 } |
|
2575 _AKNTRACE_FUNC_EXIT; |
2395 } |
2576 } |
2396 |
2577 |
2397 TBool CEikCba::IsCommandVisible(TInt aCommandId) const |
2578 TBool CEikCba::IsCommandVisible(TInt aCommandId) const |
2398 { |
2579 { |
|
2580 _AKNTRACE_FUNC_ENTER; |
2399 if( ButtonById(aCommandId) ) |
2581 if( ButtonById(aCommandId) ) |
2400 { |
2582 { |
|
2583 _AKNTRACE_FUNC_EXIT; |
2401 return ButtonById(aCommandId)->IsVisible(); |
2584 return ButtonById(aCommandId)->IsVisible(); |
2402 } |
2585 } |
|
2586 _AKNTRACE_FUNC_EXIT; |
2403 return EFalse; |
2587 return EFalse; |
2404 } |
2588 } |
2405 |
2589 |
2406 void CEikCba::AnimateCommand(TInt /*aCommandId*/) |
2590 void CEikCba::AnimateCommand(TInt /*aCommandId*/) |
2407 { |
2591 { |
|
2592 _AKNTRACE_FUNC_ENTER; |
|
2593 _AKNTRACE_FUNC_EXIT; |
2408 } |
2594 } |
2409 |
2595 |
2410 |
2596 |
2411 // --------------------------------------------------------------------------- |
2597 // --------------------------------------------------------------------------- |
2412 // Sets the dimming status of a button with the specified position. |
2598 // Sets the dimming status of a button with the specified position. |
2413 // --------------------------------------------------------------------------- |
2599 // --------------------------------------------------------------------------- |
2414 // |
2600 // |
2415 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed ) |
2601 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed ) |
2416 { |
2602 { |
|
2603 _AKNTRACE_FUNC_ENTER; |
2417 if ( aPosition >= iControlArray->Count() ) |
2604 if ( aPosition >= iControlArray->Count() ) |
2418 { |
2605 { |
|
2606 _AKNTRACE_FUNC_EXIT; |
2419 return; |
2607 return; |
2420 } |
2608 } |
2421 |
2609 |
2422 if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) ) |
2610 if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) ) |
2423 { |
2611 { |
2424 TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ]; |
2612 TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ]; |
2425 groupCtrl.iControl->SetDimmed( aDimmed ); |
2613 groupCtrl.iControl->SetDimmed( aDimmed ); |
2426 } |
2614 } |
|
2615 _AKNTRACE_FUNC_EXIT; |
2427 } |
2616 } |
2428 |
2617 |
2429 |
2618 |
2430 // --------------------------------------------------------------------------- |
2619 // --------------------------------------------------------------------------- |
2431 // Returns the dimming status of a button with the specified position. |
2620 // Returns the dimming status of a button with the specified position. |
2432 // --------------------------------------------------------------------------- |
2621 // --------------------------------------------------------------------------- |
2433 // |
2622 // |
2434 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const |
2623 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const |
2435 { |
2624 { |
|
2625 _AKNTRACE_FUNC_ENTER; |
2436 if ( aPosition >= iControlArray->Count() ) |
2626 if ( aPosition >= iControlArray->Count() ) |
2437 { |
2627 { |
|
2628 _AKNTRACE_FUNC_EXIT; |
2438 return EFalse; |
2629 return EFalse; |
2439 } |
2630 } |
2440 |
2631 |
2441 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2632 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
|
2633 _AKNTRACE_FUNC_EXIT; |
2442 return groupCtrl.iControl->IsDimmed(); |
2634 return groupCtrl.iControl->IsDimmed(); |
2443 } |
2635 } |
2444 |
2636 |
2445 |
2637 |
2446 // --------------------------------------------------------------------------- |
2638 // --------------------------------------------------------------------------- |
2447 // Sets the visibility of a button with the specified position. |
2639 // Sets the visibility of a button with the specified position. |
2448 // --------------------------------------------------------------------------- |
2640 // --------------------------------------------------------------------------- |
2449 // |
2641 // |
2450 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible ) |
2642 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible ) |
2451 { |
2643 { |
|
2644 _AKNTRACE_FUNC_ENTER; |
2452 if ( aPosition >= iControlArray->Count() ) |
2645 if ( aPosition >= iControlArray->Count() ) |
2453 { |
2646 { |
|
2647 _AKNTRACE_FUNC_EXIT; |
2454 return; |
2648 return; |
2455 } |
2649 } |
2456 |
2650 |
2457 if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) ) |
2651 if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) ) |
2458 { |
2652 { |
2467 // Just dim the button, don't hide it. |
2661 // Just dim the button, don't hide it. |
2468 groupCtrl.iControl->SetDimmed( !aVisible ); |
2662 groupCtrl.iControl->SetDimmed( !aVisible ); |
2469 groupCtrl.iControl->DrawDeferred(); |
2663 groupCtrl.iControl->DrawDeferred(); |
2470 } |
2664 } |
2471 } |
2665 } |
|
2666 _AKNTRACE_FUNC_EXIT; |
2472 } |
2667 } |
2473 |
2668 |
2474 |
2669 |
2475 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const |
2670 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const |
2476 { |
2671 { |
|
2672 _AKNTRACE_FUNC_ENTER; |
2477 if (aPosition >= iControlArray->Count()) |
2673 if (aPosition >= iControlArray->Count()) |
2478 { |
2674 { |
|
2675 _AKNTRACE_FUNC_EXIT; |
2479 return EFalse; |
2676 return EFalse; |
2480 } |
2677 } |
2481 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2678 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2482 |
2679 |
2483 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
2680 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
2484 { |
2681 { |
|
2682 _AKNTRACE_FUNC_EXIT; |
2485 return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible(); |
2683 return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible(); |
2486 } |
2684 } |
2487 |
2685 |
|
2686 _AKNTRACE_FUNC_EXIT; |
2488 return !groupCtrl.iControl->IsDimmed(); |
2687 return !groupCtrl.iControl->IsDimmed(); |
2489 } |
2688 } |
2490 |
2689 |
2491 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/) |
2690 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/) |
2492 { |
2691 { |
|
2692 _AKNTRACE_FUNC_ENTER; |
|
2693 _AKNTRACE_FUNC_EXIT; |
2493 } |
2694 } |
2494 |
2695 |
2495 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const |
2696 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const |
2496 { |
2697 { |
2497 if (aPosition >= iControlArray->Count()) |
2698 if (aPosition >= iControlArray->Count()) |
2535 TRect button2Rect( 0, 0, 0, 0 ); |
2738 TRect button2Rect( 0, 0, 0, 0 ); |
2536 TRect buttonMSKRect( 0, 0, 0, 0 ); |
2739 TRect buttonMSKRect( 0, 0, 0, 0 ); |
2537 |
2740 |
2538 if ( iFlags.IsSet( ECbaEmbedded ) ) |
2741 if ( iFlags.IsSet( ECbaEmbedded ) ) |
2539 { |
2742 { |
2540 TRect rect ( Rect() ); |
2743 // The touch area for the softkeys will be larger than the actual |
2541 TAknLayoutRect layoutRect; |
2744 // softkey area (whole CBA area is used). |
2542 layoutRect.LayoutRect( |
2745 TInt buttonWidth = containerRect.Width() / 2; |
2543 rect, |
2746 TSize buttonSize( buttonWidth, containerRect.Height() ); |
2544 AknLayoutScalable_Avkon::popup_sk_window_g1( 0 ) ); |
|
2545 |
|
2546 // Button widths are calculated based on cba area width |
|
2547 // margin width is taken from layout |
|
2548 TInt margin = layoutRect.Rect().iTl.iX - rect.iTl.iX; |
|
2549 TInt buttonWidth = ( rect.Width() - margin * 2 ) / 2; |
|
2550 TSize buttonSize ( buttonWidth, layoutRect.Rect().Height() ); |
|
2551 |
2747 |
2552 button1Rect = TRect( |
2748 button1Rect.SetRect( containerRect.iTl, buttonSize ); |
2553 TPoint( rect.iTl.iX + margin, layoutRect.Rect().iTl.iY ), |
2749 button2Rect.SetRect( TPoint( button1Rect.iBr.iX, |
2554 buttonSize ); |
2750 containerRect.iTl.iY ), |
2555 button2Rect = TRect( |
2751 containerRect.iBr ); |
2556 TPoint( button1Rect.iBr.iX, layoutRect.Rect().iTl.iY ), |
|
2557 TPoint( rect.iBr.iX - margin, |
|
2558 layoutRect.Rect().iBr.iY ) ); |
|
2559 } |
2752 } |
2560 else if ( AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
2753 else if ( AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
2561 { |
2754 { |
2562 // Landcsape nHD layout, button parent rectangle |
2755 // Landcsape nHD layout, button parent rectangle |
2563 // is the whole screen so aRelativeToScreen parameter |
2756 // is the whole screen so aRelativeToScreen parameter |
2742 SetMSKVisibility( ETrue ); |
2943 SetMSKVisibility( ETrue ); |
2743 TRAP_IGNORE( SetMSKIconL() ); |
2944 TRAP_IGNORE( SetMSKIconL() ); |
2744 } |
2945 } |
2745 |
2946 |
2746 // We must check for landscape mode bottom sks |
2947 // We must check for landscape mode bottom sks |
|
2948 TBool isLandscapeOrient = Layout_Meta_Data::IsLandscapeOrientation(); |
2747 TInt bottomPaneVariety = 1; |
2949 TInt bottomPaneVariety = 1; |
2748 if ( Layout_Meta_Data::IsLandscapeOrientation() ) |
2950 if ( isLandscapeOrient ) |
2749 { |
2951 { |
2750 bottomPaneVariety = 6; |
2952 bottomPaneVariety = 6; |
2751 } |
2953 } |
2752 |
2954 |
|
2955 // SetBoundingRect is always called by status pane when it is changing visibility. |
|
2956 // If the status pane is invisible in landscape, softkey need to draw frame to cover |
|
2957 // the area of combine pane. |
|
2958 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
2959 if (statusPane && !statusPane->IsVisible() && isLandscapeOrient && |
|
2960 statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidCombined)).IsInCurrentLayout()) |
|
2961 { |
|
2962 iFlags.Set( ECbaCombinePaneUncovered ); |
|
2963 } |
|
2964 else |
|
2965 { |
|
2966 iFlags.Clear( ECbaCombinePaneUncovered ); |
|
2967 } |
|
2968 |
2753 TAknWindowLineLayout controlPane( DoCompose( |
2969 TAknWindowLineLayout controlPane( DoCompose( |
2754 AknLayoutScalable_Avkon::application_window( 0 ), |
2970 AknLayoutScalable_Avkon::application_window( 0 ), |
2755 DoCompose( AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ), |
2971 DoCompose( AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ), |
2756 AknLayoutScalable_Avkon::control_pane() ) ).LayoutLine() ); |
2972 AknLayoutScalable_Avkon::control_pane() ) ).LayoutLine() ); |
2757 |
2973 |
2761 SetRect( cbarect.Rect() ); |
2977 SetRect( cbarect.Rect() ); |
2762 |
2978 |
2763 // Set correct window region incase we have been in stacon mode. |
2979 // Set correct window region incase we have been in stacon mode. |
2764 RRegion region; |
2980 RRegion region; |
2765 region.AddRect( Rect() ); |
2981 region.AddRect( Rect() ); |
2766 |
|
2767 CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current(); |
|
2768 |
2982 |
2769 // If status indicators and clock are shown in control pane area, |
2983 // If status indicators and clock are shown in control pane area, |
2770 // then remove those areas from cba window region. |
2984 // then remove those areas from cba window region. |
2771 // |
2985 // |
2772 // NOTE: MSK is not supported in landscape. |
2986 // NOTE: MSK is not supported in landscape. |
2773 // |
2987 // |
2774 if ( statusPane && |
2988 if ( statusPane && |
2775 statusPane->IsVisible() && |
2989 statusPane->IsVisible() && |
2776 AknStatuspaneUtils::ExtendedFlatLayoutActive() && |
2990 AknStatuspaneUtils::ExtendedFlatLayoutActive() ) |
2777 ( iBgIID == KAknsIIDQsnBgAreaControl || |
2991 { |
2778 iBgIID == KAknsIIDQsnBgAreaControlIdle || |
|
2779 iBgIID == KAknsIIDQsnBgAreaControlMp || |
|
2780 ( iBgIID == KAknsIIDWallpaper && |
|
2781 AknStatuspaneUtils::IdleLayoutActive() ) ) ) |
|
2782 { |
|
2783 TRect digitalClockRect( 0,0,0,0 ); |
|
2784 TRect indicatorRect( 0,0,0,0 ); |
|
2785 |
|
2786 if ( iBgIID == KAknsIIDQsnBgAreaControlMp ) |
2992 if ( iBgIID == KAknsIIDQsnBgAreaControlMp ) |
2787 { |
2993 { |
2788 if ( !iIsClockIndicBgIIDSet ) |
2994 if ( !iIsClockIndicBgIIDSet ) |
2789 { |
2995 { |
2790 statusPane->SetCbaAreaBackgroundID( |
2996 statusPane->SetCbaAreaBackgroundID( |
2801 iBgIID, |
3007 iBgIID, |
2802 CEikStatusPaneBase::EDrawDeferred ); |
3008 CEikStatusPaneBase::EDrawDeferred ); |
2803 } |
3009 } |
2804 } |
3010 } |
2805 |
3011 |
2806 TRAPD( err1, |
3012 if ( statusPane->PaneCapabilities( |
2807 indicatorRect = statusPane->PaneRectL( TUid::Uid( |
3013 TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() ) |
2808 EEikStatusPaneUidIndic ) ) ); |
3014 { |
2809 |
3015 TRect combinedPaneRect( 0, 0, 0, 0 ); |
2810 TRAPD( err2, |
3016 TRAPD( err, |
2811 digitalClockRect = statusPane->PaneRectL( TUid::Uid( |
3017 combinedPaneRect = |
2812 EEikStatusPaneUidDigitalClock ) ) ); |
3018 statusPane->PaneRectL( TUid::Uid( |
2813 |
3019 EEikStatusPaneUidCombined ) ) ); |
2814 if ( !err1 && !err2 ) |
3020 |
2815 { |
3021 if ( !err ) |
2816 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
|
2817 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
|
2818 |
|
2819 if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) ) |
|
2820 { |
3022 { |
2821 indicatorRect.Move( |
3023 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
2822 -cbaPositionRelativeToScreen.iX, |
3024 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
2823 -cbaPositionRelativeToScreen.iY ); |
3025 |
2824 |
3026 if ( cbaRectRelativeToScreen.Intersects( combinedPaneRect ) ) |
2825 region.SubRect( indicatorRect ); |
3027 { |
|
3028 combinedPaneRect.Move( |
|
3029 -cbaPositionRelativeToScreen.iX, |
|
3030 -cbaPositionRelativeToScreen.iY ); |
|
3031 |
|
3032 region.SubRect( combinedPaneRect ); |
|
3033 } |
2826 } |
3034 } |
|
3035 } |
|
3036 else |
|
3037 { |
|
3038 TRect digitalClockRect( 0, 0, 0, 0 ); |
|
3039 TRect indicatorRect( 0, 0, 0, 0 ); |
|
3040 |
|
3041 TRAPD( err1, |
|
3042 indicatorRect = statusPane->PaneRectL( TUid::Uid( |
|
3043 EEikStatusPaneUidIndic ) ) ); |
|
3044 |
|
3045 TRAPD( err2, |
|
3046 digitalClockRect = statusPane->PaneRectL( TUid::Uid( |
|
3047 EEikStatusPaneUidDigitalClock ) ) ); |
2827 |
3048 |
2828 if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) ) |
3049 if ( !err1 && !err2 ) |
2829 { |
3050 { |
2830 digitalClockRect.Move( |
3051 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() ); |
2831 -cbaPositionRelativeToScreen.iX, |
3052 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() ); |
2832 -cbaPositionRelativeToScreen.iY ); |
3053 |
2833 |
3054 if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) ) |
2834 region.SubRect( digitalClockRect ); |
3055 { |
|
3056 indicatorRect.Move( |
|
3057 -cbaPositionRelativeToScreen.iX, |
|
3058 -cbaPositionRelativeToScreen.iY ); |
|
3059 |
|
3060 region.SubRect( indicatorRect ); |
|
3061 } |
|
3062 |
|
3063 if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) ) |
|
3064 { |
|
3065 digitalClockRect.Move( |
|
3066 -cbaPositionRelativeToScreen.iX, |
|
3067 -cbaPositionRelativeToScreen.iY ); |
|
3068 |
|
3069 region.SubRect( digitalClockRect ); |
|
3070 } |
2835 } |
3071 } |
2836 } |
3072 } |
2837 } |
3073 } |
2838 |
3074 |
2839 if ( !region.CheckError() ) |
3075 if ( !region.CheckError() ) |
3107 aBoundingRect = largestBoundingRect; |
3347 aBoundingRect = largestBoundingRect; |
3108 boundingRegion.Close(); |
3348 boundingRegion.Close(); |
3109 } |
3349 } |
3110 } |
3350 } |
3111 } |
3351 } |
|
3352 _AKNTRACE_FUNC_EXIT; |
3112 } |
3353 } |
3113 |
3354 |
3114 |
3355 |
3115 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) |
3356 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) |
3116 { |
3357 { |
|
3358 _AKNTRACE_FUNC_ENTER; |
|
3359 _AKNTRACE_FUNC_EXIT; |
3117 return ButtonById(aCommandId); |
3360 return ButtonById(aCommandId); |
3118 } |
3361 } |
3119 |
3362 |
3120 |
3363 |
3121 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const |
3364 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const |
3122 { |
3365 { |
|
3366 _AKNTRACE_FUNC_ENTER; |
|
3367 _AKNTRACE_FUNC_EXIT; |
3123 return ButtonById(aCommandId); |
3368 return ButtonById(aCommandId); |
3124 } |
3369 } |
3125 |
3370 |
3126 TInt CEikCba::CommandId(TInt aCommandPos) const |
3371 TInt CEikCba::CommandId(TInt aCommandPos) const |
3127 { |
3372 { |
|
3373 _AKNTRACE_FUNC_ENTER; |
|
3374 _AKNTRACE_FUNC_EXIT; |
3128 return (*iControlArray)[aCommandPos].iId; |
3375 return (*iControlArray)[aCommandPos].iId; |
3129 } |
3376 } |
3130 |
3377 |
3131 TInt CEikCba::ButtonCount() const |
3378 TInt CEikCba::ButtonCount() const |
3132 { |
3379 { |
|
3380 _AKNTRACE_FUNC_ENTER; |
|
3381 _AKNTRACE_FUNC_EXIT; |
3133 return (iControlArray->Count()-1); // -1 for scroll bar; |
3382 return (iControlArray->Count()-1); // -1 for scroll bar; |
3134 } |
3383 } |
3135 |
3384 |
3136 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const |
3385 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const |
3137 { |
3386 { |
|
3387 _AKNTRACE_FUNC_ENTER; |
3138 // It is not possible to convert a CBA button to a CEikCommandButton. |
3388 // It is not possible to convert a CBA button to a CEikCommandButton. |
3139 // Please use an interface that does not use a CEikCommandButton conversion, |
3389 // Please use an interface that does not use a CEikCommandButton conversion, |
3140 // e.g. CEikButtonGroupContainer::SetCommandL(). |
3390 // e.g. CEikButtonGroupContainer::SetCommandL(). |
3141 #if defined(_DEBUG) |
3391 #if defined(_DEBUG) |
3142 Panic(EEikPanicCBACannotConvertToCEikCommandButton); |
3392 Panic(EEikPanicCBACannotConvertToCEikCommandButton); |
3143 #endif |
3393 #endif |
|
3394 _AKNTRACE_FUNC_EXIT; |
3144 return NULL; |
3395 return NULL; |
3145 } |
3396 } |
3146 |
3397 |
3147 TUint CEikCba::ButtonGroupFlags() const |
3398 TUint CEikCba::ButtonGroupFlags() const |
3148 { |
3399 { |
|
3400 _AKNTRACE_FUNC_ENTER; |
|
3401 _AKNTRACE_FUNC_EXIT; |
3149 return iCbaFlags ; |
3402 return iCbaFlags ; |
3150 } |
3403 } |
3151 |
3404 |
3152 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags) |
3405 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags) |
3153 { |
3406 { |
|
3407 _AKNTRACE_FUNC_ENTER; |
3154 iCbaFlags = aFlags; |
3408 iCbaFlags = aFlags; |
|
3409 |
|
3410 //has not supported semi-transparent, ignore the flag at this moment. |
|
3411 //TODO: if the tranparent style CBA is approved and the new icon was delivered, open it again. |
|
3412 |
|
3413 //steven yao |
|
3414 //iCbaFlags &= ~EEikCbaFlagSemiTransparent; |
|
3415 |
3155 if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && |
3416 if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && |
3156 CAknEnv::Static()->TransparencyEnabled() ) |
3417 CAknEnv::Static()->TransparencyEnabled() ) |
3157 { |
3418 { |
3158 Window().SetRequiredDisplayMode( EColor16MA ); |
3419 Window().SetRequiredDisplayMode( EColor16MA ); |
3159 TInt err = Window().SetTransparencyAlphaChannel(); |
3420 TInt err = Window().SetTransparencyAlphaChannel(); |
3160 if( err == KErrNone ) |
3421 if( err == KErrNone ) |
3161 { |
3422 { |
3162 Window().SetBackgroundColor( ~0 ); |
3423 Window().SetBackgroundColor( ~0 ); |
3163 if ( iExtension && iExtension->iEnablePostingTransparency ) |
3424 if ( iExtension && iExtension->iEnablePostingTransparency ) |
3164 { |
3425 { |
3165 iExtension->iEnablePostingTransparency = EFalse; |
3426 iExtension->iEnablePostingTransparency = EFalse; |
3166 delete iExtension->iLskPostingOverlayBitmap; |
3427 delete iExtension->iLskPostingOverlayBitmap; |
3167 iExtension->iLskPostingOverlayBitmap = NULL; |
3428 iExtension->iLskPostingOverlayBitmap = NULL; |
3168 delete iExtension->iRskPostingOverlayBitmap; |
3429 delete iExtension->iRskPostingOverlayBitmap; |
3169 iExtension->iRskPostingOverlayBitmap = NULL; |
3430 iExtension->iRskPostingOverlayBitmap = NULL; |
3170 BroadcastPostingTransparency( EFalse ); |
3431 BroadcastPostingTransparency( EFalse ); |
3171 } |
3432 } |
3172 } |
3433 } |
3173 else |
3434 else |
3174 { |
3435 { |
3175 iCbaFlags &= ~EEikCbaFlagTransparent; |
3436 iCbaFlags &= ~EEikCbaFlagTransparent; |
3176 } |
3437 } |
3177 } |
3438 } |
3178 else |
3439 else |
3179 { |
3440 { |
3180 iCbaFlags &= ~EEikCbaFlagTransparent; |
3441 iCbaFlags &= ~EEikCbaFlagTransparent; |
3181 } |
3442 } |
3182 if ( iCbaFlags & EEikCbaFlagSemiTransparent ) |
|
3183 { |
|
3184 if ( iExtension ) |
|
3185 { |
|
3186 iExtension->iSemiBgID = KAknsIIDQsnHomeBgWidget; |
|
3187 iExtension->iSemiBgCenterID = KAknsIIDQsnHomeBgWidgetCenter; |
|
3188 } |
|
3189 } |
|
3190 else |
|
3191 { |
|
3192 if ( iExtension ) |
|
3193 { |
|
3194 iExtension->iSemiBgID = KAknsIIDNone; |
|
3195 iExtension->iSemiBgCenterID = KAknsIIDNone; |
|
3196 } |
|
3197 } |
|
3198 |
3443 |
3199 UpdateFonts(); |
3444 UpdateFonts(); |
|
3445 _AKNTRACE_FUNC_EXIT; |
3200 } |
3446 } |
3201 |
3447 |
3202 // ----------------------------------------------------------------------------- |
3448 // ----------------------------------------------------------------------------- |
3203 // CEikCba::SetSkinBackgroundId |
3449 // CEikCba::SetSkinBackgroundId |
3204 // |
3450 // |
3205 // ----------------------------------------------------------------------------- |
3451 // ----------------------------------------------------------------------------- |
3206 // |
3452 // |
3207 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID ) |
3453 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID ) |
3208 { |
3454 { |
|
3455 _AKNTRACE_FUNC_ENTER; |
3209 // Skin background is not drawn by embedded CBA. |
3456 // Skin background is not drawn by embedded CBA. |
3210 if ( iFlags.IsSet( ECbaEmbedded ) ) |
3457 if ( iFlags.IsSet( ECbaEmbedded ) ) |
3211 { |
3458 { |
|
3459 iPopupVisible = ETrue; |
|
3460 _AKNTRACE_FUNC_EXIT; |
3212 return; |
3461 return; |
|
3462 } |
|
3463 else |
|
3464 { |
|
3465 iPopupVisible = EFalse; |
3213 } |
3466 } |
3214 |
3467 |
3215 if ( iBgIID != KAknsIIDNone ) |
3468 if ( iBgIID != KAknsIIDNone ) |
3216 { |
3469 { |
3217 if ( iBgIID != aIID ) |
3470 if ( iBgIID != aIID ) |
3283 (aKeyEvent.iModifiers & EModifierCtrl) || |
3540 (aKeyEvent.iModifiers & EModifierCtrl) || |
3284 (aKeyEvent.iModifiers & EModifierRightCtrl); |
3541 (aKeyEvent.iModifiers & EModifierRightCtrl); |
3285 |
3542 |
3286 TKeyResponse response(EKeyWasNotConsumed); |
3543 TKeyResponse response(EKeyWasNotConsumed); |
3287 |
3544 |
|
3545 CEikCbaButton* button1 = |
|
3546 static_cast<CEikCbaButton*>( |
|
3547 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
|
3548 CEikCbaButton* button2 = |
|
3549 static_cast<CEikCbaButton*>( |
|
3550 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
|
3551 CEikCbaButton* buttonMSK = NULL; |
|
3552 if ( iMSKset && AknLayoutUtils::MSKEnabled() ) |
|
3553 { |
|
3554 buttonMSK = |
|
3555 static_cast<CEikCbaButton*>( |
|
3556 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
|
3557 } |
|
3558 |
3288 // AknLaf - changed to use keys defined in AknKeys.h. |
3559 // AknLaf - changed to use keys defined in AknKeys.h. |
3289 // Left soft key will be returned also when MSK is enabled but not defined. |
3560 // Left soft key will be returned also when MSK is enabled but not defined. |
3290 if (aKeyEvent.iCode == EKeyCBA1) |
3561 if (aKeyEvent.iCode == EKeyCBA1) |
3291 { |
3562 { |
3292 if (KControlArrayCBAButton1Posn < iControlArray->Count()) |
3563 if (KControlArrayCBAButton1Posn < iControlArray->Count()) |
3293 { |
3564 { |
|
3565 if( button1->IsDimmed() ) |
|
3566 { |
|
3567 return EKeyWasConsumed; |
|
3568 } |
3294 // Return immediately if the button is invisible |
3569 // Return immediately if the button is invisible |
3295 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3570 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3296 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3571 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3297 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3572 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3298 { |
3573 { |
|
3574 _AKNTRACE_FUNC_EXIT; |
3299 return EKeyWasConsumed; |
3575 return EKeyWasConsumed; |
3300 } |
3576 } |
3301 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3577 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3302 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3578 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3303 |
3579 |
3304 // This will pass key event to application - no softkey command is processed. |
3580 // This will pass key event to application - no softkey command is processed. |
3305 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3581 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3306 { |
3582 { |
|
3583 _AKNTRACE_FUNC_EXIT; |
3307 return EKeyWasNotConsumed; |
3584 return EKeyWasNotConsumed; |
3308 } |
3585 } |
3309 |
3586 |
3310 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3587 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3311 { |
3588 { |
3363 && AknLayoutUtils::MSKEnabled() |
3652 && AknLayoutUtils::MSKEnabled() |
3364 && iMSKset |
3653 && iMSKset |
3365 && aKeyEvent.iCode == EKeyOK |
3654 && aKeyEvent.iCode == EKeyOK |
3366 && !Window().IsFaded() ) |
3655 && !Window().IsFaded() ) |
3367 { |
3656 { |
|
3657 if( buttonMSK->IsDimmed() ) |
|
3658 { |
|
3659 return EKeyWasConsumed; |
|
3660 } |
3368 if (KControlArrayCBAButtonMSKPosn < iControlArray->Count()) |
3661 if (KControlArrayCBAButtonMSKPosn < iControlArray->Count()) |
3369 { |
3662 { |
3370 // Return immediately if the button is invisible. |
3663 // Return immediately if the button is invisible. |
3371 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3664 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3372 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
3665 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
3373 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3666 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3374 { |
3667 { |
|
3668 _AKNTRACE_FUNC_EXIT; |
3375 return EKeyWasConsumed; |
3669 return EKeyWasConsumed; |
3376 } |
3670 } |
3377 |
3671 |
3378 TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId; |
3672 TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId; |
3379 TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId; |
3673 TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId; |
3380 |
3674 |
3381 // This will pass key event to application - no softkey command is processed. |
3675 // This will pass key event to application - no softkey command is processed. |
3382 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3676 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3383 { |
3677 { |
|
3678 _AKNTRACE_FUNC_EXIT; |
3384 return EKeyWasNotConsumed; |
3679 return EKeyWasNotConsumed; |
3385 } |
3680 } |
3386 |
3681 |
3387 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3682 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3388 { |
3683 { |
4095 SizeChanged(); |
4433 SizeChanged(); |
4096 |
4434 |
4097 //Skin change uses DrawNow to flus draw cache before layoutchange. |
4435 //Skin change uses DrawNow to flus draw cache before layoutchange. |
4098 DrawNow(); |
4436 DrawNow(); |
4099 iFlags.Clear(ECbaChangeRecordedSkin); |
4437 iFlags.Clear(ECbaChangeRecordedSkin); |
|
4438 _AKNTRACE_FUNC_EXIT; |
4100 } |
4439 } |
4101 |
4440 |
4102 void CEikCba::DoColorChange() |
4441 void CEikCba::DoColorChange() |
4103 { |
4442 { |
|
4443 _AKNTRACE_FUNC_ENTER; |
4104 iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4444 iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4105 iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this)); |
4445 iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this)); |
4106 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4446 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4107 // This is required for skin resource changes (as well as color resource change). |
4447 // This is required for skin resource changes (as well as color resource change). |
4108 CheckSkinAndUpdateContext(); |
4448 CheckSkinAndUpdateContext(); |
4109 TRAP_IGNORE( SetMSKIconL() ); |
4449 TRAP_IGNORE( SetMSKIconL() ); |
4110 SizeChanged(); |
4450 SizeChanged(); |
4111 iFlags.Clear(ECbaChangeRecordedColor); |
4451 iFlags.Clear(ECbaChangeRecordedColor); |
|
4452 _AKNTRACE_FUNC_EXIT; |
4112 } |
4453 } |
4113 |
4454 |
4114 |
4455 |
4115 void CEikCba::DoLayoutChange() |
4456 void CEikCba::DoLayoutChange() |
4116 { |
4457 { |
|
4458 _AKNTRACE_FUNC_ENTER; |
4117 SetBoundingRect( TRect() ); |
4459 SetBoundingRect( TRect() ); |
4118 |
4460 |
4119 UpdateFonts(); |
4461 UpdateFonts(); |
4120 |
4462 |
4121 TBool mskAllowed( MskAllowed() ); |
4463 TBool mskAllowed( MskAllowed() ); |
4155 { |
4497 { |
4156 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
4498 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
4157 } |
4499 } |
4158 |
4500 |
4159 iFlags.Clear( ECbaChangeRecordedLayout ); |
4501 iFlags.Clear( ECbaChangeRecordedLayout ); |
|
4502 _AKNTRACE_FUNC_EXIT; |
4160 } |
4503 } |
4161 |
4504 |
4162 |
4505 |
4163 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/) |
4506 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/) |
4164 { |
4507 { |
|
4508 _AKNTRACE_FUNC_ENTER; |
4165 User::Leave(KErrNotSupported); |
4509 User::Leave(KErrNotSupported); |
|
4510 _AKNTRACE_FUNC_EXIT; |
4166 } |
4511 } |
4167 |
4512 |
4168 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId) |
4513 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId) |
4169 { |
4514 { |
|
4515 _AKNTRACE_FUNC_ENTER; |
4170 if (aId.iUid == MAknsControlContext::ETypeId) |
4516 if (aId.iUid == MAknsControlContext::ETypeId) |
4171 { |
4517 { |
4172 if ( AknLayoutFlags() & EAknLayoutCbaInControlPane || |
4518 if ( AknLayoutFlags() & EAknLayoutCbaInControlPane || |
4173 AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
4519 AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
4174 { |
4520 { |
|
4521 _AKNTRACE_FUNC_EXIT; |
4175 return MAknsControlContext::SupplyMopObject( aId, iMLBgContext ); |
4522 return MAknsControlContext::SupplyMopObject( aId, iMLBgContext ); |
4176 } |
4523 } |
4177 else |
4524 else |
4178 { |
4525 { |
4179 // Always provide top object to mop-chain. |
4526 // Always provide top object to mop-chain. |
4180 // Bottom is parent of Top, so bottom is re-drawn |
4527 // Bottom is parent of Top, so bottom is re-drawn |
4181 // automatically when top is drawn. |
4528 // automatically when top is drawn. |
|
4529 // Ensure that the context exists. |
|
4530 TRAP_IGNORE( CheckAndCreateStaconContextsL() ); |
|
4531 |
|
4532 _AKNTRACE_FUNC_EXIT; |
4182 return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop ); |
4533 return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop ); |
4183 } |
4534 } |
4184 } |
4535 } |
4185 |
4536 |
4186 if ( aId.iUid == CEikCba::ETypeId ) |
4537 if ( aId.iUid == CEikCba::ETypeId ) |
4187 { |
4538 { |
|
4539 _AKNTRACE_FUNC_EXIT; |
4188 return aId.MakePtr( this ); |
4540 return aId.MakePtr( this ); |
4189 } |
4541 } |
4190 |
4542 |
|
4543 _AKNTRACE_FUNC_EXIT; |
4191 return CEikControlGroup::MopSupplyObject(aId); |
4544 return CEikControlGroup::MopSupplyObject(aId); |
4192 } |
4545 } |
4193 |
4546 |
4194 |
4547 |
4195 void CEikCba::Draw( const TRect& aRect ) const |
4548 void CEikCba::Draw( const TRect& aRect ) const |
4196 { |
4549 { |
|
4550 _AKNTRACE_FUNC_ENTER; |
4197 // Embedded CBA doesn't draw anything |
4551 // Embedded CBA doesn't draw anything |
4198 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4552 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4199 { |
4553 { |
4200 return; |
4554 return; |
4201 } |
4555 } |
|
4556 |
|
4557 if ( iCbaFlags & EEikCbaFlagSemiTransparent ) |
|
4558 { |
|
4559 CWindowGc &gc = SystemGc(); |
|
4560 |
|
4561 iExtension->DrawSemiTransparency( gc ); |
|
4562 return; |
|
4563 } |
4202 |
4564 |
4203 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4565 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4204 |
4566 |
4205 const TRect rect( Rect() ); |
4567 const TRect rect( Rect() ); |
4206 CWindowGc& gc = SystemGc(); |
4568 CWindowGc& gc = SystemGc(); |
4207 |
|
4208 TRgb rgb( TRgb::Color16MA( 0 ) ); |
|
4209 gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
4210 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
4211 gc.SetBrushColor( rgb ); |
|
4212 gc.Clear(); |
|
4213 |
|
4214 MAknsControlContext* cc = iMLBgContext; |
4569 MAknsControlContext* cc = iMLBgContext; |
4215 |
4570 |
4216 if ( iFlags.IsSet( ECbaEmbedded ) ) |
4571 if ( iFlags.IsSet( ECbaEmbedded ) ) |
4217 { |
4572 { |
4218 // Embedded CBA is drawn inside dialog |
4573 // Embedded CBA is drawn inside dialog |
4279 CEikCbaButton* button1 = static_cast<CEikCbaButton*>( |
4634 CEikCbaButton* button1 = static_cast<CEikCbaButton*>( |
4280 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
4635 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
4281 CEikCbaButton* button2 = static_cast<CEikCbaButton*>( |
4636 CEikCbaButton* button2 = static_cast<CEikCbaButton*>( |
4282 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
4637 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
4283 |
4638 |
4284 if ( IsMskEnabledLayoutActive() ) |
4639 if ( IsMskEnabledLayoutActive() || iFlags.IsSet( ECbaCombinePaneUncovered ) ) |
4285 { |
4640 { |
4286 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>( |
4641 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>( |
4287 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
4642 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
4288 |
4643 |
4289 CFbsBitmap* middleMask = |
4644 CFbsBitmap* middleMask = |
4290 AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt ); |
4645 AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt ); |
4291 AknIconUtils::SetSize( middleMask, middleSKSize, EAspectRatioNotPreserved ); |
4646 if ( middleMask ) |
|
4647 { |
|
4648 AknIconUtils::SetSize( middleMask, |
|
4649 middleSKSize, EAspectRatioNotPreserved ); |
|
4650 } |
4292 |
4651 |
4293 if( buttonMSK && buttonMSK->PressedDown() ) |
4652 if( buttonMSK && buttonMSK->PressedDown() ) |
4294 { |
4653 { |
4295 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
4654 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
4296 gc, |
4655 gc, |
4611 } |
4963 } |
4612 } |
4964 } |
4613 } |
4965 } |
4614 } |
4966 } |
4615 gc.SetOpaque( EFalse ); |
4967 gc.SetOpaque( EFalse ); |
|
4968 _AKNTRACE_FUNC_EXIT; |
4616 } |
4969 } |
4617 |
4970 |
4618 |
4971 |
4619 // --------------------------------------------------------------------------- |
4972 // --------------------------------------------------------------------------- |
4620 // Gets a button control by the specified command ID. |
4973 // Gets a button control by the specified command ID. |
4621 // --------------------------------------------------------------------------- |
4974 // --------------------------------------------------------------------------- |
4622 // |
4975 // |
4623 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const |
4976 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const |
4624 { |
4977 { |
|
4978 _AKNTRACE_FUNC_ENTER; |
|
4979 _AKNTRACE_FUNC_EXIT; |
4625 return ControlById( aCommandId ); |
4980 return ControlById( aCommandId ); |
4626 } |
4981 } |
4627 |
4982 |
4628 |
4983 |
4629 // --------------------------------------------------------------------------- |
4984 // --------------------------------------------------------------------------- |
4630 // Creates the scroll bar frame & sets up the scroll bar. |
4985 // Creates the scroll bar frame & sets up the scroll bar. |
4631 // --------------------------------------------------------------------------- |
4986 // --------------------------------------------------------------------------- |
4632 // |
4987 // |
4633 void CEikCba::CreateScrollBarFrameL() |
4988 void CEikCba::CreateScrollBarFrameL() |
4634 { |
4989 { |
|
4990 _AKNTRACE_FUNC_ENTER; |
4635 if ( !iSBFrame ) |
4991 if ( !iSBFrame ) |
4636 { |
4992 { |
4637 iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue ); |
4993 iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue ); |
4638 } |
4994 } |
4639 iSBFrame->ConstructL(); |
4995 iSBFrame->ConstructL(); |
|
4996 _AKNTRACE_FUNC_EXIT; |
4640 } |
4997 } |
4641 |
4998 |
4642 |
4999 |
4643 TEikGroupControl CEikCba::VScrollBarAsGroupControl() |
5000 TEikGroupControl CEikCba::VScrollBarAsGroupControl() |
4644 { |
5001 { |
|
5002 _AKNTRACE_FUNC_ENTER; |
4645 // Extracts vertical scroll bar from the scroll bar frame. |
5003 // Extracts vertical scroll bar from the scroll bar frame. |
4646 TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, |
5004 TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, |
4647 KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength); |
5005 KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength); |
|
5006 _AKNTRACE_FUNC_EXIT; |
4648 return groupCtrl; |
5007 return groupCtrl; |
4649 } |
5008 } |
4650 |
5009 |
4651 void CEikCba::InsertScrollBarL() |
5010 void CEikCba::InsertScrollBarL() |
4652 { |
5011 { |
|
5012 _AKNTRACE_FUNC_ENTER; |
4653 TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl(); |
5013 TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl(); |
4654 // Insert vertical scroll bar into cba control group. |
5014 // Insert vertical scroll bar into cba control group. |
4655 InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn); |
5015 InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn); |
|
5016 _AKNTRACE_FUNC_EXIT; |
4656 } |
5017 } |
4657 |
5018 |
4658 |
5019 |
4659 // --------------------------------------------------------------------------- |
5020 // --------------------------------------------------------------------------- |
4660 // Replaces empty scroll bar with actual arrow head scroll bar. |
5021 // Replaces empty scroll bar with actual arrow head scroll bar. |
4661 // --------------------------------------------------------------------------- |
5022 // --------------------------------------------------------------------------- |
4662 // |
5023 // |
4663 void CEikCba::CreateArrowHeadScrollBarL() |
5024 void CEikCba::CreateArrowHeadScrollBarL() |
4664 { |
5025 { |
|
5026 _AKNTRACE_FUNC_ENTER; |
4665 if ( iSBFrame ) |
5027 if ( iSBFrame ) |
4666 { |
5028 { |
4667 iSBFrame->SwitchToArrowHeadScrollBarL(); |
5029 iSBFrame->SwitchToArrowHeadScrollBarL(); |
4668 iSBFrame->VerticalScrollBar()->SetContainingCba( this ); |
5030 iSBFrame->VerticalScrollBar()->SetContainingCba( this ); |
4669 if ( iControlArray->Count() > KControlArrayScrollBarPosn ) |
5031 if ( iControlArray->Count() > KControlArrayScrollBarPosn ) |
4670 { |
5032 { |
4671 iControlArray->Delete( KControlArrayScrollBarPosn ); |
5033 iControlArray->Delete( KControlArrayScrollBarPosn ); |
4672 } |
5034 } |
4673 InsertScrollBarL(); |
5035 InsertScrollBarL(); |
4674 } |
5036 } |
|
5037 _AKNTRACE_FUNC_EXIT; |
4675 } |
5038 } |
4676 |
5039 |
4677 |
5040 |
4678 void CEikCba::SizeChanged() |
5041 void CEikCba::SizeChanged() |
4679 { |
5042 { |
|
5043 _AKNTRACE_FUNC_ENTER; |
4680 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
5044 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4681 { |
5045 { |
4682 Window().SetNonFading( EFalse ); |
5046 Window().SetNonFading( EFalse ); |
4683 SizeChangedInsideDialog(); |
5047 SizeChangedInsideDialog(); |
|
5048 _AKNTRACE_FUNC_EXIT; |
4684 return; |
5049 return; |
4685 } |
5050 } |
4686 else if ( iFlags.IsSet( ECbaEmbedded ) ) |
5051 else if ( iFlags.IsSet( ECbaEmbedded ) ) |
4687 { |
5052 { |
4688 Window().SetNonFading( EFalse ); |
5053 Window().SetNonFading( EFalse ); |
4689 SizeChangedInPopup(); |
5054 SizeChangedInPopup(); |
|
5055 _AKNTRACE_FUNC_EXIT; |
4690 return; |
5056 return; |
4691 } |
5057 } |
4692 |
5058 |
4693 const TInt aknLayoutFlags = AknLayoutFlags(); |
5059 const TInt aknLayoutFlags = AknLayoutFlags(); |
4694 |
5060 |
4749 } |
5115 } |
4750 |
5116 |
4751 // Broadcast current state to CEikCbaButtons |
5117 // Broadcast current state to CEikCbaButtons |
4752 BroadcastPostingTransparency( enabled ); |
5118 BroadcastPostingTransparency( enabled ); |
4753 } |
5119 } |
|
5120 _AKNTRACE_FUNC_EXIT; |
4754 } |
5121 } |
4755 |
5122 |
4756 // ----------------------------------------------------------------------------- |
5123 // ----------------------------------------------------------------------------- |
4757 // CEikCba::CheckSkinAndUpdateContext |
5124 // CEikCba::CheckSkinAndUpdateContext |
4758 // |
5125 // |
4759 // ----------------------------------------------------------------------------- |
5126 // ----------------------------------------------------------------------------- |
4760 // |
5127 // |
4761 void CEikCba::CheckSkinAndUpdateContext() |
5128 void CEikCba::CheckSkinAndUpdateContext() |
4762 { |
5129 { |
|
5130 _AKNTRACE_FUNC_ENTER; |
4763 if (AknsUtils::SkinInstance()) |
5131 if (AknsUtils::SkinInstance()) |
4764 { |
5132 { |
4765 // Use ENullBrush if there is skin background available. |
5133 // Use ENullBrush if there is skin background available. |
4766 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
5134 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
4767 } |
5135 } |
4768 else |
5136 else |
4769 { |
5137 { |
4770 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
5138 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
4771 } |
5139 } |
|
5140 _AKNTRACE_FUNC_EXIT; |
4772 } |
5141 } |
4773 |
5142 |
4774 void CEikCba::Reserved_MtsmPosition() |
5143 void CEikCba::Reserved_MtsmPosition() |
4775 { |
5144 { |
|
5145 _AKNTRACE_FUNC_ENTER; |
|
5146 _AKNTRACE_FUNC_EXIT; |
4776 } |
5147 } |
4777 |
5148 |
4778 void CEikCba::Reserved_MtsmObject() |
5149 void CEikCba::Reserved_MtsmObject() |
4779 { |
5150 { |
|
5151 _AKNTRACE_FUNC_ENTER; |
|
5152 _AKNTRACE_FUNC_EXIT; |
4780 } |
5153 } |
4781 |
5154 |
4782 TInt CEikCba::AknLayoutFlags() const |
5155 TInt CEikCba::AknLayoutFlags() const |
4783 { |
5156 { |
|
5157 _AKNTRACE_FUNC_ENTER; |
4784 TInt flags = 0; |
5158 TInt flags = 0; |
4785 |
5159 |
4786 TBool controlPane = ETrue; |
5160 TBool controlPane = ETrue; |
4787 TBool staconPane = EFalse; |
5161 TBool staconPane = EFalse; |
4788 TBool staconPaneLeft = EFalse; |
5162 TBool staconPaneLeft = EFalse; |
4847 if (rightPane) |
5221 if (rightPane) |
4848 { |
5222 { |
4849 flags |= EAknLayoutCbaInRightPane; |
5223 flags |= EAknLayoutCbaInRightPane; |
4850 } |
5224 } |
4851 |
5225 |
|
5226 _AKNTRACE_FUNC_EXIT; |
4852 return flags; |
5227 return flags; |
4853 } |
5228 } |
4854 |
5229 |
4855 |
5230 |
4856 // --------------------------------------------------------------------------- |
5231 // --------------------------------------------------------------------------- |
4857 // Handles size change events in bottom softkey layout. |
5232 // Handles size change events in bottom softkey layout. |
4858 // --------------------------------------------------------------------------- |
5233 // --------------------------------------------------------------------------- |
4859 // |
5234 // |
4860 void CEikCba::SizeChangedInControlPane() |
5235 void CEikCba::SizeChangedInControlPane() |
4861 { |
5236 { |
|
5237 _AKNTRACE_FUNC_ENTER; |
4862 TRect screen; |
5238 TRect screen; |
4863 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
5239 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
4864 |
5240 |
4865 TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
5241 TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
4866 TBool flatLscLayout( isLandscape && |
5242 TInt spLayout( AknStatuspaneUtils::CurrentStatusPaneLayoutResId() ); |
4867 AknStatuspaneUtils::FlatLayoutActive() ); |
5243 |
|
5244 // Treat the empty status pane layout the same way as the flat layout |
|
5245 // in landscape orientation, as the CBA layout is the same in both. |
|
5246 TBool flatLscLayout( |
|
5247 isLandscape && |
|
5248 ( spLayout == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT || |
|
5249 spLayout == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT || |
|
5250 spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT || |
|
5251 spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT || |
|
5252 spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS || |
|
5253 spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS || |
|
5254 spLayout == R_AVKON_STATUS_PANE_LAYOUT_EMPTY ) ); |
4868 |
5255 |
4869 // We must check for landscape mode bottom softkeys. |
5256 // We must check for landscape mode bottom softkeys. |
4870 TInt bottomPaneVariety = isLandscape ? ( flatLscLayout ? 2 : 6 ) : 1; |
5257 TInt bottomPaneVariety = isLandscape ? ( flatLscLayout ? 2 : 6 ) : 1; |
4871 |
5258 |
|
5259 // Skip application_window between screen and area_bottom_pane since |
|
5260 // screen and application_window are always the same. |
4872 TAknWindowComponentLayout controlPane( |
5261 TAknWindowComponentLayout controlPane( |
4873 DoCompose( |
5262 DoCompose( |
4874 AknLayoutScalable_Avkon::application_window( 0 ), |
5263 AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ), |
4875 DoCompose( |
5264 AknLayoutScalable_Avkon::control_pane() ) ); |
4876 AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ), |
|
4877 AknLayoutScalable_Avkon::control_pane() ) ) ); |
|
4878 |
5265 |
4879 TAknLayoutRect cbarect; |
5266 TAknLayoutRect cbarect; |
4880 cbarect.LayoutRect( screen, controlPane.LayoutLine() ); |
5267 cbarect.LayoutRect( screen, controlPane.LayoutLine() ); |
4881 TRect rect( cbarect.Rect().Size() ); |
5268 TRect rect( cbarect.Rect().Size() ); |
4882 |
5269 |
6435 // @since 5.0 |
6848 // @since 5.0 |
6436 // ----------------------------------------------------------------------------- |
6849 // ----------------------------------------------------------------------------- |
6437 #ifdef RD_ENHANCED_CBA |
6850 #ifdef RD_ENHANCED_CBA |
6438 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId) |
6851 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId) |
6439 { |
6852 { |
|
6853 _AKNTRACE_FUNC_ENTER; |
6440 TInt index = IndexById( aReplaceCommandId ); |
6854 TInt index = IndexById( aReplaceCommandId ); |
6441 TRAPD(err, SetCommandL( index, aResourceId ) ); |
6855 TRAPD(err, SetCommandL( index, aResourceId ) ); |
|
6856 _AKNTRACE_FUNC_EXIT; |
6442 } |
6857 } |
6443 #else |
6858 #else |
6444 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/) |
6859 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/) |
6445 { |
6860 { |
|
6861 _AKNTRACE_FUNC_ENTER; |
|
6862 _AKNTRACE_FUNC_EXIT; |
6446 } |
6863 } |
6447 #endif // RD_ENHANCED_CBA |
6864 #endif // RD_ENHANCED_CBA |
6448 |
6865 |
6449 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
6866 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
6450 { |
6867 { |
|
6868 _AKNTRACE_FUNC_ENTER; |
6451 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
6869 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
6452 { |
6870 { |
6453 //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported ); |
6871 //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported ); |
|
6872 _AKNTRACE_FUNC_EXIT; |
6454 return; |
6873 return; |
6455 } |
6874 } |
6456 |
6875 |
6457 if ( aEventType == EEventStateChanged ) |
6876 if ( aEventType == EEventStateChanged ) |
6458 { |
6877 { |
6835 { |
7263 { |
6836 button->SetTextBitmapMode( aEnable ); |
7264 button->SetTextBitmapMode( aEnable ); |
6837 } |
7265 } |
6838 } |
7266 } |
6839 } |
7267 } |
6840 } |
7268 _AKNTRACE_FUNC_EXIT; |
6841 |
|
6842 |
|
6843 // --------------------------------------------------------------------------- |
|
6844 // CEikCba::SetFadeState |
|
6845 // Sets the CBA faded if it's contents are empty. |
|
6846 // --------------------------------------------------------------------------- |
|
6847 // |
|
6848 void CEikCba::SetFadeState() |
|
6849 { |
|
6850 TBool canBeFaded = |
|
6851 IsEmpty() && !( ( iCbaFlags & EEikCbaFlagTransparent ) |
|
6852 || ( iExtension && iExtension->iEnablePostingTransparency ) ); |
|
6853 |
|
6854 // No unfading when system is faded |
|
6855 if ( !( !canBeFaded |
|
6856 && static_cast<CAknAppUi*>( iCoeEnv->AppUi() )->IsFaded() ) ) |
|
6857 { |
|
6858 Window().SetFaded( canBeFaded, RWindowTreeNode::EFadeIncludeChildren ); |
|
6859 } |
|
6860 } |
7269 } |
6861 |
7270 |
6862 |
7271 |
6863 // --------------------------------------------------------------------------- |
7272 // --------------------------------------------------------------------------- |
6864 // CEikCba::UpdateLabels |
7273 // CEikCba::UpdateLabels |
6865 // Updates softkey labels in case of embedded softkeys. |
7274 // Updates softkey labels in case of embedded softkeys. |
6866 // --------------------------------------------------------------------------- |
7275 // --------------------------------------------------------------------------- |
6867 // |
7276 // |
6868 void CEikCba::UpdateLabels( TBool aDrawDeferred ) |
7277 void CEikCba::UpdateLabels( TBool aDrawDeferred ) |
6869 { |
7278 { |
|
7279 _AKNTRACE_FUNC_ENTER; |
6870 if ( iControlArray->Count() != 0) |
7280 if ( iControlArray->Count() != 0) |
6871 { |
7281 { |
6872 CCoeControl *leftSoftkey = ( *iControlArray ) |
7282 CCoeControl *leftSoftkey = ( *iControlArray ) |
6873 [ KControlArrayCBAButton1Posn ].iControl; |
7283 [ KControlArrayCBAButton1Posn ].iControl; |
6874 CCoeControl *rightSoftkey = ( *iControlArray ) |
7284 CCoeControl *rightSoftkey = ( *iControlArray ) |
7212 aRect, |
7637 aRect, |
7213 innerRect, |
7638 innerRect, |
7214 KAknsIIDQgnFrSctrlSkButton, |
7639 KAknsIIDQgnFrSctrlSkButton, |
7215 KAknsIIDQgnFrSctrlSkButtonCenter); |
7640 KAknsIIDQgnFrSctrlSkButtonCenter); |
7216 } |
7641 } |
|
7642 _AKNTRACE_FUNC_EXIT; |
7217 } |
7643 } |
7218 |
7644 |
7219 TBool CEikCba::UpdateIconL() |
7645 TBool CEikCba::UpdateIconL() |
7220 { |
7646 { |
|
7647 _AKNTRACE_FUNC_ENTER; |
7221 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7648 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7222 { |
7649 { |
|
7650 _AKNTRACE_FUNC_EXIT; |
7223 return EFalse; |
7651 return EFalse; |
7224 } |
7652 } |
7225 |
7653 |
7226 if ( !iExtension->iIfMskIconSet || |
7654 if ( !iExtension->iIfMskIconSet || |
7227 !MskAllowed() ) |
7655 !MskAllowed() ) |
7228 { |
7656 { |
|
7657 _AKNTRACE_FUNC_EXIT; |
7229 return EFalse; |
7658 return EFalse; |
7230 } |
7659 } |
7231 |
7660 |
7232 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
7661 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
7233 if ( !skin ) |
7662 if ( !skin ) |
7234 { |
7663 { |
|
7664 _AKNTRACE_FUNC_EXIT; |
7235 return EFalse; |
7665 return EFalse; |
7236 } |
7666 } |
7237 |
7667 |
7238 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
7668 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
7239 |
7669 |
7240 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
7670 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
7241 if ( !button ) |
7671 if ( !button ) |
7242 { |
7672 { |
|
7673 _AKNTRACE_FUNC_EXIT; |
7243 return EFalse; |
7674 return EFalse; |
7244 } |
7675 } |
7245 |
7676 |
7246 CFbsBitmap *bitmap = NULL; |
7677 CFbsBitmap *bitmap = NULL; |
7247 CFbsBitmap *mask = NULL; |
7678 CFbsBitmap *mask = NULL; |
7248 |
7679 |
|
7680 TInt graphicMSKVariety = 1; |
|
7681 if ( iCbaFlags & EEikCbaFlagAppMskIcon ) |
|
7682 { |
|
7683 graphicMSKVariety = 0 ; |
|
7684 } |
7249 TAknLayoutRect qgn_graf_sk_msk; |
7685 TAknLayoutRect qgn_graf_sk_msk; |
7250 TRect rect; |
7686 TRect rect; |
7251 qgn_graf_sk_msk.LayoutRect( |
7687 qgn_graf_sk_msk.LayoutRect( |
7252 rect, |
7688 rect, |
7253 AknLayoutScalable_Avkon::control_pane_g4( 0 ).LayoutLine() ); |
7689 AknLayoutScalable_Avkon::control_pane_g4( graphicMSKVariety ).LayoutLine() ); |
7254 |
7690 |
7255 TSize iconSize( qgn_graf_sk_msk.Rect().Width(), |
7691 TSize iconSize( qgn_graf_sk_msk.Rect().Width(), |
7256 qgn_graf_sk_msk.Rect().Height() ); |
7692 qgn_graf_sk_msk.Rect().Height() ); |
7257 |
7693 |
7258 AknsUtils::CreateIconL( |
7694 AknsUtils::CreateIconL( |
7372 iExtension->iItemActionMenu->CollectionSoftkeyVisible( |
7817 iExtension->iItemActionMenu->CollectionSoftkeyVisible( |
7373 aVisibleCollection ) ); |
7818 aVisibleCollection ) ); |
7374 UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk ); |
7819 UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk ); |
7375 } |
7820 } |
7376 } |
7821 } |
|
7822 _AKNTRACE_FUNC_EXIT; |
7377 } |
7823 } |
7378 |
7824 |
7379 |
7825 |
7380 // --------------------------------------------------------------------------- |
7826 // --------------------------------------------------------------------------- |
7381 // CEikCba::UpdateItemSpecificSoftkey |
7827 // CEikCba::UpdateItemSpecificSoftkey |
7382 // Updates item specific softkey. |
7828 // Updates item specific softkey. |
7383 // --------------------------------------------------------------------------- |
7829 // --------------------------------------------------------------------------- |
7384 // |
7830 // |
7385 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable ) |
7831 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable ) |
7386 { |
7832 { |
|
7833 _AKNTRACE_FUNC_ENTER; |
|
7834 if ( iFlags.IsSet( ECbaKeepItemSoftkeyVisible )) |
|
7835 { |
|
7836 _AKNTRACE_FUNC_EXIT; |
|
7837 return; |
|
7838 } |
7387 TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() ); |
7839 TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() ); |
7388 TBool changeState( EFalse ); |
7840 TBool changeState( EFalse ); |
7389 if ( !aEnable ) |
7841 if ( !aEnable ) |
7390 { |
7842 { |
7391 iFlags.Set( ECbaItemSoftkeyDisabled ); |
7843 iFlags.Set( ECbaItemSoftkeyDisabled ); |
7413 { |
7865 { |
7414 aControl.SetDimmed( !aEnable ); |
7866 aControl.SetDimmed( !aEnable ); |
7415 aControl.DrawDeferred(); |
7867 aControl.DrawDeferred(); |
7416 } |
7868 } |
7417 } |
7869 } |
7418 } |
7870 _AKNTRACE_FUNC_EXIT; |
|
7871 } |
|
7872 |
|
7873 |
|
7874 // --------------------------------------------------------------------------- |
|
7875 // CEikCba::UpdateMultipleMarkingSoftkey |
|
7876 // Updates RSK when multiple marking is activated or deactivated. |
|
7877 // --------------------------------------------------------------------------- |
|
7878 // |
|
7879 void CEikCba::UpdateMultipleMarkingSoftkey() |
|
7880 { |
|
7881 _AKNTRACE_FUNC_ENTER; |
|
7882 if ( iFlags.IsSet( ECbaSingleClickEnabled ) |
|
7883 && iExtension && iExtension->iItemActionMenu ) |
|
7884 { |
|
7885 TBool markingActive( |
|
7886 iExtension->iItemActionMenu->MarkingMode( |
|
7887 ).MultipleMarkingActive() ); |
|
7888 TBool markingActivated( iFlags.IsSet( ECbaMultipleMarkingActive ) ); |
|
7889 if ( markingActive && !markingActivated ) |
|
7890 { |
|
7891 TRAPD( error, |
|
7892 AddCommandSetToStackL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL ) ); |
|
7893 |
|
7894 if ( error == KErrNone ) |
|
7895 { |
|
7896 iFlags.Set( ECbaMultipleMarkingActive ); |
|
7897 } |
|
7898 } |
|
7899 else if ( !markingActive && markingActivated ) |
|
7900 { |
|
7901 RemoveCommandFromStack( |
|
7902 KControlArrayCBAButton1Posn, EAknSoftkeyOptions ); |
|
7903 RemoveCommandFromStack( |
|
7904 KControlArrayCBAButton2Posn, EAknSoftkeyCancel ); |
|
7905 iFlags.Clear( ECbaMultipleMarkingActive ); |
|
7906 } |
|
7907 } |
|
7908 _AKNTRACE_FUNC_EXIT; |
|
7909 } |
|
7910 |
|
7911 |
|
7912 // --------------------------------------------------------------------------- |
|
7913 // CEikCba::CommandChangeAllowed |
|
7914 // --------------------------------------------------------------------------- |
|
7915 // |
|
7916 TBool CEikCba::CommandChangeAllowed() const |
|
7917 { |
|
7918 return ( !( iFlags.IsSet( ECbaSingleClickEnabled ) |
|
7919 && iFlags.IsSet( ECbaMultipleMarkingActive ) ) ); |
|
7920 } |
|
7921 |
|
7922 |
|
7923 // --------------------------------------------------------------------------- |
|
7924 // CEikCba::CheckAndCreateStaconContextsL |
|
7925 // Creates the skin background contexts used in StaCon layout. |
|
7926 // --------------------------------------------------------------------------- |
|
7927 // |
|
7928 void CEikCba::CheckAndCreateStaconContextsL() |
|
7929 { |
|
7930 if ( !iStaconBgContextTop && !iStaconBgContextBottom ) |
|
7931 { |
|
7932 TRect screen; |
|
7933 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
|
7934 |
|
7935 // There is a need for two layers in each context: one for wallpaper, |
|
7936 // the other for skin graphics. |
|
7937 if ( !iStaconBgContextTop ) |
|
7938 { |
|
7939 iStaconBgContextTop = |
|
7940 CAknsMaskedLayerBackgroundControlContext::NewL( |
|
7941 KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN ); |
|
7942 } |
|
7943 |
|
7944 if ( !iStaconBgContextBottom ) |
|
7945 { |
|
7946 iStaconBgContextBottom = |
|
7947 CAknsMaskedLayerBackgroundControlContext::NewL( |
|
7948 KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN ); |
|
7949 } |
|
7950 |
|
7951 for ( TInt i = 0; i < ECbaLayerN; i++ ) |
|
7952 { |
|
7953 iStaconBgContextBottom->SetLayerImage( i, KAknsIIDNone ); |
|
7954 } |
|
7955 |
|
7956 TAknLayoutRect layoutRect; |
|
7957 layoutRect.LayoutRect( screen, |
|
7958 AknLayoutScalable_Avkon::area_top_pane( 2 ) ); |
|
7959 TRect staconTop( layoutRect.Rect() ); |
|
7960 |
|
7961 layoutRect.LayoutRect( screen, |
|
7962 AknLayoutScalable_Avkon::area_bottom_pane( 2 ) ); |
|
7963 TRect staconBottom( layoutRect.Rect() ); |
|
7964 |
|
7965 // Set layers to stacon contexts. |
|
7966 // Set bottom as parent to top, so that top is re-drawn, if bottom is drawn. |
|
7967 iStaconBgContextTop->SetLayerImage( ECbaLayerWallpaper, |
|
7968 KAknsIIDWallpaper ); |
|
7969 iStaconBgContextTop->SetLayerRect( ECbaLayerWallpaper, screen ); |
|
7970 iStaconBgContextTop->SetLayerImage( ECbaLayerBackground, |
|
7971 KAknsIIDQsnBgAreaStaconRt ); |
|
7972 iStaconBgContextTop->SetLayerRect( ECbaLayerBackground, staconTop ); |
|
7973 |
|
7974 iStaconBgContextBottom->SetLayerImage( ECbaLayerWallpaper, |
|
7975 KAknsIIDWallpaper ); |
|
7976 iStaconBgContextBottom->SetLayerRect( ECbaLayerWallpaper, screen ); |
|
7977 iStaconBgContextBottom->SetLayerImage( ECbaLayerBackground, |
|
7978 KAknsIIDQsnBgAreaStaconRb ); |
|
7979 iStaconBgContextBottom->SetLayerRect( ECbaLayerBackground, staconBottom ); |
|
7980 iStaconBgContextBottom->SetParentPos( TPoint( 0, 0 ) ); |
|
7981 |
|
7982 iStaconBgContextTop->SetParentContext( iStaconBgContextBottom ); |
|
7983 |
|
7984 TBool idle = AknLayoutFlags() & EAknLayoutCbaInStaconPaneIdle; |
|
7985 if ( idle ) |
|
7986 { |
|
7987 iStaconBgContextTop->SetLayerMaskAndSizeL( |
|
7988 KAknsIIDQgnGrafBgLscTopMaskIcon, staconTop ); |
|
7989 iStaconBgContextBottom->SetLayerMaskAndSizeL( |
|
7990 KAknsIIDQgnGrafBgLscBottomMaskIcon, staconBottom ); |
|
7991 } |
|
7992 } |
|
7993 } |
|
7994 |
7419 |
7995 |
7420 |
7996 |
7421 // |
7997 // |
7422 // class CEikCbaButton |
7998 // class CEikCbaButton |
7423 // |
7999 // |
7424 |
8000 |
7425 CEikCbaButton::~CEikCbaButton() |
8001 CEikCbaButton::~CEikCbaButton() |
7426 { |
8002 { |
|
8003 _AKNTRACE_FUNC_ENTER; |
7427 AKNTASHOOK_REMOVE(); |
8004 AKNTASHOOK_REMOVE(); |
7428 delete iLabel; |
8005 delete iLabel; |
7429 if ( iImage ) |
8006 if ( iImage ) |
7430 { |
8007 { |
7431 iImage->SetMask( iMask ); |
8008 iImage->SetMask( iMask ); |
7451 if ( iUseTextBitmap ) |
8030 if ( iUseTextBitmap ) |
7452 { |
8031 { |
7453 iLabel->MakeVisible( EFalse ); |
8032 iLabel->MakeVisible( EFalse ); |
7454 } |
8033 } |
7455 AKNTASHOOK_ADDL( this, "CEikCbaButton" ); |
8034 AKNTASHOOK_ADDL( this, "CEikCbaButton" ); |
|
8035 _AKNTRACE_FUNC_EXIT; |
7456 } |
8036 } |
7457 |
8037 |
7458 void CEikCbaButton::AddCommandL(const TDesC& aText) |
8038 void CEikCbaButton::AddCommandL(const TDesC& aText) |
7459 { |
8039 { |
|
8040 _AKNTRACE_FUNC_ENTER; |
7460 UpdateLabelText(aText); |
8041 UpdateLabelText(aText); |
|
8042 _AKNTRACE_FUNC_EXIT; |
7461 } |
8043 } |
7462 |
8044 |
7463 struct STempCleanup |
8045 struct STempCleanup |
7464 { |
8046 { |
7465 CDesCArray* iText; |
8047 CDesCArray* iText; |
7466 CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions; |
8048 CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions; |
7467 }; |
8049 }; |
7468 |
8050 |
7469 LOCAL_C void CleanupTemp(TAny* aPtr) |
8051 LOCAL_C void CleanupTemp(TAny* aPtr) |
7470 { |
8052 { |
|
8053 _AKNTRACE_FUNC_ENTER; |
7471 STempCleanup& temp = *(STempCleanup*)aPtr; |
8054 STempCleanup& temp = *(STempCleanup*)aPtr; |
7472 const TInt count = temp.iText->Count(); |
8055 const TInt count = temp.iText->Count(); |
7473 if (temp.iButtonOptions->Count() == count) |
8056 if (temp.iButtonOptions->Count() == count) |
7474 { |
8057 { |
7475 temp.iButtonOptions->Delete(count - 1); |
8058 temp.iButtonOptions->Delete(count - 1); |
7476 } |
8059 } |
7477 temp.iText->Delete(count - 1); |
8060 temp.iText->Delete(count - 1); |
|
8061 _AKNTRACE_FUNC_EXIT; |
7478 } |
8062 } |
7479 |
8063 |
7480 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText) |
8064 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText) |
7481 { |
8065 { |
|
8066 _AKNTRACE_FUNC_ENTER; |
7482 if (!iButtonOptions) |
8067 if (!iButtonOptions) |
7483 { |
8068 { |
7484 iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1); |
8069 iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1); |
7485 } |
8070 } |
7486 if (!iText) |
8071 if (!iText) |
7559 iButtonOptions = NULL; |
8151 iButtonOptions = NULL; |
7560 delete iText; |
8152 delete iText; |
7561 iText = NULL; |
8153 iText = NULL; |
7562 } |
8154 } |
7563 } |
8155 } |
|
8156 _AKNTRACE_FUNC_EXIT; |
7564 } |
8157 } |
7565 |
8158 |
7566 void CEikCbaButton::RemovePreviousCommand() |
8159 void CEikCbaButton::RemovePreviousCommand() |
7567 { |
8160 { |
|
8161 _AKNTRACE_FUNC_ENTER; |
7568 if (!iButtonOptions) |
8162 if (!iButtonOptions) |
7569 { |
8163 { |
|
8164 _AKNTRACE_FUNC_EXIT; |
7570 return; |
8165 return; |
7571 } |
8166 } |
7572 TInt index = iButtonOptions->Count() - 2; |
8167 TInt index = iButtonOptions->Count() - 2; |
7573 if (index >= 0) |
8168 if (index >= 0) |
7574 { |
8169 { |
7575 iButtonOptions->Delete(index); |
8170 iButtonOptions->Delete(index); |
7576 iText->Delete(index); |
8171 iText->Delete(index); |
7577 } |
8172 } |
|
8173 _AKNTRACE_FUNC_EXIT; |
7578 } |
8174 } |
7579 |
8175 |
7580 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId) |
8176 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId) |
7581 { |
8177 { |
|
8178 _AKNTRACE_FUNC_ENTER; |
7582 TInt index; |
8179 TInt index; |
7583 TKeyArrayFix key(0, ECmpTInt); |
8180 TKeyArrayFix key(0, ECmpTInt); |
7584 SButtonOptions options; |
8181 SButtonOptions options; |
7585 options.iCommandId = aCommandId; |
8182 options.iCommandId = aCommandId; |
7586 if (iButtonOptions->Find(options, key, index) == KErrNone) |
8183 if (iButtonOptions->Find(options, key, index) == KErrNone) |
7587 { |
8184 { |
|
8185 _AKNTRACE_FUNC_EXIT; |
7588 return index; |
8186 return index; |
7589 } |
8187 } |
7590 else |
8188 else |
7591 { |
8189 { |
|
8190 _AKNTRACE_FUNC_EXIT; |
7592 return KErrNotFound; |
8191 return KErrNotFound; |
7593 } |
8192 } |
7594 } |
8193 } |
7595 |
8194 |
7596 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer) |
8195 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer) |
7597 { |
8196 { |
|
8197 _AKNTRACE_FUNC_ENTER; |
7598 CCoeControl::SetContainerWindowL(aContainer); |
8198 CCoeControl::SetContainerWindowL(aContainer); |
7599 if (!iDoImage) |
8199 if (!iDoImage) |
7600 { |
8200 { |
7601 iLabel->SetContainerWindowL(aContainer); |
8201 iLabel->SetContainerWindowL(aContainer); |
7602 } |
8202 } |
7603 else |
8203 else |
7604 { |
8204 { |
7605 iImage->SetContainerWindowL(aContainer); |
8205 iImage->SetContainerWindowL(aContainer); |
7606 } |
8206 } |
|
8207 _AKNTRACE_FUNC_EXIT; |
7607 } |
8208 } |
7608 |
8209 |
7609 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment) |
8210 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment) |
7610 { |
8211 { |
|
8212 _AKNTRACE_FUNC_ENTER; |
7611 ConstructL(anAlignment); |
8213 ConstructL(anAlignment); |
7612 UpdateLabelText(aReader.ReadTPtrC()); |
8214 UpdateLabelText(aReader.ReadTPtrC()); |
7613 aReader.ReadTPtrC(); // bmp filename |
8215 aReader.ReadTPtrC(); // bmp filename |
7614 aReader.ReadInt16(); // bmp id |
8216 aReader.ReadInt16(); // bmp id |
7615 aReader.ReadInt16(); // bmp mask id |
8217 aReader.ReadInt16(); // bmp mask id |
|
8218 _AKNTRACE_FUNC_EXIT; |
7616 } |
8219 } |
7617 |
8220 |
7618 TSize CEikCbaButton::MinimumSize() |
8221 TSize CEikCbaButton::MinimumSize() |
7619 { |
8222 { |
|
8223 _AKNTRACE_FUNC_ENTER; |
7620 if (!iDoImage) |
8224 if (!iDoImage) |
7621 { |
8225 { |
|
8226 _AKNTRACE_FUNC_EXIT; |
7622 return iLabel->MinimumSize(); |
8227 return iLabel->MinimumSize(); |
7623 } |
8228 } |
7624 else |
8229 else |
7625 { |
8230 { |
|
8231 _AKNTRACE_FUNC_EXIT; |
7626 return iImage->MinimumSize(); |
8232 return iImage->MinimumSize(); |
7627 } |
8233 } |
7628 } |
8234 } |
7629 |
8235 |
7630 TInt CEikCbaButton::CountComponentControls() const |
8236 TInt CEikCbaButton::CountComponentControls() const |
7631 { |
8237 { |
|
8238 _AKNTRACE_FUNC_ENTER; |
|
8239 _AKNTRACE_FUNC_EXIT; |
7632 return 1; |
8240 return 1; |
7633 } |
8241 } |
7634 |
8242 |
7635 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const |
8243 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const |
7636 { |
8244 { |
|
8245 _AKNTRACE_FUNC_ENTER; |
7637 if (aIndex==0) |
8246 if (aIndex==0) |
7638 { |
8247 { |
7639 if (!iDoImage) |
8248 if (!iDoImage) |
7640 { |
8249 { |
|
8250 _AKNTRACE_FUNC_EXIT; |
7641 return iLabel; |
8251 return iLabel; |
7642 } |
8252 } |
7643 else |
8253 else |
7644 { |
8254 { |
7645 // If SfeMask is available, then check the effect state (iPressedDown). |
8255 // If SfeMask is available, then check the effect state (iPressedDown). |
7655 } |
8265 } |
7656 } |
8266 } |
7657 return iImage; |
8267 return iImage; |
7658 } |
8268 } |
7659 } |
8269 } |
|
8270 _AKNTRACE_FUNC_EXIT; |
7660 return 0; |
8271 return 0; |
7661 } |
8272 } |
7662 |
8273 |
7663 |
8274 |
7664 // --------------------------------------------------------------------------- |
8275 // --------------------------------------------------------------------------- |
7665 // Handles size change events for CBA button. |
8276 // Handles size change events for CBA button. |
7666 // --------------------------------------------------------------------------- |
8277 // --------------------------------------------------------------------------- |
7667 // |
8278 // |
7668 void CEikCbaButton::SizeChanged() |
8279 void CEikCbaButton::SizeChanged() |
7669 { |
8280 { |
|
8281 _AKNTRACE_FUNC_ENTER; |
7670 // Resizing is done at CEikCba::SizeChanged(). |
8282 // Resizing is done at CEikCba::SizeChanged(). |
7671 // We cannot resize here because this control has wrong |
8283 // We cannot resize here because this control has wrong |
7672 // coordinate system available. |
8284 // coordinate system available. |
7673 |
8285 _AKNTRACE_FUNC_EXIT; |
7674 } |
8286 } |
7675 |
8287 |
7676 |
8288 |
7677 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
8289 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
7678 { |
8290 { |
|
8291 _AKNTRACE_FUNC_ENTER; |
7679 CCoeControl::HandlePointerEventL(aPointerEvent); |
8292 CCoeControl::HandlePointerEventL(aPointerEvent); |
|
8293 _AKNTRACE_FUNC_EXIT; |
7680 } |
8294 } |
7681 |
8295 |
7682 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ ) |
8296 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ ) |
7683 { |
8297 { |
|
8298 _AKNTRACE_FUNC_ENTER; |
|
8299 _AKNTRACE_FUNC_EXIT; |
7684 return NULL; |
8300 return NULL; |
7685 } |
8301 } |
7686 |
8302 |
7687 void CEikCbaButton::SetDimmed(TBool aDimmed) |
8303 void CEikCbaButton::SetDimmed(TBool aDimmed) |
7688 { |
8304 { |
|
8305 _AKNTRACE_FUNC_ENTER; |
7689 CCoeControl::SetDimmed(aDimmed); |
8306 CCoeControl::SetDimmed(aDimmed); |
7690 if (!iDoImage) |
8307 if (!iDoImage) |
7691 { |
8308 { |
7692 iLabel->SetDimmed(aDimmed); |
8309 iLabel->SetDimmed(aDimmed); |
7693 } |
8310 } |
7694 else |
8311 else |
7695 { |
8312 { |
7696 // Drawing dimmed CEikImages don't work (problem in uiklaf). |
8313 // Drawing dimmed CEikImages don't work (problem in uiklaf). |
7697 //iImage->SetDimmed(aDimmed); |
8314 //iImage->SetDimmed(aDimmed); |
7698 } |
8315 } |
|
8316 _AKNTRACE_FUNC_EXIT; |
7699 } |
8317 } |
7700 |
8318 |
7701 |
8319 |
7702 // --------------------------------------------------------------------------- |
8320 // --------------------------------------------------------------------------- |
7703 // Updates the softkey label. |
8321 // Updates the softkey label. |
7704 // --------------------------------------------------------------------------- |
8322 // --------------------------------------------------------------------------- |
7705 // |
8323 // |
7706 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText ) |
8324 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText ) |
7707 { |
8325 { |
|
8326 _AKNTRACE_FUNC_ENTER; |
7708 // Updates the label text with the given label, using tab delimited |
8327 // Updates the label text with the given label, using tab delimited |
7709 // label text to identify normal / alternative labels. |
8328 // label text to identify normal / alternative labels. |
7710 if ( aLabelText.Length() > KMaxCbaLabelLength ) |
8329 if ( aLabelText.Length() > KMaxCbaLabelLength ) |
7711 { |
8330 { |
7712 // Cannot take more chars than maximum buffer size. |
8331 // Cannot take more chars than maximum buffer size. |
7918 } |
8562 } |
7919 else |
8563 else |
7920 { |
8564 { |
7921 ReplaceImageByLabel(); |
8565 ReplaceImageByLabel(); |
7922 } |
8566 } |
|
8567 _AKNTRACE_FUNC_EXIT; |
7923 } |
8568 } |
7924 |
8569 |
7925 // ----------------------------------------------------------------------------- |
8570 // ----------------------------------------------------------------------------- |
7926 // CEikCbaButton::PrepareImageL |
8571 // CEikCbaButton::PrepareImageL |
7927 // Prepares Image for softkey feedback effect. Creates needed mask for |
8572 // Prepares Image for softkey feedback effect. Creates needed mask for |
7928 // pressed down state. |
8573 // pressed down state. |
7929 // ----------------------------------------------------------------------------- |
8574 // ----------------------------------------------------------------------------- |
7930 // |
8575 // |
7931 void CEikCbaButton::PrepareImageL() |
8576 void CEikCbaButton::PrepareImageL() |
7932 { |
8577 { |
|
8578 _AKNTRACE_FUNC_ENTER; |
7933 // 50% transparent pressed down image is made with a alternative mask |
8579 // 50% transparent pressed down image is made with a alternative mask |
7934 // which is created when a image is set to CEikCbaButton. |
8580 // which is created when a image is set to CEikCbaButton. |
7935 // Original mask is copied and each of its pixels color components is |
8581 // Original mask is copied and each of its pixels color components is |
7936 // halved. Bit-shifting to the right makes color value to half --> |
8582 // halved. Bit-shifting to the right makes color value to half --> |
7937 // image looks 50% transparent with this mask |
8583 // image looks 50% transparent with this mask |
7938 const CFbsBitmap* mask = iImage->Mask(); |
8584 const CFbsBitmap* mask = iImage->Mask(); |
7939 iMask = mask; |
8585 iMask = mask; |
7940 |
8586 |
7941 if ( !iMask ) |
8587 if ( !iMask ) |
7942 { |
8588 { |
|
8589 _AKNTRACE_FUNC_EXIT; |
7943 return; |
8590 return; |
7944 } |
8591 } |
7945 |
8592 |
7946 iSfeMask = new (ELeave) CFbsBitmap; |
8593 iSfeMask = new (ELeave) CFbsBitmap; |
7947 User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) ); |
8594 User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) ); |
8002 // ----------------------------------------------------------------------------- |
8652 // ----------------------------------------------------------------------------- |
8003 // default constructor |
8653 // default constructor |
8004 // ----------------------------------------------------------------------------- |
8654 // ----------------------------------------------------------------------------- |
8005 CEikEnhancedCbaButton::CEikEnhancedCbaButton() |
8655 CEikEnhancedCbaButton::CEikEnhancedCbaButton() |
8006 { |
8656 { |
|
8657 _AKNTRACE_FUNC_ENTER; |
|
8658 _AKNTRACE_FUNC_EXIT; |
8007 } |
8659 } |
8008 |
8660 |
8009 // ----------------------------------------------------------------------------- |
8661 // ----------------------------------------------------------------------------- |
8010 // default destructor |
8662 // default destructor |
8011 // ----------------------------------------------------------------------------- |
8663 // ----------------------------------------------------------------------------- |
8012 CEikEnhancedCbaButton::~CEikEnhancedCbaButton() |
8664 CEikEnhancedCbaButton::~CEikEnhancedCbaButton() |
8013 { |
8665 { |
|
8666 _AKNTRACE_FUNC_ENTER; |
|
8667 _AKNTRACE_FUNC_EXIT; |
8014 } |
8668 } |
8015 |
8669 |
8016 // ----------------------------------------------------------------------------- |
8670 // ----------------------------------------------------------------------------- |
8017 // Sets command type for current button |
8671 // Sets command type for current button |
8018 // @param aCommandType Command type to be set |
8672 // @param aCommandType Command type to be set |
8019 // ----------------------------------------------------------------------------- |
8673 // ----------------------------------------------------------------------------- |
8020 #ifdef RD_ENHANCED_CBA |
8674 #ifdef RD_ENHANCED_CBA |
8021 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType ) |
8675 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType ) |
8022 { |
8676 { |
|
8677 _AKNTRACE_FUNC_ENTER; |
8023 iCommandType = aCommandType; |
8678 iCommandType = aCommandType; |
|
8679 _AKNTRACE_FUNC_EXIT; |
8024 } |
8680 } |
8025 #else |
8681 #else |
8026 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ ) |
8682 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ ) |
8027 { |
8683 { |
|
8684 _AKNTRACE_FUNC_ENTER; |
|
8685 _AKNTRACE_FUNC_EXIT; |
8028 } |
8686 } |
8029 #endif // RD_ENHANCED_CBA |
8687 #endif // RD_ENHANCED_CBA |
8030 // ----------------------------------------------------------------------------- |
8688 // ----------------------------------------------------------------------------- |
8031 // returns command's type for current button |
8689 // returns command's type for current button |
8032 // @return TInt command's type |
8690 // @return TInt command's type |
8033 // ----------------------------------------------------------------------------- |
8691 // ----------------------------------------------------------------------------- |
8034 |
8692 |
8035 TInt CEikEnhancedCbaButton::CommandType() const |
8693 TInt CEikEnhancedCbaButton::CommandType() const |
8036 { |
8694 { |
|
8695 _AKNTRACE_FUNC_ENTER; |
|
8696 _AKNTRACE_FUNC_EXIT; |
8037 #ifdef RD_ENHANCED_CBA |
8697 #ifdef RD_ENHANCED_CBA |
8038 return iCommandType; |
8698 return iCommandType; |
8039 #else |
8699 #else |
8040 return 0; |
8700 return 0; |
8041 #endif // RD_ENHANCED_CBA |
8701 #endif // RD_ENHANCED_CBA |
8059 // @param aReader created resource reader for reading information from resource file |
8721 // @param aReader created resource reader for reading information from resource file |
8060 // ----------------------------------------------------------------------------- |
8722 // ----------------------------------------------------------------------------- |
8061 #ifdef RD_ENHANCED_CBA |
8723 #ifdef RD_ENHANCED_CBA |
8062 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader) |
8724 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader) |
8063 { |
8725 { |
|
8726 _AKNTRACE_FUNC_ENTER |
8064 // Alignment set to right. |
8727 // Alignment set to right. |
8065 ConstructL( EHRightVCenter ); // creates label |
8728 ConstructL( EHRightVCenter ); // creates label |
8066 iCommandType = aReader.ReadUint8(); |
8729 iCommandType = aReader.ReadUint8(); |
8067 iCommandId = aReader.ReadInt16(); |
8730 iCommandId = aReader.ReadInt16(); |
8068 // iFullLabelText.Copy( aReader.ReadTPtrC() ); |
8731 // iFullLabelText.Copy( aReader.ReadTPtrC() ); |
8069 UpdateLabelText( aReader.ReadTPtrC() ); |
8732 UpdateLabelText( aReader.ReadTPtrC() ); |
8070 |
8733 |
8071 aReader.ReadTPtrC(); // bmp filename |
8734 aReader.ReadTPtrC(); // bmp filename |
8072 aReader.ReadInt16(); // bmp id |
8735 aReader.ReadInt16(); // bmp id |
8073 aReader.ReadInt16(); // bmp mask id |
8736 aReader.ReadInt16(); // bmp mask id |
|
8737 _AKNTRACE_FUNC_EXIT; |
8074 } |
8738 } |
8075 #else |
8739 #else |
8076 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&) |
8740 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&) |
8077 { |
8741 { |
|
8742 _AKNTRACE_FUNC_ENTER; |
|
8743 _AKNTRACE_FUNC_EXIT; |
8078 } |
8744 } |
8079 #endif // RD_ENHANCED_CBA |
8745 #endif // RD_ENHANCED_CBA |
8080 |
8746 |
8081 // ----------------------------------------------------------------------------- |
8747 // ----------------------------------------------------------------------------- |
8082 // Constructs empty button with id EAknSoftkeyEmpty |
8748 // Constructs empty button with id EAknSoftkeyEmpty |
8083 // ----------------------------------------------------------------------------- |
8749 // ----------------------------------------------------------------------------- |
8084 void CEikEnhancedCbaButton::ConstructEmptyButtonL() |
8750 void CEikEnhancedCbaButton::ConstructEmptyButtonL() |
8085 { |
8751 { |
|
8752 _AKNTRACE_FUNC_ENTER; |
|
8753 _AKNTRACE_FUNC_EXIT; |
8086 #ifdef RD_ENHANCED_CBA |
8754 #ifdef RD_ENHANCED_CBA |
8087 ConstructL( EHRightVCenter ); // creates label |
8755 ConstructL( EHRightVCenter ); // creates label |
8088 iCommandType = EEikCommandTypeAnyCommand; |
8756 iCommandType = EEikCommandTypeAnyCommand; |
8089 iCommandId = EAknSoftkeyEmpty; |
8757 iCommandId = EAknSoftkeyEmpty; |
8090 _LIT(KEmptyText, ""); |
8758 _LIT(KEmptyText, ""); |
8175 } |
8853 } |
8176 |
8854 |
8177 |
8855 |
8178 CEikCommandTable::~CEikCommandTable() |
8856 CEikCommandTable::~CEikCommandTable() |
8179 { |
8857 { |
|
8858 _AKNTRACE_FUNC_ENTER; |
8180 #ifdef RD_ENHANCED_CBA |
8859 #ifdef RD_ENHANCED_CBA |
8181 iCommandButtons.Reset(); // Reset array |
8860 iCommandButtons.Reset(); // Reset array |
8182 for(TInt i = 0; i < iPriorities.Count(); i++) |
8861 for(TInt i = 0; i < iPriorities.Count(); i++) |
8183 { |
8862 { |
8184 iPriorities[i].Reset(); |
8863 iPriorities[i].Reset(); |
8185 } |
8864 } |
8186 iPriorities.Reset(); |
8865 iPriorities.Reset(); |
8187 #endif |
8866 #endif |
|
8867 _AKNTRACE_FUNC_EXIT; |
8188 } |
8868 } |
8189 |
8869 |
8190 // ----------------------------------------------------------------------------- |
8870 // ----------------------------------------------------------------------------- |
8191 // Used to add a command to CommandTable |
8871 // Used to add a command to CommandTable |
8192 // @param aButton button to be added |
8872 // @param aButton button to be added |
8193 // ----------------------------------------------------------------------------- |
8873 // ----------------------------------------------------------------------------- |
8194 #ifndef RD_ENHANCED_CBA |
8874 #ifndef RD_ENHANCED_CBA |
8195 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) |
8875 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) |
8196 { |
8876 { |
|
8877 _AKNTRACE_FUNC_ENTER; |
|
8878 _AKNTRACE_FUNC_EXIT; |
8197 return KErrNone; |
8879 return KErrNone; |
8198 } |
8880 } |
8199 #else |
8881 #else |
8200 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) |
8882 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) |
8201 { |
8883 { |
|
8884 _AKNTRACE_FUNC_ENTER; |
8202 // CommandType tells in which button this command should be placed |
8885 // CommandType tells in which button this command should be placed |
8203 TInt commandType( aButton->CommandType() ); |
8886 TInt commandType( aButton->CommandType() ); |
8204 TInt index( KErrNotFound ); |
8887 TInt index( KErrNotFound ); |
8205 |
8888 |
8206 // Find button and index for this button. |
8889 // Find button and index for this button. |
8248 // @param aCommandId Id to be checked. |
8932 // @param aCommandId Id to be checked. |
8249 // ----------------------------------------------------------------------------- |
8933 // ----------------------------------------------------------------------------- |
8250 #ifndef RD_ENHANCED_CBA |
8934 #ifndef RD_ENHANCED_CBA |
8251 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const |
8935 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const |
8252 { |
8936 { |
|
8937 _AKNTRACE_FUNC_ENTER; |
8253 #else // !RD_ENHANCED_CBA |
8938 #else // !RD_ENHANCED_CBA |
8254 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const |
8939 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const |
8255 { |
8940 { |
|
8941 _AKNTRACE_FUNC_ENTER; |
8256 TInt count( iCommandButtons.Count() ); |
8942 TInt count( iCommandButtons.Count() ); |
8257 |
8943 |
8258 for ( TInt i = 0; i < count; i++ ) |
8944 for ( TInt i = 0; i < count; i++ ) |
8259 { |
8945 { |
8260 if ( iCommandButtons[i] ) |
8946 if ( iCommandButtons[i] ) |
8261 { |
8947 { |
8262 if ( iCommandButtons[i]->CommandId() == aCommandId ) |
8948 if ( iCommandButtons[i]->CommandId() == aCommandId ) |
8263 { |
8949 { |
|
8950 _AKNTRACE_FUNC_EXIT; |
8264 return ETrue; |
8951 return ETrue; |
8265 } |
8952 } |
8266 } |
8953 } |
8267 } |
8954 } |
8268 #endif // RD_ENHANCED_CBA |
8955 #endif // RD_ENHANCED_CBA |
|
8956 _AKNTRACE_FUNC_EXIT; |
8269 return EFalse; // if no match for command id |
8957 return EFalse; // if no match for command id |
8270 } |
8958 } |
8271 |
8959 |
8272 // ----------------------------------------------------------------------------- |
8960 // ----------------------------------------------------------------------------- |
8273 // Used to replace command with a new command. |
8961 // Used to replace command with a new command. |
8319 iCommandButtons[index] = button; // transfers ownership |
9010 iCommandButtons[index] = button; // transfers ownership |
8320 |
9011 |
8321 // Delete old button. |
9012 // Delete old button. |
8322 delete oldButton; |
9013 delete oldButton; |
8323 #endif // !RD_ENHANCED_CBA |
9014 #endif // !RD_ENHANCED_CBA |
|
9015 _AKNTRACE_FUNC_EXIT; |
8324 } |
9016 } |
8325 |
9017 |
8326 // ----------------------------------------------------------------------------- |
9018 // ----------------------------------------------------------------------------- |
8327 // Used to get CEikEnhancedCbaButton for current control button (1-4). |
9019 // Used to get CEikEnhancedCbaButton for current control button (1-4). |
8328 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions. |
9020 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions. |
8329 // @return CEikCbaButton for current position, NULL if no button placed in that position. |
9021 // @return CEikCbaButton for current position, NULL if no button placed in that position. |
8330 // ----------------------------------------------------------------------------- |
9022 // ----------------------------------------------------------------------------- |
8331 #ifdef RD_ENHANCED_CBA |
9023 #ifdef RD_ENHANCED_CBA |
8332 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex ) |
9024 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex ) |
8333 { |
9025 { |
|
9026 _AKNTRACE_FUNC_ENTER; |
|
9027 _AKNTRACE_FUNC_EXIT; |
8334 return iCommandButtons[aCommandIndex]; |
9028 return iCommandButtons[aCommandIndex]; |
8335 } |
9029 } |
8336 #else // RD_ENHANCED_CBA |
9030 #else // RD_ENHANCED_CBA |
8337 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ ) |
9031 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ ) |
8338 { |
9032 { |
|
9033 _AKNTRACE_FUNC_ENTER; |
|
9034 _AKNTRACE_FUNC_EXIT; |
8339 return NULL; |
9035 return NULL; |
8340 } |
9036 } |
8341 #endif // RD_ENHANCED_CBA |
9037 #endif // RD_ENHANCED_CBA |
8342 |
9038 |
8343 // ----------------------------------------------------------------------------- |
9039 // ----------------------------------------------------------------------------- |
8344 // Reset CommandTable |
9040 // Reset CommandTable |
8345 // ----------------------------------------------------------------------------- |
9041 // ----------------------------------------------------------------------------- |
8346 void CEikCommandTable::Reset() |
9042 void CEikCommandTable::Reset() |
8347 { |
9043 { |
|
9044 _AKNTRACE_FUNC_ENTER; |
|
9045 _AKNTRACE_FUNC_EXIT; |
8348 #ifdef RD_ENHANCED_CBA |
9046 #ifdef RD_ENHANCED_CBA |
8349 iCommandButtons.Reset(); |
9047 iCommandButtons.Reset(); |
8350 #endif // RD_ENHANCED_CBA |
9048 #endif // RD_ENHANCED_CBA |
8351 } |
9049 } |
8352 |
9050 |