branch | RCL_3 |
changeset 10 | 9f56a4e1b8ab |
parent 9 | aabf2c525e0f |
child 16 | 71dd06cfe933 |
9:aabf2c525e0f | 10:9f56a4e1b8ab |
---|---|
54 #include <AknTasHook.h> |
54 #include <AknTasHook.h> |
55 #include <akncbacontentobserver.h> |
55 #include <akncbacontentobserver.h> |
56 #include <aknitemactionmenu.h> |
56 #include <aknitemactionmenu.h> |
57 #include "akncollectionobserver.h" |
57 #include "akncollectionobserver.h" |
58 #include "aknitemactionmenuregister.h" |
58 #include "aknitemactionmenuregister.h" |
59 |
59 #include "akntrace.h" |
60 /** |
60 /** |
61 * Color value for transparent pixel (ARGB format). |
61 * Color value for transparent pixel (ARGB format). |
62 */ |
62 */ |
63 const TUint32 KAknCbaColorKey = 0x00000000; |
63 const TUint32 KAknCbaColorKey = 0x00000000; |
64 |
64 |
74 #include <touchfeedback.h> |
74 #include <touchfeedback.h> |
75 |
75 |
76 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, |
76 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, |
77 TAknWindowComponentLayout aLine2) |
77 TAknWindowComponentLayout aLine2) |
78 { |
78 { |
79 _AKNTRACE_FUNC_ENTER; |
|
80 _AKNTRACE_FUNC_EXIT; |
|
79 return TAknWindowComponentLayout::Compose(aLine1, aLine2); |
81 return TAknWindowComponentLayout::Compose(aLine1, aLine2); |
80 } |
82 } |
81 |
83 |
82 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, |
84 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, |
83 TAknTextComponentLayout aLine2) |
85 TAknTextComponentLayout aLine2) |
84 { |
86 { |
87 _AKNTRACE_FUNC_ENTER; |
|
88 _AKNTRACE_FUNC_EXIT; |
|
85 return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); |
89 return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); |
86 } |
90 } |
87 |
91 |
88 /** |
92 /** |
89 * Checks if right side pane is active. |
93 * Checks if right side pane is active. |
90 * @return ETrue if right side pane is active, EFalse otherwise. |
94 * @return ETrue if right side pane is active, EFalse otherwise. |
91 */ |
95 */ |
92 static TBool IsAreaSideRightPaneActive() |
96 static TBool IsAreaSideRightPaneActive() |
93 { |
97 { |
98 _AKNTRACE_FUNC_ENTER; |
|
99 _AKNTRACE_FUNC_EXIT; |
|
94 return EFalse; |
100 return EFalse; |
95 } |
101 } |
96 |
102 |
97 |
103 |
98 /** |
104 /** |
99 * Checks if MSK-enabled layout is in use. |
105 * Checks if MSK-enabled layout is in use. |
100 */ |
106 */ |
101 static TBool IsMskEnabledLayoutActive() |
107 static TBool IsMskEnabledLayoutActive() |
102 { |
108 { |
109 _AKNTRACE_FUNC_ENTER; |
|
103 TBool result( EFalse ); |
110 TBool result( EFalse ); |
104 |
111 |
105 if ( Layout_Meta_Data::IsMSKEnabled() ) |
112 if ( Layout_Meta_Data::IsMSKEnabled() ) |
106 { |
113 { |
107 // First check if MSK is enabled in the layout metadata. |
114 // First check if MSK is enabled in the layout metadata. |
123 // these status pane layouts an exception is made. |
130 // these status pane layouts an exception is made. |
124 result = ETrue; |
131 result = ETrue; |
125 } |
132 } |
126 } |
133 } |
127 |
134 |
135 _AKNTRACE_FUNC_EXIT; |
|
128 return result; |
136 return result; |
129 } |
137 } |
130 |
138 |
131 |
139 |
132 /* |
140 /* |
133 * Checks if bitmap must be updated, i.e. bitmap does not exist or |
141 * Checks if bitmap must be updated, i.e. bitmap does not exist or |
134 * expected size does not match with actual size. |
142 * expected size does not match with actual size. |
135 */ |
143 */ |
136 static TBool IsBitmapUpdateNeeded( CFbsBitmap* aOldBitmap, const TSize& aSize ) |
144 static TBool IsBitmapUpdateNeeded( CFbsBitmap* aOldBitmap, const TSize& aSize ) |
137 { |
145 { |
146 _AKNTRACE_FUNC_ENTER; |
|
147 _AKNTRACE_FUNC_EXIT; |
|
138 return !aOldBitmap || ( aOldBitmap->SizeInPixels() != aSize ); |
148 return !aOldBitmap || ( aOldBitmap->SizeInPixels() != aSize ); |
139 } |
149 } |
140 |
150 |
141 |
151 |
142 /** |
152 /** |
238 iCbaBgIIDSetExt( EFalse ) |
248 iCbaBgIIDSetExt( EFalse ) |
239 ,iLeftFrameMask( NULL ), |
249 ,iLeftFrameMask( NULL ), |
240 iRightFrameMask( NULL ), |
250 iRightFrameMask( NULL ), |
241 iItemActionMenu( NULL ) |
251 iItemActionMenu( NULL ) |
242 { |
252 { |
253 _AKNTRACE_FUNC_ENTER; |
|
254 _AKNTRACE_FUNC_EXIT; |
|
243 }; |
255 }; |
244 |
256 |
245 static CEikCbaExtension* NewL( CEikCba& aOwner ) |
257 static CEikCbaExtension* NewL( CEikCba& aOwner ) |
246 { |
258 { |
259 _AKNTRACE_FUNC_ENTER; |
|
247 CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner ); |
260 CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner ); |
248 CleanupStack::PushL( self ); |
261 CleanupStack::PushL( self ); |
249 self->ConstructL(); |
262 self->ConstructL(); |
250 CleanupStack::Pop( self ); |
263 CleanupStack::Pop( self ); |
264 _AKNTRACE_FUNC_EXIT; |
|
251 return self; |
265 return self; |
252 } |
266 } |
253 |
267 |
254 void ConstructL() |
268 void ConstructL() |
255 { |
269 { |
270 _AKNTRACE_FUNC_ENTER; |
|
256 // Wallpaper is not drawn by embedded CBA. |
271 // Wallpaper is not drawn by embedded CBA. |
257 if ( !iOwner.Flags().IsSet( ECbaEmbedded ) ) |
272 if ( !iOwner.Flags().IsSet( ECbaEmbedded ) ) |
258 { |
273 { |
259 iRepository = CRepository::NewL( KCRUidPersonalisation ); |
274 iRepository = CRepository::NewL( KCRUidPersonalisation ); |
260 iRepository->Get( KPslnWallpaperType, iWallpaperInUse ); |
275 iRepository->Get( KPslnWallpaperType, iWallpaperInUse ); |
274 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
289 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
275 { |
290 { |
276 AknItemActionMenuRegister::RegisterCollectionObserverL( |
291 AknItemActionMenuRegister::RegisterCollectionObserverL( |
277 *this ); |
292 *this ); |
278 } |
293 } |
294 _AKNTRACE_FUNC_EXIT; |
|
279 } |
295 } |
280 |
296 |
281 ~CEikCbaExtension() |
297 ~CEikCbaExtension() |
282 { |
298 { |
299 _AKNTRACE_FUNC_ENTER; |
|
283 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
300 if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) ) |
284 { |
301 { |
285 AknItemActionMenuRegister::UnregisterCollectionObserver( *this ); |
302 AknItemActionMenuRegister::UnregisterCollectionObserver( *this ); |
286 } |
303 } |
287 if ( iCRListener ) |
304 if ( iCRListener ) |
295 delete iLeftFrameMask; |
312 delete iLeftFrameMask; |
296 delete iRightFrameMask; |
313 delete iRightFrameMask; |
297 delete iLskPostingOverlayBitmap; |
314 delete iLskPostingOverlayBitmap; |
298 delete iRskPostingOverlayBitmap; |
315 delete iRskPostingOverlayBitmap; |
299 delete iBmpFile; |
316 delete iBmpFile; |
317 _AKNTRACE_FUNC_EXIT; |
|
300 } |
318 } |
301 |
319 |
302 /** From base class MCenRepNotifyHandlerCallback */ |
320 /** From base class MCenRepNotifyHandlerCallback */ |
303 void HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue ) |
321 void HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue ) |
304 { |
322 { |
323 _AKNTRACE_FUNC_ENTER; |
|
305 iWallpaperInUse = aNewValue; |
324 iWallpaperInUse = aNewValue; |
306 iOwner.SetSkinBackgroundId( KAknsIIDNone ); |
325 iOwner.SetSkinBackgroundId( KAknsIIDNone ); |
326 _AKNTRACE_FUNC_EXIT; |
|
307 } |
327 } |
308 |
328 |
309 void UpdateSoftkeyFrameL( TBool aForcedUpdate ) |
329 void UpdateSoftkeyFrameL( TBool aForcedUpdate ) |
310 { |
330 { |
331 _AKNTRACE_FUNC_ENTER; |
|
311 if ( !AknLayoutUtils::PenEnabled() ) |
332 if ( !AknLayoutUtils::PenEnabled() ) |
312 { |
333 { |
334 _AKNTRACE_FUNC_EXIT; |
|
313 return; |
335 return; |
314 } |
336 } |
315 TAknLayoutRect cbarect; |
337 TAknLayoutRect cbarect; |
316 |
338 |
317 TRect screen; |
339 TRect screen; |
437 |
459 |
438 iUpdateFrameOuterRect = outerRect; |
460 iUpdateFrameOuterRect = outerRect; |
439 iUpdateFrameInnerRect = innerRect; |
461 iUpdateFrameInnerRect = innerRect; |
440 iUpdateMSKFrameOuterRect = mskOuterRect; |
462 iUpdateMSKFrameOuterRect = mskOuterRect; |
441 iUpdateMskFrameInnerRect = mskInnerRect; |
463 iUpdateMskFrameInnerRect = mskInnerRect; |
464 _AKNTRACE_FUNC_EXIT; |
|
442 } |
465 } |
443 |
466 |
444 |
467 |
445 |
468 |
446 |
469 |
451 * @param aMask mask to be merged. |
474 * @param aMask mask to be merged. |
452 * @param aDestBitmap bitmap to merge mask with. |
475 * @param aDestBitmap bitmap to merge mask with. |
453 */ |
476 */ |
454 static void MergeMaskInto16MA( CFbsBitmap* aMask, CFbsBitmap* aDestBitmap ) |
477 static void MergeMaskInto16MA( CFbsBitmap* aMask, CFbsBitmap* aDestBitmap ) |
455 { |
478 { |
479 _AKNTRACE_FUNC_ENTER; |
|
456 // aMask display mode must be EGray256. |
480 // aMask display mode must be EGray256. |
457 // aMask must not be compressed in RAM. |
481 // aMask must not be compressed in RAM. |
458 // aDestBitmap display mode must be EColor16MA. |
482 // aDestBitmap display mode must be EColor16MA. |
459 // aDestBitmap must not be compressed in RAM. |
483 // aDestBitmap must not be compressed in RAM. |
460 // aMask size must equal to aDestBitmap size. |
484 // aMask size must equal to aDestBitmap size. |
488 } |
512 } |
489 } |
513 } |
490 } |
514 } |
491 aDestBitmap->UnlockHeap(); |
515 aDestBitmap->UnlockHeap(); |
492 aMask->UnlockHeap(); |
516 aMask->UnlockHeap(); |
517 _AKNTRACE_FUNC_EXIT; |
|
493 } |
518 } |
494 |
519 |
495 /** |
520 /** |
496 * Updates posting overlay bitmap. |
521 * Updates posting overlay bitmap. |
497 * @internal |
522 * @internal |
504 void UpdatePostingOverlayBitmapL( |
529 void UpdatePostingOverlayBitmapL( |
505 CFbsBitmap*& aBitmap, |
530 CFbsBitmap*& aBitmap, |
506 const TRect& aRect, |
531 const TRect& aRect, |
507 CEikCbaButton* aButton ) |
532 CEikCbaButton* aButton ) |
508 { |
533 { |
534 _AKNTRACE_FUNC_ENTER; |
|
509 delete aBitmap; |
535 delete aBitmap; |
510 aBitmap = NULL; |
536 aBitmap = NULL; |
511 |
537 |
512 // If you modify this method, please make sure that assumptions |
538 // If you modify this method, please make sure that assumptions |
513 // mentioned in MergeMaskInto16MA still hold. |
539 // mentioned in MergeMaskInto16MA still hold. |
557 } |
583 } |
558 |
584 |
559 CleanupStack::PopAndDestroy( 2, bitmapDevice ); |
585 CleanupStack::PopAndDestroy( 2, bitmapDevice ); |
560 CleanupStack::Pop( bitmap ); |
586 CleanupStack::Pop( bitmap ); |
561 aBitmap = bitmap; |
587 aBitmap = bitmap; |
588 _AKNTRACE_FUNC_EXIT; |
|
562 } |
589 } |
563 |
590 |
564 /** |
591 /** |
565 * Updates posting overlay bitmaps. |
592 * Updates posting overlay bitmaps. |
566 * @param aCbaRect cba rect. |
593 * @param aCbaRect cba rect. |
571 const TRect& aCbaRect, |
598 const TRect& aCbaRect, |
572 CEikCbaButton* aLeftButton, |
599 CEikCbaButton* aLeftButton, |
573 CEikCbaButton* aRightButton, |
600 CEikCbaButton* aRightButton, |
574 TInt aAknLayoutFlags ) |
601 TInt aAknLayoutFlags ) |
575 { |
602 { |
603 _AKNTRACE_FUNC_ENTER; |
|
576 TRect rightSoftKeyButtonRect; |
604 TRect rightSoftKeyButtonRect; |
577 TRect leftSoftKeyButtonRect; |
605 TRect leftSoftKeyButtonRect; |
578 if( aAknLayoutFlags & EAknLayoutCbaInRightPane ) |
606 if( aAknLayoutFlags & EAknLayoutCbaInRightPane ) |
579 { |
607 { |
580 // Read right (top in landscape) softkey layout. |
608 // Read right (top in landscape) softkey layout. |
683 aLeftButton ); |
711 aLeftButton ); |
684 UpdatePostingOverlayBitmapL( |
712 UpdatePostingOverlayBitmapL( |
685 iRskPostingOverlayBitmap, |
713 iRskPostingOverlayBitmap, |
686 rightSoftKeyButtonRect, |
714 rightSoftKeyButtonRect, |
687 aRightButton ); |
715 aRightButton ); |
716 _AKNTRACE_FUNC_EXIT; |
|
688 } |
717 } |
689 |
718 |
690 /** |
719 /** |
691 * From MAknCollectionObserver. |
720 * From MAknCollectionObserver. |
692 * This method is used to set the item action menu to observer. |
721 * This method is used to set the item action menu to observer. |
693 * |
722 * |
694 * @param aItemActionMenu Item action menu. |
723 * @param aItemActionMenu Item action menu. |
695 */ |
724 */ |
696 void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu ) |
725 void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu ) |
697 { |
726 { |
727 _AKNTRACE_FUNC_ENTER; |
|
698 iItemActionMenu = aItemActionMenu; |
728 iItemActionMenu = aItemActionMenu; |
729 _AKNTRACE_FUNC_EXIT; |
|
699 } |
730 } |
700 |
731 |
701 /** |
732 /** |
702 * From MAknCollectionObserver. |
733 * From MAknCollectionObserver. |
703 * This method is called when there are changes in collection state. |
734 * This method is called when there are changes in collection state. |
705 * |
736 * |
706 * @param aCollectionVisible ETrue if changed collection is visible. |
737 * @param aCollectionVisible ETrue if changed collection is visible. |
707 */ |
738 */ |
708 void CollectionChanged( TBool aCollectionVisible ) |
739 void CollectionChanged( TBool aCollectionVisible ) |
709 { |
740 { |
741 _AKNTRACE_FUNC_ENTER; |
|
710 // Do not update state if invisible collection tries to enable sk |
742 // Do not update state if invisible collection tries to enable sk |
711 if ( aCollectionVisible |
743 if ( aCollectionVisible |
712 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) ) |
744 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) ) |
713 { |
745 { |
714 iOwner.UpdateItemSpecificSoftkey(); |
746 iOwner.UpdateItemSpecificSoftkey(); |
715 } |
747 } |
748 _AKNTRACE_FUNC_EXIT; |
|
716 } |
749 } |
717 |
750 |
718 /** |
751 /** |
719 * From MAknCollectionObserver. |
752 * From MAknCollectionObserver. |
720 * This method returns ETrue if collection observer is active. |
753 * This method returns ETrue if collection observer is active. |
721 * |
754 * |
722 * @return ETrue if observer is active. |
755 * @return ETrue if observer is active. |
723 */ |
756 */ |
724 TBool Active() const |
757 TBool Active() const |
725 { |
758 { |
759 _AKNTRACE_FUNC_ENTER; |
|
760 _AKNTRACE_FUNC_EXIT; |
|
726 return iOwner.IsVisible() && !iOwner.IsEmpty(); |
761 return iOwner.IsVisible() && !iOwner.IsEmpty(); |
727 } |
762 } |
728 |
763 |
729 /* |
764 /* |
730 * Using the special theme Id draw background |
765 * Using the special theme Id draw background |
731 */ |
766 */ |
732 void DrawSemiTransparencyL(CWindowGc& aGc, |
767 void DrawSemiTransparency( CWindowGc& aGc, |
733 const TRect& aRect) |
768 const TRect& aRect ) |
734 { |
769 { |
770 _AKNTRACE_FUNC_ENTER; |
|
735 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
771 aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
736 aGc.SetBrushColor( TRgb(128, 128, 128, 64) ); |
772 aGc.SetBrushColor( TRgb(128, 128, 128, 64) ); |
737 aGc.Clear(); |
773 aGc.Clear(); |
738 |
774 |
739 TAknsItemID SemiButtonID = KAknsIIDQgnHomeButtonWidget; |
775 TAknsItemID SemiButtonID = KAknsIIDQgnHomeButtonWidget; |
808 iRightFrameOuterRect, |
844 iRightFrameOuterRect, |
809 innerRect,//iRightFrameInnerRect, |
845 innerRect,//iRightFrameInnerRect, |
810 SemiButtonID, |
846 SemiButtonID, |
811 SemiButtonCenterID); |
847 SemiButtonCenterID); |
812 } |
848 } |
813 } |
849 _AKNTRACE_FUNC_EXIT; |
850 } |
|
814 public: |
851 public: |
815 |
852 |
816 CEikCba& iOwner; |
853 CEikCba& iOwner; |
817 CRepository* iRepository; |
854 CRepository* iRepository; |
818 CCenRepNotifyHandler* iCRListener; |
855 CCenRepNotifyHandler* iCRListener; |
889 |
926 |
890 |
927 |
891 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
928 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
892 RWindowGroup* aParentWg) |
929 RWindowGroup* aParentWg) |
893 { |
930 { |
931 _AKNTRACE_FUNC_ENTER; |
|
894 CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static |
932 CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static |
895 CleanupStack::Pop( self ); |
933 CleanupStack::Pop( self ); |
934 _AKNTRACE_FUNC_EXIT; |
|
896 return self; |
935 return self; |
897 } |
936 } |
898 |
937 |
899 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, |
938 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, |
900 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
939 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
901 { |
940 { |
941 _AKNTRACE_FUNC_ENTER; |
|
902 CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static |
942 CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static |
903 CleanupStack::Pop( self ); |
943 CleanupStack::Pop( self ); |
944 _AKNTRACE_FUNC_EXIT; |
|
904 return self; |
945 return self; |
905 } |
946 } |
906 |
947 |
907 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
948 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, |
908 RWindowGroup* aParentWg) |
949 RWindowGroup* aParentWg) |
909 { |
950 { |
951 _AKNTRACE_FUNC_ENTER; |
|
952 _AKNTRACE_FUNC_EXIT; |
|
910 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static |
953 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static |
911 } |
954 } |
912 |
955 |
913 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, |
956 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, |
914 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
957 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
915 TUint aFlags) |
958 TUint aFlags) |
916 { |
959 { |
960 _AKNTRACE_FUNC_ENTER; |
|
961 _AKNTRACE_FUNC_EXIT; |
|
917 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, |
962 return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, |
918 aParentWg, aFlags); |
963 aParentWg, aFlags); |
919 } |
964 } |
920 |
965 |
921 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
966 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
922 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
967 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg) |
923 { |
968 { |
969 _AKNTRACE_FUNC_ENTER; |
|
924 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static |
970 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static |
925 CleanupStack::PushL(self); |
971 CleanupStack::PushL(self); |
926 self->ConstructL(aResourceId); |
972 self->ConstructL(aResourceId); |
927 AKNTASHOOK_ADDL( self, "CEikCba" ); |
973 AKNTASHOOK_ADDL( self, "CEikCba" ); |
974 _AKNTRACE_FUNC_EXIT; |
|
928 return self; |
975 return self; |
929 } |
976 } |
930 |
977 |
931 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
978 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious, |
932 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
979 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
933 TUint aFlags) |
980 TUint aFlags) |
934 { |
981 { |
982 _AKNTRACE_FUNC_ENTER; |
|
935 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, |
983 CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, |
936 aParentWg, aFlags); |
984 aParentWg, aFlags); |
937 CleanupStack::PushL(self); |
985 CleanupStack::PushL(self); |
938 self->ConstructL(aResourceId); |
986 self->ConstructL(aResourceId); |
939 AKNTASHOOK_ADDL( self, "CEikCba" ); |
987 AKNTASHOOK_ADDL( self, "CEikCba" ); |
988 _AKNTRACE_FUNC_EXIT; |
|
940 return self; |
989 return self; |
941 } |
990 } |
942 |
991 |
943 |
992 |
944 /** |
993 /** |
945 * Destructor. |
994 * Destructor. |
946 */ |
995 */ |
947 CEikCba::~CEikCba() |
996 CEikCba::~CEikCba() |
948 { |
997 { |
998 _AKNTRACE_FUNC_ENTER; |
|
949 AKNTASHOOK_REMOVE(); |
999 AKNTASHOOK_REMOVE(); |
950 // Revert the clock and indicator pane area of status pane |
1000 // Revert the clock and indicator pane area of status pane |
951 // to use the previous skin background. |
1001 // to use the previous skin background. |
952 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
1002 CEikStatusPaneBase* sp = CEikStatusPaneBase::Current(); |
953 if ( sp && |
1003 if ( sp && |
988 #ifdef RD_ENHANCED_CBA |
1038 #ifdef RD_ENHANCED_CBA |
989 delete iCommandTable; |
1039 delete iCommandTable; |
990 #endif // RD_ENHANCED_CBA |
1040 #endif // RD_ENHANCED_CBA |
991 |
1041 |
992 delete iExtension; |
1042 delete iExtension; |
1043 _AKNTRACE_FUNC_EXIT; |
|
993 } |
1044 } |
994 |
1045 |
995 /** |
1046 /** |
996 * Constructor. |
1047 * Constructor. |
997 */ |
1048 */ |
998 CEikCba::CEikCba(const CEikCba* aPrevious, |
1049 CEikCba::CEikCba(const CEikCba* aPrevious, |
999 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
1050 MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg, |
1000 TUint aFlags) |
1051 TUint aFlags) |
1001 : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg) |
1052 : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg) |
1002 { |
1053 { |
1054 _AKNTRACE_FUNC_ENTER; |
|
1003 if (aFlags & CEikButtonGroupContainer::EIsEmbedded) |
1055 if (aFlags & CEikButtonGroupContainer::EIsEmbedded) |
1004 { |
1056 { |
1005 // CBA is embedded in another component (eg. dialog/popup/setting page |
1057 // CBA is embedded in another component (eg. dialog/popup/setting page |
1006 iFlags.Set(ECbaEmbedded); |
1058 iFlags.Set(ECbaEmbedded); |
1007 } |
1059 } |
1009 if ( aFlags & CEikButtonGroupContainer::EParentIsControl ) |
1061 if ( aFlags & CEikButtonGroupContainer::EParentIsControl ) |
1010 { |
1062 { |
1011 iFlags.Set( ECbaParentAsControl ); |
1063 iFlags.Set( ECbaParentAsControl ); |
1012 } |
1064 } |
1013 |
1065 |
1014 if ( aFlags & CEikButtonGroupContainer::EDelayActivation ) |
1066 if ( aFlags & CEikButtonGroupContainer::EDelayActivation ) |
1015 { |
1067 { |
1016 iFlags.Set( ECbaActivationDelayed ); |
1068 iFlags.Set( ECbaActivationDelayed ); |
1017 } |
1069 } |
1018 |
1070 |
1019 CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() ); |
1071 CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() ); |
1022 iFlags.Set( ECbaSingleClickEnabled ); |
1074 iFlags.Set( ECbaSingleClickEnabled ); |
1023 iFlags.Set( ECbaItemSpecificSoftkeyInUse ); |
1075 iFlags.Set( ECbaItemSpecificSoftkeyInUse ); |
1024 } |
1076 } |
1025 |
1077 |
1026 SetNonFocusing(); |
1078 SetNonFocusing(); |
1079 _AKNTRACE_FUNC_EXIT; |
|
1027 } |
1080 } |
1028 |
1081 |
1029 |
1082 |
1030 void CEikCba::SetContainerWindowL( const CCoeControl& aContainer ) |
1083 void CEikCba::SetContainerWindowL( const CCoeControl& aContainer ) |
1031 { |
1084 { |
1085 _AKNTRACE_FUNC_ENTER; |
|
1032 // CCoeControl::SetContainerWindowL closes the previously own window and |
1086 // CCoeControl::SetContainerWindowL closes the previously own window and |
1033 // deactivates control. Therefore store the activation status and re-set |
1087 // deactivates control. Therefore store the activation status and re-set |
1034 // it after the container window has been set. |
1088 // it after the container window has been set. |
1035 |
1089 |
1036 // Removed to enable drawing of Query Input in one phase |
1090 // Removed to enable drawing of Query Input in one phase |
1210 } |
1264 } |
1211 else |
1265 else |
1212 { |
1266 { |
1213 CCoeControl::SetContainerWindowL( aContainer ); |
1267 CCoeControl::SetContainerWindowL( aContainer ); |
1214 } |
1268 } |
1269 _AKNTRACE_FUNC_EXIT; |
|
1215 } |
1270 } |
1216 |
1271 |
1217 void CEikCba::ActivateL() |
1272 void CEikCba::ActivateL() |
1218 { |
1273 { |
1274 _AKNTRACE_FUNC_ENTER; |
|
1219 CCoeControl::ActivateL(); |
1275 CCoeControl::ActivateL(); |
1276 _AKNTRACE_FUNC_EXIT; |
|
1220 } |
1277 } |
1221 |
1278 |
1222 void CEikCba::BaseConstructL() |
1279 void CEikCba::BaseConstructL() |
1223 { |
1280 { |
1281 _AKNTRACE_FUNC_ENTER; |
|
1224 if ( iFlags.IsSet( ECbaEmbedded ) && iFlags.IsSet( ECbaParentAsControl ) ) |
1282 if ( iFlags.IsSet( ECbaEmbedded ) && iFlags.IsSet( ECbaParentAsControl ) ) |
1225 { |
1283 { |
1226 __ASSERT_DEBUG( iParentWg, User::Invariant() ); |
1284 __ASSERT_DEBUG( iParentWg, User::Invariant() ); |
1227 CreateWindowL( (CCoeControl*)iParentWg ); |
1285 CreateWindowL( (CCoeControl*)iParentWg ); |
1228 EnableWindowTransparency(); |
1286 EnableWindowTransparency(); |
1381 // Default value. |
1439 // Default value. |
1382 iClockIndicBgIID = KAknsIIDQsnBgAreaControl; |
1440 iClockIndicBgIID = KAknsIIDQsnBgAreaControl; |
1383 } |
1441 } |
1384 } |
1442 } |
1385 } |
1443 } |
1444 _AKNTRACE_FUNC_EXIT; |
|
1386 } |
1445 } |
1387 |
1446 |
1388 void CEikCba::ConstructL(TInt aResourceId) |
1447 void CEikCba::ConstructL(TInt aResourceId) |
1389 { |
1448 { |
1449 _AKNTRACE_FUNC_ENTER; |
|
1390 if (aResourceId != KNoResource) |
1450 if (aResourceId != KNoResource) |
1391 { |
1451 { |
1392 TResourceReader reader; |
1452 TResourceReader reader; |
1393 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
1453 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
1394 iCbaFlags = reader.ReadInt32(); // flags resource |
1454 iCbaFlags = reader.ReadInt32(); // flags resource |
1395 |
1455 |
1396 const TUid KActiveIdle2Uid = {0x102750F0}; |
|
1397 CEikApplication* app = CEikonEnv::Static()->EikAppUi()->Application(); |
|
1398 if ( app && app->AppDllUid() == KActiveIdle2Uid ) |
|
1399 { |
|
1400 //it's intereting that the transparent can't not be set after the CBA was created for a while. |
|
1401 //it just can be done in the CBA constructor, maybe some defect in Window server, but I'm not sure |
|
1402 //about that, in order to fix the defect I have hardcode the transparent flag for homescreen the only usercase. |
|
1403 //it should be fixed later. |
|
1404 iCbaFlags |= EEikCbaFlagSemiTransparent; |
|
1405 } |
|
1406 |
|
1407 // If using enhanced cba. |
1456 // If using enhanced cba. |
1408 if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) |
1457 if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) |
1409 { |
1458 { |
1410 #ifdef RD_ENHANCED_CBA |
1459 #ifdef RD_ENHANCED_CBA |
1411 iCommandTable = CEikCommandTable::NewL(); |
1460 iCommandTable = CEikCommandTable::NewL(); |
1557 } |
1606 } |
1558 } |
1607 } |
1559 |
1608 |
1560 // Set CBA faded in case the softkeys are empty. |
1609 // Set CBA faded in case the softkeys are empty. |
1561 SetFadeState(); |
1610 SetFadeState(); |
1611 _AKNTRACE_FUNC_EXIT; |
|
1562 } |
1612 } |
1563 |
1613 |
1564 |
1614 |
1565 void CEikCba::ConstructFromResourceL(TResourceReader& aReader) |
1615 void CEikCba::ConstructFromResourceL(TResourceReader& aReader) |
1566 { |
1616 { |
1617 _AKNTRACE_FUNC_ENTER; |
|
1567 BaseConstructL(); |
1618 BaseConstructL(); |
1568 CreateScrollBarFrameL(); |
1619 CreateScrollBarFrameL(); |
1569 TGulAlignmentValue anAlignment[3] = {EHLeftVCenter, EHRightVCenter, EHCenterVCenter}; |
1620 TGulAlignmentValue anAlignment[3] = {EHLeftVCenter, EHRightVCenter, EHCenterVCenter}; |
1570 iCbaFlags = aReader.ReadInt32(); // flags resource |
1621 iCbaFlags = aReader.ReadInt32(); // flags resource |
1571 iSize.iWidth = aReader.ReadInt16(); |
1622 iSize.iWidth = aReader.ReadInt16(); |
1652 } |
1703 } |
1653 } |
1704 } |
1654 |
1705 |
1655 // Set CBA faded in case the softkeys are empty. |
1706 // Set CBA faded in case the softkeys are empty. |
1656 SetFadeState(); |
1707 SetFadeState(); |
1708 _AKNTRACE_FUNC_EXIT; |
|
1657 } |
1709 } |
1658 |
1710 |
1659 |
1711 |
1660 TInt CEikCba::MaxCommands() const |
1712 TInt CEikCba::MaxCommands() const |
1661 { |
1713 { |
1714 _AKNTRACE_FUNC_ENTER; |
|
1715 _AKNTRACE_FUNC_EXIT; |
|
1662 return KMaxSeries60Softkeys; |
1716 return KMaxSeries60Softkeys; |
1663 } |
1717 } |
1664 |
1718 |
1665 TInt CEikCba::MSKEnabledInPlatform() const |
1719 TInt CEikCba::MSKEnabledInPlatform() const |
1666 { |
1720 { |
1721 _AKNTRACE_FUNC_ENTER; |
|
1722 _AKNTRACE_FUNC_EXIT; |
|
1667 return iMSKEnabledInPlatform; |
1723 return iMSKEnabledInPlatform; |
1668 } |
1724 } |
1669 |
1725 |
1670 |
1726 |
1671 // --------------------------------------------------------------------------- |
1727 // --------------------------------------------------------------------------- |
1672 // Sets the middle softkey icon. |
1728 // Sets the middle softkey icon. |
1673 // --------------------------------------------------------------------------- |
1729 // --------------------------------------------------------------------------- |
1674 // |
1730 // |
1675 void CEikCba::SetMSKIconL() |
1731 void CEikCba::SetMSKIconL() |
1676 { |
1732 { |
1733 _AKNTRACE_FUNC_ENTER; |
|
1677 // MSK is not supported by dialog-embedded CBAs. |
1734 // MSK is not supported by dialog-embedded CBAs. |
1678 if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) ) |
1735 if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) ) |
1679 { |
1736 { |
1737 _AKNTRACE_FUNC_EXIT; |
|
1680 return; |
1738 return; |
1681 } |
1739 } |
1682 |
1740 |
1683 if ( !MskAllowed() ) |
1741 if ( !MskAllowed() ) |
1684 { |
1742 { |
1743 _AKNTRACE_FUNC_EXIT; |
|
1685 return; |
1744 return; |
1686 } |
1745 } |
1687 |
1746 |
1688 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1747 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
1689 if ( !skin ) |
1748 if ( !skin ) |
1690 { |
1749 { |
1750 _AKNTRACE_FUNC_EXIT; |
|
1691 return; |
1751 return; |
1692 } |
1752 } |
1693 if( iExtension->iIfMskIconSet ) |
1753 if( iExtension->iIfMskIconSet ) |
1694 { |
1754 { |
1695 // UpdateIconL(); |
1755 // UpdateIconL(); |
1696 return; |
1756 _AKNTRACE_FUNC_EXIT; |
1757 return; |
|
1697 } |
1758 } |
1698 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
1759 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
1699 |
1760 |
1700 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
1761 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
1701 if ( !button ) |
1762 if ( !button ) |
1702 { |
1763 { |
1764 _AKNTRACE_FUNC_EXIT; |
|
1703 return; |
1765 return; |
1704 } |
1766 } |
1705 |
1767 |
1706 CFbsBitmap *bitmap = NULL; |
1768 CFbsBitmap *bitmap = NULL; |
1707 CFbsBitmap *mask = NULL; |
1769 CFbsBitmap *mask = NULL; |
1834 { |
1896 { |
1835 button->ReplaceImageByLabel(); // remove old image |
1897 button->ReplaceImageByLabel(); // remove old image |
1836 } |
1898 } |
1837 |
1899 |
1838 button->SetContainerWindowL( *this ); |
1900 button->SetContainerWindowL( *this ); |
1901 _AKNTRACE_FUNC_EXIT; |
|
1839 } |
1902 } |
1840 |
1903 |
1841 EXPORT_C TBool CEikCba::UpdateMSKIconL( const TAknsItemID& aId, |
1904 EXPORT_C TBool CEikCba::UpdateMSKIconL( const TAknsItemID& aId, |
1842 const TDesC& aBmpFile, |
1905 const TDesC& aBmpFile, |
1843 const TInt32 aBmp, |
1906 const TInt32 aBmp, |
1844 const TInt32 aBmpM, |
1907 const TInt32 aBmpM, |
1845 TBool aEnable ) |
1908 TBool aEnable ) |
1846 { |
1909 { |
1910 _AKNTRACE_FUNC_ENTER; |
|
1847 iExtension->iIfMskIconSet = EFalse; |
1911 iExtension->iIfMskIconSet = EFalse; |
1848 |
1912 |
1849 // MSK is not supported by dialog-embedded CBAs. |
1913 // MSK is not supported by dialog-embedded CBAs. |
1850 if (!aEnable) |
1914 if (!aEnable) |
1851 { |
1915 { |
1852 SetMSKIconL(); |
1916 SetMSKIconL(); |
1853 return ETrue; |
1917 _AKNTRACE_FUNC_EXIT; |
1918 return ETrue; |
|
1854 } |
1919 } |
1855 |
1920 |
1856 delete iExtension->iBmpFile; |
1921 delete iExtension->iBmpFile; |
1857 iExtension->iBmpFile = NULL; |
1922 iExtension->iBmpFile = NULL; |
1858 iExtension->iBmpFile = aBmpFile.AllocL(); |
1923 iExtension->iBmpFile = aBmpFile.AllocL(); |
1861 iExtension->iMSKSkinID = aId; |
1926 iExtension->iMSKSkinID = aId; |
1862 |
1927 |
1863 iExtension->iBmp = aBmp; |
1928 iExtension->iBmp = aBmp; |
1864 iExtension->iBmpM = aBmpM; |
1929 iExtension->iBmpM = aBmpM; |
1865 |
1930 |
1931 _AKNTRACE_FUNC_EXIT; |
|
1866 return UpdateIconL(); |
1932 return UpdateIconL(); |
1867 } |
1933 } |
1868 |
1934 |
1869 |
1935 |
1870 // ---------------------------------------------------------------------------- |
1936 // ---------------------------------------------------------------------------- |
1871 // CEikCba::EnableItemSpecificSoftkey |
1937 // CEikCba::EnableItemSpecificSoftkey |
1872 // ---------------------------------------------------------------------------- |
1938 // ---------------------------------------------------------------------------- |
1873 // |
1939 // |
1874 EXPORT_C void CEikCba::EnableItemSpecificSoftkey( TBool aEnable ) |
1940 EXPORT_C void CEikCba::EnableItemSpecificSoftkey( TBool aEnable ) |
1875 { |
1941 { |
1942 _AKNTRACE_FUNC_ENTER; |
|
1876 if ( iFlags.IsSet( ECbaSingleClickEnabled ) ) |
1943 if ( iFlags.IsSet( ECbaSingleClickEnabled ) ) |
1877 { |
1944 { |
1878 iFlags.Assign( ECbaItemSpecificSoftkeyInUse, aEnable ); |
1945 iFlags.Assign( ECbaItemSpecificSoftkeyInUse, aEnable ); |
1879 |
1946 |
1880 if ( aEnable ) |
1947 if ( aEnable ) |
1895 leftSoftkey.iControl->SetDimmed( EFalse ); |
1962 leftSoftkey.iControl->SetDimmed( EFalse ); |
1896 leftSoftkey.iControl->DrawDeferred(); |
1963 leftSoftkey.iControl->DrawDeferred(); |
1897 } |
1964 } |
1898 } |
1965 } |
1899 } |
1966 } |
1967 _AKNTRACE_FUNC_EXIT; |
|
1900 } |
1968 } |
1901 |
1969 |
1902 |
1970 |
1903 void CEikCba::SetMSKCommandObserver(MEikCommandObserver* aCommandObserver) |
1971 void CEikCba::SetMSKCommandObserver(MEikCommandObserver* aCommandObserver) |
1904 { |
1972 { |
1973 _AKNTRACE_FUNC_ENTER; |
|
1905 // aCommandObserver set to NULL when removing observer. |
1974 // aCommandObserver set to NULL when removing observer. |
1906 iMSKCommandObserver = aCommandObserver; |
1975 iMSKCommandObserver = aCommandObserver; |
1976 _AKNTRACE_FUNC_EXIT; |
|
1907 } |
1977 } |
1908 |
1978 |
1909 void CEikCba::UpdateCbaLabels(TBool aScrollerOn) |
1979 void CEikCba::UpdateCbaLabels(TBool aScrollerOn) |
1910 { |
1980 { |
1981 _AKNTRACE_FUNC_ENTER; |
|
1911 // This method is called only from scrollbar that has nothing to do with |
1982 // This method is called only from scrollbar that has nothing to do with |
1912 // dialog-embedded CBAs -> ignore the call. |
1983 // dialog-embedded CBAs -> ignore the call. |
1913 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
1984 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
1914 { |
1985 { |
1986 _AKNTRACE_FUNC_EXIT; |
|
1915 return; |
1987 return; |
1916 } |
1988 } |
1917 |
1989 |
1918 // Communicate change to CBA buttons. |
1990 // Communicate change to CBA buttons. |
1919 for (TInt ii = 0; ii < iControlArray->Count(); ii++) |
1991 for (TInt ii = 0; ii < iControlArray->Count(); ii++) |
1926 } |
1998 } |
1927 } |
1999 } |
1928 // Change of text may affect layout. |
2000 // Change of text may affect layout. |
1929 SizeChanged(); |
2001 SizeChanged(); |
1930 DrawDeferred() ; |
2002 DrawDeferred() ; |
2003 _AKNTRACE_FUNC_EXIT; |
|
1931 } |
2004 } |
1932 |
2005 |
1933 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver) |
2006 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver) |
1934 { |
2007 { |
2008 _AKNTRACE_FUNC_ENTER; |
|
1935 if(iSBFrame) |
2009 if(iSBFrame) |
1936 { |
2010 { |
1937 iSBFrame->SetScrollBarFrameObserver(aObserver); |
2011 iSBFrame->SetScrollBarFrameObserver(aObserver); |
1938 } |
2012 } |
2013 _AKNTRACE_FUNC_EXIT; |
|
1939 } |
2014 } |
1940 |
2015 |
1941 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel) |
2016 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel) |
1942 { |
2017 { |
2018 _AKNTRACE_FUNC_ENTER; |
|
1943 if(iSBFrame) |
2019 if(iSBFrame) |
1944 { |
2020 { |
1945 VScrollBarAsControl()->SetModelL(aModel); |
2021 VScrollBarAsControl()->SetModelL(aModel); |
1946 } |
2022 } |
2023 _AKNTRACE_FUNC_EXIT; |
|
1947 } |
2024 } |
1948 |
2025 |
1949 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const |
2026 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const |
1950 { |
2027 { |
2028 _AKNTRACE_FUNC_ENTER; |
|
2029 _AKNTRACE_FUNC_EXIT; |
|
1951 return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); |
2030 return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); |
1952 } |
2031 } |
1953 |
2032 |
1954 CAknScrollBar* CEikCba::VScrollBarAsControl() |
2033 CAknScrollBar* CEikCba::VScrollBarAsControl() |
1955 { |
2034 { |
2035 _AKNTRACE_FUNC_ENTER; |
|
2036 _AKNTRACE_FUNC_EXIT; |
|
1956 return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl); |
2037 return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl); |
1957 } |
2038 } |
1958 |
2039 |
1959 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex) |
2040 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex) |
1960 { |
2041 { |
2042 _AKNTRACE_FUNC_ENTER; |
|
1961 iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point. |
2043 iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point. |
2044 _AKNTRACE_FUNC_EXIT; |
|
1962 } |
2045 } |
1963 |
2046 |
1964 |
2047 |
1965 void CEikCba::SetCommandL( TInt aPosition, |
2048 void CEikCba::SetCommandL( TInt aPosition, |
1966 TInt aCommandId, |
2049 TInt aCommandId, |
1967 const TDesC* aText, |
2050 const TDesC* aText, |
1968 const CFbsBitmap* /*aBitmap*/, |
2051 const CFbsBitmap* /*aBitmap*/, |
1969 const CFbsBitmap* /*aMask*/ ) |
2052 const CFbsBitmap* /*aMask*/ ) |
1970 { |
2053 { |
2054 _AKNTRACE_FUNC_ENTER; |
|
1971 // We need to check if this call changes the softkeys from being |
2055 // We need to check if this call changes the softkeys from being |
1972 // empty to having a command or vice versa to be able to maintain |
2056 // empty to having a command or vice versa to be able to maintain |
1973 // correct fade state. |
2057 // correct fade state. |
1974 TBool isEmptyBefore( IsEmpty() ); |
2058 TBool isEmptyBefore( IsEmpty() ); |
1975 |
2059 |
2008 { |
2092 { |
2009 SetFadeState(); |
2093 SetFadeState(); |
2010 } |
2094 } |
2011 |
2095 |
2012 ReportContentChangedEvent(); |
2096 ReportContentChangedEvent(); |
2097 _AKNTRACE_FUNC_EXIT; |
|
2013 } |
2098 } |
2014 |
2099 |
2015 |
2100 |
2016 void CEikCba::SetCommandL(TInt aPosition,TInt aResourceId) |
2101 void CEikCba::SetCommandL(TInt aPosition,TInt aResourceId) |
2017 { |
2102 { |
2103 _AKNTRACE_FUNC_ENTER; |
|
2018 TResourceReader reader; |
2104 TResourceReader reader; |
2019 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2105 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2020 TInt version = reader.ReadInt8(); // version |
2106 TInt version = reader.ReadInt8(); // version |
2021 |
2107 |
2022 #ifdef RD_ENHANCED_CBA |
2108 #ifdef RD_ENHANCED_CBA |
2051 TPtrC text = reader.ReadTPtrC(); |
2137 TPtrC text = reader.ReadTPtrC(); |
2052 SetCommandL(aPosition, commandId, &text, NULL, NULL); |
2138 SetCommandL(aPosition, commandId, &text, NULL, NULL); |
2053 CleanupStack::PopAndDestroy(); // reader |
2139 CleanupStack::PopAndDestroy(); // reader |
2054 |
2140 |
2055 ReportContentChangedEvent(); |
2141 ReportContentChangedEvent(); |
2142 _AKNTRACE_FUNC_EXIT; |
|
2056 } |
2143 } |
2057 |
2144 |
2058 /** |
2145 /** |
2059 * Installs a new set of commands to be associated with the cba buttons. |
2146 * Installs a new set of commands to be associated with the cba buttons. |
2060 * The previous command set is restored if there is an error while adding |
2147 * The previous command set is restored if there is an error while adding |
2061 * the new command set. |
2148 * the new command set. |
2062 */ |
2149 */ |
2063 void CEikCba::SetCommandSetL(TInt aResourceId) |
2150 void CEikCba::SetCommandSetL(TInt aResourceId) |
2064 { |
2151 { |
2152 _AKNTRACE_FUNC_ENTER; |
|
2065 TResourceReader reader; |
2153 TResourceReader reader; |
2066 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
2154 iCoeEnv->CreateResourceReaderLC(reader, aResourceId); |
2067 |
2155 |
2068 iCbaFlags = reader.ReadInt32(); |
2156 iCbaFlags = reader.ReadInt32(); |
2069 |
2157 |
2070 if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) |
2158 if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) |
2071 { |
2159 { |
2072 CleanupStack::PopAndDestroy(); // reader |
2160 CleanupStack::PopAndDestroy(); // reader |
2073 OfferCommandListL( aResourceId ); |
2161 OfferCommandListL( aResourceId ); |
2162 _AKNTRACE_FUNC_EXIT; |
|
2074 return; |
2163 return; |
2075 } |
2164 } |
2076 |
2165 |
2077 SetButtonGroupFlags( iCbaFlags ); |
2166 SetButtonGroupFlags( iCbaFlags ); |
2078 reader.ReadInt16(); // Skip width resource. |
2167 reader.ReadInt16(); // Skip width resource. |
2170 CleanupStack::PopAndDestroy(); // reader |
2259 CleanupStack::PopAndDestroy(); // reader |
2171 |
2260 |
2172 // Force labels to be re-formatted... |
2261 // Force labels to be re-formatted... |
2173 SizeChanged(); |
2262 SizeChanged(); |
2174 ReportContentChangedEvent(); |
2263 ReportContentChangedEvent(); |
2264 _AKNTRACE_FUNC_EXIT; |
|
2175 } |
2265 } |
2176 |
2266 |
2177 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, |
2267 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, |
2178 const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/) |
2268 const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/) |
2179 { |
2269 { |
2270 _AKNTRACE_FUNC_ENTER; |
|
2180 User::Leave(KErrNotSupported); |
2271 User::Leave(KErrNotSupported); |
2272 _AKNTRACE_FUNC_EXIT; |
|
2181 } |
2273 } |
2182 |
2274 |
2183 |
2275 |
2184 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition, |
2276 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition, |
2185 TInt aCommandId, |
2277 TInt aCommandId, |
2186 const TDesC* aText) |
2278 const TDesC* aText) |
2187 { |
2279 { |
2280 _AKNTRACE_FUNC_ENTER; |
|
2188 // We need to check if this call changes the softkeys from being |
2281 // We need to check if this call changes the softkeys from being |
2189 // empty to having a command or vice versa to be able to maintain |
2282 // empty to having a command or vice versa to be able to maintain |
2190 // correct fade state. |
2283 // correct fade state. |
2191 TBool isEmptyBefore( IsEmpty() ); |
2284 TBool isEmptyBefore( IsEmpty() ); |
2192 |
2285 |
2230 { |
2323 { |
2231 SetFadeState(); |
2324 SetFadeState(); |
2232 } |
2325 } |
2233 |
2326 |
2234 ReportContentChangedEvent(); |
2327 ReportContentChangedEvent(); |
2328 _AKNTRACE_FUNC_EXIT; |
|
2235 } |
2329 } |
2236 |
2330 |
2237 void CEikCba::AddCommandToStackL( TInt aPosition, |
2331 void CEikCba::AddCommandToStackL( TInt aPosition, |
2238 TInt aCommandId, |
2332 TInt aCommandId, |
2239 const TDesC* aText, |
2333 const TDesC* aText, |
2240 const CFbsBitmap* /*aBitmap*/, |
2334 const CFbsBitmap* /*aBitmap*/, |
2241 const CFbsBitmap* /*aMask*/ ) |
2335 const CFbsBitmap* /*aMask*/ ) |
2242 { |
2336 { |
2337 _AKNTRACE_FUNC_ENTER; |
|
2243 |
2338 |
2244 AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText); |
2339 AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText); |
2245 // Force labels to be re-formatted... |
2340 // Force labels to be re-formatted... |
2246 SizeChanged(); |
2341 SizeChanged(); |
2342 _AKNTRACE_FUNC_EXIT; |
|
2247 } |
2343 } |
2248 |
2344 |
2249 |
2345 |
2250 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId) |
2346 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId) |
2251 { |
2347 { |
2348 _AKNTRACE_FUNC_ENTER; |
|
2252 TResourceReader reader; |
2349 TResourceReader reader; |
2253 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2350 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2254 TUint8 version = (TUint8)reader.ReadInt8(); |
2351 TUint8 version = (TUint8)reader.ReadInt8(); |
2255 TInt commandId(0); |
2352 TInt commandId(0); |
2256 if (version == KAknCbaVersion) |
2353 if (version == KAknCbaVersion) |
2265 TPtrC text=reader.ReadTPtrC(); |
2362 TPtrC text=reader.ReadTPtrC(); |
2266 AddCommandToStackL(aPosition, commandId, &text, NULL, NULL); |
2363 AddCommandToStackL(aPosition, commandId, &text, NULL, NULL); |
2267 CleanupStack::PopAndDestroy(); // reader |
2364 CleanupStack::PopAndDestroy(); // reader |
2268 |
2365 |
2269 ReportContentChangedEvent(); |
2366 ReportContentChangedEvent(); |
2367 _AKNTRACE_FUNC_EXIT; |
|
2270 } |
2368 } |
2271 |
2369 |
2272 void CEikCba::AddCommandSetToStackL(TInt aResourceId) |
2370 void CEikCba::AddCommandSetToStackL(TInt aResourceId) |
2273 { |
2371 { |
2372 _AKNTRACE_FUNC_ENTER; |
|
2274 TResourceReader reader; |
2373 TResourceReader reader; |
2275 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2374 iCoeEnv->CreateResourceReaderLC(reader,aResourceId); |
2276 |
2375 |
2277 iCbaFlags = reader.ReadInt32(); // Flags resource. |
2376 iCbaFlags = reader.ReadInt32(); // Flags resource. |
2278 reader.ReadInt16(); // Skip width resource. |
2377 reader.ReadInt16(); // Skip width resource. |
2338 CleanupStack::PopAndDestroy(); // reader |
2437 CleanupStack::PopAndDestroy(); // reader |
2339 |
2438 |
2340 // Force labels to be re-formatted... |
2439 // Force labels to be re-formatted... |
2341 SizeChanged(); |
2440 SizeChanged(); |
2342 ReportContentChangedEvent(); |
2441 ReportContentChangedEvent(); |
2442 _AKNTRACE_FUNC_EXIT; |
|
2343 } |
2443 } |
2344 |
2444 |
2345 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/) |
2445 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/) |
2346 { |
2446 { |
2447 _AKNTRACE_FUNC_ENTER; |
|
2448 _AKNTRACE_FUNC_EXIT; |
|
2347 } |
2449 } |
2348 |
2450 |
2349 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/) |
2451 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/) |
2350 { |
2452 { |
2453 _AKNTRACE_FUNC_ENTER; |
|
2454 _AKNTRACE_FUNC_EXIT; |
|
2351 return MinimumSize(); |
2455 return MinimumSize(); |
2352 } |
2456 } |
2353 |
2457 |
2354 |
2458 |
2355 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId ) |
2459 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId ) |
2356 { |
2460 { |
2461 _AKNTRACE_FUNC_ENTER; |
|
2357 // We need to check if this call changes the softkeys from being |
2462 // We need to check if this call changes the softkeys from being |
2358 // empty to having a command or vice versa to be able to maintain |
2463 // empty to having a command or vice versa to be able to maintain |
2359 // correct fade state. |
2464 // correct fade state. |
2360 TBool isEmptyBefore( IsEmpty() ); |
2465 TBool isEmptyBefore( IsEmpty() ); |
2361 |
2466 |
2404 SetFadeState(); |
2509 SetFadeState(); |
2405 } |
2510 } |
2406 |
2511 |
2407 DrawDeferred(); |
2512 DrawDeferred(); |
2408 ReportContentChangedEvent(); |
2513 ReportContentChangedEvent(); |
2514 _AKNTRACE_FUNC_EXIT; |
|
2409 } |
2515 } |
2410 |
2516 |
2411 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition) |
2517 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition) |
2412 { |
2518 { |
2519 _AKNTRACE_FUNC_ENTER; |
|
2413 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2520 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2414 STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand(); |
2521 STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand(); |
2522 _AKNTRACE_FUNC_EXIT; |
|
2415 } |
2523 } |
2416 |
2524 |
2417 void CEikCba::RemovePreviousCommand(TInt aPosition) |
2525 void CEikCba::RemovePreviousCommand(TInt aPosition) |
2418 { |
2526 { |
2527 _AKNTRACE_FUNC_ENTER; |
|
2419 RemovePreviousCommandWithoutSizeChanged( aPosition ); |
2528 RemovePreviousCommandWithoutSizeChanged( aPosition ); |
2420 // If MSK or left CBA was changed, this sets MSK icon accordingly. |
2529 // If MSK or left CBA was changed, this sets MSK icon accordingly. |
2421 TRAP_IGNORE( SetMSKIconL() ); |
2530 TRAP_IGNORE( SetMSKIconL() ); |
2422 |
2531 |
2423 // Force labels to be re-formatted... |
2532 // Force labels to be re-formatted... |
2424 SizeChanged(); |
2533 SizeChanged(); |
2425 ReportContentChangedEvent(); |
2534 ReportContentChangedEvent(); |
2535 _AKNTRACE_FUNC_EXIT; |
|
2426 } |
2536 } |
2427 |
2537 |
2428 |
2538 |
2429 TInt CEikCba::CommandPos(TInt aCommandId) const |
2539 TInt CEikCba::CommandPos(TInt aCommandId) const |
2430 { |
2540 { |
2541 _AKNTRACE_FUNC_ENTER; |
|
2542 _AKNTRACE_FUNC_EXIT; |
|
2431 return IndexById(aCommandId); |
2543 return IndexById(aCommandId); |
2432 } |
2544 } |
2433 |
2545 |
2434 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed) |
2546 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed) |
2435 { |
2547 { |
2548 _AKNTRACE_FUNC_ENTER; |
|
2436 CCoeControl* control( ButtonById( aCommandId ) ); |
2549 CCoeControl* control( ButtonById( aCommandId ) ); |
2437 if ( control ) |
2550 if ( control ) |
2438 { |
2551 { |
2439 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) ) |
2552 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) ) |
2440 { |
2553 { |
2441 control->SetDimmed( aDimmed ); |
2554 control->SetDimmed( aDimmed ); |
2442 } |
2555 } |
2443 } |
2556 } |
2557 _AKNTRACE_FUNC_EXIT; |
|
2444 } |
2558 } |
2445 |
2559 |
2446 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const |
2560 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const |
2447 { |
2561 { |
2562 _AKNTRACE_FUNC_ENTER; |
|
2448 if( ButtonById(aCommandId) ) |
2563 if( ButtonById(aCommandId) ) |
2449 { |
2564 { |
2565 _AKNTRACE_FUNC_EXIT; |
|
2450 return ButtonById(aCommandId)->IsDimmed(); |
2566 return ButtonById(aCommandId)->IsDimmed(); |
2451 } |
2567 } |
2568 _AKNTRACE_FUNC_EXIT; |
|
2452 return EFalse; |
2569 return EFalse; |
2453 } |
2570 } |
2454 |
2571 |
2455 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible) |
2572 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible) |
2456 { |
2573 { |
2574 _AKNTRACE_FUNC_ENTER; |
|
2457 CCoeControl* control( ButtonById( aCommandId ) ); |
2575 CCoeControl* control( ButtonById( aCommandId ) ); |
2458 if ( control ) |
2576 if ( control ) |
2459 { |
2577 { |
2460 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) ) |
2578 if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) ) |
2461 { |
2579 { |
2462 control->MakeVisible( aVisible ); |
2580 control->MakeVisible( aVisible ); |
2463 } |
2581 } |
2464 } |
2582 } |
2583 _AKNTRACE_FUNC_EXIT; |
|
2465 } |
2584 } |
2466 |
2585 |
2467 TBool CEikCba::IsCommandVisible(TInt aCommandId) const |
2586 TBool CEikCba::IsCommandVisible(TInt aCommandId) const |
2468 { |
2587 { |
2588 _AKNTRACE_FUNC_ENTER; |
|
2469 if( ButtonById(aCommandId) ) |
2589 if( ButtonById(aCommandId) ) |
2470 { |
2590 { |
2591 _AKNTRACE_FUNC_EXIT; |
|
2471 return ButtonById(aCommandId)->IsVisible(); |
2592 return ButtonById(aCommandId)->IsVisible(); |
2472 } |
2593 } |
2594 _AKNTRACE_FUNC_EXIT; |
|
2473 return EFalse; |
2595 return EFalse; |
2474 } |
2596 } |
2475 |
2597 |
2476 void CEikCba::AnimateCommand(TInt /*aCommandId*/) |
2598 void CEikCba::AnimateCommand(TInt /*aCommandId*/) |
2477 { |
2599 { |
2600 _AKNTRACE_FUNC_ENTER; |
|
2601 _AKNTRACE_FUNC_EXIT; |
|
2478 } |
2602 } |
2479 |
2603 |
2480 |
2604 |
2481 // --------------------------------------------------------------------------- |
2605 // --------------------------------------------------------------------------- |
2482 // Sets the dimming status of a button with the specified position. |
2606 // Sets the dimming status of a button with the specified position. |
2483 // --------------------------------------------------------------------------- |
2607 // --------------------------------------------------------------------------- |
2484 // |
2608 // |
2485 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed ) |
2609 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed ) |
2486 { |
2610 { |
2611 _AKNTRACE_FUNC_ENTER; |
|
2487 if ( aPosition >= iControlArray->Count() ) |
2612 if ( aPosition >= iControlArray->Count() ) |
2488 { |
2613 { |
2614 _AKNTRACE_FUNC_EXIT; |
|
2489 return; |
2615 return; |
2490 } |
2616 } |
2491 |
2617 |
2492 if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) ) |
2618 if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) ) |
2493 { |
2619 { |
2494 TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ]; |
2620 TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ]; |
2495 groupCtrl.iControl->SetDimmed( aDimmed ); |
2621 groupCtrl.iControl->SetDimmed( aDimmed ); |
2496 } |
2622 } |
2623 _AKNTRACE_FUNC_EXIT; |
|
2497 } |
2624 } |
2498 |
2625 |
2499 |
2626 |
2500 // --------------------------------------------------------------------------- |
2627 // --------------------------------------------------------------------------- |
2501 // Returns the dimming status of a button with the specified position. |
2628 // Returns the dimming status of a button with the specified position. |
2502 // --------------------------------------------------------------------------- |
2629 // --------------------------------------------------------------------------- |
2503 // |
2630 // |
2504 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const |
2631 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const |
2505 { |
2632 { |
2633 _AKNTRACE_FUNC_ENTER; |
|
2506 if ( aPosition >= iControlArray->Count() ) |
2634 if ( aPosition >= iControlArray->Count() ) |
2507 { |
2635 { |
2636 _AKNTRACE_FUNC_EXIT; |
|
2508 return EFalse; |
2637 return EFalse; |
2509 } |
2638 } |
2510 |
2639 |
2511 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2640 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2641 _AKNTRACE_FUNC_EXIT; |
|
2512 return groupCtrl.iControl->IsDimmed(); |
2642 return groupCtrl.iControl->IsDimmed(); |
2513 } |
2643 } |
2514 |
2644 |
2515 |
2645 |
2516 // --------------------------------------------------------------------------- |
2646 // --------------------------------------------------------------------------- |
2517 // Sets the visibility of a button with the specified position. |
2647 // Sets the visibility of a button with the specified position. |
2518 // --------------------------------------------------------------------------- |
2648 // --------------------------------------------------------------------------- |
2519 // |
2649 // |
2520 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible ) |
2650 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible ) |
2521 { |
2651 { |
2652 _AKNTRACE_FUNC_ENTER; |
|
2522 if ( aPosition >= iControlArray->Count() ) |
2653 if ( aPosition >= iControlArray->Count() ) |
2523 { |
2654 { |
2655 _AKNTRACE_FUNC_EXIT; |
|
2524 return; |
2656 return; |
2525 } |
2657 } |
2526 |
2658 |
2527 if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) ) |
2659 if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) ) |
2528 { |
2660 { |
2537 // Just dim the button, don't hide it. |
2669 // Just dim the button, don't hide it. |
2538 groupCtrl.iControl->SetDimmed( !aVisible ); |
2670 groupCtrl.iControl->SetDimmed( !aVisible ); |
2539 groupCtrl.iControl->DrawDeferred(); |
2671 groupCtrl.iControl->DrawDeferred(); |
2540 } |
2672 } |
2541 } |
2673 } |
2674 _AKNTRACE_FUNC_EXIT; |
|
2542 } |
2675 } |
2543 |
2676 |
2544 |
2677 |
2545 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const |
2678 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const |
2546 { |
2679 { |
2680 _AKNTRACE_FUNC_ENTER; |
|
2547 if (aPosition >= iControlArray->Count()) |
2681 if (aPosition >= iControlArray->Count()) |
2548 { |
2682 { |
2683 _AKNTRACE_FUNC_EXIT; |
|
2549 return EFalse; |
2684 return EFalse; |
2550 } |
2685 } |
2551 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2686 TEikGroupControl& groupCtrl = (*iControlArray)[aPosition]; |
2552 |
2687 |
2553 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
2688 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
2554 { |
2689 { |
2690 _AKNTRACE_FUNC_EXIT; |
|
2555 return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible(); |
2691 return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible(); |
2556 } |
2692 } |
2557 |
2693 |
2694 _AKNTRACE_FUNC_EXIT; |
|
2558 return !groupCtrl.iControl->IsDimmed(); |
2695 return !groupCtrl.iControl->IsDimmed(); |
2559 } |
2696 } |
2560 |
2697 |
2561 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/) |
2698 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/) |
2562 { |
2699 { |
2700 _AKNTRACE_FUNC_ENTER; |
|
2701 _AKNTRACE_FUNC_EXIT; |
|
2563 } |
2702 } |
2564 |
2703 |
2565 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const |
2704 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const |
2566 { |
2705 { |
2567 if (aPosition >= iControlArray->Count()) |
2706 if (aPosition >= iControlArray->Count()) |
2578 // Gets a CBA button rectangle. |
2717 // Gets a CBA button rectangle. |
2579 // --------------------------------------------------------------------------- |
2718 // --------------------------------------------------------------------------- |
2580 // |
2719 // |
2581 TRect CEikCba::ButtonRectByPosition( TInt aPosition, TBool aRelativeToScreen ) |
2720 TRect CEikCba::ButtonRectByPosition( TInt aPosition, TBool aRelativeToScreen ) |
2582 { |
2721 { |
2722 _AKNTRACE_FUNC_ENTER; |
|
2583 TRect rect( 0, 0, 0, 0 ); |
2723 TRect rect( 0, 0, 0, 0 ); |
2584 |
2724 |
2585 if ( aPosition >= iControlArray->Count() || aPosition < 0 ) |
2725 if ( aPosition >= iControlArray->Count() || aPosition < 0 ) |
2586 { |
2726 { |
2727 _AKNTRACE_FUNC_EXIT; |
|
2587 return rect; |
2728 return rect; |
2588 } |
2729 } |
2589 |
2730 |
2590 if ( !AknLayoutUtils::PenEnabled() ) |
2731 if ( !AknLayoutUtils::PenEnabled() ) |
2591 { |
2732 { |
2751 break; |
2892 break; |
2752 } |
2893 } |
2753 } |
2894 } |
2754 } |
2895 } |
2755 |
2896 |
2897 _AKNTRACE_FUNC_EXIT; |
|
2756 return rect; |
2898 return rect; |
2757 } |
2899 } |
2758 |
2900 |
2759 |
2901 |
2760 CCoeControl* CEikCba::AsControl() |
2902 CCoeControl* CEikCba::AsControl() |
2761 { |
2903 { |
2904 _AKNTRACE_FUNC_ENTER; |
|
2905 _AKNTRACE_FUNC_EXIT; |
|
2762 return this; |
2906 return this; |
2763 } |
2907 } |
2764 |
2908 |
2765 const CCoeControl* CEikCba::AsControl() const |
2909 const CCoeControl* CEikCba::AsControl() const |
2766 { |
2910 { |
2911 _AKNTRACE_FUNC_ENTER; |
|
2912 _AKNTRACE_FUNC_EXIT; |
|
2767 return this; |
2913 return this; |
2768 } |
2914 } |
2769 |
2915 |
2770 |
2916 |
2771 void CEikCba::SetBoundingRect( const TRect& /*aBoundingRect*/ ) |
2917 void CEikCba::SetBoundingRect( const TRect& /*aBoundingRect*/ ) |
2772 { |
2918 { |
2919 _AKNTRACE_FUNC_ENTER; |
|
2773 if ( iFlags.IsSet( ECbaEmbedded ) ) |
2920 if ( iFlags.IsSet( ECbaEmbedded ) ) |
2774 { |
2921 { |
2922 _AKNTRACE_FUNC_EXIT; |
|
2775 return; |
2923 return; |
2776 } |
2924 } |
2777 |
2925 |
2778 // If background skin id has not been set from outside CBA, |
2926 // If background skin id has not been set from outside CBA, |
2779 // update it in case status pane layout has changed |
2927 // update it in case status pane layout has changed |
2786 |
2934 |
2787 // If CBA is inserted into a query dialog then it is positioned by the |
2935 // If CBA is inserted into a query dialog then it is positioned by the |
2788 // query control. |
2936 // query control. |
2789 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
2937 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
2790 { |
2938 { |
2939 _AKNTRACE_FUNC_EXIT; |
|
2791 return; |
2940 return; |
2792 } |
2941 } |
2793 |
2942 |
2794 TRect oldRect( Rect() ); |
2943 TRect oldRect( Rect() ); |
2795 |
2944 |
3060 SetMSKVisibility( EFalse ); |
3209 SetMSKVisibility( EFalse ); |
3061 } |
3210 } |
3062 |
3211 |
3063 DrawDeferred(); |
3212 DrawDeferred(); |
3064 } |
3213 } |
3214 _AKNTRACE_FUNC_EXIT; |
|
3065 } |
3215 } |
3066 |
3216 |
3067 |
3217 |
3068 // --------------------------------------------------------------------------- |
3218 // --------------------------------------------------------------------------- |
3069 // Subtracts the area occupied by the button group from the specified |
3219 // Subtracts the area occupied by the button group from the specified |
3070 // bounding rectangle. |
3220 // bounding rectangle. |
3071 // --------------------------------------------------------------------------- |
3221 // --------------------------------------------------------------------------- |
3072 // |
3222 // |
3073 void CEikCba::ReduceRect( TRect& aBoundingRect ) const |
3223 void CEikCba::ReduceRect( TRect& aBoundingRect ) const |
3074 { |
3224 { |
3225 _AKNTRACE_FUNC_ENTER; |
|
3075 // CBA inside Popup/Query Input does not reduce bounding rect |
3226 // CBA inside Popup/Query Input does not reduce bounding rect |
3076 if ( iFlags.IsSet( ECbaEmbedded ) || iFlags.IsSet( ECbaInsideDialog ) ) |
3227 if ( iFlags.IsSet( ECbaEmbedded ) || iFlags.IsSet( ECbaInsideDialog ) ) |
3077 { |
3228 { |
3229 _AKNTRACE_FUNC_EXIT; |
|
3078 return; |
3230 return; |
3079 } |
3231 } |
3080 |
3232 |
3081 if ( !IsVisible() ) |
3233 if ( !IsVisible() ) |
3082 { |
3234 { |
3235 _AKNTRACE_FUNC_EXIT; |
|
3083 return; |
3236 return; |
3084 } |
3237 } |
3085 |
3238 |
3086 const TInt aknLayoutFlags = AknLayoutFlags(); |
3239 const TInt aknLayoutFlags = AknLayoutFlags(); |
3087 |
3240 |
3199 aBoundingRect = largestBoundingRect; |
3352 aBoundingRect = largestBoundingRect; |
3200 boundingRegion.Close(); |
3353 boundingRegion.Close(); |
3201 } |
3354 } |
3202 } |
3355 } |
3203 } |
3356 } |
3357 _AKNTRACE_FUNC_EXIT; |
|
3204 } |
3358 } |
3205 |
3359 |
3206 |
3360 |
3207 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) |
3361 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) |
3208 { |
3362 { |
3363 _AKNTRACE_FUNC_ENTER; |
|
3364 _AKNTRACE_FUNC_EXIT; |
|
3209 return ButtonById(aCommandId); |
3365 return ButtonById(aCommandId); |
3210 } |
3366 } |
3211 |
3367 |
3212 |
3368 |
3213 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const |
3369 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const |
3214 { |
3370 { |
3371 _AKNTRACE_FUNC_ENTER; |
|
3372 _AKNTRACE_FUNC_EXIT; |
|
3215 return ButtonById(aCommandId); |
3373 return ButtonById(aCommandId); |
3216 } |
3374 } |
3217 |
3375 |
3218 TInt CEikCba::CommandId(TInt aCommandPos) const |
3376 TInt CEikCba::CommandId(TInt aCommandPos) const |
3219 { |
3377 { |
3378 _AKNTRACE_FUNC_ENTER; |
|
3379 _AKNTRACE_FUNC_EXIT; |
|
3220 return (*iControlArray)[aCommandPos].iId; |
3380 return (*iControlArray)[aCommandPos].iId; |
3221 } |
3381 } |
3222 |
3382 |
3223 TInt CEikCba::ButtonCount() const |
3383 TInt CEikCba::ButtonCount() const |
3224 { |
3384 { |
3385 _AKNTRACE_FUNC_ENTER; |
|
3386 _AKNTRACE_FUNC_EXIT; |
|
3225 return (iControlArray->Count()-1); // -1 for scroll bar; |
3387 return (iControlArray->Count()-1); // -1 for scroll bar; |
3226 } |
3388 } |
3227 |
3389 |
3228 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const |
3390 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const |
3229 { |
3391 { |
3392 _AKNTRACE_FUNC_ENTER; |
|
3230 // It is not possible to convert a CBA button to a CEikCommandButton. |
3393 // It is not possible to convert a CBA button to a CEikCommandButton. |
3231 // Please use an interface that does not use a CEikCommandButton conversion, |
3394 // Please use an interface that does not use a CEikCommandButton conversion, |
3232 // e.g. CEikButtonGroupContainer::SetCommandL(). |
3395 // e.g. CEikButtonGroupContainer::SetCommandL(). |
3233 #if defined(_DEBUG) |
3396 #if defined(_DEBUG) |
3234 Panic(EEikPanicCBACannotConvertToCEikCommandButton); |
3397 Panic(EEikPanicCBACannotConvertToCEikCommandButton); |
3235 #endif |
3398 #endif |
3399 _AKNTRACE_FUNC_EXIT; |
|
3236 return NULL; |
3400 return NULL; |
3237 } |
3401 } |
3238 |
3402 |
3239 TUint CEikCba::ButtonGroupFlags() const |
3403 TUint CEikCba::ButtonGroupFlags() const |
3240 { |
3404 { |
3405 _AKNTRACE_FUNC_ENTER; |
|
3406 _AKNTRACE_FUNC_EXIT; |
|
3241 return iCbaFlags ; |
3407 return iCbaFlags ; |
3242 } |
3408 } |
3243 |
3409 |
3244 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags) |
3410 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags) |
3245 { |
3411 { |
3412 _AKNTRACE_FUNC_ENTER; |
|
3246 iCbaFlags = aFlags; |
3413 iCbaFlags = aFlags; |
3414 |
|
3415 //has not supported semi-transparent, ignore the flag at this moment. |
|
3416 //TODO: if the tranparent style CBA is approved and the new icon was delivered, open it again. |
|
3417 iCbaFlags &= ~EEikCbaFlagSemiTransparent; |
|
3418 |
|
3247 if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && |
3419 if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && |
3248 CAknEnv::Static()->TransparencyEnabled() ) |
3420 CAknEnv::Static()->TransparencyEnabled() ) |
3249 { |
3421 { |
3250 Window().SetRequiredDisplayMode( EColor16MA ); |
3422 Window().SetRequiredDisplayMode( EColor16MA ); |
3251 TInt err = Window().SetTransparencyAlphaChannel(); |
3423 TInt err = Window().SetTransparencyAlphaChannel(); |
3252 if( err == KErrNone ) |
3424 if( err == KErrNone ) |
3253 { |
3425 { |
3254 Window().SetBackgroundColor( ~0 ); |
3426 Window().SetBackgroundColor( ~0 ); |
3255 if ( iExtension && iExtension->iEnablePostingTransparency ) |
3427 if ( iExtension && iExtension->iEnablePostingTransparency ) |
3256 { |
3428 { |
3257 iExtension->iEnablePostingTransparency = EFalse; |
3429 iExtension->iEnablePostingTransparency = EFalse; |
3258 delete iExtension->iLskPostingOverlayBitmap; |
3430 delete iExtension->iLskPostingOverlayBitmap; |
3259 iExtension->iLskPostingOverlayBitmap = NULL; |
3431 iExtension->iLskPostingOverlayBitmap = NULL; |
3260 delete iExtension->iRskPostingOverlayBitmap; |
3432 delete iExtension->iRskPostingOverlayBitmap; |
3261 iExtension->iRskPostingOverlayBitmap = NULL; |
3433 iExtension->iRskPostingOverlayBitmap = NULL; |
3262 BroadcastPostingTransparency( EFalse ); |
3434 BroadcastPostingTransparency( EFalse ); |
3263 } |
3435 } |
3264 } |
3436 } |
3265 else |
3437 else |
3266 { |
3438 { |
3267 iCbaFlags &= ~EEikCbaFlagTransparent; |
3439 iCbaFlags &= ~EEikCbaFlagTransparent; |
3268 } |
3440 } |
3271 { |
3443 { |
3272 iCbaFlags &= ~EEikCbaFlagTransparent; |
3444 iCbaFlags &= ~EEikCbaFlagTransparent; |
3273 } |
3445 } |
3274 |
3446 |
3275 UpdateFonts(); |
3447 UpdateFonts(); |
3448 _AKNTRACE_FUNC_EXIT; |
|
3276 } |
3449 } |
3277 |
3450 |
3278 // ----------------------------------------------------------------------------- |
3451 // ----------------------------------------------------------------------------- |
3279 // CEikCba::SetSkinBackgroundId |
3452 // CEikCba::SetSkinBackgroundId |
3280 // |
3453 // |
3281 // ----------------------------------------------------------------------------- |
3454 // ----------------------------------------------------------------------------- |
3282 // |
3455 // |
3283 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID ) |
3456 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID ) |
3284 { |
3457 { |
3458 _AKNTRACE_FUNC_ENTER; |
|
3285 // Skin background is not drawn by embedded CBA. |
3459 // Skin background is not drawn by embedded CBA. |
3286 if ( iFlags.IsSet( ECbaEmbedded ) ) |
3460 if ( iFlags.IsSet( ECbaEmbedded ) ) |
3287 { |
3461 { |
3462 iPopupVisible = ETrue; |
|
3463 _AKNTRACE_FUNC_EXIT; |
|
3288 return; |
3464 return; |
3465 } |
|
3466 else |
|
3467 { |
|
3468 iPopupVisible = EFalse; |
|
3289 } |
3469 } |
3290 |
3470 |
3291 if ( iBgIID != KAknsIIDNone ) |
3471 if ( iBgIID != KAknsIIDNone ) |
3292 { |
3472 { |
3293 if ( iBgIID != aIID ) |
3473 if ( iBgIID != aIID ) |
3335 { |
3515 { |
3336 statusPane->SetCbaAreaBackgroundID( |
3516 statusPane->SetCbaAreaBackgroundID( |
3337 iBgIID, |
3517 iBgIID, |
3338 CEikStatusPaneBase::EDrawDeferred ); |
3518 CEikStatusPaneBase::EDrawDeferred ); |
3339 } |
3519 } |
3520 _AKNTRACE_FUNC_EXIT; |
|
3340 } |
3521 } |
3341 |
3522 |
3342 TKeyResponse CEikCba::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
3523 TKeyResponse CEikCba::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) |
3343 { |
3524 { |
3525 _AKNTRACE_FUNC_ENTER; |
|
3344 if (aType != EEventKey) |
3526 if (aType != EEventKey) |
3345 { |
3527 { |
3528 _AKNTRACE_FUNC_EXIT; |
|
3346 return EKeyWasNotConsumed; |
3529 return EKeyWasNotConsumed; |
3347 } |
3530 } |
3348 |
3531 |
3349 // Return immediately if the control is invisible. |
3532 // Return immediately if the control is invisible. |
3350 if (!IsVisible() && !(iCbaFlags&EAknCBAFlagRespondWhenInvisible)) |
3533 if (!IsVisible() && !(iCbaFlags&EAknCBAFlagRespondWhenInvisible)) |
3351 { |
3534 { |
3535 _AKNTRACE_FUNC_EXIT; |
|
3352 return EKeyWasNotConsumed; |
3536 return EKeyWasNotConsumed; |
3353 } |
3537 } |
3354 |
3538 |
3355 TBool shiftControlPressed = |
3539 TBool shiftControlPressed = |
3356 (aKeyEvent.iModifiers & EModifierShift) || |
3540 (aKeyEvent.iModifiers & EModifierShift) || |
3388 // Return immediately if the button is invisible |
3572 // Return immediately if the button is invisible |
3389 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3573 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3390 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3574 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3391 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3575 !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) ) |
3392 { |
3576 { |
3577 _AKNTRACE_FUNC_EXIT; |
|
3393 return EKeyWasConsumed; |
3578 return EKeyWasConsumed; |
3394 } |
3579 } |
3395 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3580 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3396 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3581 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3397 |
3582 |
3398 // This will pass key event to application - no softkey command is processed. |
3583 // This will pass key event to application - no softkey command is processed. |
3399 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3584 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3400 { |
3585 { |
3586 _AKNTRACE_FUNC_EXIT; |
|
3401 return EKeyWasNotConsumed; |
3587 return EKeyWasNotConsumed; |
3402 } |
3588 } |
3403 |
3589 |
3404 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3590 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3405 { |
3591 { |
3423 // Return immediately if the button is invisible. |
3609 // Return immediately if the button is invisible. |
3424 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl && |
3610 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl && |
3425 !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && |
3611 !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && |
3426 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3612 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3427 { |
3613 { |
3614 _AKNTRACE_FUNC_EXIT; |
|
3428 return EKeyWasConsumed; |
3615 return EKeyWasConsumed; |
3429 } |
3616 } |
3430 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iId; |
3617 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iId; |
3431 TInt longCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iLongId; |
3618 TInt longCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iLongId; |
3432 |
3619 |
3437 } |
3624 } |
3438 |
3625 |
3439 // This will pass key event to application - no softkey command is processed. |
3626 // This will pass key event to application - no softkey command is processed. |
3440 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3627 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3441 { |
3628 { |
3629 _AKNTRACE_FUNC_EXIT; |
|
3442 return EKeyWasNotConsumed; |
3630 return EKeyWasNotConsumed; |
3443 } |
3631 } |
3444 |
3632 |
3445 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3633 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3446 { |
3634 { |
3472 // Return immediately if the button is invisible. |
3660 // Return immediately if the button is invisible. |
3473 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3661 if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl && |
3474 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
3662 !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && |
3475 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3663 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3476 { |
3664 { |
3665 _AKNTRACE_FUNC_EXIT; |
|
3477 return EKeyWasConsumed; |
3666 return EKeyWasConsumed; |
3478 } |
3667 } |
3479 |
3668 |
3480 TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId; |
3669 TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId; |
3481 TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId; |
3670 TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId; |
3482 |
3671 |
3483 // This will pass key event to application - no softkey command is processed. |
3672 // This will pass key event to application - no softkey command is processed. |
3484 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3673 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3485 { |
3674 { |
3675 _AKNTRACE_FUNC_EXIT; |
|
3486 return EKeyWasNotConsumed; |
3676 return EKeyWasNotConsumed; |
3487 } |
3677 } |
3488 |
3678 |
3489 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3679 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3490 { |
3680 { |
3528 // Return immediately if the button is invisible. |
3718 // Return immediately if the button is invisible. |
3529 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3719 if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl && |
3530 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3720 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && |
3531 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3721 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) ) |
3532 { |
3722 { |
3723 _AKNTRACE_FUNC_EXIT; |
|
3533 return EKeyWasConsumed; |
3724 return EKeyWasConsumed; |
3534 } |
3725 } |
3535 |
3726 |
3536 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3727 TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId; |
3537 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3728 TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId; |
3538 |
3729 |
3539 // This will pass key event to application - no softkey command is processed. |
3730 // This will pass key event to application - no softkey command is processed. |
3540 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3731 if (shortCommand == EAknSoftkeyForwardKeyEvent) |
3541 { |
3732 { |
3733 _AKNTRACE_FUNC_EXIT; |
|
3542 return EKeyWasNotConsumed; |
3734 return EKeyWasNotConsumed; |
3543 } |
3735 } |
3544 |
3736 |
3545 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3737 if (aKeyEvent.iRepeats == 0 && shortCommand) |
3546 { |
3738 { |
3568 } |
3760 } |
3569 response = EKeyWasConsumed; |
3761 response = EKeyWasConsumed; |
3570 } |
3762 } |
3571 } |
3763 } |
3572 |
3764 |
3765 _AKNTRACE_FUNC_EXIT; |
|
3573 return response; |
3766 return response; |
3574 } |
3767 } |
3575 |
3768 |
3576 EXPORT_C void* CEikCba::ExtensionInterface( TUid /*aInterface*/ ) |
3769 EXPORT_C void* CEikCba::ExtensionInterface( TUid /*aInterface*/ ) |
3577 { |
3770 { |
3771 _AKNTRACE_FUNC_ENTER; |
|
3772 _AKNTRACE_FUNC_EXIT; |
|
3578 return NULL; |
3773 return NULL; |
3579 } |
3774 } |
3580 |
3775 |
3581 |
3776 |
3582 // --------------------------------------------------------------------------- |
3777 // --------------------------------------------------------------------------- |
3585 // command observer if a cba button was tapped. |
3780 // command observer if a cba button was tapped. |
3586 // --------------------------------------------------------------------------- |
3781 // --------------------------------------------------------------------------- |
3587 // |
3782 // |
3588 void CEikCba::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
3783 void CEikCba::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
3589 { |
3784 { |
3785 _AKNTRACE_FUNC_ENTER; |
|
3590 if ( !AknLayoutUtils::PenEnabled() ) |
3786 if ( !AknLayoutUtils::PenEnabled() ) |
3591 { |
3787 { |
3788 _AKNTRACE_FUNC_EXIT; |
|
3592 return; |
3789 return; |
3593 } |
3790 } |
3594 else if ( iFlags.IsSet( ECbaInsideDialog ) ) |
3791 else if ( iFlags.IsSet( ECbaInsideDialog ) ) |
3595 { |
3792 { |
3596 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3793 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3794 _AKNTRACE_FUNC_EXIT; |
|
3597 return; |
3795 return; |
3598 } |
3796 } |
3599 |
3797 |
3600 // If a child control is grabbing the pointer, we store the object pointer |
3798 // If a child control is grabbing the pointer, we store the object pointer |
3601 // before calling base class implementation. This is because the up event |
3799 // before calling base class implementation. This is because the up event |
3679 // If hits the left softkey. |
3877 // If hits the left softkey. |
3680 if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty ) |
3878 if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty ) |
3681 { |
3879 { |
3682 if( button1->IsDimmed() ) |
3880 if( button1->IsDimmed() ) |
3683 { |
3881 { |
3684 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3882 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3685 return; |
3883 return; |
3686 } |
3884 } |
3687 if ( button1->IsVisible() ) |
3885 if ( button1->IsVisible() ) |
3688 { |
3886 { |
3689 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
3887 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
3690 { |
3888 { |
3743 } |
3941 } |
3744 else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty ) |
3942 else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty ) |
3745 { |
3943 { |
3746 if( button2->IsDimmed() ) |
3944 if( button2->IsDimmed() ) |
3747 { |
3945 { |
3748 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3946 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3749 return; |
3947 return; |
3750 } |
3948 } |
3751 if ( button2->IsVisible() ) |
3949 if ( button2->IsVisible() ) |
3752 { |
3950 { |
3753 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
3951 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
3754 { |
3952 { |
3809 !buttonMSKEmpty && |
4007 !buttonMSKEmpty && |
3810 buttonMSKRect.Contains( aPointerEvent.iPosition ) ) |
4008 buttonMSKRect.Contains( aPointerEvent.iPosition ) ) |
3811 { |
4009 { |
3812 if( buttonMSK->IsDimmed() ) |
4010 if( buttonMSK->IsDimmed() ) |
3813 { |
4011 { |
3814 CCoeControl::HandlePointerEventL( aPointerEvent ); |
4012 CCoeControl::HandlePointerEventL( aPointerEvent ); |
3815 return; |
4013 return; |
3816 } |
4014 } |
3817 if ( buttonMSK->IsVisible() ) |
4015 if ( buttonMSK->IsVisible() ) |
3818 { |
4016 { |
3819 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
4017 if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) |
3820 { |
4018 { |
3961 for ( TInt i = 0; i < buttoncount; i++ ) |
4159 for ( TInt i = 0; i < buttoncount; i++ ) |
3962 { |
4160 { |
3963 if ( (*iControlArray)[i].iControl == grabber ) |
4161 if ( (*iControlArray)[i].iControl == grabber ) |
3964 { |
4162 { |
3965 if ( !IsVisible() ) |
4163 if ( !IsVisible() ) |
4164 { |
|
4165 _AKNTRACE_FUNC_EXIT; |
|
3966 return; |
4166 return; |
3967 |
4167 } |
3968 // Send the button command to command observer. |
4168 // Send the button command to command observer. |
3969 TInt shortCommand = (*iControlArray)[i].iId; |
4169 TInt shortCommand = (*iControlArray)[i].iId; |
3970 if ( shortCommand && |
4170 if ( shortCommand && |
3971 i == KControlArrayCBAButtonMSKPosn && |
4171 i == KControlArrayCBAButtonMSKPosn && |
3972 iMSKCommandObserver ) |
4172 iMSKCommandObserver ) |
3982 break; |
4182 break; |
3983 } |
4183 } |
3984 } |
4184 } |
3985 } |
4185 } |
3986 } |
4186 } |
4187 _AKNTRACE_FUNC_EXIT; |
|
3987 } |
4188 } |
3988 |
4189 |
3989 |
4190 |
3990 TSize CEikCba::MinimumSize() |
4191 TSize CEikCba::MinimumSize() |
3991 { |
4192 { |
4193 _AKNTRACE_FUNC_ENTER; |
|
3992 TSize size = CEikControlGroup::MinimumSize(); |
4194 TSize size = CEikControlGroup::MinimumSize(); |
3993 size.iWidth = iAvkonAppUi->ApplicationRect().Width(); |
4195 size.iWidth = iAvkonAppUi->ApplicationRect().Width(); |
3994 const TInt count = iControlArray->Count(); |
4196 const TInt count = iControlArray->Count(); |
3995 for (TInt ii = 0; ii < count; ii++) |
4197 for (TInt ii = 0; ii < count; ii++) |
3996 { |
4198 { |
3998 } |
4200 } |
3999 if (iLink) |
4201 if (iLink) |
4000 { |
4202 { |
4001 size.iHeight = Max(size.iHeight, iLink->Size().iHeight); |
4203 size.iHeight = Max(size.iHeight, iLink->Size().iHeight); |
4002 } |
4204 } |
4205 _AKNTRACE_FUNC_EXIT; |
|
4003 // Add a standard margin from the laf. |
4206 // Add a standard margin from the laf. |
4004 return size; |
4207 return size; |
4005 } |
4208 } |
4006 |
4209 |
4007 /** |
4210 /** |
4010 * |
4213 * |
4011 * @since ER5U |
4214 * @since ER5U |
4012 */ |
4215 */ |
4013 void CEikCba::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const |
4216 void CEikCba::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const |
4014 { |
4217 { |
4218 _AKNTRACE_FUNC_ENTER; |
|
4015 CEikControlGroup::GetColorUseListL(aColorUseList); |
4219 CEikControlGroup::GetColorUseListL(aColorUseList); |
4016 |
4220 |
4017 TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::EActive|TCoeColorUse::ENormal| |
4221 TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::EActive|TCoeColorUse::ENormal| |
4018 TCoeColorUse::ENeutral; |
4222 TCoeColorUse::ENeutral; |
4019 |
4223 |
4024 aColorUseList.AppendL(colorUse); |
4228 aColorUseList.AppendL(colorUse); |
4025 |
4229 |
4026 colorUse.SetLogicalColor(EColorToolbarBackground); |
4230 colorUse.SetLogicalColor(EColorToolbarBackground); |
4027 colorUse.SetUse(TCoeColorUse::EBack|commonAttributes); |
4231 colorUse.SetUse(TCoeColorUse::EBack|commonAttributes); |
4028 aColorUseList.AppendL(colorUse); |
4232 aColorUseList.AppendL(colorUse); |
4233 _AKNTRACE_FUNC_EXIT; |
|
4029 } |
4234 } |
4030 |
4235 |
4031 |
4236 |
4032 // --------------------------------------------------------------------------- |
4237 // --------------------------------------------------------------------------- |
4033 // Handles a change to the control's resources of type aType |
4238 // Handles a change to the control's resources of type aType |
4034 // which are shared across the environment, e.g. colors or fonts. |
4239 // which are shared across the environment, e.g. colors or fonts. |
4035 // --------------------------------------------------------------------------- |
4240 // --------------------------------------------------------------------------- |
4036 // |
4241 // |
4037 void CEikCba::HandleResourceChange( TInt aType ) |
4242 void CEikCba::HandleResourceChange( TInt aType ) |
4038 { |
4243 { |
4244 _AKNTRACE_FUNC_ENTER; |
|
4039 CEikControlGroup::HandleResourceChange( aType ); |
4245 CEikControlGroup::HandleResourceChange( aType ); |
4040 |
4246 |
4041 switch ( aType ) |
4247 switch ( aType ) |
4042 { |
4248 { |
4043 case KAknsMessageSkinChange: |
4249 case KAknsMessageSkinChange: |
4095 |
4301 |
4096 case KAknMessageFocusLost: |
4302 case KAknMessageFocusLost: |
4097 { |
4303 { |
4098 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4304 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4099 { |
4305 { |
4306 _AKNTRACE_FUNC_EXIT; |
|
4100 return; |
4307 return; |
4101 } |
4308 } |
4102 |
4309 |
4103 |
4310 |
4104 CEikCbaButton* button1 = |
4311 CEikCbaButton* button1 = |
4191 default: |
4398 default: |
4192 { |
4399 { |
4193 break; |
4400 break; |
4194 } |
4401 } |
4195 } |
4402 } |
4403 _AKNTRACE_FUNC_EXIT; |
|
4196 } |
4404 } |
4197 |
4405 |
4198 |
4406 |
4199 void CEikCba::DoSkinChange() |
4407 void CEikCba::DoSkinChange() |
4200 { |
4408 { |
4409 _AKNTRACE_FUNC_ENTER; |
|
4201 iExtension->iIfSkinChanged = ETrue; |
4410 iExtension->iIfSkinChanged = ETrue; |
4202 DoSetLayers( KAknsIIDNone ); |
4411 DoSetLayers( KAknsIIDNone ); |
4203 iExtension->iIfSkinChanged = EFalse; |
4412 iExtension->iIfSkinChanged = EFalse; |
4204 if ( iExtension ) |
4413 if ( iExtension ) |
4205 { |
4414 { |
4212 SizeChanged(); |
4421 SizeChanged(); |
4213 |
4422 |
4214 //Skin change uses DrawNow to flus draw cache before layoutchange. |
4423 //Skin change uses DrawNow to flus draw cache before layoutchange. |
4215 DrawNow(); |
4424 DrawNow(); |
4216 iFlags.Clear(ECbaChangeRecordedSkin); |
4425 iFlags.Clear(ECbaChangeRecordedSkin); |
4426 _AKNTRACE_FUNC_EXIT; |
|
4217 } |
4427 } |
4218 |
4428 |
4219 void CEikCba::DoColorChange() |
4429 void CEikCba::DoColorChange() |
4220 { |
4430 { |
4431 _AKNTRACE_FUNC_ENTER; |
|
4221 iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4432 iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4222 iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this)); |
4433 iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this)); |
4223 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4434 Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this)); |
4224 // This is required for skin resource changes (as well as color resource change). |
4435 // This is required for skin resource changes (as well as color resource change). |
4225 CheckSkinAndUpdateContext(); |
4436 CheckSkinAndUpdateContext(); |
4226 TRAP_IGNORE( SetMSKIconL() ); |
4437 TRAP_IGNORE( SetMSKIconL() ); |
4227 SizeChanged(); |
4438 SizeChanged(); |
4228 iFlags.Clear(ECbaChangeRecordedColor); |
4439 iFlags.Clear(ECbaChangeRecordedColor); |
4440 _AKNTRACE_FUNC_EXIT; |
|
4229 } |
4441 } |
4230 |
4442 |
4231 |
4443 |
4232 void CEikCba::DoLayoutChange() |
4444 void CEikCba::DoLayoutChange() |
4233 { |
4445 { |
4446 _AKNTRACE_FUNC_ENTER; |
|
4234 SetBoundingRect( TRect() ); |
4447 SetBoundingRect( TRect() ); |
4235 |
4448 |
4236 UpdateFonts(); |
4449 UpdateFonts(); |
4237 |
4450 |
4238 TBool mskAllowed( MskAllowed() ); |
4451 TBool mskAllowed( MskAllowed() ); |
4272 { |
4485 { |
4273 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
4486 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
4274 } |
4487 } |
4275 |
4488 |
4276 iFlags.Clear( ECbaChangeRecordedLayout ); |
4489 iFlags.Clear( ECbaChangeRecordedLayout ); |
4490 _AKNTRACE_FUNC_EXIT; |
|
4277 } |
4491 } |
4278 |
4492 |
4279 |
4493 |
4280 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/) |
4494 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/) |
4281 { |
4495 { |
4496 _AKNTRACE_FUNC_ENTER; |
|
4282 User::Leave(KErrNotSupported); |
4497 User::Leave(KErrNotSupported); |
4498 _AKNTRACE_FUNC_EXIT; |
|
4283 } |
4499 } |
4284 |
4500 |
4285 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId) |
4501 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId) |
4286 { |
4502 { |
4503 _AKNTRACE_FUNC_ENTER; |
|
4287 if (aId.iUid == MAknsControlContext::ETypeId) |
4504 if (aId.iUid == MAknsControlContext::ETypeId) |
4288 { |
4505 { |
4289 if ( AknLayoutFlags() & EAknLayoutCbaInControlPane || |
4506 if ( AknLayoutFlags() & EAknLayoutCbaInControlPane || |
4290 AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
4507 AknLayoutFlags() & EAknLayoutCbaInRightPane ) |
4291 { |
4508 { |
4509 _AKNTRACE_FUNC_EXIT; |
|
4292 return MAknsControlContext::SupplyMopObject( aId, iMLBgContext ); |
4510 return MAknsControlContext::SupplyMopObject( aId, iMLBgContext ); |
4293 } |
4511 } |
4294 else |
4512 else |
4295 { |
4513 { |
4296 // Always provide top object to mop-chain. |
4514 // Always provide top object to mop-chain. |
4297 // Bottom is parent of Top, so bottom is re-drawn |
4515 // Bottom is parent of Top, so bottom is re-drawn |
4298 // automatically when top is drawn. |
4516 // automatically when top is drawn. |
4517 _AKNTRACE_FUNC_EXIT; |
|
4299 return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop ); |
4518 return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop ); |
4300 } |
4519 } |
4301 } |
4520 } |
4302 |
4521 |
4303 if ( aId.iUid == CEikCba::ETypeId ) |
4522 if ( aId.iUid == CEikCba::ETypeId ) |
4304 { |
4523 { |
4524 _AKNTRACE_FUNC_EXIT; |
|
4305 return aId.MakePtr( this ); |
4525 return aId.MakePtr( this ); |
4306 } |
4526 } |
4307 |
4527 |
4528 _AKNTRACE_FUNC_EXIT; |
|
4308 return CEikControlGroup::MopSupplyObject(aId); |
4529 return CEikControlGroup::MopSupplyObject(aId); |
4309 } |
4530 } |
4310 |
4531 |
4311 |
4532 |
4312 void CEikCba::Draw( const TRect& aRect ) const |
4533 void CEikCba::Draw( const TRect& aRect ) const |
4313 { |
4534 { |
4535 _AKNTRACE_FUNC_ENTER; |
|
4314 // Embedded CBA doesn't draw anything |
4536 // Embedded CBA doesn't draw anything |
4315 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4537 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4316 { |
4538 { |
4317 return; |
4539 return; |
4318 } |
4540 } |
4319 |
4541 |
4320 if ( iCbaFlags & EEikCbaFlagSemiTransparent ) |
4542 // if ( iCbaFlags & EEikCbaFlagSemiTransparent ) |
4321 { |
4543 // { |
4322 CWindowGc &gc = SystemGc(); |
4544 // CWindowGc &gc = SystemGc(); |
4323 |
4545 // |
4324 iExtension->DrawSemiTransparencyL( gc, Rect() ); |
4546 // iExtension->DrawSemiTransparency( gc, Rect() ); |
4325 return; |
4547 // return; |
4326 } |
4548 // } |
4327 |
4549 |
4328 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4550 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
4329 |
4551 |
4330 const TRect rect( Rect() ); |
4552 const TRect rect( Rect() ); |
4331 CWindowGc& gc = SystemGc(); |
4553 CWindowGc& gc = SystemGc(); |
4397 CEikCbaButton* button1 = static_cast<CEikCbaButton*>( |
4619 CEikCbaButton* button1 = static_cast<CEikCbaButton*>( |
4398 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
4620 (*iControlArray)[KControlArrayCBAButton1Posn].iControl ); |
4399 CEikCbaButton* button2 = static_cast<CEikCbaButton*>( |
4621 CEikCbaButton* button2 = static_cast<CEikCbaButton*>( |
4400 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
4622 (*iControlArray)[KControlArrayCBAButton2Posn].iControl ); |
4401 |
4623 |
4402 if ( IsMskEnabledLayoutActive() ) |
4624 if ( IsMskEnabledLayoutActive() ) |
4403 { |
4625 { |
4404 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>( |
4626 CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>( |
4405 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
4627 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl ); |
4406 |
4628 |
4407 CFbsBitmap* middleMask = |
4629 CFbsBitmap* middleMask = |
4408 AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt ); |
4630 AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt ); |
4409 AknIconUtils::SetSize( middleMask, middleSKSize, EAspectRatioNotPreserved ); |
4631 if ( middleMask ) |
4632 { |
|
4633 AknIconUtils::SetSize( middleMask, |
|
4634 middleSKSize, EAspectRatioNotPreserved ); |
|
4635 } |
|
4410 |
4636 |
4411 if( buttonMSK && buttonMSK->PressedDown() ) |
4637 if( buttonMSK && buttonMSK->PressedDown() ) |
4412 { |
4638 { |
4413 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
4639 AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), |
4414 gc, |
4640 gc, |
4722 } |
4948 } |
4723 } |
4949 } |
4724 } |
4950 } |
4725 } |
4951 } |
4726 gc.SetOpaque( EFalse ); |
4952 gc.SetOpaque( EFalse ); |
4953 _AKNTRACE_FUNC_EXIT; |
|
4727 } |
4954 } |
4728 |
4955 |
4729 |
4956 |
4730 // --------------------------------------------------------------------------- |
4957 // --------------------------------------------------------------------------- |
4731 // Gets a button control by the specified command ID. |
4958 // Gets a button control by the specified command ID. |
4732 // --------------------------------------------------------------------------- |
4959 // --------------------------------------------------------------------------- |
4733 // |
4960 // |
4734 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const |
4961 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const |
4735 { |
4962 { |
4963 _AKNTRACE_FUNC_ENTER; |
|
4964 _AKNTRACE_FUNC_EXIT; |
|
4736 return ControlById( aCommandId ); |
4965 return ControlById( aCommandId ); |
4737 } |
4966 } |
4738 |
4967 |
4739 |
4968 |
4740 // --------------------------------------------------------------------------- |
4969 // --------------------------------------------------------------------------- |
4741 // Creates the scroll bar frame & sets up the scroll bar. |
4970 // Creates the scroll bar frame & sets up the scroll bar. |
4742 // --------------------------------------------------------------------------- |
4971 // --------------------------------------------------------------------------- |
4743 // |
4972 // |
4744 void CEikCba::CreateScrollBarFrameL() |
4973 void CEikCba::CreateScrollBarFrameL() |
4745 { |
4974 { |
4975 _AKNTRACE_FUNC_ENTER; |
|
4746 if ( !iSBFrame ) |
4976 if ( !iSBFrame ) |
4747 { |
4977 { |
4748 iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue ); |
4978 iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue ); |
4749 } |
4979 } |
4750 iSBFrame->ConstructL(); |
4980 iSBFrame->ConstructL(); |
4981 _AKNTRACE_FUNC_EXIT; |
|
4751 } |
4982 } |
4752 |
4983 |
4753 |
4984 |
4754 TEikGroupControl CEikCba::VScrollBarAsGroupControl() |
4985 TEikGroupControl CEikCba::VScrollBarAsGroupControl() |
4755 { |
4986 { |
4987 _AKNTRACE_FUNC_ENTER; |
|
4756 // Extracts vertical scroll bar from the scroll bar frame. |
4988 // Extracts vertical scroll bar from the scroll bar frame. |
4757 TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, |
4989 TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, |
4758 KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength); |
4990 KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength); |
4991 _AKNTRACE_FUNC_EXIT; |
|
4759 return groupCtrl; |
4992 return groupCtrl; |
4760 } |
4993 } |
4761 |
4994 |
4762 void CEikCba::InsertScrollBarL() |
4995 void CEikCba::InsertScrollBarL() |
4763 { |
4996 { |
4997 _AKNTRACE_FUNC_ENTER; |
|
4764 TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl(); |
4998 TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl(); |
4765 // Insert vertical scroll bar into cba control group. |
4999 // Insert vertical scroll bar into cba control group. |
4766 InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn); |
5000 InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn); |
5001 _AKNTRACE_FUNC_EXIT; |
|
4767 } |
5002 } |
4768 |
5003 |
4769 |
5004 |
4770 // --------------------------------------------------------------------------- |
5005 // --------------------------------------------------------------------------- |
4771 // Replaces empty scroll bar with actual arrow head scroll bar. |
5006 // Replaces empty scroll bar with actual arrow head scroll bar. |
4772 // --------------------------------------------------------------------------- |
5007 // --------------------------------------------------------------------------- |
4773 // |
5008 // |
4774 void CEikCba::CreateArrowHeadScrollBarL() |
5009 void CEikCba::CreateArrowHeadScrollBarL() |
4775 { |
5010 { |
5011 _AKNTRACE_FUNC_ENTER; |
|
4776 if ( iSBFrame ) |
5012 if ( iSBFrame ) |
4777 { |
5013 { |
4778 iSBFrame->SwitchToArrowHeadScrollBarL(); |
5014 iSBFrame->SwitchToArrowHeadScrollBarL(); |
4779 iSBFrame->VerticalScrollBar()->SetContainingCba( this ); |
5015 iSBFrame->VerticalScrollBar()->SetContainingCba( this ); |
4780 if ( iControlArray->Count() > KControlArrayScrollBarPosn ) |
5016 if ( iControlArray->Count() > KControlArrayScrollBarPosn ) |
4781 { |
5017 { |
4782 iControlArray->Delete( KControlArrayScrollBarPosn ); |
5018 iControlArray->Delete( KControlArrayScrollBarPosn ); |
4783 } |
5019 } |
4784 InsertScrollBarL(); |
5020 InsertScrollBarL(); |
4785 } |
5021 } |
5022 _AKNTRACE_FUNC_EXIT; |
|
4786 } |
5023 } |
4787 |
5024 |
4788 |
5025 |
4789 void CEikCba::SizeChanged() |
5026 void CEikCba::SizeChanged() |
4790 { |
5027 { |
5028 _AKNTRACE_FUNC_ENTER; |
|
4791 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
5029 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
4792 { |
5030 { |
4793 Window().SetNonFading( EFalse ); |
5031 Window().SetNonFading( EFalse ); |
4794 SizeChangedInsideDialog(); |
5032 SizeChangedInsideDialog(); |
5033 _AKNTRACE_FUNC_EXIT; |
|
4795 return; |
5034 return; |
4796 } |
5035 } |
4797 else if ( iFlags.IsSet( ECbaEmbedded ) ) |
5036 else if ( iFlags.IsSet( ECbaEmbedded ) ) |
4798 { |
5037 { |
4799 Window().SetNonFading( EFalse ); |
5038 Window().SetNonFading( EFalse ); |
4800 SizeChangedInPopup(); |
5039 SizeChangedInPopup(); |
5040 _AKNTRACE_FUNC_EXIT; |
|
4801 return; |
5041 return; |
4802 } |
5042 } |
4803 |
5043 |
4804 const TInt aknLayoutFlags = AknLayoutFlags(); |
5044 const TInt aknLayoutFlags = AknLayoutFlags(); |
4805 |
5045 |
4860 } |
5100 } |
4861 |
5101 |
4862 // Broadcast current state to CEikCbaButtons |
5102 // Broadcast current state to CEikCbaButtons |
4863 BroadcastPostingTransparency( enabled ); |
5103 BroadcastPostingTransparency( enabled ); |
4864 } |
5104 } |
5105 _AKNTRACE_FUNC_EXIT; |
|
4865 } |
5106 } |
4866 |
5107 |
4867 // ----------------------------------------------------------------------------- |
5108 // ----------------------------------------------------------------------------- |
4868 // CEikCba::CheckSkinAndUpdateContext |
5109 // CEikCba::CheckSkinAndUpdateContext |
4869 // |
5110 // |
4870 // ----------------------------------------------------------------------------- |
5111 // ----------------------------------------------------------------------------- |
4871 // |
5112 // |
4872 void CEikCba::CheckSkinAndUpdateContext() |
5113 void CEikCba::CheckSkinAndUpdateContext() |
4873 { |
5114 { |
5115 _AKNTRACE_FUNC_ENTER; |
|
4874 if (AknsUtils::SkinInstance()) |
5116 if (AknsUtils::SkinInstance()) |
4875 { |
5117 { |
4876 // Use ENullBrush if there is skin background available. |
5118 // Use ENullBrush if there is skin background available. |
4877 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
5119 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush); |
4878 } |
5120 } |
4879 else |
5121 else |
4880 { |
5122 { |
4881 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
5123 iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush); |
4882 } |
5124 } |
5125 _AKNTRACE_FUNC_EXIT; |
|
4883 } |
5126 } |
4884 |
5127 |
4885 void CEikCba::Reserved_MtsmPosition() |
5128 void CEikCba::Reserved_MtsmPosition() |
4886 { |
5129 { |
5130 _AKNTRACE_FUNC_ENTER; |
|
5131 _AKNTRACE_FUNC_EXIT; |
|
4887 } |
5132 } |
4888 |
5133 |
4889 void CEikCba::Reserved_MtsmObject() |
5134 void CEikCba::Reserved_MtsmObject() |
4890 { |
5135 { |
5136 _AKNTRACE_FUNC_ENTER; |
|
5137 _AKNTRACE_FUNC_EXIT; |
|
4891 } |
5138 } |
4892 |
5139 |
4893 TInt CEikCba::AknLayoutFlags() const |
5140 TInt CEikCba::AknLayoutFlags() const |
4894 { |
5141 { |
5142 _AKNTRACE_FUNC_ENTER; |
|
4895 TInt flags = 0; |
5143 TInt flags = 0; |
4896 |
5144 |
4897 TBool controlPane = ETrue; |
5145 TBool controlPane = ETrue; |
4898 TBool staconPane = EFalse; |
5146 TBool staconPane = EFalse; |
4899 TBool staconPaneLeft = EFalse; |
5147 TBool staconPaneLeft = EFalse; |
4958 if (rightPane) |
5206 if (rightPane) |
4959 { |
5207 { |
4960 flags |= EAknLayoutCbaInRightPane; |
5208 flags |= EAknLayoutCbaInRightPane; |
4961 } |
5209 } |
4962 |
5210 |
5211 _AKNTRACE_FUNC_EXIT; |
|
4963 return flags; |
5212 return flags; |
4964 } |
5213 } |
4965 |
5214 |
4966 |
5215 |
4967 // --------------------------------------------------------------------------- |
5216 // --------------------------------------------------------------------------- |
4968 // Handles size change events in bottom softkey layout. |
5217 // Handles size change events in bottom softkey layout. |
4969 // --------------------------------------------------------------------------- |
5218 // --------------------------------------------------------------------------- |
4970 // |
5219 // |
4971 void CEikCba::SizeChangedInControlPane() |
5220 void CEikCba::SizeChangedInControlPane() |
4972 { |
5221 { |
5222 _AKNTRACE_FUNC_ENTER; |
|
4973 TRect screen; |
5223 TRect screen; |
4974 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
5224 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
4975 |
5225 |
4976 TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
5226 TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() ); |
4977 TBool flatLscLayout( isLandscape && |
5227 TBool flatLscLayout( isLandscape && |
5049 { |
5299 { |
5050 layoutRect.LayoutRect( |
5300 layoutRect.LayoutRect( |
5051 rect, |
5301 rect, |
5052 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_cp1().LayoutLine() ); |
5302 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_cp1().LayoutLine() ); |
5053 frameSizeChanged = layoutRect.Rect() != iExtension->iRightFrameOuterRect; |
5303 frameSizeChanged = layoutRect.Rect() != iExtension->iRightFrameOuterRect; |
5054 iExtension->iRightFrameOuterRect = layoutRect.Rect(); |
5304 iExtension->iRightFrameOuterRect = layoutRect.Rect(); |
5055 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect, |
5305 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect, |
5056 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
5306 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
5057 .LayoutLine() ); |
5307 .LayoutLine() ); |
5058 iExtension->iRightFrameInnerRect = layoutRect.Rect(); |
5308 iExtension->iRightFrameInnerRect = layoutRect.Rect(); |
5059 |
5309 |
5444 |
5694 |
5445 DrawDeferred(); |
5695 DrawDeferred(); |
5446 } |
5696 } |
5447 |
5697 |
5448 AknsUtils::RegisterControlPosition( this, posInScreen.iTl ); |
5698 AknsUtils::RegisterControlPosition( this, posInScreen.iTl ); |
5699 _AKNTRACE_FUNC_EXIT; |
|
5449 } |
5700 } |
5450 |
5701 |
5451 |
5702 |
5452 void CEikCba::SizeChangedInStaconPane() |
5703 void CEikCba::SizeChangedInStaconPane() |
5453 { |
5704 { |
5705 _AKNTRACE_FUNC_ENTER; |
|
5454 TRect screen( iAvkonAppUi->ApplicationRect() ); |
5706 TRect screen( iAvkonAppUi->ApplicationRect() ); |
5455 TBool softKeysUpAndDownMirrored = EFalse; |
5707 TBool softKeysUpAndDownMirrored = EFalse; |
5456 |
5708 |
5457 TInt variety = 0; |
5709 TInt variety = 0; |
5458 if (AknLayoutFlags() & EAknLayoutCbaInStaconPaneLeft) |
5710 if (AknLayoutFlags() & EAknLayoutCbaInStaconPaneLeft) |
5797 |
6049 |
5798 DrawDeferred(); |
6050 DrawDeferred(); |
5799 } |
6051 } |
5800 |
6052 |
5801 AknsUtils::RegisterControlPosition( this, TPoint(0,0) ); |
6053 AknsUtils::RegisterControlPosition( this, TPoint(0,0) ); |
6054 _AKNTRACE_FUNC_EXIT; |
|
5802 } |
6055 } |
5803 |
6056 |
5804 |
6057 |
5805 //------------------------------------------------------------------------------ |
6058 //------------------------------------------------------------------------------ |
5806 // CEikCba::SizeChangedInRightPane() |
6059 // CEikCba::SizeChangedInRightPane() |
5807 //------------------------------------------------------------------------------ |
6060 //------------------------------------------------------------------------------ |
5808 // |
6061 // |
5809 void CEikCba::SizeChangedInRightPane() |
6062 void CEikCba::SizeChangedInRightPane() |
5810 { |
6063 { |
6064 _AKNTRACE_FUNC_ENTER; |
|
5811 TRect screen; |
6065 TRect screen; |
5812 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
6066 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen ); |
5813 |
6067 |
5814 TAknWindowComponentLayout rightAreaLayout( |
6068 TAknWindowComponentLayout rightAreaLayout( |
5815 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
6069 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) ); |
6070 |
6324 |
6071 DrawDeferred(); |
6325 DrawDeferred(); |
6072 } |
6326 } |
6073 |
6327 |
6074 AknsUtils::RegisterControlPosition( this, TPoint( 0, 0 ) ); |
6328 AknsUtils::RegisterControlPosition( this, TPoint( 0, 0 ) ); |
6329 _AKNTRACE_FUNC_EXIT; |
|
6075 } |
6330 } |
6076 |
6331 |
6077 |
6332 |
6078 |
6333 |
6079 void CEikCba::SizeChangedInsideDialog() |
6334 void CEikCba::SizeChangedInsideDialog() |
6080 { |
6335 { |
6336 _AKNTRACE_FUNC_ENTER; |
|
6081 // Give both LSK and RSK buttons half of the available space. |
6337 // Give both LSK and RSK buttons half of the available space. |
6082 // |
6338 // |
6083 if ( iControlArray ) |
6339 if ( iControlArray ) |
6084 { |
6340 { |
6085 TRect buttonRect1( Rect() ); |
6341 TRect buttonRect1( Rect() ); |
6098 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl ) |
6354 if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl ) |
6099 { |
6355 { |
6100 (*iControlArray)[KControlArrayCBAButton2Posn].iControl->SetRect( buttonRect2 ); |
6356 (*iControlArray)[KControlArrayCBAButton2Posn].iControl->SetRect( buttonRect2 ); |
6101 } |
6357 } |
6102 } |
6358 } |
6359 _AKNTRACE_FUNC_EXIT; |
|
6103 } |
6360 } |
6104 |
6361 |
6105 |
6362 |
6106 void CEikCba::SizeChangedInPopup() |
6363 void CEikCba::SizeChangedInPopup() |
6107 { |
6364 { |
6365 _AKNTRACE_FUNC_ENTER; |
|
6108 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
6366 TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) ); |
6109 |
6367 |
6110 TAknLayoutRect layoutRect; |
6368 TAknLayoutRect layoutRect; |
6111 TRect rect ( Rect() ); |
6369 TRect rect ( Rect() ); |
6112 |
6370 |
6130 |
6388 |
6131 layoutRect.LayoutRect( iExtension->iLeftFrameOuterRect, |
6389 layoutRect.LayoutRect( iExtension->iLeftFrameOuterRect, |
6132 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
6390 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
6133 .LayoutLine() ); |
6391 .LayoutLine() ); |
6134 iExtension->iLeftFrameInnerRect = layoutRect.Rect(); |
6392 iExtension->iLeftFrameInnerRect = layoutRect.Rect(); |
6135 UpdateLabels( ETrue ); |
|
6136 |
6393 |
6137 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect, |
6394 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect, |
6138 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
6395 AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1() |
6139 .LayoutLine() ); |
6396 .LayoutLine() ); |
6140 iExtension->iRightFrameInnerRect = layoutRect.Rect(); |
6397 iExtension->iRightFrameInnerRect = layoutRect.Rect(); |
6148 if ( msk ) |
6405 if ( msk ) |
6149 { |
6406 { |
6150 msk->SetRect( TRect() ); |
6407 msk->SetRect( TRect() ); |
6151 } |
6408 } |
6152 } |
6409 } |
6410 _AKNTRACE_FUNC_EXIT; |
|
6153 } |
6411 } |
6154 |
6412 |
6155 |
6413 |
6156 void CEikCba::UpdateFonts() |
6414 void CEikCba::UpdateFonts() |
6157 { |
6415 { |
6416 _AKNTRACE_FUNC_ENTER; |
|
6158 // Control pane: |
6417 // Control pane: |
6159 // Use the layout dll to get the right font for the CBA. |
6418 // Use the layout dll to get the right font for the CBA. |
6160 TAknTextLineLayout layout( |
6419 TAknTextLineLayout layout( |
6161 AknLayoutScalable_Avkon::control_pane_t1( |
6420 AknLayoutScalable_Avkon::control_pane_t1( |
6162 Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0 ).LayoutLine() ); |
6421 Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0 ).LayoutLine() ); |
6201 } |
6460 } |
6202 const CFont* rightPaneCustomFont = 0; |
6461 const CFont* rightPaneCustomFont = 0; |
6203 iRightPaneLabelFont = |
6462 iRightPaneLabelFont = |
6204 AknLayoutUtils::FontFromId( |
6463 AknLayoutUtils::FontFromId( |
6205 rightPaneTextLayout.FontId(), rightPaneCustomFont ); |
6464 rightPaneTextLayout.FontId(), rightPaneCustomFont ); |
6465 _AKNTRACE_FUNC_EXIT; |
|
6206 } |
6466 } |
6207 |
6467 |
6208 // Enhanced CBA |
6468 // Enhanced CBA |
6209 |
6469 |
6210 // ----------------------------------------------------------------------------- |
6470 // ----------------------------------------------------------------------------- |
6213 // @since 5.0 |
6473 // @since 5.0 |
6214 // ----------------------------------------------------------------------------- |
6474 // ----------------------------------------------------------------------------- |
6215 #ifdef RD_ENHANCED_CBA |
6475 #ifdef RD_ENHANCED_CBA |
6216 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& aCommandList) |
6476 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& aCommandList) |
6217 { |
6477 { |
6478 _AKNTRACE_FUNC_ENTER; |
|
6218 if( !iCommandTable ) |
6479 if( !iCommandTable ) |
6219 { |
6480 { |
6220 iCommandTable = CEikCommandTable::NewL(); |
6481 iCommandTable = CEikCommandTable::NewL(); |
6221 } |
6482 } |
6222 else |
6483 else |
6349 RemovePreviousCommand( controlId ); |
6610 RemovePreviousCommand( controlId ); |
6350 } |
6611 } |
6351 } |
6612 } |
6352 |
6613 |
6353 CleanupStack::PopAndDestroy(); // previousIds |
6614 CleanupStack::PopAndDestroy(); // previousIds |
6615 _AKNTRACE_FUNC_EXIT; |
|
6354 } |
6616 } |
6355 #else // !RD_ENHANCED_CBA |
6617 #else // !RD_ENHANCED_CBA |
6356 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& /*aCommandList*/) |
6618 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& /*aCommandList*/) |
6357 { |
6619 { |
6620 _AKNTRACE_FUNC_ENTER; |
|
6358 User::Leave( KErrNotSupported ); |
6621 User::Leave( KErrNotSupported ); |
6622 _AKNTRACE_FUNC_EXIT; |
|
6359 } |
6623 } |
6360 #endif // RD_ENHANCED_CBA |
6624 #endif // RD_ENHANCED_CBA |
6361 |
6625 |
6362 // ----------------------------------------------------------------------------- |
6626 // ----------------------------------------------------------------------------- |
6363 // Used to offer list of commands for softkeys. |
6627 // Used to offer list of commands for softkeys. |
6365 // @since 5.0 |
6629 // @since 5.0 |
6366 // ----------------------------------------------------------------------------- |
6630 // ----------------------------------------------------------------------------- |
6367 #ifdef RD_ENHANCED_CBA |
6631 #ifdef RD_ENHANCED_CBA |
6368 EXPORT_C void CEikCba::OfferCommandListL(const TInt aResourceId) |
6632 EXPORT_C void CEikCba::OfferCommandListL(const TInt aResourceId) |
6369 { |
6633 { |
6634 _AKNTRACE_FUNC_ENTER; |
|
6370 if ( !iCommandTable ) // This is needed if cba was not constructed with enhanced cba. |
6635 if ( !iCommandTable ) // This is needed if cba was not constructed with enhanced cba. |
6371 { |
6636 { |
6372 iCommandTable = CEikCommandTable::NewL(); |
6637 iCommandTable = CEikCommandTable::NewL(); |
6373 } |
6638 } |
6374 |
6639 |
6510 RemovePreviousCommand( controlId ); |
6775 RemovePreviousCommand( controlId ); |
6511 } |
6776 } |
6512 } |
6777 } |
6513 |
6778 |
6514 CleanupStack::PopAndDestroy(); // previousIds |
6779 CleanupStack::PopAndDestroy(); // previousIds |
6780 _AKNTRACE_FUNC_EXIT; |
|
6515 } |
6781 } |
6516 #else // !RD_ENHANCED_CBA |
6782 #else // !RD_ENHANCED_CBA |
6517 EXPORT_C void CEikCba::OfferCommandListL(const TInt /*aResourceId*/) |
6783 EXPORT_C void CEikCba::OfferCommandListL(const TInt /*aResourceId*/) |
6518 { |
6784 { |
6785 _AKNTRACE_FUNC_ENTER; |
|
6519 User::Leave( KErrNotSupported ); |
6786 User::Leave( KErrNotSupported ); |
6787 _AKNTRACE_FUNC_EXIT; |
|
6520 } |
6788 } |
6521 #endif // RD_ENHANCED_CBA |
6789 #endif // RD_ENHANCED_CBA |
6522 |
6790 |
6523 // ----------------------------------------------------------------------------- |
6791 // ----------------------------------------------------------------------------- |
6524 // Used to check if a certain command have been approved to the current command set. |
6792 // Used to check if a certain command have been approved to the current command set. |
6526 // @since 5.0 |
6794 // @since 5.0 |
6527 // ----------------------------------------------------------------------------- |
6795 // ----------------------------------------------------------------------------- |
6528 #ifdef RD_ENHANCED_CBA |
6796 #ifdef RD_ENHANCED_CBA |
6529 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt aCommandId) const |
6797 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt aCommandId) const |
6530 { |
6798 { |
6799 _AKNTRACE_FUNC_ENTER; |
|
6800 _AKNTRACE_FUNC_EXIT; |
|
6531 return ButtonById(aCommandId) ? ETrue : EFalse; // check the iControlArray |
6801 return ButtonById(aCommandId) ? ETrue : EFalse; // check the iControlArray |
6532 } |
6802 } |
6533 #else // !RD_ENHANCED_CBA |
6803 #else // !RD_ENHANCED_CBA |
6534 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt /*aCommandId*/) const |
6804 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt /*aCommandId*/) const |
6535 { |
6805 { |
6806 _AKNTRACE_FUNC_ENTER; |
|
6807 _AKNTRACE_FUNC_EXIT; |
|
6536 return EFalse; |
6808 return EFalse; |
6537 } |
6809 } |
6538 #endif // RD_ENHANCED_CBA |
6810 #endif // RD_ENHANCED_CBA |
6539 |
6811 |
6540 // ----------------------------------------------------------------------------- |
6812 // ----------------------------------------------------------------------------- |
6544 // @since 5.0 |
6816 // @since 5.0 |
6545 // ----------------------------------------------------------------------------- |
6817 // ----------------------------------------------------------------------------- |
6546 #ifdef RD_ENHANCED_CBA |
6818 #ifdef RD_ENHANCED_CBA |
6547 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId) |
6819 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId) |
6548 { |
6820 { |
6821 _AKNTRACE_FUNC_ENTER; |
|
6549 TInt index = IndexById( aReplaceCommandId ); |
6822 TInt index = IndexById( aReplaceCommandId ); |
6550 TRAPD(err, SetCommandL( index, aResourceId ) ); |
6823 TRAPD(err, SetCommandL( index, aResourceId ) ); |
6824 _AKNTRACE_FUNC_EXIT; |
|
6551 } |
6825 } |
6552 #else |
6826 #else |
6553 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/) |
6827 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/) |
6554 { |
6828 { |
6829 _AKNTRACE_FUNC_ENTER; |
|
6830 _AKNTRACE_FUNC_EXIT; |
|
6555 } |
6831 } |
6556 #endif // RD_ENHANCED_CBA |
6832 #endif // RD_ENHANCED_CBA |
6557 |
6833 |
6558 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
6834 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType ) |
6559 { |
6835 { |
6836 _AKNTRACE_FUNC_ENTER; |
|
6560 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
6837 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
6561 { |
6838 { |
6562 //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported ); |
6839 //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported ); |
6840 _AKNTRACE_FUNC_EXIT; |
|
6563 return; |
6841 return; |
6564 } |
6842 } |
6565 |
6843 |
6566 if ( aEventType == EEventStateChanged ) |
6844 if ( aEventType == EEventStateChanged ) |
6567 { |
6845 { |
6592 if( command ) |
6870 if( command ) |
6593 { |
6871 { |
6594 iCommandObserver->ProcessCommandL( command ); |
6872 iCommandObserver->ProcessCommandL( command ); |
6595 } |
6873 } |
6596 } |
6874 } |
6875 _AKNTRACE_FUNC_EXIT; |
|
6597 } |
6876 } |
6598 |
6877 |
6599 |
6878 |
6600 void CEikCba::MakeVisible( TBool aVisible ) |
6879 void CEikCba::MakeVisible( TBool aVisible ) |
6601 { |
6880 { |
6881 _AKNTRACE_FUNC_ENTER; |
|
6602 if ( aVisible ) |
6882 if ( aVisible ) |
6603 { |
6883 { |
6604 TBool redrawNeeded( EFalse ); |
6884 TBool redrawNeeded( EFalse ); |
6605 |
6885 |
6606 if ( AknLayoutUtils::PenEnabled() ) |
6886 if ( AknLayoutUtils::PenEnabled() ) |
6678 Window().ClearRedrawStore(); |
6958 Window().ClearRedrawStore(); |
6679 CEikControlGroup::MakeVisible( aVisible ); |
6959 CEikControlGroup::MakeVisible( aVisible ); |
6680 } |
6960 } |
6681 |
6961 |
6682 ReportContentChangedEvent(); |
6962 ReportContentChangedEvent(); |
6963 _AKNTRACE_FUNC_EXIT; |
|
6683 } |
6964 } |
6684 |
6965 |
6685 |
6966 |
6686 // ----------------------------------------------------------------------------- |
6967 // ----------------------------------------------------------------------------- |
6687 // Sets layer images and rects. |
6968 // Sets layer images and rects. |
6688 // @since 5.0 |
6969 // @since 5.0 |
6689 // ----------------------------------------------------------------------------- |
6970 // ----------------------------------------------------------------------------- |
6690 void CEikCba::DoSetLayers( const TAknsItemID& aIID ) |
6971 void CEikCba::DoSetLayers( const TAknsItemID& aIID ) |
6691 { |
6972 { |
6973 _AKNTRACE_FUNC_ENTER; |
|
6692 // Skin background is not drawn by embedded CBA. |
6974 // Skin background is not drawn by embedded CBA. |
6693 if ( iFlags.IsSet( ECbaEmbedded ) ) |
6975 if ( iFlags.IsSet( ECbaEmbedded ) ) |
6694 { |
6976 { |
6977 _AKNTRACE_FUNC_EXIT; |
|
6695 return; |
6978 return; |
6696 } |
6979 } |
6697 |
6980 |
6698 TAknLayoutRect cbarect; |
6981 TAknLayoutRect cbarect; |
6699 TRect screen; |
6982 TRect screen; |
6908 |
7191 |
6909 TRAP_IGNORE( iMLBgContext->SetLayerMaskAndSizeL( maskIID, cbaRect ) ); |
7192 TRAP_IGNORE( iMLBgContext->SetLayerMaskAndSizeL( maskIID, cbaRect ) ); |
6910 } |
7193 } |
6911 |
7194 |
6912 DrawDeferred(); |
7195 DrawDeferred(); |
7196 _AKNTRACE_FUNC_EXIT; |
|
6913 } |
7197 } |
6914 |
7198 |
6915 |
7199 |
6916 void CEikCba::LayoutControl( CCoeControl* aControl, const TRect& aRect ) |
7200 void CEikCba::LayoutControl( CCoeControl* aControl, const TRect& aRect ) |
6917 { |
7201 { |
7202 _AKNTRACE_FUNC_ENTER; |
|
6918 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
7203 if ( !iFlags.IsSet( ECbaInsideDialog ) ) |
6919 { |
7204 { |
6920 TRect rect( aRect ); |
7205 TRect rect( aRect ); |
6921 // aid_value_unit2 is 10ux10u rectangle. |
7206 // aid_value_unit2 is 10ux10u rectangle. |
6922 TAknWindowComponentLayout unit( AknLayoutScalable_Avkon::aid_value_unit2() ); |
7207 TAknWindowComponentLayout unit( AknLayoutScalable_Avkon::aid_value_unit2() ); |
6927 rect.Move( delta, delta ); |
7212 rect.Move( delta, delta ); |
6928 } |
7213 } |
6929 aControl->SetRect( rect ); |
7214 aControl->SetRect( rect ); |
6930 aControl->ComponentControl( 0 )->SetRect( rect ); |
7215 aControl->ComponentControl( 0 )->SetRect( rect ); |
6931 } |
7216 } |
7217 _AKNTRACE_FUNC_EXIT; |
|
6932 } |
7218 } |
6933 |
7219 |
6934 void CEikCba::BroadcastPostingTransparency( TBool aEnable ) |
7220 void CEikCba::BroadcastPostingTransparency( TBool aEnable ) |
6935 { |
7221 { |
7222 _AKNTRACE_FUNC_ENTER; |
|
6936 // Communicate change to CBA buttons. |
7223 // Communicate change to CBA buttons. |
6937 for ( TInt i = 0; i < iControlArray->Count(); i++ ) |
7224 for ( TInt i = 0; i < iControlArray->Count(); i++ ) |
6938 { |
7225 { |
6939 if ( i != KControlArrayScrollBarPosn ) // To avoid tinkering with scrollbar. |
7226 if ( i != KControlArrayScrollBarPosn ) // To avoid tinkering with scrollbar. |
6940 { |
7227 { |
6944 { |
7231 { |
6945 button->SetTextBitmapMode( aEnable ); |
7232 button->SetTextBitmapMode( aEnable ); |
6946 } |
7233 } |
6947 } |
7234 } |
6948 } |
7235 } |
7236 _AKNTRACE_FUNC_EXIT; |
|
6949 } |
7237 } |
6950 |
7238 |
6951 |
7239 |
6952 // --------------------------------------------------------------------------- |
7240 // --------------------------------------------------------------------------- |
6953 // CEikCba::SetFadeState |
7241 // CEikCba::SetFadeState |
6954 // Sets the CBA faded if it's contents are empty. |
7242 // Sets the CBA faded if it's contents are empty. |
6955 // --------------------------------------------------------------------------- |
7243 // --------------------------------------------------------------------------- |
6956 // |
7244 // |
6957 void CEikCba::SetFadeState() |
7245 void CEikCba::SetFadeState() |
6958 { |
7246 { |
7247 _AKNTRACE_FUNC_ENTER; |
|
6959 TBool canBeFaded = |
7248 TBool canBeFaded = |
6960 IsEmpty() && !( ( iCbaFlags & EEikCbaFlagTransparent ) |
7249 IsEmpty() && !( ( iCbaFlags & EEikCbaFlagTransparent ) |
6961 || ( iExtension && iExtension->iEnablePostingTransparency ) ); |
7250 || ( iExtension && iExtension->iEnablePostingTransparency ) ); |
6962 |
7251 |
6963 // No unfading when system is faded |
7252 // No unfading when system is faded |
6964 if ( !( !canBeFaded |
7253 if ( !( !canBeFaded |
6965 && static_cast<CAknAppUi*>( iCoeEnv->AppUi() )->IsFaded() ) ) |
7254 && static_cast<CAknAppUi*>( iCoeEnv->AppUi() )->IsFaded() ) ) |
6966 { |
7255 { |
6967 Window().SetFaded( canBeFaded, RWindowTreeNode::EFadeIncludeChildren ); |
7256 Window().SetFaded( canBeFaded, RWindowTreeNode::EFadeIncludeChildren ); |
6968 } |
7257 } |
7258 _AKNTRACE_FUNC_EXIT; |
|
6969 } |
7259 } |
6970 |
7260 |
6971 |
7261 |
6972 // --------------------------------------------------------------------------- |
7262 // --------------------------------------------------------------------------- |
6973 // CEikCba::UpdateLabels |
7263 // CEikCba::UpdateLabels |
6974 // Updates softkey labels in case of embedded softkeys. |
7264 // Updates softkey labels in case of embedded softkeys. |
6975 // --------------------------------------------------------------------------- |
7265 // --------------------------------------------------------------------------- |
6976 // |
7266 // |
6977 void CEikCba::UpdateLabels( TBool aDrawDeferred ) |
7267 void CEikCba::UpdateLabels( TBool aDrawDeferred ) |
6978 { |
7268 { |
7269 _AKNTRACE_FUNC_ENTER; |
|
6979 if ( iControlArray->Count() != 0) |
7270 if ( iControlArray->Count() != 0) |
6980 { |
7271 { |
6981 CCoeControl *leftSoftkey = ( *iControlArray ) |
7272 CCoeControl *leftSoftkey = ( *iControlArray ) |
6982 [ KControlArrayCBAButton1Posn ].iControl; |
7273 [ KControlArrayCBAButton1Posn ].iControl; |
6983 CCoeControl *rightSoftkey = ( *iControlArray ) |
7274 CCoeControl *rightSoftkey = ( *iControlArray ) |
7096 if ( aDrawDeferred ) |
7387 if ( aDrawDeferred ) |
7097 { |
7388 { |
7098 DrawDeferred(); |
7389 DrawDeferred(); |
7099 } |
7390 } |
7100 } |
7391 } |
7392 _AKNTRACE_FUNC_EXIT; |
|
7101 } |
7393 } |
7102 |
7394 |
7103 |
7395 |
7104 // ----------------------------------------------------------------------------- |
7396 // ----------------------------------------------------------------------------- |
7105 // EikSoftkeyPostingTransparency::MakeTransparent |
7397 // EikSoftkeyPostingTransparency::MakeTransparent |
7107 // |
7399 // |
7108 EXPORT_C TInt EikSoftkeyPostingTransparency::MakeTransparent( |
7400 EXPORT_C TInt EikSoftkeyPostingTransparency::MakeTransparent( |
7109 CEikButtonGroupContainer& aButtonGroupContainer, |
7401 CEikButtonGroupContainer& aButtonGroupContainer, |
7110 TBool aEnable ) |
7402 TBool aEnable ) |
7111 { |
7403 { |
7404 _AKNTRACE_FUNC_ENTER; |
|
7112 CEikCba* cba = dynamic_cast<CEikCba*>( aButtonGroupContainer.ButtonGroup() ); |
7405 CEikCba* cba = dynamic_cast<CEikCba*>( aButtonGroupContainer.ButtonGroup() ); |
7113 TInt ret = KErrNone; |
7406 TInt ret = KErrNone; |
7114 if ( cba ) |
7407 if ( cba ) |
7115 { |
7408 { |
7116 if ( aEnable && ( cba->ButtonGroupFlags() & EEikCbaFlagTransparent ) ) |
7409 if ( aEnable && ( cba->ButtonGroupFlags() & EEikCbaFlagTransparent ) ) |
7122 else |
7415 else |
7123 { |
7416 { |
7124 cba->EnablePostingTransparency( aEnable ); |
7417 cba->EnablePostingTransparency( aEnable ); |
7125 } |
7418 } |
7126 } |
7419 } |
7420 _AKNTRACE_FUNC_EXIT; |
|
7127 return ret; |
7421 return ret; |
7128 } |
7422 } |
7129 |
7423 |
7130 // ----------------------------------------------------------------------------- |
7424 // ----------------------------------------------------------------------------- |
7131 // CEikCba::EnablePostingTransparency |
7425 // CEikCba::EnablePostingTransparency |
7132 // |
7426 // |
7133 // ----------------------------------------------------------------------------- |
7427 // ----------------------------------------------------------------------------- |
7134 // |
7428 // |
7135 void CEikCba::EnablePostingTransparency( TBool aEnable ) |
7429 void CEikCba::EnablePostingTransparency( TBool aEnable ) |
7136 { |
7430 { |
7431 _AKNTRACE_FUNC_ENTER; |
|
7137 if ( iExtension ) |
7432 if ( iExtension ) |
7138 { |
7433 { |
7139 if ( iExtension->iEnablePostingTransparency != aEnable ) |
7434 if ( iExtension->iEnablePostingTransparency != aEnable ) |
7140 { |
7435 { |
7141 iExtension->iEnablePostingTransparency = aEnable; |
7436 iExtension->iEnablePostingTransparency = aEnable; |
7164 } |
7459 } |
7165 |
7460 |
7166 DrawDeferred(); |
7461 DrawDeferred(); |
7167 } |
7462 } |
7168 } |
7463 } |
7464 _AKNTRACE_FUNC_EXIT; |
|
7169 } |
7465 } |
7170 |
7466 |
7171 |
7467 |
7172 // --------------------------------------------------------------------------- |
7468 // --------------------------------------------------------------------------- |
7173 // CEikCba::IsEmpty |
7469 // CEikCba::IsEmpty |
7174 // Checks if the CBA has no commands. |
7470 // Checks if the CBA has no commands. |
7175 // --------------------------------------------------------------------------- |
7471 // --------------------------------------------------------------------------- |
7176 // |
7472 // |
7177 EXPORT_C TBool CEikCba::IsEmpty() const |
7473 EXPORT_C TBool CEikCba::IsEmpty() const |
7178 { |
7474 { |
7475 _AKNTRACE_FUNC_ENTER; |
|
7179 TBool isEmpty( ETrue ); |
7476 TBool isEmpty( ETrue ); |
7180 |
7477 |
7181 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7478 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7182 { |
7479 { |
7183 // Not supported for full screen query. |
7480 // Not supported for full screen query. |
7208 } |
7505 } |
7209 } |
7506 } |
7210 } |
7507 } |
7211 } |
7508 } |
7212 |
7509 |
7510 _AKNTRACE_FUNC_EXIT; |
|
7213 return isEmpty; |
7511 return isEmpty; |
7214 } |
7512 } |
7215 |
7513 |
7216 |
7514 |
7217 // --------------------------------------------------------------------------- |
7515 // --------------------------------------------------------------------------- |
7219 // Returns flags. |
7517 // Returns flags. |
7220 // --------------------------------------------------------------------------- |
7518 // --------------------------------------------------------------------------- |
7221 // |
7519 // |
7222 TBitFlags CEikCba::Flags() |
7520 TBitFlags CEikCba::Flags() |
7223 { |
7521 { |
7522 _AKNTRACE_FUNC_ENTER; |
|
7523 _AKNTRACE_FUNC_EXIT; |
|
7224 return iFlags; |
7524 return iFlags; |
7225 } |
7525 } |
7226 |
7526 |
7227 |
7527 |
7228 // --------------------------------------------------------------------------- |
7528 // --------------------------------------------------------------------------- |
7230 // Sets content observer. |
7530 // Sets content observer. |
7231 // --------------------------------------------------------------------------- |
7531 // --------------------------------------------------------------------------- |
7232 // |
7532 // |
7233 void CEikCba::SetContentObserver( TCallBack aCallBack ) |
7533 void CEikCba::SetContentObserver( TCallBack aCallBack ) |
7234 { |
7534 { |
7535 _AKNTRACE_FUNC_ENTER; |
|
7235 if ( iExtension ) |
7536 if ( iExtension ) |
7236 { |
7537 { |
7237 iExtension->iContentObserver = aCallBack; |
7538 iExtension->iContentObserver = aCallBack; |
7238 } |
7539 } |
7540 _AKNTRACE_FUNC_EXIT; |
|
7239 } |
7541 } |
7240 |
7542 |
7241 |
7543 |
7242 // --------------------------------------------------------------------------- |
7544 // --------------------------------------------------------------------------- |
7243 // CEikCba::ReportContentChangedEvent |
7545 // CEikCba::ReportContentChangedEvent |
7245 // or vice versa. |
7547 // or vice versa. |
7246 // --------------------------------------------------------------------------- |
7548 // --------------------------------------------------------------------------- |
7247 // |
7549 // |
7248 void CEikCba::ReportContentChangedEvent() |
7550 void CEikCba::ReportContentChangedEvent() |
7249 { |
7551 { |
7552 _AKNTRACE_FUNC_ENTER; |
|
7250 if ( ItemSpecificSoftkey() ) |
7553 if ( ItemSpecificSoftkey() ) |
7251 { |
7554 { |
7252 UpdateItemSpecificSoftkey( |
7555 UpdateItemSpecificSoftkey( |
7253 iExtension->Active() && !Window().IsFaded() ); |
7556 iExtension->Active() && !Window().IsFaded() ); |
7254 } |
7557 } |
7255 |
7558 |
7256 if ( !iFlags.IsSet( ECbaEmbedded ) ) |
7559 if ( !iFlags.IsSet( ECbaEmbedded ) ) |
7257 { |
7560 { |
7561 _AKNTRACE_FUNC_EXIT; |
|
7258 return; |
7562 return; |
7259 } |
7563 } |
7260 |
7564 |
7261 TBool isEmpty( !IsVisible() || IsEmpty() ); |
7565 TBool isEmpty( !IsVisible() || IsEmpty() ); |
7262 TBool reportStateChanged( EFalse ); |
7566 TBool reportStateChanged( EFalse ); |
7280 if ( iExtension && iExtension->iContentObserver.iFunction ) |
7584 if ( iExtension && iExtension->iContentObserver.iFunction ) |
7281 { |
7585 { |
7282 iExtension->iContentObserver.CallBack(); // return value ignored |
7586 iExtension->iContentObserver.CallBack(); // return value ignored |
7283 } |
7587 } |
7284 } |
7588 } |
7589 _AKNTRACE_FUNC_EXIT; |
|
7285 } |
7590 } |
7286 |
7591 |
7287 // --------------------------------------------------------------------------- |
7592 // --------------------------------------------------------------------------- |
7288 // CEikCba::DrawEmbeddedSoftkey |
7593 // CEikCba::DrawEmbeddedSoftkey |
7289 // Draws embedded softkey |
7594 // Draws embedded softkey |
7292 void CEikCba::DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl, |
7597 void CEikCba::DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl, |
7293 const TRect& aRect, |
7598 const TRect& aRect, |
7294 CWindowGc& aGc, |
7599 CWindowGc& aGc, |
7295 CFbsBitmap* /*aMask*/ ) const |
7600 CFbsBitmap* /*aMask*/ ) const |
7296 { |
7601 { |
7602 _AKNTRACE_FUNC_ENTER; |
|
7297 CEikCbaButton* button = |
7603 CEikCbaButton* button = |
7298 static_cast<CEikCbaButton*>( aGroupControl.iControl ); |
7604 static_cast<CEikCbaButton*>( aGroupControl.iControl ); |
7299 |
7605 |
7300 TAknLayoutRect layoutRect; |
7606 TAknLayoutRect layoutRect; |
7301 TRect innerRect; |
7607 TRect innerRect; |
7321 aRect, |
7627 aRect, |
7322 innerRect, |
7628 innerRect, |
7323 KAknsIIDQgnFrSctrlSkButton, |
7629 KAknsIIDQgnFrSctrlSkButton, |
7324 KAknsIIDQgnFrSctrlSkButtonCenter); |
7630 KAknsIIDQgnFrSctrlSkButtonCenter); |
7325 } |
7631 } |
7632 _AKNTRACE_FUNC_EXIT; |
|
7326 } |
7633 } |
7327 |
7634 |
7328 TBool CEikCba::UpdateIconL() |
7635 TBool CEikCba::UpdateIconL() |
7329 { |
7636 { |
7637 _AKNTRACE_FUNC_ENTER; |
|
7330 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7638 if ( iFlags.IsSet( ECbaInsideDialog ) ) |
7331 { |
7639 { |
7640 _AKNTRACE_FUNC_EXIT; |
|
7332 return EFalse; |
7641 return EFalse; |
7333 } |
7642 } |
7334 |
7643 |
7335 if ( !iExtension->iIfMskIconSet || |
7644 if ( !iExtension->iIfMskIconSet || |
7336 !MskAllowed() ) |
7645 !MskAllowed() ) |
7337 { |
7646 { |
7647 _AKNTRACE_FUNC_EXIT; |
|
7338 return EFalse; |
7648 return EFalse; |
7339 } |
7649 } |
7340 |
7650 |
7341 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
7651 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
7342 if ( !skin ) |
7652 if ( !skin ) |
7343 { |
7653 { |
7654 _AKNTRACE_FUNC_EXIT; |
|
7344 return EFalse; |
7655 return EFalse; |
7345 } |
7656 } |
7346 |
7657 |
7347 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
7658 TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn ); |
7348 |
7659 |
7349 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
7660 CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl ); |
7350 if ( !button ) |
7661 if ( !button ) |
7351 { |
7662 { |
7663 _AKNTRACE_FUNC_EXIT; |
|
7352 return EFalse; |
7664 return EFalse; |
7353 } |
7665 } |
7354 |
7666 |
7355 CFbsBitmap *bitmap = NULL; |
7667 CFbsBitmap *bitmap = NULL; |
7356 CFbsBitmap *mask = NULL; |
7668 CFbsBitmap *mask = NULL; |
7393 button->ReplaceImageByLabel(); // remove old image |
7705 button->ReplaceImageByLabel(); // remove old image |
7394 } |
7706 } |
7395 |
7707 |
7396 button->SetContainerWindowL( *this ); |
7708 button->SetContainerWindowL( *this ); |
7397 |
7709 |
7710 _AKNTRACE_FUNC_EXIT; |
|
7398 return ETrue; |
7711 return ETrue; |
7399 |
7712 |
7400 } |
7713 } |
7401 |
7714 |
7402 |
7715 |
7403 // --------------------------------------------------------------------------- |
7716 // --------------------------------------------------------------------------- |
7404 // Checks if the middle softkey should be used. |
7717 // Checks if the middle softkey should be used. |
7406 // when on layout changes etc. |
7719 // when on layout changes etc. |
7407 // --------------------------------------------------------------------------- |
7720 // --------------------------------------------------------------------------- |
7408 // |
7721 // |
7409 TBool CEikCba::MskAllowed() const |
7722 TBool CEikCba::MskAllowed() const |
7410 { |
7723 { |
7724 _AKNTRACE_FUNC_ENTER; |
|
7725 _AKNTRACE_FUNC_EXIT; |
|
7411 return ( iMSKEnabledInPlatform && |
7726 return ( iMSKEnabledInPlatform && |
7412 AknLayoutUtils::MSKEnabled() && |
7727 AknLayoutUtils::MSKEnabled() && |
7413 IsMskEnabledLayoutActive() ); |
7728 IsMskEnabledLayoutActive() ); |
7414 } |
7729 } |
7415 |
7730 |
7420 // --------------------------------------------------------------------------- |
7735 // --------------------------------------------------------------------------- |
7421 // |
7736 // |
7422 TBool CEikCba::SoftkeyStatusChangeAllowed( |
7737 TBool CEikCba::SoftkeyStatusChangeAllowed( |
7423 TInt aSoftkeyPosition, TBool aDisabled ) |
7738 TInt aSoftkeyPosition, TBool aDisabled ) |
7424 { |
7739 { |
7740 _AKNTRACE_FUNC_ENTER; |
|
7425 TBool allowChange( ETrue ); |
7741 TBool allowChange( ETrue ); |
7426 if ( aSoftkeyPosition == KControlArrayCBAButton1Posn ) |
7742 if ( aSoftkeyPosition == KControlArrayCBAButton1Posn ) |
7427 { |
7743 { |
7428 if ( aDisabled ) |
7744 if ( aDisabled ) |
7429 { |
7745 { |
7437 { |
7753 { |
7438 allowChange = EFalse; |
7754 allowChange = EFalse; |
7439 } |
7755 } |
7440 } |
7756 } |
7441 } |
7757 } |
7758 _AKNTRACE_FUNC_EXIT; |
|
7442 return allowChange; |
7759 return allowChange; |
7443 } |
7760 } |
7444 |
7761 |
7445 |
7762 |
7446 // --------------------------------------------------------------------------- |
7763 // --------------------------------------------------------------------------- |
7448 // Returns item specific softkey control if it state should be updated. |
7765 // Returns item specific softkey control if it state should be updated. |
7449 // --------------------------------------------------------------------------- |
7766 // --------------------------------------------------------------------------- |
7450 // |
7767 // |
7451 TEikGroupControl* CEikCba::ItemSpecificSoftkey() const |
7768 TEikGroupControl* CEikCba::ItemSpecificSoftkey() const |
7452 { |
7769 { |
7770 _AKNTRACE_FUNC_ENTER; |
|
7453 TEikGroupControl* lsk( NULL ); |
7771 TEikGroupControl* lsk( NULL ); |
7454 if ( iFlags.IsSet( ECbaItemSpecificSoftkeyInUse ) ) |
7772 if ( iFlags.IsSet( ECbaItemSpecificSoftkeyInUse ) ) |
7455 { |
7773 { |
7456 TEikGroupControl& leftSoftkey = |
7774 TEikGroupControl& leftSoftkey = |
7457 ( *iControlArray ) [ KControlArrayCBAButton1Posn ]; |
7775 ( *iControlArray ) [ KControlArrayCBAButton1Posn ]; |
7459 || iFlags.IsSet( ECbaItemSoftkeyDisabled ) ) |
7777 || iFlags.IsSet( ECbaItemSoftkeyDisabled ) ) |
7460 { |
7778 { |
7461 lsk = &leftSoftkey; |
7779 lsk = &leftSoftkey; |
7462 } |
7780 } |
7463 } |
7781 } |
7782 _AKNTRACE_FUNC_EXIT; |
|
7464 return lsk; |
7783 return lsk; |
7465 } |
7784 } |
7466 |
7785 |
7467 |
7786 |
7468 // --------------------------------------------------------------------------- |
7787 // --------------------------------------------------------------------------- |
7470 // Updates item specific softkey. |
7789 // Updates item specific softkey. |
7471 // --------------------------------------------------------------------------- |
7790 // --------------------------------------------------------------------------- |
7472 // |
7791 // |
7473 void CEikCba::UpdateItemSpecificSoftkey( TBool aVisibleCollection ) |
7792 void CEikCba::UpdateItemSpecificSoftkey( TBool aVisibleCollection ) |
7474 { |
7793 { |
7794 _AKNTRACE_FUNC_ENTER; |
|
7475 if ( iFlags.IsSet( ECbaSingleClickEnabled ) |
7795 if ( iFlags.IsSet( ECbaSingleClickEnabled ) |
7476 && iExtension && iExtension->iItemActionMenu ) |
7796 && iExtension && iExtension->iItemActionMenu ) |
7477 { |
7797 { |
7478 TEikGroupControl* leftSk = ItemSpecificSoftkey(); |
7798 TEikGroupControl* leftSk = ItemSpecificSoftkey(); |
7479 if ( leftSk ) |
7799 if ( leftSk ) |
7482 iExtension->iItemActionMenu->CollectionSoftkeyVisible( |
7802 iExtension->iItemActionMenu->CollectionSoftkeyVisible( |
7483 aVisibleCollection ) ); |
7803 aVisibleCollection ) ); |
7484 UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk ); |
7804 UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk ); |
7485 } |
7805 } |
7486 } |
7806 } |
7807 _AKNTRACE_FUNC_EXIT; |
|
7487 } |
7808 } |
7488 |
7809 |
7489 |
7810 |
7490 // --------------------------------------------------------------------------- |
7811 // --------------------------------------------------------------------------- |
7491 // CEikCba::UpdateItemSpecificSoftkey |
7812 // CEikCba::UpdateItemSpecificSoftkey |
7492 // Updates item specific softkey. |
7813 // Updates item specific softkey. |
7493 // --------------------------------------------------------------------------- |
7814 // --------------------------------------------------------------------------- |
7494 // |
7815 // |
7495 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable ) |
7816 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable ) |
7496 { |
7817 { |
7818 _AKNTRACE_FUNC_ENTER; |
|
7497 TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() ); |
7819 TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() ); |
7498 TBool changeState( EFalse ); |
7820 TBool changeState( EFalse ); |
7499 if ( !aEnable ) |
7821 if ( !aEnable ) |
7500 { |
7822 { |
7501 iFlags.Set( ECbaItemSoftkeyDisabled ); |
7823 iFlags.Set( ECbaItemSoftkeyDisabled ); |
7523 { |
7845 { |
7524 aControl.SetDimmed( !aEnable ); |
7846 aControl.SetDimmed( !aEnable ); |
7525 aControl.DrawDeferred(); |
7847 aControl.DrawDeferred(); |
7526 } |
7848 } |
7527 } |
7849 } |
7850 _AKNTRACE_FUNC_EXIT; |
|
7528 } |
7851 } |
7529 |
7852 |
7530 |
7853 |
7531 // |
7854 // |
7532 // class CEikCbaButton |
7855 // class CEikCbaButton |
7533 // |
7856 // |
7534 |
7857 |
7535 CEikCbaButton::~CEikCbaButton() |
7858 CEikCbaButton::~CEikCbaButton() |
7536 { |
7859 { |
7860 _AKNTRACE_FUNC_ENTER; |
|
7537 AKNTASHOOK_REMOVE(); |
7861 AKNTASHOOK_REMOVE(); |
7538 delete iLabel; |
7862 delete iLabel; |
7539 if ( iImage ) |
7863 if ( iImage ) |
7540 { |
7864 { |
7541 iImage->SetMask( iMask ); |
7865 iImage->SetMask( iMask ); |
7543 delete iImage; |
7867 delete iImage; |
7544 delete iSfeMask; |
7868 delete iSfeMask; |
7545 delete iButtonOptions; |
7869 delete iButtonOptions; |
7546 delete iText; |
7870 delete iText; |
7547 |
7871 |
7872 _AKNTRACE_FUNC_EXIT; |
|
7548 } |
7873 } |
7549 |
7874 |
7550 void CEikCbaButton::ConstructL(TGulAlignmentValue aAlignment) |
7875 void CEikCbaButton::ConstructL(TGulAlignmentValue aAlignment) |
7551 { |
7876 { |
7877 _AKNTRACE_FUNC_ENTER; |
|
7552 iLabel = new(ELeave) CEikLabel; |
7878 iLabel = new(ELeave) CEikLabel; |
7553 iPressedDown = EFalse; |
7879 iPressedDown = EFalse; |
7554 iLabel->SetBufferReserveLengthL(KMaxCbaLabelLength); |
7880 iLabel->SetBufferReserveLengthL(KMaxCbaLabelLength); |
7555 UpdateLabelText(TPtrC()); |
7881 UpdateLabelText(TPtrC()); |
7556 iLabel->SetAlignment(aAlignment); |
7882 iLabel->SetAlignment(aAlignment); |
7561 if ( iUseTextBitmap ) |
7887 if ( iUseTextBitmap ) |
7562 { |
7888 { |
7563 iLabel->MakeVisible( EFalse ); |
7889 iLabel->MakeVisible( EFalse ); |
7564 } |
7890 } |
7565 AKNTASHOOK_ADDL( this, "CEikCbaButton" ); |
7891 AKNTASHOOK_ADDL( this, "CEikCbaButton" ); |
7892 _AKNTRACE_FUNC_EXIT; |
|
7566 } |
7893 } |
7567 |
7894 |
7568 void CEikCbaButton::AddCommandL(const TDesC& aText) |
7895 void CEikCbaButton::AddCommandL(const TDesC& aText) |
7569 { |
7896 { |
7897 _AKNTRACE_FUNC_ENTER; |
|
7570 UpdateLabelText(aText); |
7898 UpdateLabelText(aText); |
7899 _AKNTRACE_FUNC_EXIT; |
|
7571 } |
7900 } |
7572 |
7901 |
7573 struct STempCleanup |
7902 struct STempCleanup |
7574 { |
7903 { |
7575 CDesCArray* iText; |
7904 CDesCArray* iText; |
7576 CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions; |
7905 CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions; |
7577 }; |
7906 }; |
7578 |
7907 |
7579 LOCAL_C void CleanupTemp(TAny* aPtr) |
7908 LOCAL_C void CleanupTemp(TAny* aPtr) |
7580 { |
7909 { |
7910 _AKNTRACE_FUNC_ENTER; |
|
7581 STempCleanup& temp = *(STempCleanup*)aPtr; |
7911 STempCleanup& temp = *(STempCleanup*)aPtr; |
7582 const TInt count = temp.iText->Count(); |
7912 const TInt count = temp.iText->Count(); |
7583 if (temp.iButtonOptions->Count() == count) |
7913 if (temp.iButtonOptions->Count() == count) |
7584 { |
7914 { |
7585 temp.iButtonOptions->Delete(count - 1); |
7915 temp.iButtonOptions->Delete(count - 1); |
7586 } |
7916 } |
7587 temp.iText->Delete(count - 1); |
7917 temp.iText->Delete(count - 1); |
7918 _AKNTRACE_FUNC_EXIT; |
|
7588 } |
7919 } |
7589 |
7920 |
7590 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText) |
7921 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText) |
7591 { |
7922 { |
7923 _AKNTRACE_FUNC_ENTER; |
|
7592 if (!iButtonOptions) |
7924 if (!iButtonOptions) |
7593 { |
7925 { |
7594 iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1); |
7926 iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1); |
7595 } |
7927 } |
7596 if (!iText) |
7928 if (!iText) |
7609 options.iDimmed = iLabel->IsDimmed(); |
7941 options.iDimmed = iLabel->IsDimmed(); |
7610 iLabel->SetDimmed(EFalse); |
7942 iLabel->SetDimmed(EFalse); |
7611 iButtonOptions->AppendL(options); |
7943 iButtonOptions->AppendL(options); |
7612 UpdateLabelText(aText); |
7944 UpdateLabelText(aText); |
7613 CleanupStack::Pop(); // temp |
7945 CleanupStack::Pop(); // temp |
7946 _AKNTRACE_FUNC_EXIT; |
|
7614 } |
7947 } |
7615 |
7948 |
7616 TInt CEikCbaButton::PopCommand() |
7949 TInt CEikCbaButton::PopCommand() |
7617 { |
7950 { |
7951 _AKNTRACE_FUNC_ENTER; |
|
7618 if (!iButtonOptions) |
7952 if (!iButtonOptions) |
7619 { |
7953 { |
7954 _AKNTRACE_FUNC_EXIT; |
|
7620 return -1; |
7955 return -1; |
7621 } |
7956 } |
7622 |
7957 |
7623 TInt count = iButtonOptions->Count(); |
7958 TInt count = iButtonOptions->Count(); |
7624 --count; |
7959 --count; |
7625 |
7960 |
7626 if (count < 0) |
7961 if (count < 0) |
7627 { |
7962 { |
7963 _AKNTRACE_FUNC_EXIT; |
|
7628 return -1; |
7964 return -1; |
7629 } |
7965 } |
7630 |
7966 |
7631 const SButtonOptions buttonOptions = (*iButtonOptions)[count]; |
7967 const SButtonOptions buttonOptions = (*iButtonOptions)[count]; |
7632 iButtonOptions->Delete(count); |
7968 iButtonOptions->Delete(count); |
7647 } |
7983 } |
7648 else |
7984 else |
7649 { |
7985 { |
7650 iImage->DrawNow(); |
7986 iImage->DrawNow(); |
7651 } |
7987 } |
7988 _AKNTRACE_FUNC_EXIT; |
|
7652 return buttonOptions.iCommandId; |
7989 return buttonOptions.iCommandId; |
7653 } |
7990 } |
7654 |
7991 |
7655 void CEikCbaButton::RemoveCommand(TInt aCommandId) |
7992 void CEikCbaButton::RemoveCommand(TInt aCommandId) |
7656 { |
7993 { |
7994 _AKNTRACE_FUNC_ENTER; |
|
7657 if (!iButtonOptions) |
7995 if (!iButtonOptions) |
7658 { |
7996 { |
7997 _AKNTRACE_FUNC_EXIT; |
|
7659 return; |
7998 return; |
7660 } |
7999 } |
7661 TInt index = IndexFromCommandId(aCommandId); |
8000 TInt index = IndexFromCommandId(aCommandId); |
7662 if (index != KErrNotFound) |
8001 if (index != KErrNotFound) |
7663 { |
8002 { |
7669 iButtonOptions = NULL; |
8008 iButtonOptions = NULL; |
7670 delete iText; |
8009 delete iText; |
7671 iText = NULL; |
8010 iText = NULL; |
7672 } |
8011 } |
7673 } |
8012 } |
8013 _AKNTRACE_FUNC_EXIT; |
|
7674 } |
8014 } |
7675 |
8015 |
7676 void CEikCbaButton::RemovePreviousCommand() |
8016 void CEikCbaButton::RemovePreviousCommand() |
7677 { |
8017 { |
8018 _AKNTRACE_FUNC_ENTER; |
|
7678 if (!iButtonOptions) |
8019 if (!iButtonOptions) |
7679 { |
8020 { |
8021 _AKNTRACE_FUNC_EXIT; |
|
7680 return; |
8022 return; |
7681 } |
8023 } |
7682 TInt index = iButtonOptions->Count() - 2; |
8024 TInt index = iButtonOptions->Count() - 2; |
7683 if (index >= 0) |
8025 if (index >= 0) |
7684 { |
8026 { |
7685 iButtonOptions->Delete(index); |
8027 iButtonOptions->Delete(index); |
7686 iText->Delete(index); |
8028 iText->Delete(index); |
7687 } |
8029 } |
8030 _AKNTRACE_FUNC_EXIT; |
|
7688 } |
8031 } |
7689 |
8032 |
7690 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId) |
8033 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId) |
7691 { |
8034 { |
8035 _AKNTRACE_FUNC_ENTER; |
|
7692 TInt index; |
8036 TInt index; |
7693 TKeyArrayFix key(0, ECmpTInt); |
8037 TKeyArrayFix key(0, ECmpTInt); |
7694 SButtonOptions options; |
8038 SButtonOptions options; |
7695 options.iCommandId = aCommandId; |
8039 options.iCommandId = aCommandId; |
7696 if (iButtonOptions->Find(options, key, index) == KErrNone) |
8040 if (iButtonOptions->Find(options, key, index) == KErrNone) |
7697 { |
8041 { |
8042 _AKNTRACE_FUNC_EXIT; |
|
7698 return index; |
8043 return index; |
7699 } |
8044 } |
7700 else |
8045 else |
7701 { |
8046 { |
8047 _AKNTRACE_FUNC_EXIT; |
|
7702 return KErrNotFound; |
8048 return KErrNotFound; |
7703 } |
8049 } |
7704 } |
8050 } |
7705 |
8051 |
7706 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer) |
8052 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer) |
7707 { |
8053 { |
8054 _AKNTRACE_FUNC_ENTER; |
|
7708 CCoeControl::SetContainerWindowL(aContainer); |
8055 CCoeControl::SetContainerWindowL(aContainer); |
7709 if (!iDoImage) |
8056 if (!iDoImage) |
7710 { |
8057 { |
7711 iLabel->SetContainerWindowL(aContainer); |
8058 iLabel->SetContainerWindowL(aContainer); |
7712 } |
8059 } |
7713 else |
8060 else |
7714 { |
8061 { |
7715 iImage->SetContainerWindowL(aContainer); |
8062 iImage->SetContainerWindowL(aContainer); |
7716 } |
8063 } |
8064 _AKNTRACE_FUNC_EXIT; |
|
7717 } |
8065 } |
7718 |
8066 |
7719 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment) |
8067 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment) |
7720 { |
8068 { |
8069 _AKNTRACE_FUNC_ENTER; |
|
7721 ConstructL(anAlignment); |
8070 ConstructL(anAlignment); |
7722 UpdateLabelText(aReader.ReadTPtrC()); |
8071 UpdateLabelText(aReader.ReadTPtrC()); |
7723 aReader.ReadTPtrC(); // bmp filename |
8072 aReader.ReadTPtrC(); // bmp filename |
7724 aReader.ReadInt16(); // bmp id |
8073 aReader.ReadInt16(); // bmp id |
7725 aReader.ReadInt16(); // bmp mask id |
8074 aReader.ReadInt16(); // bmp mask id |
8075 _AKNTRACE_FUNC_EXIT; |
|
7726 } |
8076 } |
7727 |
8077 |
7728 TSize CEikCbaButton::MinimumSize() |
8078 TSize CEikCbaButton::MinimumSize() |
7729 { |
8079 { |
8080 _AKNTRACE_FUNC_ENTER; |
|
7730 if (!iDoImage) |
8081 if (!iDoImage) |
7731 { |
8082 { |
8083 _AKNTRACE_FUNC_EXIT; |
|
7732 return iLabel->MinimumSize(); |
8084 return iLabel->MinimumSize(); |
7733 } |
8085 } |
7734 else |
8086 else |
7735 { |
8087 { |
8088 _AKNTRACE_FUNC_EXIT; |
|
7736 return iImage->MinimumSize(); |
8089 return iImage->MinimumSize(); |
7737 } |
8090 } |
7738 } |
8091 } |
7739 |
8092 |
7740 TInt CEikCbaButton::CountComponentControls() const |
8093 TInt CEikCbaButton::CountComponentControls() const |
7741 { |
8094 { |
8095 _AKNTRACE_FUNC_ENTER; |
|
8096 _AKNTRACE_FUNC_EXIT; |
|
7742 return 1; |
8097 return 1; |
7743 } |
8098 } |
7744 |
8099 |
7745 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const |
8100 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const |
7746 { |
8101 { |
8102 _AKNTRACE_FUNC_ENTER; |
|
7747 if (aIndex==0) |
8103 if (aIndex==0) |
7748 { |
8104 { |
7749 if (!iDoImage) |
8105 if (!iDoImage) |
7750 { |
8106 { |
8107 _AKNTRACE_FUNC_EXIT; |
|
7751 return iLabel; |
8108 return iLabel; |
7752 } |
8109 } |
7753 else |
8110 else |
7754 { |
8111 { |
7755 // If SfeMask is available, then check the effect state (iPressedDown). |
8112 // If SfeMask is available, then check the effect state (iPressedDown). |
7765 } |
8122 } |
7766 } |
8123 } |
7767 return iImage; |
8124 return iImage; |
7768 } |
8125 } |
7769 } |
8126 } |
8127 _AKNTRACE_FUNC_EXIT; |
|
7770 return 0; |
8128 return 0; |
7771 } |
8129 } |
7772 |
8130 |
7773 |
8131 |
7774 // --------------------------------------------------------------------------- |
8132 // --------------------------------------------------------------------------- |
7775 // Handles size change events for CBA button. |
8133 // Handles size change events for CBA button. |
7776 // --------------------------------------------------------------------------- |
8134 // --------------------------------------------------------------------------- |
7777 // |
8135 // |
7778 void CEikCbaButton::SizeChanged() |
8136 void CEikCbaButton::SizeChanged() |
7779 { |
8137 { |
8138 _AKNTRACE_FUNC_ENTER; |
|
7780 // Resizing is done at CEikCba::SizeChanged(). |
8139 // Resizing is done at CEikCba::SizeChanged(). |
7781 // We cannot resize here because this control has wrong |
8140 // We cannot resize here because this control has wrong |
7782 // coordinate system available. |
8141 // coordinate system available. |
7783 |
8142 _AKNTRACE_FUNC_EXIT; |
7784 } |
8143 } |
7785 |
8144 |
7786 |
8145 |
7787 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
8146 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
7788 { |
8147 { |
8148 _AKNTRACE_FUNC_ENTER; |
|
7789 CCoeControl::HandlePointerEventL(aPointerEvent); |
8149 CCoeControl::HandlePointerEventL(aPointerEvent); |
8150 _AKNTRACE_FUNC_EXIT; |
|
7790 } |
8151 } |
7791 |
8152 |
7792 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ ) |
8153 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ ) |
7793 { |
8154 { |
8155 _AKNTRACE_FUNC_ENTER; |
|
8156 _AKNTRACE_FUNC_EXIT; |
|
7794 return NULL; |
8157 return NULL; |
7795 } |
8158 } |
7796 |
8159 |
7797 void CEikCbaButton::SetDimmed(TBool aDimmed) |
8160 void CEikCbaButton::SetDimmed(TBool aDimmed) |
7798 { |
8161 { |
8162 _AKNTRACE_FUNC_ENTER; |
|
7799 CCoeControl::SetDimmed(aDimmed); |
8163 CCoeControl::SetDimmed(aDimmed); |
7800 if (!iDoImage) |
8164 if (!iDoImage) |
7801 { |
8165 { |
7802 iLabel->SetDimmed(aDimmed); |
8166 iLabel->SetDimmed(aDimmed); |
7803 } |
8167 } |
7804 else |
8168 else |
7805 { |
8169 { |
7806 // Drawing dimmed CEikImages don't work (problem in uiklaf). |
8170 // Drawing dimmed CEikImages don't work (problem in uiklaf). |
7807 //iImage->SetDimmed(aDimmed); |
8171 //iImage->SetDimmed(aDimmed); |
7808 } |
8172 } |
8173 _AKNTRACE_FUNC_EXIT; |
|
7809 } |
8174 } |
7810 |
8175 |
7811 |
8176 |
7812 // --------------------------------------------------------------------------- |
8177 // --------------------------------------------------------------------------- |
7813 // Updates the softkey label. |
8178 // Updates the softkey label. |
7814 // --------------------------------------------------------------------------- |
8179 // --------------------------------------------------------------------------- |
7815 // |
8180 // |
7816 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText ) |
8181 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText ) |
7817 { |
8182 { |
8183 _AKNTRACE_FUNC_ENTER; |
|
7818 // Updates the label text with the given label, using tab delimited |
8184 // Updates the label text with the given label, using tab delimited |
7819 // label text to identify normal / alternative labels. |
8185 // label text to identify normal / alternative labels. |
7820 if ( aLabelText.Length() > KMaxCbaLabelLength ) |
8186 if ( aLabelText.Length() > KMaxCbaLabelLength ) |
7821 { |
8187 { |
7822 // Cannot take more chars than maximum buffer size. |
8188 // Cannot take more chars than maximum buffer size. |
7845 TRAP_IGNORE( iLabel->SetTextL( iLongLabelText ) ); |
8211 TRAP_IGNORE( iLabel->SetTextL( iLongLabelText ) ); |
7846 if ( IsReadyToDraw() ) |
8212 if ( IsReadyToDraw() ) |
7847 { |
8213 { |
7848 TruncateLabelText(); |
8214 TruncateLabelText(); |
7849 } |
8215 } |
8216 _AKNTRACE_FUNC_EXIT; |
|
7850 } |
8217 } |
7851 |
8218 |
7852 |
8219 |
7853 void CEikCbaButton::SetTextBitmapMode( TBool aEnableBitmap ) |
8220 void CEikCbaButton::SetTextBitmapMode( TBool aEnableBitmap ) |
7854 { |
8221 { |
8222 _AKNTRACE_FUNC_ENTER; |
|
7855 iUseTextBitmap = aEnableBitmap; |
8223 iUseTextBitmap = aEnableBitmap; |
7856 if ( iLabel ) |
8224 if ( iLabel ) |
7857 { |
8225 { |
7858 iLabel->MakeVisible( !aEnableBitmap ); |
8226 iLabel->MakeVisible( !aEnableBitmap ); |
7859 } |
8227 } |
8228 _AKNTRACE_FUNC_EXIT; |
|
7860 } |
8229 } |
7861 |
8230 |
7862 void CEikCbaButton::DrawToContext( CBitmapContext& aContext, CBitmapContext& aMaskContext, const TPoint& aOffset ) const |
8231 void CEikCbaButton::DrawToContext( CBitmapContext& aContext, CBitmapContext& aMaskContext, const TPoint& aOffset ) const |
7863 { |
8232 { |
8233 _AKNTRACE_FUNC_ENTER; |
|
7864 if ( iLabel ) |
8234 if ( iLabel ) |
7865 { |
8235 { |
7866 // Draw text into EColor16MA bitmap |
8236 // Draw text into EColor16MA bitmap |
7867 aContext.SetOrigin( -aOffset ); |
8237 aContext.SetOrigin( -aOffset ); |
7868 iLabel->DrawToContext( aContext, NULL ); |
8238 iLabel->DrawToContext( aContext, NULL ); |
7871 // The mask should have a black background and the text in white. |
8241 // The mask should have a black background and the text in white. |
7872 TRgb maskColor = KRgbWhite; |
8242 TRgb maskColor = KRgbWhite; |
7873 aMaskContext.SetOrigin( -aOffset ); |
8243 aMaskContext.SetOrigin( -aOffset ); |
7874 iLabel->DrawToContext( aMaskContext, &maskColor ); |
8244 iLabel->DrawToContext( aMaskContext, &maskColor ); |
7875 } |
8245 } |
8246 _AKNTRACE_FUNC_EXIT; |
|
7876 } |
8247 } |
7877 |
8248 |
7878 void CEikCbaButton::SwitchToShortTextL(TBool aShortText) |
8249 void CEikCbaButton::SwitchToShortTextL(TBool aShortText) |
7879 { |
8250 { |
8251 _AKNTRACE_FUNC_ENTER; |
|
7880 if (aShortText) |
8252 if (aShortText) |
7881 { |
8253 { |
7882 iLabel->SetTextL(iShortLabelText); |
8254 iLabel->SetTextL(iShortLabelText); |
7883 } |
8255 } |
7884 else |
8256 else |
7897 } |
8269 } |
7898 else |
8270 else |
7899 { |
8271 { |
7900 iImage->DrawDeferred(); |
8272 iImage->DrawDeferred(); |
7901 } |
8273 } |
8274 _AKNTRACE_FUNC_EXIT; |
|
7902 } |
8275 } |
7903 |
8276 |
7904 void CEikCbaButton::SetLabelFont(const CFont* aLabelFont) |
8277 void CEikCbaButton::SetLabelFont(const CFont* aLabelFont) |
7905 { |
8278 { |
8279 _AKNTRACE_FUNC_ENTER; |
|
7906 iLabel->SetFont(aLabelFont); |
8280 iLabel->SetFont(aLabelFont); |
8281 _AKNTRACE_FUNC_EXIT; |
|
7907 } |
8282 } |
7908 |
8283 |
7909 void CEikCbaButton::TruncateLabelText() |
8284 void CEikCbaButton::TruncateLabelText() |
7910 { |
8285 { |
8286 _AKNTRACE_FUNC_ENTER; |
|
7911 // Truncation removed from here, as it was not bidi-text compatible. |
8287 // Truncation removed from here, as it was not bidi-text compatible. |
7912 // Let CEikLabel handle truncation instead. |
8288 // Let CEikLabel handle truncation instead. |
7913 iLabel->CropText(); |
8289 iLabel->CropText(); |
8290 _AKNTRACE_FUNC_EXIT; |
|
7914 } |
8291 } |
7915 |
8292 |
7916 TBool CEikCbaButton::IsEmptyText() const |
8293 TBool CEikCbaButton::IsEmptyText() const |
7917 { |
8294 { |
8295 _AKNTRACE_FUNC_ENTER; |
|
7918 if ( iDoImage ) |
8296 if ( iDoImage ) |
7919 { |
8297 { |
8298 _AKNTRACE_FUNC_EXIT; |
|
7920 return EFalse; |
8299 return EFalse; |
7921 } |
8300 } |
7922 |
8301 |
7923 TPtrC text( iFullLabelText ); |
8302 TPtrC text( iFullLabelText ); |
7924 TBool allSpaces = ETrue; |
8303 TBool allSpaces = ETrue; |
7930 allSpaces = EFalse; |
8309 allSpaces = EFalse; |
7931 break; |
8310 break; |
7932 } |
8311 } |
7933 } |
8312 } |
7934 |
8313 |
8314 _AKNTRACE_FUNC_EXIT; |
|
7935 return allSpaces; |
8315 return allSpaces; |
7936 } |
8316 } |
7937 |
8317 |
7938 void CEikCbaButton::ConstructEmptyButtonL() |
8318 void CEikCbaButton::ConstructEmptyButtonL() |
7939 { |
8319 { |
8320 _AKNTRACE_FUNC_ENTER; |
|
7940 ConstructL( EHRightVCenter ); // creates label |
8321 ConstructL( EHRightVCenter ); // creates label |
7941 _LIT(KEmptyText, ""); |
8322 _LIT(KEmptyText, ""); |
7942 TPtrC16 ptr(KEmptyText); |
8323 TPtrC16 ptr(KEmptyText); |
7943 UpdateLabelText( ptr ); |
8324 UpdateLabelText( ptr ); |
8325 _AKNTRACE_FUNC_EXIT; |
|
7944 } |
8326 } |
7945 |
8327 |
7946 TBool CEikCbaButton::PressedDown() const |
8328 TBool CEikCbaButton::PressedDown() const |
7947 { |
8329 { |
8330 _AKNTRACE_FUNC_ENTER; |
|
8331 _AKNTRACE_FUNC_EXIT; |
|
7948 return iPressedDown; |
8332 return iPressedDown; |
7949 } |
8333 } |
7950 |
8334 |
7951 void CEikCbaButton::SetPressedDown( const TBool aPressedDown ) |
8335 void CEikCbaButton::SetPressedDown( const TBool aPressedDown ) |
7952 { |
8336 { |
8337 _AKNTRACE_FUNC_ENTER; |
|
7953 iPressedDown = aPressedDown; |
8338 iPressedDown = aPressedDown; |
8339 _AKNTRACE_FUNC_EXIT; |
|
7954 } |
8340 } |
7955 |
8341 |
7956 // ----------------------------------------------------------------------------- |
8342 // ----------------------------------------------------------------------------- |
7957 // EikSoftkeyImage::SetImage |
8343 // EikSoftkeyImage::SetImage |
7958 // |
8344 // |
7961 EXPORT_C void EikSoftkeyImage::SetImage( |
8347 EXPORT_C void EikSoftkeyImage::SetImage( |
7962 CEikButtonGroupContainer* aButtonGroupContainer, |
8348 CEikButtonGroupContainer* aButtonGroupContainer, |
7963 CEikImage& aImage, |
8349 CEikImage& aImage, |
7964 TBool aLeft) |
8350 TBool aLeft) |
7965 { // static |
8351 { // static |
8352 _AKNTRACE_FUNC_ENTER; |
|
7966 TInt commandPos = aLeft ? 0 : 2; |
8353 TInt commandPos = aLeft ? 0 : 2; |
7967 TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos); |
8354 TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos); |
7968 CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId); |
8355 CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId); |
7969 if ( cbaButton ) |
8356 if ( cbaButton ) |
7970 { |
8357 { |
7975 aButtonGroupContainer->SetRect(aButtonGroupContainer->Rect()); |
8362 aButtonGroupContainer->SetRect(aButtonGroupContainer->Rect()); |
7976 // Draw previosly set image |
8363 // Draw previosly set image |
7977 cbaButton->DrawNow(); |
8364 cbaButton->DrawNow(); |
7978 aButtonGroupContainer->DrawNow(); |
8365 aButtonGroupContainer->DrawNow(); |
7979 } |
8366 } |
8367 _AKNTRACE_FUNC_EXIT; |
|
7980 } |
8368 } |
7981 |
8369 |
7982 // ----------------------------------------------------------------------------- |
8370 // ----------------------------------------------------------------------------- |
7983 // EikSoftkeyImage::SetLabel |
8371 // EikSoftkeyImage::SetLabel |
7984 // |
8372 // |
7986 // |
8374 // |
7987 EXPORT_C void EikSoftkeyImage::SetLabel( |
8375 EXPORT_C void EikSoftkeyImage::SetLabel( |
7988 CEikButtonGroupContainer* aButtonGroupContainer, |
8376 CEikButtonGroupContainer* aButtonGroupContainer, |
7989 TBool aLeft) |
8377 TBool aLeft) |
7990 { // static |
8378 { // static |
8379 _AKNTRACE_FUNC_ENTER; |
|
7991 TInt commandPos = aLeft ? 0 : 2; |
8380 TInt commandPos = aLeft ? 0 : 2; |
7992 TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos); |
8381 TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos); |
7993 CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId); |
8382 CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId); |
7994 if ( cbaButton ) |
8383 if ( cbaButton ) |
7995 { |
8384 { |
8001 aButtonGroupContainer->SetBoundingRect(screenRect); |
8390 aButtonGroupContainer->SetBoundingRect(screenRect); |
8002 // Draw previosly set label |
8391 // Draw previosly set label |
8003 cbaButton->DrawNow(); |
8392 cbaButton->DrawNow(); |
8004 aButtonGroupContainer->DrawNow(); |
8393 aButtonGroupContainer->DrawNow(); |
8005 } |
8394 } |
8395 _AKNTRACE_FUNC_EXIT; |
|
8006 } |
8396 } |
8007 |
8397 |
8008 // ----------------------------------------------------------------------------- |
8398 // ----------------------------------------------------------------------------- |
8009 // CEikCbaButton::SetImage |
8399 // CEikCbaButton::SetImage |
8010 // |
8400 // |
8011 // ----------------------------------------------------------------------------- |
8401 // ----------------------------------------------------------------------------- |
8012 // |
8402 // |
8013 void CEikCbaButton::SetImage(CEikImage &aImage) |
8403 void CEikCbaButton::SetImage(CEikImage &aImage) |
8014 { |
8404 { |
8405 _AKNTRACE_FUNC_ENTER; |
|
8015 iDoImage = ETrue; |
8406 iDoImage = ETrue; |
8016 |
8407 |
8017 if ( iImage ) |
8408 if ( iImage ) |
8018 { |
8409 { |
8019 iImage->SetMask( iMask ); |
8410 iImage->SetMask( iMask ); |
8028 } |
8419 } |
8029 else |
8420 else |
8030 { |
8421 { |
8031 ReplaceImageByLabel(); |
8422 ReplaceImageByLabel(); |
8032 } |
8423 } |
8424 _AKNTRACE_FUNC_EXIT; |
|
8033 } |
8425 } |
8034 |
8426 |
8035 // ----------------------------------------------------------------------------- |
8427 // ----------------------------------------------------------------------------- |
8036 // CEikCbaButton::PrepareImageL |
8428 // CEikCbaButton::PrepareImageL |
8037 // Prepares Image for softkey feedback effect. Creates needed mask for |
8429 // Prepares Image for softkey feedback effect. Creates needed mask for |
8038 // pressed down state. |
8430 // pressed down state. |
8039 // ----------------------------------------------------------------------------- |
8431 // ----------------------------------------------------------------------------- |
8040 // |
8432 // |
8041 void CEikCbaButton::PrepareImageL() |
8433 void CEikCbaButton::PrepareImageL() |
8042 { |
8434 { |
8435 _AKNTRACE_FUNC_ENTER; |
|
8043 // 50% transparent pressed down image is made with a alternative mask |
8436 // 50% transparent pressed down image is made with a alternative mask |
8044 // which is created when a image is set to CEikCbaButton. |
8437 // which is created when a image is set to CEikCbaButton. |
8045 // Original mask is copied and each of its pixels color components is |
8438 // Original mask is copied and each of its pixels color components is |
8046 // halved. Bit-shifting to the right makes color value to half --> |
8439 // halved. Bit-shifting to the right makes color value to half --> |
8047 // image looks 50% transparent with this mask |
8440 // image looks 50% transparent with this mask |
8048 const CFbsBitmap* mask = iImage->Mask(); |
8441 const CFbsBitmap* mask = iImage->Mask(); |
8049 iMask = mask; |
8442 iMask = mask; |
8050 |
8443 |
8051 if ( !iMask ) |
8444 if ( !iMask ) |
8052 { |
8445 { |
8446 _AKNTRACE_FUNC_EXIT; |
|
8053 return; |
8447 return; |
8054 } |
8448 } |
8055 |
8449 |
8056 iSfeMask = new (ELeave) CFbsBitmap; |
8450 iSfeMask = new (ELeave) CFbsBitmap; |
8057 User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) ); |
8451 User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) ); |
8083 |
8477 |
8084 iSfeMask->UnlockHeap(); |
8478 iSfeMask->UnlockHeap(); |
8085 CleanupStack::PopAndDestroy( device ); // device |
8479 CleanupStack::PopAndDestroy( device ); // device |
8086 |
8480 |
8087 delete gc; |
8481 delete gc; |
8482 _AKNTRACE_FUNC_EXIT; |
|
8088 } |
8483 } |
8089 // ----------------------------------------------------------------------------- |
8484 // ----------------------------------------------------------------------------- |
8090 // CEikCbaButton::ReplaceImageByLabel |
8485 // CEikCbaButton::ReplaceImageByLabel |
8091 // |
8486 // |
8092 // ----------------------------------------------------------------------------- |
8487 // ----------------------------------------------------------------------------- |
8093 // |
8488 // |
8094 void CEikCbaButton::ReplaceImageByLabel() |
8489 void CEikCbaButton::ReplaceImageByLabel() |
8095 { |
8490 { |
8491 _AKNTRACE_FUNC_ENTER; |
|
8096 iDoImage = EFalse; |
8492 iDoImage = EFalse; |
8097 if ( iImage ) |
8493 if ( iImage ) |
8098 { |
8494 { |
8099 // avoid mem leak. |
8495 // avoid mem leak. |
8100 iImage->SetMask( iMask ); |
8496 iImage->SetMask( iMask ); |
8101 delete iImage; |
8497 delete iImage; |
8102 iImage = NULL; |
8498 iImage = NULL; |
8103 delete iSfeMask; |
8499 delete iSfeMask; |
8104 iSfeMask = NULL; |
8500 iSfeMask = NULL; |
8105 } |
8501 } |
8502 _AKNTRACE_FUNC_EXIT; |
|
8106 } |
8503 } |
8107 |
8504 |
8108 // |
8505 // |
8109 // CEikEnhancedCbaButton |
8506 // CEikEnhancedCbaButton |
8110 // |
8507 // |
8112 // ----------------------------------------------------------------------------- |
8509 // ----------------------------------------------------------------------------- |
8113 // default constructor |
8510 // default constructor |
8114 // ----------------------------------------------------------------------------- |
8511 // ----------------------------------------------------------------------------- |
8115 CEikEnhancedCbaButton::CEikEnhancedCbaButton() |
8512 CEikEnhancedCbaButton::CEikEnhancedCbaButton() |
8116 { |
8513 { |
8514 _AKNTRACE_FUNC_ENTER; |
|
8515 _AKNTRACE_FUNC_EXIT; |
|
8117 } |
8516 } |
8118 |
8517 |
8119 // ----------------------------------------------------------------------------- |
8518 // ----------------------------------------------------------------------------- |
8120 // default destructor |
8519 // default destructor |
8121 // ----------------------------------------------------------------------------- |
8520 // ----------------------------------------------------------------------------- |
8122 CEikEnhancedCbaButton::~CEikEnhancedCbaButton() |
8521 CEikEnhancedCbaButton::~CEikEnhancedCbaButton() |
8123 { |
8522 { |
8523 _AKNTRACE_FUNC_ENTER; |
|
8524 _AKNTRACE_FUNC_EXIT; |
|
8124 } |
8525 } |
8125 |
8526 |
8126 // ----------------------------------------------------------------------------- |
8527 // ----------------------------------------------------------------------------- |
8127 // Sets command type for current button |
8528 // Sets command type for current button |
8128 // @param aCommandType Command type to be set |
8529 // @param aCommandType Command type to be set |
8129 // ----------------------------------------------------------------------------- |
8530 // ----------------------------------------------------------------------------- |
8130 #ifdef RD_ENHANCED_CBA |
8531 #ifdef RD_ENHANCED_CBA |
8131 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType ) |
8532 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType ) |
8132 { |
8533 { |
8534 _AKNTRACE_FUNC_ENTER; |
|
8133 iCommandType = aCommandType; |
8535 iCommandType = aCommandType; |
8536 _AKNTRACE_FUNC_EXIT; |
|
8134 } |
8537 } |
8135 #else |
8538 #else |
8136 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ ) |
8539 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ ) |
8137 { |
8540 { |
8541 _AKNTRACE_FUNC_ENTER; |
|
8542 _AKNTRACE_FUNC_EXIT; |
|
8138 } |
8543 } |
8139 #endif // RD_ENHANCED_CBA |
8544 #endif // RD_ENHANCED_CBA |
8140 // ----------------------------------------------------------------------------- |
8545 // ----------------------------------------------------------------------------- |
8141 // returns command's type for current button |
8546 // returns command's type for current button |
8142 // @return TInt command's type |
8547 // @return TInt command's type |
8143 // ----------------------------------------------------------------------------- |
8548 // ----------------------------------------------------------------------------- |
8144 |
8549 |
8145 TInt CEikEnhancedCbaButton::CommandType() const |
8550 TInt CEikEnhancedCbaButton::CommandType() const |
8146 { |
8551 { |
8552 _AKNTRACE_FUNC_ENTER; |
|
8553 _AKNTRACE_FUNC_EXIT; |
|
8147 #ifdef RD_ENHANCED_CBA |
8554 #ifdef RD_ENHANCED_CBA |
8148 return iCommandType; |
8555 return iCommandType; |
8149 #else |
8556 #else |
8150 return 0; |
8557 return 0; |
8151 #endif // RD_ENHANCED_CBA |
8558 #endif // RD_ENHANCED_CBA |
8155 // returns command id for current button |
8562 // returns command id for current button |
8156 // @return TInt command's id |
8563 // @return TInt command's id |
8157 // ----------------------------------------------------------------------------- |
8564 // ----------------------------------------------------------------------------- |
8158 TInt CEikEnhancedCbaButton::CommandId() const |
8565 TInt CEikEnhancedCbaButton::CommandId() const |
8159 { |
8566 { |
8567 _AKNTRACE_FUNC_ENTER; |
|
8568 _AKNTRACE_FUNC_EXIT; |
|
8160 #ifdef RD_ENHANCED_CBA |
8569 #ifdef RD_ENHANCED_CBA |
8161 return iCommandId; |
8570 return iCommandId; |
8162 #else |
8571 #else |
8163 return 0; |
8572 return 0; |
8164 #endif // RD_ENHANCED_CBA |
8573 #endif // RD_ENHANCED_CBA |
8169 // @param aReader created resource reader for reading information from resource file |
8578 // @param aReader created resource reader for reading information from resource file |
8170 // ----------------------------------------------------------------------------- |
8579 // ----------------------------------------------------------------------------- |
8171 #ifdef RD_ENHANCED_CBA |
8580 #ifdef RD_ENHANCED_CBA |
8172 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader) |
8581 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader) |
8173 { |
8582 { |
8583 _AKNTRACE_FUNC_ENTER |
|
8174 // Alignment set to right. |
8584 // Alignment set to right. |
8175 ConstructL( EHRightVCenter ); // creates label |
8585 ConstructL( EHRightVCenter ); // creates label |
8176 iCommandType = aReader.ReadUint8(); |
8586 iCommandType = aReader.ReadUint8(); |
8177 iCommandId = aReader.ReadInt16(); |
8587 iCommandId = aReader.ReadInt16(); |
8178 // iFullLabelText.Copy( aReader.ReadTPtrC() ); |
8588 // iFullLabelText.Copy( aReader.ReadTPtrC() ); |
8179 UpdateLabelText( aReader.ReadTPtrC() ); |
8589 UpdateLabelText( aReader.ReadTPtrC() ); |
8180 |
8590 |
8181 aReader.ReadTPtrC(); // bmp filename |
8591 aReader.ReadTPtrC(); // bmp filename |
8182 aReader.ReadInt16(); // bmp id |
8592 aReader.ReadInt16(); // bmp id |
8183 aReader.ReadInt16(); // bmp mask id |
8593 aReader.ReadInt16(); // bmp mask id |
8594 _AKNTRACE_FUNC_EXIT; |
|
8184 } |
8595 } |
8185 #else |
8596 #else |
8186 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&) |
8597 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&) |
8187 { |
8598 { |
8599 _AKNTRACE_FUNC_ENTER; |
|
8600 _AKNTRACE_FUNC_EXIT; |
|
8188 } |
8601 } |
8189 #endif // RD_ENHANCED_CBA |
8602 #endif // RD_ENHANCED_CBA |
8190 |
8603 |
8191 // ----------------------------------------------------------------------------- |
8604 // ----------------------------------------------------------------------------- |
8192 // Constructs empty button with id EAknSoftkeyEmpty |
8605 // Constructs empty button with id EAknSoftkeyEmpty |
8193 // ----------------------------------------------------------------------------- |
8606 // ----------------------------------------------------------------------------- |
8194 void CEikEnhancedCbaButton::ConstructEmptyButtonL() |
8607 void CEikEnhancedCbaButton::ConstructEmptyButtonL() |
8195 { |
8608 { |
8609 _AKNTRACE_FUNC_ENTER; |
|
8610 _AKNTRACE_FUNC_EXIT; |
|
8196 #ifdef RD_ENHANCED_CBA |
8611 #ifdef RD_ENHANCED_CBA |
8197 ConstructL( EHRightVCenter ); // creates label |
8612 ConstructL( EHRightVCenter ); // creates label |
8198 iCommandType = EEikCommandTypeAnyCommand; |
8613 iCommandType = EEikCommandTypeAnyCommand; |
8199 iCommandId = EAknSoftkeyEmpty; |
8614 iCommandId = EAknSoftkeyEmpty; |
8200 _LIT(KEmptyText, ""); |
8615 _LIT(KEmptyText, ""); |
8207 // Used to get the label's text for the button |
8622 // Used to get the label's text for the button |
8208 // @return TPtrC label text |
8623 // @return TPtrC label text |
8209 // ----------------------------------------------------------------------------- |
8624 // ----------------------------------------------------------------------------- |
8210 TPtrC* CEikEnhancedCbaButton::LabelText() |
8625 TPtrC* CEikEnhancedCbaButton::LabelText() |
8211 { |
8626 { |
8627 _AKNTRACE_FUNC_ENTER; |
|
8628 _AKNTRACE_FUNC_EXIT; |
|
8212 #ifdef RD_ENHANCED_CBA |
8629 #ifdef RD_ENHANCED_CBA |
8213 return &iLongLabelText; |
8630 return &iLongLabelText; |
8214 #else |
8631 #else |
8215 return NULL; |
8632 return NULL; |
8216 #endif |
8633 #endif |
8220 // CEikCommandTable |
8637 // CEikCommandTable |
8221 // |
8638 // |
8222 |
8639 |
8223 CEikCommandTable* CEikCommandTable::NewL() |
8640 CEikCommandTable* CEikCommandTable::NewL() |
8224 { |
8641 { |
8642 _AKNTRACE_FUNC_ENTER; |
|
8643 _AKNTRACE_FUNC_EXIT; |
|
8225 #ifdef RD_ENHANCED_CBA |
8644 #ifdef RD_ENHANCED_CBA |
8226 CEikCommandTable* self = CEikCommandTable::NewLC(); |
8645 CEikCommandTable* self = CEikCommandTable::NewLC(); |
8227 CleanupStack::Pop( self ); |
8646 CleanupStack::Pop( self ); |
8228 return self; |
8647 return self; |
8229 #else |
8648 #else |
8231 #endif |
8650 #endif |
8232 } |
8651 } |
8233 |
8652 |
8234 CEikCommandTable* CEikCommandTable::NewLC() |
8653 CEikCommandTable* CEikCommandTable::NewLC() |
8235 { |
8654 { |
8655 _AKNTRACE_FUNC_ENTER; |
|
8656 _AKNTRACE_FUNC_EXIT; |
|
8236 #ifdef RD_ENHANCED_CBA |
8657 #ifdef RD_ENHANCED_CBA |
8237 CEikCommandTable* self = new (ELeave) CEikCommandTable; |
8658 CEikCommandTable* self = new (ELeave) CEikCommandTable; |
8238 CleanupStack::PushL( self ); |
8659 CleanupStack::PushL( self ); |
8239 self->ConstructL(); |
8660 self->ConstructL(); |
8240 return self; |
8661 return self; |
8247 // Construction for command table |
8668 // Construction for command table |
8248 // priority configuration is read from the resource file |
8669 // priority configuration is read from the resource file |
8249 // ----------------------------------------------------------------------------- |
8670 // ----------------------------------------------------------------------------- |
8250 void CEikCommandTable::ConstructL() |
8671 void CEikCommandTable::ConstructL() |
8251 { |
8672 { |
8673 _AKNTRACE_FUNC_ENTER; |
|
8252 #ifdef RD_ENHANCED_CBA |
8674 #ifdef RD_ENHANCED_CBA |
8253 // Get the cba priority configuration |
8675 // Get the cba priority configuration |
8254 TResourceReader reader; |
8676 TResourceReader reader; |
8255 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_EIK_CBA_PRIORITIES ); |
8677 CCoeEnv::Static()->CreateResourceReaderLC( reader, R_EIK_CBA_PRIORITIES ); |
8256 |
8678 |
8272 iPriorities.Append( arr ); |
8694 iPriorities.Append( arr ); |
8273 } |
8695 } |
8274 |
8696 |
8275 CleanupStack::PopAndDestroy(); // reader |
8697 CleanupStack::PopAndDestroy(); // reader |
8276 #endif |
8698 #endif |
8699 _AKNTRACE_FUNC_EXIT; |
|
8277 } |
8700 } |
8278 |
8701 |
8279 #ifdef RD_ENHANCED_CBA |
8702 #ifdef RD_ENHANCED_CBA |
8280 CEikCommandTable::CEikCommandTable() : iPriorities(1) |
8703 CEikCommandTable::CEikCommandTable() : iPriorities(1) |
8281 #else |
8704 #else |
8285 } |
8708 } |
8286 |
8709 |
8287 |
8710 |
8288 CEikCommandTable::~CEikCommandTable() |
8711 CEikCommandTable::~CEikCommandTable() |
8289 { |
8712 { |
8713 _AKNTRACE_FUNC_ENTER; |
|
8290 #ifdef RD_ENHANCED_CBA |
8714 #ifdef RD_ENHANCED_CBA |
8291 iCommandButtons.Reset(); // Reset array |
8715 iCommandButtons.Reset(); // Reset array |
8292 for(TInt i = 0; i < iPriorities.Count(); i++) |
8716 for(TInt i = 0; i < iPriorities.Count(); i++) |
8293 { |
8717 { |
8294 iPriorities[i].Reset(); |
8718 iPriorities[i].Reset(); |
8295 } |
8719 } |
8296 iPriorities.Reset(); |
8720 iPriorities.Reset(); |
8297 #endif |
8721 #endif |
8722 _AKNTRACE_FUNC_EXIT; |
|
8298 } |
8723 } |
8299 |
8724 |
8300 // ----------------------------------------------------------------------------- |
8725 // ----------------------------------------------------------------------------- |
8301 // Used to add a command to CommandTable |
8726 // Used to add a command to CommandTable |
8302 // @param aButton button to be added |
8727 // @param aButton button to be added |
8303 // ----------------------------------------------------------------------------- |
8728 // ----------------------------------------------------------------------------- |
8304 #ifndef RD_ENHANCED_CBA |
8729 #ifndef RD_ENHANCED_CBA |
8305 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) |
8730 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) |
8306 { |
8731 { |
8732 _AKNTRACE_FUNC_ENTER; |
|
8733 _AKNTRACE_FUNC_EXIT; |
|
8307 return KErrNone; |
8734 return KErrNone; |
8308 } |
8735 } |
8309 #else |
8736 #else |
8310 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) |
8737 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) |
8311 { |
8738 { |
8739 _AKNTRACE_FUNC_ENTER; |
|
8312 // CommandType tells in which button this command should be placed |
8740 // CommandType tells in which button this command should be placed |
8313 TInt commandType( aButton->CommandType() ); |
8741 TInt commandType( aButton->CommandType() ); |
8314 TInt index( KErrNotFound ); |
8742 TInt index( KErrNotFound ); |
8315 |
8743 |
8316 // Find button and index for this button. |
8744 // Find button and index for this button. |
8347 if( button == iPriorities.Count() ) |
8775 if( button == iPriorities.Count() ) |
8348 { |
8776 { |
8349 delete aButton; |
8777 delete aButton; |
8350 aButton = NULL; |
8778 aButton = NULL; |
8351 } |
8779 } |
8780 _AKNTRACE_FUNC_EXIT; |
|
8352 return KErrNone; |
8781 return KErrNone; |
8353 } |
8782 } |
8354 #endif // RD_ENHANCED_CBA |
8783 #endif // RD_ENHANCED_CBA |
8355 |
8784 |
8356 // ----------------------------------------------------------------------------- |
8785 // ----------------------------------------------------------------------------- |
8358 // @param aCommandId Id to be checked. |
8787 // @param aCommandId Id to be checked. |
8359 // ----------------------------------------------------------------------------- |
8788 // ----------------------------------------------------------------------------- |
8360 #ifndef RD_ENHANCED_CBA |
8789 #ifndef RD_ENHANCED_CBA |
8361 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const |
8790 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const |
8362 { |
8791 { |
8792 _AKNTRACE_FUNC_ENTER; |
|
8363 #else // !RD_ENHANCED_CBA |
8793 #else // !RD_ENHANCED_CBA |
8364 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const |
8794 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const |
8365 { |
8795 { |
8796 _AKNTRACE_FUNC_ENTER; |
|
8366 TInt count( iCommandButtons.Count() ); |
8797 TInt count( iCommandButtons.Count() ); |
8367 |
8798 |
8368 for ( TInt i = 0; i < count; i++ ) |
8799 for ( TInt i = 0; i < count; i++ ) |
8369 { |
8800 { |
8370 if ( iCommandButtons[i] ) |
8801 if ( iCommandButtons[i] ) |
8371 { |
8802 { |
8372 if ( iCommandButtons[i]->CommandId() == aCommandId ) |
8803 if ( iCommandButtons[i]->CommandId() == aCommandId ) |
8373 { |
8804 { |
8805 _AKNTRACE_FUNC_EXIT; |
|
8374 return ETrue; |
8806 return ETrue; |
8375 } |
8807 } |
8376 } |
8808 } |
8377 } |
8809 } |
8378 #endif // RD_ENHANCED_CBA |
8810 #endif // RD_ENHANCED_CBA |
8811 _AKNTRACE_FUNC_EXIT; |
|
8379 return EFalse; // if no match for command id |
8812 return EFalse; // if no match for command id |
8380 } |
8813 } |
8381 |
8814 |
8382 // ----------------------------------------------------------------------------- |
8815 // ----------------------------------------------------------------------------- |
8383 // Used to replace command with a new command. |
8816 // Used to replace command with a new command. |
8385 // @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the CommandTable. |
8818 // @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the CommandTable. |
8386 // ----------------------------------------------------------------------------- |
8819 // ----------------------------------------------------------------------------- |
8387 #ifndef RD_ENHANCED_CBA |
8820 #ifndef RD_ENHANCED_CBA |
8388 void CEikCommandTable::ReplaceCommandL( const TInt /*aCommandId*/, const TInt /*aResourceId*/ ) |
8821 void CEikCommandTable::ReplaceCommandL( const TInt /*aCommandId*/, const TInt /*aResourceId*/ ) |
8389 { |
8822 { |
8823 _AKNTRACE_FUNC_ENTER; |
|
8390 #else // !RD_ENHANCED_CBA |
8824 #else // !RD_ENHANCED_CBA |
8391 void CEikCommandTable::ReplaceCommandL( const TInt aCommandId, const TInt aResourceId ) |
8825 void CEikCommandTable::ReplaceCommandL( const TInt aCommandId, const TInt aResourceId ) |
8392 { |
8826 { |
8827 _AKNTRACE_FUNC_ENTER; |
|
8393 // If the command is not in the command table, return. |
8828 // If the command is not in the command table, return. |
8394 if( !IsCommandPlaced( aCommandId ) ) |
8829 if( !IsCommandPlaced( aCommandId ) ) |
8395 { |
8830 { |
8831 _AKNTRACE_FUNC_EXIT; |
|
8396 return; |
8832 return; |
8397 } |
8833 } |
8398 |
8834 |
8399 TInt index( iCommandButtons.Count() ); |
8835 TInt index( iCommandButtons.Count() ); |
8400 |
8836 |
8429 iCommandButtons[index] = button; // transfers ownership |
8865 iCommandButtons[index] = button; // transfers ownership |
8430 |
8866 |
8431 // Delete old button. |
8867 // Delete old button. |
8432 delete oldButton; |
8868 delete oldButton; |
8433 #endif // !RD_ENHANCED_CBA |
8869 #endif // !RD_ENHANCED_CBA |
8870 _AKNTRACE_FUNC_EXIT; |
|
8434 } |
8871 } |
8435 |
8872 |
8436 // ----------------------------------------------------------------------------- |
8873 // ----------------------------------------------------------------------------- |
8437 // Used to get CEikEnhancedCbaButton for current control button (1-4). |
8874 // Used to get CEikEnhancedCbaButton for current control button (1-4). |
8438 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions. |
8875 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions. |
8439 // @return CEikCbaButton for current position, NULL if no button placed in that position. |
8876 // @return CEikCbaButton for current position, NULL if no button placed in that position. |
8440 // ----------------------------------------------------------------------------- |
8877 // ----------------------------------------------------------------------------- |
8441 #ifdef RD_ENHANCED_CBA |
8878 #ifdef RD_ENHANCED_CBA |
8442 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex ) |
8879 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex ) |
8443 { |
8880 { |
8881 _AKNTRACE_FUNC_ENTER; |
|
8882 _AKNTRACE_FUNC_EXIT; |
|
8444 return iCommandButtons[aCommandIndex]; |
8883 return iCommandButtons[aCommandIndex]; |
8445 } |
8884 } |
8446 #else // RD_ENHANCED_CBA |
8885 #else // RD_ENHANCED_CBA |
8447 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ ) |
8886 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ ) |
8448 { |
8887 { |
8888 _AKNTRACE_FUNC_ENTER; |
|
8889 _AKNTRACE_FUNC_EXIT; |
|
8449 return NULL; |
8890 return NULL; |
8450 } |
8891 } |
8451 #endif // RD_ENHANCED_CBA |
8892 #endif // RD_ENHANCED_CBA |
8452 |
8893 |
8453 // ----------------------------------------------------------------------------- |
8894 // ----------------------------------------------------------------------------- |
8454 // Reset CommandTable |
8895 // Reset CommandTable |
8455 // ----------------------------------------------------------------------------- |
8896 // ----------------------------------------------------------------------------- |
8456 void CEikCommandTable::Reset() |
8897 void CEikCommandTable::Reset() |
8457 { |
8898 { |
8899 _AKNTRACE_FUNC_ENTER; |
|
8900 _AKNTRACE_FUNC_EXIT; |
|
8458 #ifdef RD_ENHANCED_CBA |
8901 #ifdef RD_ENHANCED_CBA |
8459 iCommandButtons.Reset(); |
8902 iCommandButtons.Reset(); |
8460 #endif // RD_ENHANCED_CBA |
8903 #endif // RD_ENHANCED_CBA |
8461 } |
8904 } |
8462 |
8905 |
8465 // ----------------------------------------------------------------------------- |
8908 // ----------------------------------------------------------------------------- |
8466 EXPORT_C void AknCbaContentObserver::SetContentObserver( |
8909 EXPORT_C void AknCbaContentObserver::SetContentObserver( |
8467 CEikCba* aCba, |
8910 CEikCba* aCba, |
8468 TCallBack aCallBack ) |
8911 TCallBack aCallBack ) |
8469 { |
8912 { |
8913 _AKNTRACE_FUNC_ENTER; |
|
8470 if ( aCba ) |
8914 if ( aCba ) |
8471 { |
8915 { |
8472 aCba->SetContentObserver( aCallBack ); |
8916 aCba->SetContentObserver( aCallBack ); |
8473 } |
8917 } |
8918 _AKNTRACE_FUNC_EXIT; |
|
8474 } |
8919 } |
8475 |
8920 |
8476 // End of file |
8921 // End of file |