uifw/EikStd/coctlsrc/eikcba.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 18 fcdfafb36fe7
child 20 d48ab3b357f1
equal deleted inserted replaced
18:fcdfafb36fe7 19:aecbbf00d063
     1 /*
     1 /*
     2 * Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 #include <eiklabel.h>
    24 #include <eiklabel.h>
    25 #include <eiksoftkeyimage.h>
    25 #include <eiksoftkeyimage.h>
    26 #include <eiksoftkeypostingtransparency.h>
    26 #include <eiksoftkeypostingtransparency.h>
    27 #include <eikbtgpc.h>
    27 #include <eikbtgpc.h>
    28 #include <aknappui.h>
    28 #include <aknappui.h>
    29 #include <eikappui.h>
       
    30 #include <eikapp.h>
       
    31 #include <AknUtils.h> // LayoutUtils
    29 #include <AknUtils.h> // LayoutUtils
    32 #include <aknlayoutscalable_apps.cdl.h>
    30 #include <aknlayoutscalable_apps.cdl.h>
    33 #include <AknsBasicBackgroundControlContext.h>
    31 #include <AknsBasicBackgroundControlContext.h>
    34 #include <AknsMaskedLayerBackgroundControlContext.h>
    32 #include <AknsMaskedLayerBackgroundControlContext.h>
    35 #include <AknsDrawUtils.h>
    33 #include <AknsDrawUtils.h>
    54 #include <AknTasHook.h>
    52 #include <AknTasHook.h>
    55 #include <akncbacontentobserver.h>
    53 #include <akncbacontentobserver.h>
    56 #include <aknitemactionmenu.h>
    54 #include <aknitemactionmenu.h>
    57 #include "akncollectionobserver.h"
    55 #include "akncollectionobserver.h"
    58 #include "aknitemactionmenuregister.h"
    56 #include "aknitemactionmenuregister.h"
    59 #include "aknmarkingmode.h"
    57 
    60 #include "akntrace.h"
       
    61 /**
    58 /**
    62  * Color value for transparent pixel (ARGB format).
    59  * Color value for transparent pixel (ARGB format).
    63  */
    60  */
    64 const TUint32 KAknCbaColorKey = 0x00000000;
    61 const TUint32 KAknCbaColorKey = 0x00000000;
    65 
    62 
    75 #include <touchfeedback.h>
    72 #include <touchfeedback.h>
    76 
    73 
    77 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, 
    74 inline TAknWindowComponentLayout DoCompose(TAknWindowComponentLayout aLine1, 
    78     TAknWindowComponentLayout aLine2) 
    75     TAknWindowComponentLayout aLine2) 
    79     { 
    76     { 
    80     _AKNTRACE_FUNC_ENTER;
       
    81     _AKNTRACE_FUNC_EXIT;
       
    82     return TAknWindowComponentLayout::Compose(aLine1, aLine2); 
    77     return TAknWindowComponentLayout::Compose(aLine1, aLine2); 
    83     }
    78     }
    84 
    79 
    85 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, 
    80 inline TAknTextComponentLayout DoComposeText(TAknWindowComponentLayout aLine1, 
    86     TAknTextComponentLayout aLine2) 
    81     TAknTextComponentLayout aLine2) 
    87     { 
    82     { 
    88     _AKNTRACE_FUNC_ENTER;
       
    89     _AKNTRACE_FUNC_EXIT;
       
    90     return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); 
    83     return TAknWindowComponentLayout::ComposeText(aLine1, aLine2); 
    91     }
    84     }
    92     
    85     
    93 /**
    86 /**
    94 * Checks if right side pane is active.
    87 * Checks if right side pane is active.
    95 * @return ETrue if right side pane is active, EFalse otherwise.
    88 * @return ETrue if right side pane is active, EFalse otherwise.
    96 */
    89 */
    97 static TBool IsAreaSideRightPaneActive()
    90 static TBool IsAreaSideRightPaneActive()
    98     {
    91     {
    99     _AKNTRACE_FUNC_ENTER;
       
   100     _AKNTRACE_FUNC_EXIT;
       
   101     return EFalse;
    92     return EFalse;
   102     }
    93     }
   103 
    94 
   104 
    95 
   105 /**
    96 /**
   106 * Checks if MSK-enabled layout is in use.
    97 * Checks if MSK-enabled layout is in use.
   107 */
    98 */
   108 static TBool IsMskEnabledLayoutActive()
    99 static TBool IsMskEnabledLayoutActive()
   109     {
   100     {
   110     _AKNTRACE_FUNC_ENTER;
       
   111     TBool result( EFalse );
   101     TBool result( EFalse );
   112     
   102     
   113     if ( Layout_Meta_Data::IsMSKEnabled() )
   103     if ( Layout_Meta_Data::IsMSKEnabled() )
   114         {
   104         {
   115         // First check if MSK is enabled in the layout metadata.
   105         // First check if MSK is enabled in the layout metadata.
   131             // these status pane layouts an exception is made.
   121             // these status pane layouts an exception is made.
   132             result = ETrue;
   122             result = ETrue;
   133             }
   123             }
   134         }
   124         }
   135     
   125     
   136     _AKNTRACE_FUNC_EXIT;
       
   137     return result;
   126     return result;
   138     }
   127     }
   139 
   128 
   140 
   129 
   141 /*
   130 /*
   142  * Checks if bitmap must be updated, i.e. bitmap does not exist or 
   131  * Checks if bitmap must be updated, i.e. bitmap does not exist or 
   143  * expected size does not match with actual size.
   132  * expected size does not match with actual size.
   144  */
   133  */
   145 static TBool IsBitmapUpdateNeeded( CFbsBitmap* aOldBitmap, const TSize& aSize )
   134 static TBool IsBitmapUpdateNeeded( CFbsBitmap* aOldBitmap, const TSize& aSize )
   146     {
   135     {
   147     _AKNTRACE_FUNC_ENTER;
       
   148     _AKNTRACE_FUNC_EXIT;
       
   149     return !aOldBitmap || ( aOldBitmap->SizeInPixels() != aSize );
   136     return !aOldBitmap || ( aOldBitmap->SizeInPixels() != aSize );
   150     }
   137     }
   151 
   138 
   152 
   139 
   153 /**
   140 /**
   212     ECbaParentAsControl, // cba's parent window group is treated as CCoeControl
   199     ECbaParentAsControl, // cba's parent window group is treated as CCoeControl
   213     ECbaActivationDelayed, // activation delayed
   200     ECbaActivationDelayed, // activation delayed
   214     ECbaSingleClickEnabled, // single click enabled in appUi
   201     ECbaSingleClickEnabled, // single click enabled in appUi
   215     ECbaItemSoftkeyDisabled, // item specific softkey disabled
   202     ECbaItemSoftkeyDisabled, // item specific softkey disabled
   216     ECbaItemSpecificSoftkeyInUse, // item specific softkey is in use
   203     ECbaItemSpecificSoftkeyInUse, // item specific softkey is in use
   217     ECbaItemSoftkeyDisabledByClient, // client has disabled item specific softkey
   204     ECbaItemSoftkeyDisabledByClient // client has disabled item specific softkey
   218     ECbaMultipleMarkingActive, // multiple marking has changed RSK
       
   219     ECbaCombinePaneUncovered, // The combine pane in status pane is invisible.
       
   220     ECbaKeepItemSoftkeyVisible // No auto hide for item specific commands
       
   221     };
   205     };
   222 
   206 
   223 enum TCbaLayers
   207 enum TCbaLayers
   224     {
   208     {
   225     ECbaLayerWallpaper,
   209     ECbaLayerWallpaper,
   252                                           iCbaBgIIDSetExt( EFalse )
   236                                           iCbaBgIIDSetExt( EFalse )
   253                                           ,iLeftFrameMask( NULL ),
   237                                           ,iLeftFrameMask( NULL ),
   254                                           iRightFrameMask( NULL ),
   238                                           iRightFrameMask( NULL ),
   255                                           iItemActionMenu( NULL )
   239                                           iItemActionMenu( NULL )
   256         {
   240         {
   257         _AKNTRACE_FUNC_ENTER;
       
   258         _AKNTRACE_FUNC_EXIT;
       
   259         };
   241         };
   260     
   242     
   261     static CEikCbaExtension* NewL( CEikCba& aOwner )
   243     static CEikCbaExtension* NewL( CEikCba& aOwner )
   262         {
   244         {
   263         _AKNTRACE_FUNC_ENTER;
       
   264         CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner );
   245         CEikCbaExtension* self = new (ELeave) CEikCbaExtension( aOwner );
   265         CleanupStack::PushL( self );
   246         CleanupStack::PushL( self );
   266         self->ConstructL();
   247         self->ConstructL();
   267         CleanupStack::Pop( self );
   248         CleanupStack::Pop( self );
   268         _AKNTRACE_FUNC_EXIT;
       
   269         return self;
   249         return self;
   270         }
   250         }
   271     
   251     
   272     void ConstructL() 
   252     void ConstructL() 
   273         {
   253         {
   274         _AKNTRACE_FUNC_ENTER;
       
   275         // Wallpaper is not drawn by embedded CBA.
   254         // Wallpaper is not drawn by embedded CBA.
   276         if ( !iOwner.Flags().IsSet( ECbaEmbedded ) )
   255         if ( !iOwner.Flags().IsSet( ECbaEmbedded ) )
   277             {
   256             {
   278             iRepository = CRepository::NewL( KCRUidPersonalisation );
   257             iRepository = CRepository::NewL( KCRUidPersonalisation );
   279             iRepository->Get( KPslnWallpaperType, iWallpaperInUse );
   258             iRepository->Get( KPslnWallpaperType, iWallpaperInUse );
   287         
   266         
   288         iBackgroundMaskID = KAknsIIDNone;
   267         iBackgroundMaskID = KAknsIIDNone;
   289         iCbaRect = TRect( 0,0,0,0 );
   268         iCbaRect = TRect( 0,0,0,0 );
   290         iIfSkinChanged = EFalse;
   269         iIfSkinChanged = EFalse;
   291         iIfMskIconSet = EFalse;
   270         iIfMskIconSet = EFalse;
       
   271         iSemiBgID = KAknsIIDNone;
   292 
   272 
   293         if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) )
   273         if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) )
   294             {
   274             {
   295             AknItemActionMenuRegister::RegisterCollectionObserverL(
   275             AknItemActionMenuRegister::RegisterCollectionObserverL(
   296                     *this );
   276                     *this );
   297             }
   277             }
   298         _AKNTRACE_FUNC_EXIT;
       
   299         }
   278         }
   300     
   279     
   301     ~CEikCbaExtension() 
   280     ~CEikCbaExtension() 
   302         {
   281         {
   303         _AKNTRACE_FUNC_ENTER;
       
   304         if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) )
   282         if ( iOwner.Flags().IsSet( ECbaSingleClickEnabled ) )
   305             {
   283             {
   306             AknItemActionMenuRegister::UnregisterCollectionObserver( *this );
   284             AknItemActionMenuRegister::UnregisterCollectionObserver( *this );
   307             }
   285             }
   308         if ( iCRListener )
   286         if ( iCRListener )
   316         delete iLeftFrameMask;
   294         delete iLeftFrameMask;
   317         delete iRightFrameMask;    
   295         delete iRightFrameMask;    
   318         delete iLskPostingOverlayBitmap;
   296         delete iLskPostingOverlayBitmap;
   319         delete iRskPostingOverlayBitmap;
   297         delete iRskPostingOverlayBitmap;
   320         delete iBmpFile;
   298         delete iBmpFile;
   321         _AKNTRACE_FUNC_EXIT;
       
   322         }
   299         }
   323     
   300     
   324     /** From base class MCenRepNotifyHandlerCallback */
   301     /** From base class MCenRepNotifyHandlerCallback */
   325     void HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue )
   302     void HandleNotifyInt( TUint32 /*aId*/, TInt aNewValue )
   326         {
   303         {
   327         _AKNTRACE_FUNC_ENTER;
       
   328         iWallpaperInUse = aNewValue;
   304         iWallpaperInUse = aNewValue;
   329         iOwner.SetSkinBackgroundId( KAknsIIDNone );
   305         iOwner.SetSkinBackgroundId( KAknsIIDNone );
   330         _AKNTRACE_FUNC_EXIT;
       
   331         }
   306         }
   332         
   307         
   333     void UpdateSoftkeyFrameL( TBool aForcedUpdate )
   308     void UpdateSoftkeyFrameL( TBool aForcedUpdate )
   334         {
   309         {
   335         _AKNTRACE_FUNC_ENTER;
       
   336         if ( !AknLayoutUtils::PenEnabled() )
   310         if ( !AknLayoutUtils::PenEnabled() )
   337             {
   311             {
   338             _AKNTRACE_FUNC_EXIT;
       
   339             return;
   312             return;
   340             }
   313             }
   341         TAknLayoutRect cbarect;
   314         TAknLayoutRect cbarect;
   342         
   315         
   343         TRect screen;
   316         TRect screen;
   463         
   436         
   464         iUpdateFrameOuterRect = outerRect;
   437         iUpdateFrameOuterRect = outerRect;
   465         iUpdateFrameInnerRect = innerRect;
   438         iUpdateFrameInnerRect = innerRect;
   466         iUpdateMSKFrameOuterRect = mskOuterRect;
   439         iUpdateMSKFrameOuterRect = mskOuterRect;
   467         iUpdateMskFrameInnerRect = mskInnerRect;
   440         iUpdateMskFrameInnerRect = mskInnerRect;
   468         _AKNTRACE_FUNC_EXIT;
       
   469         }
   441         }
   470 
   442 
   471 
   443 
   472 
   444 
   473 
   445 
   478      * @param aMask mask to be merged.
   450      * @param aMask mask to be merged.
   479      * @param aDestBitmap bitmap to merge mask with.
   451      * @param aDestBitmap bitmap to merge mask with.
   480      */
   452      */
   481     static void MergeMaskInto16MA( CFbsBitmap* aMask, CFbsBitmap* aDestBitmap )
   453     static void MergeMaskInto16MA( CFbsBitmap* aMask, CFbsBitmap* aDestBitmap )
   482         {
   454         {
   483         _AKNTRACE_FUNC_ENTER;
       
   484         // aMask display mode must be EGray256.
   455         // aMask display mode must be EGray256.
   485         // aMask must not be compressed in RAM.
   456         // aMask must not be compressed in RAM.
   486         // aDestBitmap display mode must be EColor16MA.
   457         // aDestBitmap display mode must be EColor16MA.
   487         // aDestBitmap must not be compressed in RAM.
   458         // aDestBitmap must not be compressed in RAM.
   488         // aMask size must equal to aDestBitmap size.
   459         // aMask size must equal to aDestBitmap size.
   516                     }
   487                     }
   517                 }
   488                 }
   518             }
   489             }
   519         aDestBitmap->UnlockHeap();
   490         aDestBitmap->UnlockHeap();
   520         aMask->UnlockHeap();
   491         aMask->UnlockHeap();
   521         _AKNTRACE_FUNC_EXIT;
       
   522         }
   492         }
   523 
   493 
   524     /**
   494     /**
   525      * Updates posting overlay bitmap.
   495      * Updates posting overlay bitmap.
   526      * @internal
   496      * @internal
   533     void UpdatePostingOverlayBitmapL(
   503     void UpdatePostingOverlayBitmapL(
   534             CFbsBitmap*& aBitmap,
   504             CFbsBitmap*& aBitmap,
   535             const TRect& aRect,
   505             const TRect& aRect,
   536             CEikCbaButton* aButton )
   506             CEikCbaButton* aButton )
   537         {
   507         {
   538         _AKNTRACE_FUNC_ENTER;
       
   539         delete aBitmap;
   508         delete aBitmap;
   540         aBitmap = NULL;
   509         aBitmap = NULL;
   541 
   510 
   542         // If you modify this method, please make sure that assumptions
   511         // If you modify this method, please make sure that assumptions
   543         // mentioned in MergeMaskInto16MA still hold.
   512         // mentioned in MergeMaskInto16MA still hold.
   587             }
   556             }
   588 
   557 
   589         CleanupStack::PopAndDestroy( 2, bitmapDevice );
   558         CleanupStack::PopAndDestroy( 2, bitmapDevice );
   590         CleanupStack::Pop( bitmap );
   559         CleanupStack::Pop( bitmap );
   591         aBitmap = bitmap;
   560         aBitmap = bitmap;
   592         _AKNTRACE_FUNC_EXIT;
       
   593         }
   561         }
   594     
   562     
   595     /**
   563     /**
   596      * Updates posting overlay bitmaps.
   564      * Updates posting overlay bitmaps.
   597      * @param aCbaRect cba rect.
   565      * @param aCbaRect cba rect.
   602             const TRect& aCbaRect,
   570             const TRect& aCbaRect,
   603             CEikCbaButton* aLeftButton,
   571             CEikCbaButton* aLeftButton,
   604             CEikCbaButton* aRightButton,
   572             CEikCbaButton* aRightButton,
   605             TInt aAknLayoutFlags )
   573             TInt aAknLayoutFlags )
   606         {
   574         {
   607         _AKNTRACE_FUNC_ENTER;
       
   608         TRect rightSoftKeyButtonRect;
   575         TRect rightSoftKeyButtonRect;
   609         TRect leftSoftKeyButtonRect;
   576         TRect leftSoftKeyButtonRect;
   610         if( aAknLayoutFlags & EAknLayoutCbaInRightPane )
   577         if( aAknLayoutFlags & EAknLayoutCbaInRightPane )
   611             {
   578             {
   612         // Read right (top in landscape) softkey layout.      
   579         // Read right (top in landscape) softkey layout.      
   715                 aLeftButton );
   682                 aLeftButton );
   716         UpdatePostingOverlayBitmapL(
   683         UpdatePostingOverlayBitmapL(
   717                 iRskPostingOverlayBitmap,
   684                 iRskPostingOverlayBitmap,
   718                 rightSoftKeyButtonRect,
   685                 rightSoftKeyButtonRect,
   719                 aRightButton );
   686                 aRightButton );
   720         _AKNTRACE_FUNC_EXIT;
       
   721         }
       
   722 
       
   723     /**
       
   724      * Returns ETrue if the command cancels multiple marking and should not
       
   725      * be forwarded to actual command observer.
       
   726      * 
       
   727      * @return ETrue if multiple marking was cancelled.
       
   728      */
       
   729     TBool CancelMultipleMarking( TInt aCommandId )
       
   730         {
       
   731         _AKNTRACE_FUNC_ENTER;
       
   732         TBool cancelled( EFalse );
       
   733         if ( aCommandId == EAknSoftkeyCancel
       
   734                 && iItemActionMenu
       
   735                 && iOwner.Flags().IsSet( ECbaMultipleMarkingActive ) )
       
   736             {
       
   737             iItemActionMenu->MarkingMode().SetCollectionMultipleMarkingState(
       
   738                     EFalse );
       
   739             cancelled = ETrue;
       
   740             }
       
   741         _AKNTRACE_FUNC_EXIT;
       
   742         return cancelled;
       
   743         }
   687         }
   744 
   688 
   745     /**
   689     /**
   746      * From MAknCollectionObserver.
   690      * From MAknCollectionObserver.
   747      * This method is used to set the item action menu to observer.
   691      * This method is used to set the item action menu to observer.
   748      * 
   692      * 
   749      * @param aItemActionMenu Item action menu. 
   693      * @param aItemActionMenu Item action menu. 
   750      */
   694      */
   751     void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu )
   695     void SetItemActionMenu( CAknItemActionMenu* aItemActionMenu )
   752         {
   696         {
   753         _AKNTRACE_FUNC_ENTER;
       
   754         iItemActionMenu = aItemActionMenu;
   697         iItemActionMenu = aItemActionMenu;
   755         _AKNTRACE_FUNC_EXIT;
       
   756         }
   698         }
   757 
   699 
   758     /**
   700     /**
   759      * From MAknCollectionObserver.
   701      * From MAknCollectionObserver.
   760      * This method is called when there are changes in collection state.
   702      * This method is called when there are changes in collection state.
   762      * 
   704      * 
   763      * @param aCollectionVisible ETrue if changed collection is visible.
   705      * @param aCollectionVisible ETrue if changed collection is visible.
   764      */
   706      */
   765     void CollectionChanged( TBool aCollectionVisible )
   707     void CollectionChanged( TBool aCollectionVisible )
   766         {
   708         {
   767         _AKNTRACE_FUNC_ENTER;
       
   768         // Do not update state if invisible collection tries to enable sk
   709         // Do not update state if invisible collection tries to enable sk
   769         if ( aCollectionVisible
   710         if ( aCollectionVisible
   770                 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) )
   711                 || iOwner.Flags().IsClear( ECbaItemSoftkeyDisabled ) )
   771             {
   712             {
   772             iOwner.UpdateItemSpecificSoftkey();
   713             iOwner.UpdateItemSpecificSoftkey();
   773             }
   714             }
   774 
       
   775         iOwner.UpdateMultipleMarkingSoftkey();
       
   776         _AKNTRACE_FUNC_EXIT;
       
   777         }
   715         }
   778 
   716 
   779     /**
   717     /**
   780      * From MAknCollectionObserver.
   718      * From MAknCollectionObserver.
   781      * This method returns ETrue if collection observer is active.
   719      * This method returns ETrue if collection observer is active.
   782      * 
   720      * 
   783      * @return ETrue if observer is active.
   721      * @return ETrue if observer is active.
   784      */
   722      */
   785     TBool Active() const
   723     TBool Active() const
   786         {
   724         {
   787         _AKNTRACE_FUNC_ENTER;
       
   788         _AKNTRACE_FUNC_EXIT;
       
   789         return iOwner.IsVisible() && !iOwner.IsEmpty();
   725         return iOwner.IsVisible() && !iOwner.IsEmpty();
   790         }
   726         }
   791     
   727     
   792     /*
   728     /*
   793      * Using the special theme Id draw background
   729      * Using the special theme Id draw background
   794      */
   730      */
   795     void DrawSemiTransparency( CWindowGc& aGc )
   731     void DrawSemiTransparencyL(CWindowGc& aGc, 
   796         {
   732             const TRect& aRect)
   797         _AKNTRACE_FUNC_ENTER;
   733     	{
   798         
   734     	//Temporary inner rectangal value
   799         TAknsItemID SemiButtonID              = KAknsIIDQgnFrSctrlSkButton;
   735     	TRect innerRect = aRect;
   800         TAknsItemID SemiButtonCenterID        = KAknsIIDQgnFrSctrlSkButtonCenter;
   736     	innerRect.Shrink( 5, 5 );
   801         TAknsItemID SemiButtonPressedID       = KAknsIIDQgnFrSctrlSkButtonPressed;
   737     	if ( iSemiBgID != KAknsIIDNone )
   802         TAknsItemID SemiButtonPressedCenterID = KAknsIIDQgnFrSctrlSkButtonCenterPressed;
   738 	        {
   803         
   739 	        AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), 
   804         CEikCbaButton* button1 = static_cast<CEikCbaButton*>
   740 	            aGc, aRect, innerRect, iSemiBgID, iSemiBgCenterID );
   805             (iOwner.Control(KControlArrayCBAButton1Posn));
   741 	        }
   806         CEikCbaButton* button2 = static_cast<CEikCbaButton*>
   742     	}
   807             (iOwner.Control(KControlArrayCBAButton2Posn));
   743 
   808 
       
   809         if (IsMskEnabledLayoutActive())
       
   810             {
       
   811             CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>
       
   812                 (iOwner.Control(KControlArrayCBAButtonMSKPosn));
       
   813 
       
   814             if (buttonMSK && buttonMSK->PressedDown())
       
   815                 {
       
   816                 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   817                         iMiddleFrameOuterRect,
       
   818                         iMiddleFrameInnerRect,
       
   819                         SemiButtonPressedID,
       
   820                         SemiButtonPressedCenterID);
       
   821                 }
       
   822             else
       
   823                 {
       
   824                 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   825                         iMiddleFrameOuterRect,
       
   826                         iMiddleFrameInnerRect,
       
   827                         SemiButtonID,
       
   828                         SemiButtonCenterID);
       
   829                 }
       
   830             }
       
   831 
       
   832         if (button1 && button1->PressedDown())
       
   833             {
       
   834             AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   835                     iLeftFrameOuterRect,
       
   836                     iLeftFrameInnerRect,
       
   837                     SemiButtonPressedID,
       
   838                     SemiButtonPressedCenterID);
       
   839             }
       
   840         else
       
   841             {
       
   842             AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   843                     iLeftFrameOuterRect,
       
   844                     iLeftFrameInnerRect,
       
   845                     SemiButtonID,
       
   846                     SemiButtonCenterID);
       
   847             }
       
   848 
       
   849         if (button2 && button2->PressedDown())
       
   850             {
       
   851             AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   852                     iRightFrameOuterRect,
       
   853                     iRightFrameInnerRect,
       
   854                     SemiButtonPressedID,
       
   855                     SemiButtonPressedCenterID);
       
   856             }
       
   857         else
       
   858             {
       
   859             AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), aGc,
       
   860                     iRightFrameOuterRect,
       
   861                     iRightFrameInnerRect,
       
   862                     SemiButtonID,
       
   863                     SemiButtonCenterID);
       
   864             }                    
       
   865         _AKNTRACE_FUNC_EXIT;
       
   866         }
       
   867 public:
   744 public:
   868     
   745     
   869     CEikCba&               iOwner;
   746     CEikCba&               iOwner;
   870     CRepository*           iRepository;
   747     CRepository*           iRepository;
   871     CCenRepNotifyHandler*  iCRListener;
   748     CCenRepNotifyHandler*  iCRListener;
   917     /**
   794     /**
   918      * Outer rect used in UpdateSoftkeyFrameL method.
   795      * Outer rect used in UpdateSoftkeyFrameL method.
   919      */
   796      */
   920     TRect iUpdateFrameOuterRect;
   797     TRect iUpdateFrameOuterRect;
   921     
   798     
       
   799     /*
       
   800      * Frame and center theme ID, using for semi-transparent  
       
   801      */
       
   802     TAknsItemID            iSemiBgID;
       
   803     TAknsItemID	           iSemiBgCenterID;
   922     /**
   804     /**
   923      * Inner rect used in UpdateSoftkeyFrameL method.
   805      * Inner rect used in UpdateSoftkeyFrameL method.
   924      */
   806      */
   925     TRect iUpdateFrameInnerRect;
   807     TRect iUpdateFrameInnerRect;
   926 
   808 
   942 
   824 
   943 
   825 
   944 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, 
   826 CEikCba* CEikCba::NewL(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, 
   945     RWindowGroup* aParentWg)
   827     RWindowGroup* aParentWg)
   946     { 
   828     { 
   947     _AKNTRACE_FUNC_ENTER; 
       
   948     CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static
   829     CEikCba* self = CEikCba::NewLC(aPrevious, aCommandObserver, aParentWg); // static
   949     CleanupStack::Pop( self );
   830     CleanupStack::Pop( self );
   950     _AKNTRACE_FUNC_EXIT;
       
   951     return self;
   831     return self;
   952     }
   832     }
   953 
   833 
   954 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, 
   834 CEikCba* CEikCba::NewL(TInt aResourceId, const CEikCba* aPrevious, 
   955     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg)
   835     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg)
   956     { 
   836     { 
   957     _AKNTRACE_FUNC_ENTER; 
       
   958     CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static
   837     CEikCba* self = CEikCba::NewLC(aResourceId, aPrevious, aCommandObserver, aParentWg); // static
   959     CleanupStack::Pop( self );
   838     CleanupStack::Pop( self );
   960     _AKNTRACE_FUNC_EXIT;
       
   961     return self;
   839     return self;
   962     }
   840     }
   963 
   841 
   964 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, 
   842 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious, MEikCommandObserver* aCommandObserver, 
   965     RWindowGroup* aParentWg)
   843     RWindowGroup* aParentWg)
   966     {
   844     {
   967     _AKNTRACE_FUNC_ENTER;
       
   968     _AKNTRACE_FUNC_EXIT;
       
   969     return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static
   845     return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver, aParentWg); // static
   970     }
   846     }
   971 
   847 
   972 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious,
   848 CEikCba* CEikCba::NewLC(const CEikCba* aPrevious,
   973     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
   849     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
   974     TUint aFlags)
   850     TUint aFlags)
   975     {
   851     {
   976     _AKNTRACE_FUNC_ENTER;
       
   977     _AKNTRACE_FUNC_EXIT;
       
   978     return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver,
   852     return CEikCba::NewLC(KNoResource, aPrevious, aCommandObserver,
   979         aParentWg, aFlags);
   853         aParentWg, aFlags);
   980     }
   854     }
   981 
   855 
   982 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious,
   856 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious,
   983     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg)
   857     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg)
   984     { 
   858     { 
   985     _AKNTRACE_FUNC_ENTER; 
       
   986     CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static
   859     CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver, aParentWg); // static
   987     CleanupStack::PushL(self);
   860     CleanupStack::PushL(self);
   988     self->ConstructL(aResourceId);
   861     self->ConstructL(aResourceId);
   989     AKNTASHOOK_ADDL( self, "CEikCba" );
   862     AKNTASHOOK_ADDL( self, "CEikCba" );
   990     _AKNTRACE_FUNC_EXIT;
       
   991     return self;
   863     return self;
   992     }
   864     }
   993 
   865 
   994 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious,
   866 CEikCba* CEikCba::NewLC(TInt aResourceId, const CEikCba* aPrevious,
   995     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
   867     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
   996     TUint aFlags)
   868     TUint aFlags)
   997     {
   869     {
   998     _AKNTRACE_FUNC_ENTER;
       
   999     CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver,
   870     CEikCba* self = new(ELeave) CEikCba(aPrevious, aCommandObserver,
  1000         aParentWg, aFlags);
   871         aParentWg, aFlags);
  1001     CleanupStack::PushL(self);
   872     CleanupStack::PushL(self);
  1002     self->ConstructL(aResourceId);
   873     self->ConstructL(aResourceId);
  1003     AKNTASHOOK_ADDL( self, "CEikCba" );
   874     AKNTASHOOK_ADDL( self, "CEikCba" );
  1004     _AKNTRACE_FUNC_EXIT;
       
  1005     return self;
   875     return self;
  1006     }
   876     }
  1007 
   877 
  1008 
   878 
  1009 /**
   879 /**
  1010 * Destructor.
   880 * Destructor.
  1011 */
   881 */
  1012 CEikCba::~CEikCba()
   882 CEikCba::~CEikCba()
  1013     {
   883     {
  1014     _AKNTRACE_FUNC_ENTER;
       
  1015     AKNTASHOOK_REMOVE();
   884     AKNTASHOOK_REMOVE();
  1016     // Revert the clock and indicator pane area of status pane
   885     // Revert the clock and indicator pane area of status pane
  1017     // to use the previous skin background.
   886     // to use the previous skin background.
  1018     CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
   887     CEikStatusPaneBase* sp = CEikStatusPaneBase::Current();
  1019     if ( sp &&
   888     if ( sp &&
  1054 #ifdef RD_ENHANCED_CBA         
   923 #ifdef RD_ENHANCED_CBA         
  1055      delete iCommandTable;              
   924      delete iCommandTable;              
  1056 #endif // RD_ENHANCED_CBA
   925 #endif // RD_ENHANCED_CBA
  1057 
   926 
  1058     delete iExtension;
   927     delete iExtension;
  1059     _AKNTRACE_FUNC_EXIT;
       
  1060     }
   928     }
  1061 
   929 
  1062 /**
   930 /**
  1063 * Constructor.
   931 * Constructor.
  1064 */
   932 */
  1065 CEikCba::CEikCba(const CEikCba* aPrevious,
   933 CEikCba::CEikCba(const CEikCba* aPrevious,
  1066     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
   934     MEikCommandObserver* aCommandObserver, RWindowGroup* aParentWg,
  1067     TUint aFlags)
   935     TUint aFlags)
  1068     : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg)
   936     : iLink(aPrevious), iCommandObserver(aCommandObserver), iParentWg(aParentWg)
  1069     {
   937     {
  1070     _AKNTRACE_FUNC_ENTER;
       
  1071     if (aFlags & CEikButtonGroupContainer::EIsEmbedded)
   938     if (aFlags & CEikButtonGroupContainer::EIsEmbedded)
  1072         {
   939         {
  1073         // CBA is embedded in another component (eg. dialog/popup/setting page
   940         // CBA is embedded in another component (eg. dialog/popup/setting page
  1074         iFlags.Set(ECbaEmbedded);
   941         iFlags.Set(ECbaEmbedded);
  1075         }
   942         }
  1076     
   943 
  1077     if ( aFlags & CEikButtonGroupContainer::EAlwaysShown )
       
  1078         {
       
  1079         iFlags.Set( ECbaKeepItemSoftkeyVisible  );
       
  1080         }
       
  1081     
       
  1082     if ( aFlags & CEikButtonGroupContainer::EParentIsControl )
   944     if ( aFlags & CEikButtonGroupContainer::EParentIsControl )
  1083         {
   945         {
  1084         iFlags.Set( ECbaParentAsControl );
   946         iFlags.Set( ECbaParentAsControl );
  1085         }
   947         }
  1086     
   948     
  1087     if ( aFlags & CEikButtonGroupContainer::EDelayActivation )
   949 	if ( aFlags & CEikButtonGroupContainer::EDelayActivation )
  1088         {
   950         {
  1089         iFlags.Set( ECbaActivationDelayed );
   951         iFlags.Set( ECbaActivationDelayed );
  1090         }    
   952         }    
  1091 
   953 
  1092     CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() );
   954     CAknAppUi* appUi = static_cast<CAknAppUi*>( iCoeEnv->AppUi() );
  1095         iFlags.Set( ECbaSingleClickEnabled );
   957         iFlags.Set( ECbaSingleClickEnabled );
  1096         iFlags.Set( ECbaItemSpecificSoftkeyInUse );
   958         iFlags.Set( ECbaItemSpecificSoftkeyInUse );
  1097         }
   959         }
  1098 
   960 
  1099     SetNonFocusing();
   961     SetNonFocusing();
  1100     _AKNTRACE_FUNC_EXIT;
       
  1101     }
   962     }
  1102 
   963 
  1103 
   964 
  1104 void CEikCba::SetContainerWindowL( const CCoeControl& aContainer )
   965 void CEikCba::SetContainerWindowL( const CCoeControl& aContainer )
  1105     {
   966     {
  1106     _AKNTRACE_FUNC_ENTER;
       
  1107     // CCoeControl::SetContainerWindowL closes the previously own window and
   967     // CCoeControl::SetContainerWindowL closes the previously own window and
  1108     // deactivates control. Therefore store the activation status and re-set
   968     // deactivates control. Therefore store the activation status and re-set
  1109     // it after the container window has been set.
   969     // it after the container window has been set.
  1110     
   970     
  1111     // Removed to enable drawing of Query Input in one phase 
   971     // Removed to enable drawing of Query Input in one phase 
  1285         }
  1145         }
  1286     else
  1146     else
  1287         {
  1147         {
  1288         CCoeControl::SetContainerWindowL( aContainer );            
  1148         CCoeControl::SetContainerWindowL( aContainer );            
  1289         }        
  1149         }        
  1290     _AKNTRACE_FUNC_EXIT;
       
  1291     }
  1150     }
  1292 
  1151 
  1293 void CEikCba::ActivateL()
  1152 void CEikCba::ActivateL()
  1294     {
  1153     {
  1295     _AKNTRACE_FUNC_ENTER;
       
  1296     CCoeControl::ActivateL();
  1154     CCoeControl::ActivateL();
  1297     _AKNTRACE_FUNC_EXIT;
       
  1298     }
  1155     }
  1299     
  1156     
  1300 void CEikCba::BaseConstructL()
  1157 void CEikCba::BaseConstructL()
  1301     {
  1158     {
  1302     _AKNTRACE_FUNC_ENTER;
       
  1303     if ( iFlags.IsSet( ECbaEmbedded ) && iFlags.IsSet( ECbaParentAsControl ) )
  1159     if ( iFlags.IsSet( ECbaEmbedded ) && iFlags.IsSet( ECbaParentAsControl ) )
  1304         {
  1160         {
  1305         __ASSERT_DEBUG( iParentWg, User::Invariant() );
  1161         __ASSERT_DEBUG( iParentWg, User::Invariant() );
  1306         CreateWindowL( (CCoeControl*)iParentWg );
  1162         CreateWindowL( (CCoeControl*)iParentWg );
  1307         EnableWindowTransparency();
  1163         EnableWindowTransparency();
  1337             iCbaFlags &= ~EEikCbaFlagTransparent;
  1193             iCbaFlags &= ~EEikCbaFlagTransparent;
  1338             }
  1194             }
  1339         }
  1195         }
  1340 
  1196 
  1341     iExtension = CEikCbaExtension::NewL( *this );
  1197     iExtension = CEikCbaExtension::NewL( *this );
       
  1198     //create bitmap for semi-transparent background
       
  1199     if ( iCbaFlags & EEikCbaFlagSemiTransparent && iExtension )
       
  1200         {
       
  1201         iExtension->iSemiBgID = KAknsIIDQsnHomeBgWidget;
       
  1202         iExtension->iSemiBgCenterID = KAknsIIDQsnHomeBgWidgetCenter;
       
  1203         }
  1342 
  1204 
  1343     // Skin background is not drawn by embedded CBA.
  1205     // Skin background is not drawn by embedded CBA.
  1344     if ( !iFlags.IsSet( ECbaEmbedded ) )
  1206     if ( !iFlags.IsSet( ECbaEmbedded ) )
  1345         {
  1207         {
       
  1208         TRect screen;
       
  1209         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
  1210 
  1346         // Construct background control context, SizeChanged will update
  1211         // Construct background control context, SizeChanged will update
  1347         // the layout rectangle.
  1212         // the layout rectangle.
  1348         iBgIID = AknStatuspaneUtils::IdleLayoutActive() ?
  1213         iBgIID = AknStatuspaneUtils::IdleLayoutActive() ?
  1349             KAknsIIDQsnBgAreaControlIdle :
  1214             KAknsIIDQsnBgAreaControlIdle :
  1350             KAknsIIDQsnBgAreaControl;
  1215             KAknsIIDQsnBgAreaControl;
  1354             TRect( 0, 0, 1, 1 ),
  1219             TRect( 0, 0, 1, 1 ),
  1355             ETrue,
  1220             ETrue,
  1356             2 );
  1221             2 );
  1357 
  1222 
  1358         // Other context for staconpane
  1223         // Other context for staconpane
  1359         if ( AknStatuspaneUtils::StaconPaneActive() )
  1224 
  1360             {
  1225         // There is a need for two layers in each context: one for wallpaper, 
  1361             CheckAndCreateStaconContextsL();
  1226         // the other for skin graphics.
  1362             }
  1227         iStaconBgContextTop = CAknsMaskedLayerBackgroundControlContext::NewL(
       
  1228             KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN );
       
  1229         iStaconBgContextBottom = CAknsMaskedLayerBackgroundControlContext::NewL(
       
  1230             KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN );
       
  1231             
       
  1232         for ( TInt i = 0; i < ECbaLayerN; i++ )
       
  1233             {
       
  1234             iStaconBgContextBottom->SetLayerImage( i, KAknsIIDNone );
       
  1235             }
       
  1236         
       
  1237         TAknWindowLineLayout layout( AknLayoutScalable_Avkon::area_top_pane(2).LayoutLine() );
       
  1238         TAknLayoutRect layoutRect;
       
  1239         layoutRect.LayoutRect( screen, layout );
       
  1240         TRect staconTop( layoutRect.Rect() );
       
  1241     
       
  1242         layout = AknLayoutScalable_Avkon::area_bottom_pane(2).LayoutLine();
       
  1243         layoutRect.LayoutRect( screen, layout );        
       
  1244         TRect staconBottom( layoutRect.Rect() );
       
  1245     
       
  1246         // Set layers to stacon contexts.
       
  1247         // Set bottom as parent to top, so that top is re-drawn, if bottom is drawn.
       
  1248         iStaconBgContextTop->SetLayerImage( ECbaLayerWallpaper, KAknsIIDWallpaper );
       
  1249         iStaconBgContextTop->SetLayerRect( ECbaLayerWallpaper, screen );
       
  1250         iStaconBgContextTop->SetLayerImage( ECbaLayerBackground, KAknsIIDQsnBgAreaStaconRt );
       
  1251         iStaconBgContextTop->SetLayerRect( ECbaLayerBackground, staconTop );
       
  1252     
       
  1253         iStaconBgContextBottom->SetLayerImage( ECbaLayerWallpaper, KAknsIIDWallpaper );
       
  1254         iStaconBgContextBottom->SetLayerRect( ECbaLayerWallpaper, screen );
       
  1255         iStaconBgContextBottom->SetLayerImage( ECbaLayerBackground, KAknsIIDQsnBgAreaStaconRb );
       
  1256         iStaconBgContextBottom->SetLayerRect( ECbaLayerBackground, staconBottom );
       
  1257         iStaconBgContextBottom->SetParentPos( TPoint( 0, 0 ) );
       
  1258     
       
  1259         iStaconBgContextTop->SetParentContext( iStaconBgContextBottom );
       
  1260     
       
  1261         TBool idle = AknLayoutFlags() & EAknLayoutCbaInStaconPaneIdle;
       
  1262         if ( idle )
       
  1263             {
       
  1264             iStaconBgContextTop->SetLayerMaskAndSizeL( KAknsIIDQgnGrafBgLscTopMaskIcon, staconTop );
       
  1265             iStaconBgContextBottom->SetLayerMaskAndSizeL( KAknsIIDQgnGrafBgLscBottomMaskIcon, staconBottom );
       
  1266             }
       
  1267 
  1363         }
  1268         }
  1364 
  1269 
  1365     iExtension->UpdateSoftkeyFrameL( EFalse );
  1270     iExtension->UpdateSoftkeyFrameL( EFalse );
  1366     
  1271     
  1367     CRepository* cenRep = NULL;
  1272     CRepository* cenRep = NULL;
  1417                 // Default value.
  1322                 // Default value.
  1418                 iClockIndicBgIID = KAknsIIDQsnBgAreaControl;
  1323                 iClockIndicBgIID = KAknsIIDQsnBgAreaControl;
  1419                 }
  1324                 }
  1420             }
  1325             }
  1421         }
  1326         }
  1422     _AKNTRACE_FUNC_EXIT;
       
  1423     }
  1327     }
  1424 
  1328 
  1425 void CEikCba::ConstructL(TInt aResourceId)
  1329 void CEikCba::ConstructL(TInt aResourceId)
  1426     {
  1330     {
  1427     _AKNTRACE_FUNC_ENTER;
       
  1428     if (aResourceId != KNoResource)
  1331     if (aResourceId != KNoResource)
  1429         {
  1332         {
  1430         TResourceReader reader;
  1333         TResourceReader reader;
  1431         iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
  1334         iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
  1432         iCbaFlags = reader.ReadInt32();        // flags resource
  1335         iCbaFlags = reader.ReadInt32();        // flags resource
  1433             
  1336     
  1434         // If using enhanced cba.
  1337         // If using enhanced cba.
  1435         if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) 
  1338         if ( (iCbaFlags & EEikEnhancedButtonGroup) == EEikEnhancedButtonGroup ) 
  1436             { 
  1339             { 
  1437 #ifdef RD_ENHANCED_CBA            
  1340 #ifdef RD_ENHANCED_CBA            
  1438             iCommandTable = CEikCommandTable::NewL();   
  1341             iCommandTable = CEikCommandTable::NewL();   
  1582                 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL();
  1485                 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL();
  1583                 }
  1486                 }
  1584             }
  1487             }
  1585         }
  1488         }
  1586 
  1489 
  1587     _AKNTRACE_FUNC_EXIT;
  1490     // Set CBA faded in case the softkeys are empty.
       
  1491     SetFadeState();
  1588     }
  1492     }
  1589 
  1493 
  1590 
  1494 
  1591 void CEikCba::ConstructFromResourceL(TResourceReader& aReader)
  1495 void CEikCba::ConstructFromResourceL(TResourceReader& aReader)
  1592     {
  1496     {
  1593     _AKNTRACE_FUNC_ENTER;
       
  1594     BaseConstructL();
  1497     BaseConstructL();
  1595     CreateScrollBarFrameL();
  1498     CreateScrollBarFrameL();
  1596     TGulAlignmentValue anAlignment[3] = {EHLeftVCenter, EHRightVCenter, EHCenterVCenter};
  1499     TGulAlignmentValue anAlignment[3] = {EHLeftVCenter, EHRightVCenter, EHCenterVCenter};
  1597     iCbaFlags = aReader.ReadInt32(); // flags resource
  1500     iCbaFlags = aReader.ReadInt32(); // flags resource
  1598     iSize.iWidth = aReader.ReadInt16();
  1501     iSize.iWidth = aReader.ReadInt16();
  1677             {
  1580             {
  1678             (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL();
  1581             (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->ActivateL();
  1679             }
  1582             }
  1680         }
  1583         }
  1681 
  1584 
  1682     _AKNTRACE_FUNC_EXIT;
  1585     // Set CBA faded in case the softkeys are empty.
       
  1586     SetFadeState();
  1683     }
  1587     }
  1684 
  1588 
  1685 
  1589 
  1686 TInt CEikCba::MaxCommands() const
  1590 TInt CEikCba::MaxCommands() const
  1687     {
  1591     {
  1688     _AKNTRACE_FUNC_ENTER;
       
  1689     _AKNTRACE_FUNC_EXIT;
       
  1690     return KMaxSeries60Softkeys;
  1592     return KMaxSeries60Softkeys;
  1691     }
  1593     }
  1692 
  1594 
  1693 TInt CEikCba::MSKEnabledInPlatform() const
  1595 TInt CEikCba::MSKEnabledInPlatform() const
  1694     {
  1596     {
  1695     _AKNTRACE_FUNC_ENTER;
       
  1696     _AKNTRACE_FUNC_EXIT;
       
  1697     return iMSKEnabledInPlatform;
  1597     return iMSKEnabledInPlatform;
  1698     }
  1598     }
  1699 
  1599 
  1700 
  1600 
  1701 // ---------------------------------------------------------------------------
  1601 // ---------------------------------------------------------------------------
  1702 // Sets the middle softkey icon.
  1602 // Sets the middle softkey icon.
  1703 // ---------------------------------------------------------------------------
  1603 // ---------------------------------------------------------------------------
  1704 //
  1604 //
  1705 void CEikCba::SetMSKIconL()
  1605 void CEikCba::SetMSKIconL()
  1706     {
  1606     {
  1707     _AKNTRACE_FUNC_ENTER;
       
  1708     // MSK is not supported by dialog-embedded CBAs.
  1607     // MSK is not supported by dialog-embedded CBAs.
  1709     if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) )
  1608     if ( iFlags.IsSet( ECbaInsideDialog ) || iFlags.IsSet( ECbaEmbedded ) )
  1710         {
  1609         {
  1711         _AKNTRACE_FUNC_EXIT;
       
  1712         return;
  1610         return;
  1713         }
  1611         }
  1714         
  1612         
  1715     if ( !MskAllowed() )
  1613     if ( !MskAllowed() )
  1716         {
  1614         {
  1717         _AKNTRACE_FUNC_EXIT;
       
  1718         return;         
  1615         return;         
  1719         }
  1616         }
  1720         
  1617         
  1721     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1618     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  1722     if ( !skin )
  1619     if ( !skin )
  1723         { 
  1620         { 
  1724         _AKNTRACE_FUNC_EXIT;        
       
  1725         return;
  1621         return;
  1726         }
  1622         }
  1727     if( iExtension->iIfMskIconSet )
  1623     if( iExtension->iIfMskIconSet )
  1728         {
  1624         {
  1729     //    UpdateIconL();
  1625     //	UpdateIconL();
  1730         _AKNTRACE_FUNC_EXIT;
  1626     	return;
  1731         return;
       
  1732         }
  1627         }
  1733     TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn );
  1628     TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn );
  1734 
  1629 
  1735     CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl );
  1630     CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl );
  1736     if ( !button )
  1631     if ( !button )
  1737         {
  1632         {
  1738         _AKNTRACE_FUNC_EXIT;
       
  1739         return;
  1633         return;
  1740         }
  1634         }
  1741    
  1635    
  1742     CFbsBitmap *bitmap = NULL;
  1636     CFbsBitmap *bitmap = NULL;
  1743     CFbsBitmap *mask = NULL;
  1637     CFbsBitmap *mask = NULL;
  1744       
  1638       
  1745     TAknLayoutRect qgn_graf_sk_msk;
  1639     TAknLayoutRect qgn_graf_sk_msk;
  1746     TRect rect;
  1640     TRect rect;
  1747     TInt graphicMSKVariety = 1;
       
  1748     if ( iCbaFlags & EEikCbaFlagAppMskIcon )
       
  1749     	{
       
  1750         graphicMSKVariety = 0 ;
       
  1751     	}
       
  1752     qgn_graf_sk_msk.LayoutRect(
  1641     qgn_graf_sk_msk.LayoutRect(
  1753         rect,
  1642         rect,
  1754         AknLayoutScalable_Avkon::control_pane_g4( graphicMSKVariety ).LayoutLine() );
  1643         AknLayoutScalable_Avkon::control_pane_g4( 0 ).LayoutLine() );
  1755 
  1644 
  1756     TSize iconSize( qgn_graf_sk_msk.Rect().Width(),
  1645     TSize iconSize( qgn_graf_sk_msk.Rect().Width(),
  1757                     qgn_graf_sk_msk.Rect().Height() );
  1646                     qgn_graf_sk_msk.Rect().Height() );
  1758     TInt leftId = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  1647     TInt leftId = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  1759 
  1648 
  1875         {
  1764         {
  1876         button->ReplaceImageByLabel(); // remove old image
  1765         button->ReplaceImageByLabel(); // remove old image
  1877         }
  1766         }
  1878     
  1767     
  1879     button->SetContainerWindowL( *this );
  1768     button->SetContainerWindowL( *this );
  1880     _AKNTRACE_FUNC_EXIT;
       
  1881     }
  1769     }
  1882 
  1770 
  1883 EXPORT_C TBool CEikCba::UpdateMSKIconL( const TAknsItemID& aId,
  1771 EXPORT_C TBool CEikCba::UpdateMSKIconL( const TAknsItemID& aId,
  1884     const TDesC& aBmpFile,
  1772     const TDesC& aBmpFile,
  1885     const TInt32 aBmp,
  1773     const TInt32 aBmp,
  1886     const TInt32 aBmpM,
  1774     const TInt32 aBmpM,
  1887     TBool aEnable )
  1775     TBool aEnable )
  1888     {
  1776     {
  1889     _AKNTRACE_FUNC_ENTER;
       
  1890     iExtension->iIfMskIconSet = EFalse;
  1777     iExtension->iIfMskIconSet = EFalse;
  1891 
  1778 
  1892     // MSK is not supported by dialog-embedded CBAs.
  1779     // MSK is not supported by dialog-embedded CBAs.
  1893     if (!aEnable)
  1780     if (!aEnable)
  1894         {
  1781         {
  1895         SetMSKIconL();
  1782     	SetMSKIconL();
  1896         _AKNTRACE_FUNC_EXIT;
  1783     	return ETrue;
  1897         return ETrue;
       
  1898         }
  1784         }
  1899 
  1785 
  1900     delete iExtension->iBmpFile;
  1786     delete iExtension->iBmpFile;
  1901     iExtension->iBmpFile = NULL;
  1787     iExtension->iBmpFile = NULL;
  1902     iExtension->iBmpFile = aBmpFile.AllocL();
  1788     iExtension->iBmpFile = aBmpFile.AllocL();
  1905     iExtension->iMSKSkinID = aId;
  1791     iExtension->iMSKSkinID = aId;
  1906     
  1792     
  1907     iExtension->iBmp = aBmp;
  1793     iExtension->iBmp = aBmp;
  1908     iExtension->iBmpM = aBmpM;
  1794     iExtension->iBmpM = aBmpM;
  1909     
  1795     
  1910     _AKNTRACE_FUNC_EXIT;
       
  1911     return UpdateIconL();
  1796     return UpdateIconL();
  1912     }
  1797     }
  1913 
  1798 
  1914 
  1799 
  1915 // ----------------------------------------------------------------------------
  1800 // ----------------------------------------------------------------------------
  1916 // CEikCba::EnableItemSpecificSoftkey
  1801 // CEikCba::EnableItemSpecificSoftkey
  1917 // ----------------------------------------------------------------------------
  1802 // ----------------------------------------------------------------------------
  1918 //
  1803 //
  1919 EXPORT_C void CEikCba::EnableItemSpecificSoftkey( TBool aEnable )
  1804 EXPORT_C void CEikCba::EnableItemSpecificSoftkey( TBool aEnable )
  1920     {
  1805     {
  1921     _AKNTRACE_FUNC_ENTER;
       
  1922     if ( iFlags.IsSet( ECbaSingleClickEnabled ) )
  1806     if ( iFlags.IsSet( ECbaSingleClickEnabled ) )
  1923         {
  1807         {
  1924         iFlags.Assign( ECbaItemSpecificSoftkeyInUse, aEnable );
  1808         iFlags.Assign( ECbaItemSpecificSoftkeyInUse, aEnable );
  1925         
  1809         
  1926         if ( aEnable )
  1810         if ( aEnable )
  1941                 leftSoftkey.iControl->SetDimmed( EFalse );
  1825                 leftSoftkey.iControl->SetDimmed( EFalse );
  1942                 leftSoftkey.iControl->DrawDeferred();
  1826                 leftSoftkey.iControl->DrawDeferred();
  1943                 }
  1827                 }
  1944             }
  1828             }
  1945         }
  1829         }
  1946     _AKNTRACE_FUNC_EXIT;
       
  1947     }
  1830     }
  1948 
  1831 
  1949 
  1832 
  1950 void CEikCba::SetMSKCommandObserver(MEikCommandObserver* aCommandObserver)
  1833 void CEikCba::SetMSKCommandObserver(MEikCommandObserver* aCommandObserver)
  1951     {
  1834     {
  1952     _AKNTRACE_FUNC_ENTER;
       
  1953     // aCommandObserver set to NULL when removing observer.
  1835     // aCommandObserver set to NULL when removing observer.
  1954     iMSKCommandObserver = aCommandObserver;
  1836     iMSKCommandObserver = aCommandObserver;
  1955     _AKNTRACE_FUNC_EXIT;
       
  1956     }
  1837     }
  1957 
  1838 
  1958 void CEikCba::UpdateCbaLabels(TBool aScrollerOn)
  1839 void CEikCba::UpdateCbaLabels(TBool aScrollerOn)
  1959     {
  1840     {
  1960     _AKNTRACE_FUNC_ENTER;
       
  1961     // This method is called only from scrollbar that has nothing to do with
  1841     // This method is called only from scrollbar that has nothing to do with
  1962     // dialog-embedded CBAs -> ignore the call.
  1842     // dialog-embedded CBAs -> ignore the call.
  1963     if ( iFlags.IsSet( ECbaInsideDialog ) )
  1843     if ( iFlags.IsSet( ECbaInsideDialog ) )
  1964         {
  1844         {
  1965         _AKNTRACE_FUNC_EXIT;
       
  1966         return;
  1845         return;
  1967         }
  1846         }
  1968         
  1847         
  1969     // Communicate change to CBA buttons.
  1848     // Communicate change to CBA buttons.
  1970     for (TInt ii = 0; ii < iControlArray->Count(); ii++) 
  1849     for (TInt ii = 0; ii < iControlArray->Count(); ii++) 
  1977             }
  1856             }
  1978         }
  1857         }
  1979     // Change of text may affect layout.
  1858     // Change of text may affect layout.
  1980     SizeChanged();
  1859     SizeChanged();
  1981     DrawDeferred() ;
  1860     DrawDeferred() ;
  1982     _AKNTRACE_FUNC_EXIT;
       
  1983     }
  1861     }
  1984 
  1862 
  1985 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver)
  1863 void CEikCba::SetSBFrameObserver(MEikScrollBarObserver* aObserver)
  1986     {
  1864     {
  1987     _AKNTRACE_FUNC_ENTER;
       
  1988     if(iSBFrame)
  1865     if(iSBFrame)
  1989         {
  1866         {
  1990         iSBFrame->SetScrollBarFrameObserver(aObserver);
  1867         iSBFrame->SetScrollBarFrameObserver(aObserver);
  1991         }
  1868         }
  1992     _AKNTRACE_FUNC_EXIT;
       
  1993     }
  1869     }
  1994 
  1870 
  1995 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel)
  1871 void CEikCba::SetScrollBarModelL(TEikScrollBarModel* aModel)
  1996     {
  1872     {
  1997     _AKNTRACE_FUNC_ENTER;
       
  1998     if(iSBFrame)
  1873     if(iSBFrame)
  1999         {
  1874         {
  2000         VScrollBarAsControl()->SetModelL(aModel);
  1875         VScrollBarAsControl()->SetModelL(aModel);
  2001         }
  1876         }
  2002     _AKNTRACE_FUNC_EXIT;
       
  2003     }
  1877     }
  2004 
  1878 
  2005 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const
  1879 const CEikCbaScrollBarFrame* CEikCba::ScrollBarFrame() const
  2006     { 
  1880     { 
  2007     _AKNTRACE_FUNC_ENTER;
       
  2008     _AKNTRACE_FUNC_EXIT;    
       
  2009     return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); 
  1881     return STATIC_CAST(const CEikCbaScrollBarFrame*, iSBFrame); 
  2010     }
  1882     }
  2011 
  1883 
  2012 CAknScrollBar* CEikCba::VScrollBarAsControl()
  1884 CAknScrollBar* CEikCba::VScrollBarAsControl()
  2013     {
  1885     {
  2014     _AKNTRACE_FUNC_ENTER;
       
  2015     _AKNTRACE_FUNC_EXIT;
       
  2016     return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl);
  1886     return STATIC_CAST(CAknScrollBar*, VScrollBarAsGroupControl().iControl);
  2017     }
  1887     }
  2018 
  1888 
  2019 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex)
  1889 void CEikCba::InsertControlL(TEikGroupControl& aGroupControl,TInt aIndex)
  2020     {
  1890     {
  2021     _AKNTRACE_FUNC_ENTER;
       
  2022     iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point.
  1891     iControlArray->InsertL(aIndex,aGroupControl); // Takes ownership at this point.
  2023     _AKNTRACE_FUNC_EXIT;
       
  2024     }
  1892     }
  2025 
  1893 
  2026 
  1894 
  2027 void CEikCba::SetCommandL( TInt aPosition,
  1895 void CEikCba::SetCommandL( TInt aPosition,
  2028                            TInt aCommandId,
  1896                            TInt aCommandId,
  2029                            const TDesC* aText, 
  1897                            const TDesC* aText, 
  2030                            const CFbsBitmap* /*aBitmap*/,
  1898                            const CFbsBitmap* /*aBitmap*/,
  2031                            const CFbsBitmap* /*aMask*/ )
  1899                            const CFbsBitmap* /*aMask*/ )
  2032     {
  1900     {
  2033     _AKNTRACE_FUNC_ENTER;
  1901     // We need to check if this call changes the softkeys from being
  2034 
  1902     // empty to having a command or vice versa to be able to maintain
       
  1903     // correct fade state.
       
  1904     TBool isEmptyBefore( IsEmpty() );
       
  1905     
  2035     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  1906     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2036     groupCtrl.iId = aCommandId;
  1907     groupCtrl.iId = aCommandId;
  2037     groupCtrl.iLongId = 0;
  1908     groupCtrl.iLongId = 0;
  2038     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  1909     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  2039         {
  1910         {
  2058         CAknCommandButtonState* buttonState =
  1929         CAknCommandButtonState* buttonState =
  2059             static_cast<CAknCommandButtonState*>( button->State() );
  1930             static_cast<CAknCommandButtonState*>( button->State() );
  2060         buttonState->SetTextL( *aText );
  1931         buttonState->SetTextL( *aText );
  2061         buttonState->SetCommand( aCommandId );
  1932         buttonState->SetCommand( aCommandId );
  2062         }
  1933         }
       
  1934     
       
  1935     TBool isEmptyAfter( IsEmpty() );
       
  1936     
       
  1937     if ( !COMPARE_BOOLS( isEmptyBefore, isEmptyAfter ) )
       
  1938         {
       
  1939         SetFadeState();
       
  1940         }
  2063 
  1941 
  2064     ReportContentChangedEvent();      
  1942     ReportContentChangedEvent();      
  2065     _AKNTRACE_FUNC_EXIT;
       
  2066     }
  1943     }
  2067 
  1944 
  2068 
  1945 
  2069 void CEikCba::SetCommandL(TInt aPosition,TInt aResourceId)
  1946 void CEikCba::SetCommandL(TInt aPosition,TInt aResourceId)
  2070     {
  1947     {
  2071     _AKNTRACE_FUNC_ENTER;
       
  2072     TResourceReader reader;
  1948     TResourceReader reader;
  2073     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  1949     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  2074     TInt version = reader.ReadInt8(); // version
  1950     TInt version = reader.ReadInt8(); // version
  2075     
  1951     
  2076 #ifdef RD_ENHANCED_CBA
  1952 #ifdef RD_ENHANCED_CBA
  2105     TPtrC text = reader.ReadTPtrC();
  1981     TPtrC text = reader.ReadTPtrC();
  2106     SetCommandL(aPosition, commandId, &text, NULL, NULL);
  1982     SetCommandL(aPosition, commandId, &text, NULL, NULL);
  2107     CleanupStack::PopAndDestroy(); // reader
  1983     CleanupStack::PopAndDestroy(); // reader
  2108     
  1984     
  2109     ReportContentChangedEvent();
  1985     ReportContentChangedEvent();
  2110     _AKNTRACE_FUNC_EXIT;
       
  2111     }
  1986     }
  2112     
  1987     
  2113 /**
  1988 /**
  2114 * Installs a new set of commands to be associated with the cba buttons.
  1989 * Installs a new set of commands to be associated with the cba buttons.
  2115 * The previous command set is restored if there is an error while adding
  1990 * The previous command set is restored if there is an error while adding
  2116 * the new command set.
  1991 * the new command set.
  2117 */
  1992 */
  2118 void CEikCba::SetCommandSetL(TInt aResourceId)
  1993 void CEikCba::SetCommandSetL(TInt aResourceId)
  2119     {
  1994     {
  2120     _AKNTRACE_FUNC_ENTER;
       
  2121     TResourceReader reader;
  1995     TResourceReader reader;
  2122     iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
  1996     iCoeEnv->CreateResourceReaderLC(reader, aResourceId);
  2123 
  1997 
  2124     iCbaFlags = reader.ReadInt32();
  1998     iCbaFlags = reader.ReadInt32();
  2125     
  1999     
  2126     if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) 
  2000     if ( ( iCbaFlags & EEikEnhancedButtonGroup ) == EEikEnhancedButtonGroup ) 
  2127         { 
  2001         { 
  2128         CleanupStack::PopAndDestroy(); // reader
  2002         CleanupStack::PopAndDestroy(); // reader
  2129         OfferCommandListL( aResourceId );
  2003         OfferCommandListL( aResourceId );
  2130         _AKNTRACE_FUNC_EXIT;
       
  2131         return;
  2004         return;
  2132         }
  2005         }
  2133     
  2006     
  2134     SetButtonGroupFlags( iCbaFlags );
  2007     SetButtonGroupFlags( iCbaFlags );
  2135     reader.ReadInt16(); // Skip width resource.
  2008     reader.ReadInt16(); // Skip width resource.
  2227     CleanupStack::PopAndDestroy(); // reader
  2100     CleanupStack::PopAndDestroy(); // reader
  2228 
  2101 
  2229     // Force labels to be re-formatted...
  2102     // Force labels to be re-formatted...
  2230     SizeChanged();
  2103     SizeChanged();
  2231     ReportContentChangedEvent();
  2104     ReportContentChangedEvent();
  2232     _AKNTRACE_FUNC_EXIT;
       
  2233     }
  2105     }
  2234 
  2106 
  2235 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, 
  2107 void CEikCba::AddCommandL(TInt /*aPosition*/, TInt /*aCommandId*/, const TDesC* /*aText*/, 
  2236     const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/)
  2108     const CFbsBitmap* /*aBitmap*/, const CFbsBitmap* /*aMask*/)
  2237     {
  2109     {
  2238     _AKNTRACE_FUNC_ENTER;
       
  2239     User::Leave(KErrNotSupported);
  2110     User::Leave(KErrNotSupported);
  2240     _AKNTRACE_FUNC_EXIT;
       
  2241     }
  2111     }
  2242 
  2112 
  2243 
  2113 
  2244 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition,
  2114 void CEikCba::AddCommandToStackWithoutSizeChangedL(TInt aPosition,
  2245                                                TInt aCommandId,
  2115                                                TInt aCommandId,
  2246                                                const TDesC* aText)
  2116                                                const TDesC* aText)
  2247     {
  2117     {
  2248     _AKNTRACE_FUNC_ENTER;
  2118     // We need to check if this call changes the softkeys from being
  2249     
  2119     // empty to having a command or vice versa to be able to maintain
  2250     if ( !CommandChangeAllowed() )
  2120     // correct fade state.
  2251         {
  2121     TBool isEmptyBefore( IsEmpty() );
  2252         _AKNTRACE_FUNC_EXIT;
       
  2253         return;
       
  2254         }
       
  2255     
  2122     
  2256     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2123     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2257     
  2124     
  2258     if ( iFlags.IsSet( ECbaInsideDialog ) )
  2125     if ( iFlags.IsSet( ECbaInsideDialog ) )
  2259         {
  2126         {
  2260         CAknButton* button = static_cast<CAknButton*>( groupCtrl.iControl );
  2127         CAknButton* button = static_cast<CAknButton*>( groupCtrl.iControl );
  2261 
       
  2262         if ( aCommandId == EAknSoftkeyEmergencyCall )
       
  2263             {
       
  2264             // Change the button to use "call button" (green) frame graphics
       
  2265             // in case of ECS call command to highlight the possibility
       
  2266             // of making an emergency call from the query.
       
  2267             button->SetBackgroundIds( KAknsIIDQsnFrButtonNormalAnswer,
       
  2268                                       KAknsIIDNone,
       
  2269                                       KAknsIIDNone,
       
  2270                                       KAknsIIDQsnFrButtonPressedAnswer,
       
  2271                                       KAknsIIDNone );
       
  2272             }
       
  2273         else
       
  2274             {
       
  2275             // Revert the frame graphics back to normal in case that a
       
  2276             // new command is added to the stack on top of the emergency
       
  2277             // call command (shouldn't happen though).
       
  2278             button->SetBackgroundIds( KAknsIIDQsnFrFunctionButtonNormal,
       
  2279                                       KAknsIIDQsnFrFunctionButtonPressed,
       
  2280                                       KAknsIIDQsnFrFunctionButtonInactive,
       
  2281                                       KAknsIIDQsnFrFunctionButtonPressed,
       
  2282                                       KAknsIIDQsnFrFunctionButtonInactive );
       
  2283             }
       
  2284 
       
  2285         button->AddStateL( NULL, NULL, NULL, NULL, *aText, KNullDesC, 0, aCommandId );
  2128         button->AddStateL( NULL, NULL, NULL, NULL, *aText, KNullDesC, 0, aCommandId );
  2286             
  2129             
  2287         if ( aText->Length() == 0 || !aText->Compare( _L(" ") ) )
  2130         if ( aText->Length() == 0 || !aText->Compare( _L(" ") ) )
  2288             {
  2131             {
  2289             button->SetDimmed( ETrue );
  2132             button->SetDimmed( ETrue );
  2309         {
  2152         {
  2310         iMSKset = ETrue;
  2153         iMSKset = ETrue;
  2311         }
  2154         }
  2312     SetMSKIconL(); // If MSK id was changed, this sets MSK icon accordingly.
  2155     SetMSKIconL(); // If MSK id was changed, this sets MSK icon accordingly.
  2313 
  2156 
       
  2157     TBool isEmptyAfter( IsEmpty() );
       
  2158 
       
  2159     if ( !COMPARE_BOOLS( isEmptyBefore, isEmptyAfter ) )
       
  2160         {
       
  2161         SetFadeState();
       
  2162         }
       
  2163 
  2314     ReportContentChangedEvent();
  2164     ReportContentChangedEvent();
  2315     _AKNTRACE_FUNC_EXIT;
       
  2316     }
  2165     }
  2317 
  2166 
  2318 void CEikCba::AddCommandToStackL( TInt aPosition,
  2167 void CEikCba::AddCommandToStackL( TInt aPosition,
  2319                                   TInt aCommandId,
  2168                                   TInt aCommandId,
  2320                                   const TDesC* aText, 
  2169                                   const TDesC* aText, 
  2321                                   const CFbsBitmap* /*aBitmap*/,
  2170                                   const CFbsBitmap* /*aBitmap*/,
  2322                                   const CFbsBitmap* /*aMask*/ )
  2171                                   const CFbsBitmap* /*aMask*/ )
  2323     {
  2172     {
  2324     _AKNTRACE_FUNC_ENTER;
       
  2325 
  2173 
  2326     AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText);
  2174     AddCommandToStackWithoutSizeChangedL( aPosition, aCommandId, aText);
  2327     // Force labels to be re-formatted...
  2175     // Force labels to be re-formatted...
  2328     SizeChanged();
  2176     SizeChanged();
  2329     _AKNTRACE_FUNC_EXIT;
       
  2330     }
  2177     }
  2331 
  2178 
  2332 
  2179 
  2333 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId)
  2180 void CEikCba::AddCommandToStackL(TInt aPosition, TInt aResourceId)
  2334     {
  2181     {
  2335     _AKNTRACE_FUNC_ENTER;
       
  2336     TResourceReader reader;
  2182     TResourceReader reader;
  2337     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  2183     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  2338     TUint8 version = (TUint8)reader.ReadInt8();
  2184     TUint8 version = (TUint8)reader.ReadInt8();
  2339     TInt commandId(0);
  2185     TInt commandId(0);
  2340     if (version == KAknCbaVersion)
  2186     if (version == KAknCbaVersion)
  2349     TPtrC text=reader.ReadTPtrC();
  2195     TPtrC text=reader.ReadTPtrC();
  2350     AddCommandToStackL(aPosition, commandId, &text, NULL, NULL);
  2196     AddCommandToStackL(aPosition, commandId, &text, NULL, NULL);
  2351     CleanupStack::PopAndDestroy(); // reader
  2197     CleanupStack::PopAndDestroy(); // reader
  2352       
  2198       
  2353     ReportContentChangedEvent();
  2199     ReportContentChangedEvent();
  2354     _AKNTRACE_FUNC_EXIT;
       
  2355     }
  2200     }
  2356 
  2201 
  2357 void CEikCba::AddCommandSetToStackL(TInt aResourceId)
  2202 void CEikCba::AddCommandSetToStackL(TInt aResourceId)
  2358     {
  2203     {
  2359     _AKNTRACE_FUNC_ENTER;
       
  2360     TResourceReader reader;
  2204     TResourceReader reader;
  2361     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  2205     iCoeEnv->CreateResourceReaderLC(reader,aResourceId);
  2362 
  2206 
  2363     iCbaFlags = reader.ReadInt32(); // Flags resource.
  2207     iCbaFlags = reader.ReadInt32(); // Flags resource.
  2364     reader.ReadInt16();             // Skip width resource.
  2208     reader.ReadInt16();             // Skip width resource.
  2424     CleanupStack::PopAndDestroy(); // reader
  2268     CleanupStack::PopAndDestroy(); // reader
  2425 
  2269 
  2426     // Force labels to be re-formatted...
  2270     // Force labels to be re-formatted...
  2427     SizeChanged();
  2271     SizeChanged();
  2428     ReportContentChangedEvent();
  2272     ReportContentChangedEvent();
  2429     _AKNTRACE_FUNC_EXIT;
       
  2430     }
  2273     }
  2431 
  2274 
  2432 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/)
  2275 void CEikCba::SetDefaultCommand(TInt /*aCommandId*/)
  2433     {
  2276     {
  2434     _AKNTRACE_FUNC_ENTER;
       
  2435     _AKNTRACE_FUNC_EXIT;
       
  2436     }
  2277     }
  2437 
  2278 
  2438 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/)
  2279 TSize CEikCba::CalcMinimumSizeL(TInt /*aResourceId*/)
  2439     {
  2280     {
  2440     _AKNTRACE_FUNC_ENTER;
       
  2441     _AKNTRACE_FUNC_EXIT;
       
  2442     return MinimumSize();
  2281     return MinimumSize();
  2443     }
  2282     }
  2444 
  2283 
  2445 
  2284 
  2446 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId )
  2285 void CEikCba::RemoveCommandFromStack( TInt aPosition, TInt aCommandId )
  2447     {
  2286     {
  2448     _AKNTRACE_FUNC_ENTER;
       
  2449     // We need to check if this call changes the softkeys from being
  2287     // We need to check if this call changes the softkeys from being
  2450     // empty to having a command or vice versa to be able to maintain
  2288     // empty to having a command or vice versa to be able to maintain
  2451     // correct fade state.
  2289     // correct fade state.
  2452     TBool isEmptyBefore( IsEmpty() );
  2290     TBool isEmptyBefore( IsEmpty() );
  2453     
  2291     
  2464                 static_cast<CAknCommandButtonState*>( button->State() );
  2302                 static_cast<CAknCommandButtonState*>( button->State() );
  2465                 
  2303                 
  2466             groupCtrl.iId     = buttonState->CommandId();
  2304             groupCtrl.iId     = buttonState->CommandId();
  2467             groupCtrl.iLongId = 0;
  2305             groupCtrl.iLongId = 0;
  2468                 
  2306                 
  2469             if ( aCommandId == EAknSoftkeyEmergencyCall )
       
  2470                 {
       
  2471                 // Revert the button's frame graphics to the normal ones.
       
  2472                 button->SetBackgroundIds( KAknsIIDQsnFrFunctionButtonNormal,
       
  2473                                           KAknsIIDQsnFrFunctionButtonPressed,
       
  2474                                           KAknsIIDQsnFrFunctionButtonInactive,
       
  2475                                           KAknsIIDQsnFrFunctionButtonPressed,
       
  2476                                           KAknsIIDQsnFrFunctionButtonInactive );
       
  2477                 }
       
  2478                 
       
  2479             if ( buttonState->Text().Length() == 0 ||
  2307             if ( buttonState->Text().Length() == 0 ||
  2480                  !buttonState->Text().Compare( _L(" ") ) )
  2308                  !buttonState->Text().Compare( _L(" ") ) )
  2481                 {
  2309                 {
  2482                 button->SetDimmed( ETrue );
  2310                 button->SetDimmed( ETrue );
  2483                 }
  2311                 }
  2498     
  2326     
  2499     // Force labels to be re-formatted...
  2327     // Force labels to be re-formatted...
  2500     SizeChanged();
  2328     SizeChanged();
  2501     
  2329     
  2502     TBool isEmptyAfter( IsEmpty() );
  2330     TBool isEmptyAfter( IsEmpty() );
       
  2331     
       
  2332     if ( !COMPARE_BOOLS( isEmptyBefore, isEmptyAfter ) )
       
  2333         {
       
  2334         SetFadeState();
       
  2335         }
  2503 
  2336 
  2504     DrawDeferred();
  2337     DrawDeferred();
  2505     ReportContentChangedEvent();
  2338     ReportContentChangedEvent();
  2506     _AKNTRACE_FUNC_EXIT;
       
  2507     }
  2339     }
  2508 
  2340 
  2509 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition)
  2341 void CEikCba::RemovePreviousCommandWithoutSizeChanged(TInt aPosition)
  2510     {
  2342     {
  2511     _AKNTRACE_FUNC_ENTER;
       
  2512     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2343     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2513     STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand();
  2344     STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->RemovePreviousCommand();
  2514     _AKNTRACE_FUNC_EXIT;
       
  2515     }
  2345     }
  2516 
  2346 
  2517 void CEikCba::RemovePreviousCommand(TInt aPosition)
  2347 void CEikCba::RemovePreviousCommand(TInt aPosition)
  2518     {
  2348     {
  2519     _AKNTRACE_FUNC_ENTER;
       
  2520     RemovePreviousCommandWithoutSizeChanged( aPosition );
  2349     RemovePreviousCommandWithoutSizeChanged( aPosition );
  2521     // If MSK or left CBA was changed, this sets MSK icon accordingly.
  2350     // If MSK or left CBA was changed, this sets MSK icon accordingly.
  2522     TRAP_IGNORE( SetMSKIconL() ); 
  2351     TRAP_IGNORE( SetMSKIconL() ); 
  2523     
  2352     
  2524     // Force labels to be re-formatted...
  2353     // Force labels to be re-formatted...
  2525     SizeChanged();
  2354     SizeChanged();
  2526     ReportContentChangedEvent();
  2355     ReportContentChangedEvent();
  2527     _AKNTRACE_FUNC_EXIT;
       
  2528     }
  2356     }
  2529 
  2357 
  2530 
  2358 
  2531 TInt CEikCba::CommandPos(TInt aCommandId) const
  2359 TInt CEikCba::CommandPos(TInt aCommandId) const
  2532     {
  2360     {
  2533     _AKNTRACE_FUNC_ENTER;
       
  2534     _AKNTRACE_FUNC_EXIT;
       
  2535     return IndexById(aCommandId);
  2361     return IndexById(aCommandId);
  2536     }
  2362     }
  2537 
  2363 
  2538 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed)
  2364 void CEikCba::DimCommand(TInt aCommandId,TBool aDimmed)
  2539     {
  2365     {
  2540     _AKNTRACE_FUNC_ENTER;
       
  2541     CCoeControl* control( ButtonById( aCommandId ) );
  2366     CCoeControl* control( ButtonById( aCommandId ) );
  2542     if ( control )
  2367     if ( control )
  2543         {
  2368         {
  2544         if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) )
  2369         if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), aDimmed ) )
  2545             {
  2370             {
  2546             control->SetDimmed( aDimmed );
  2371             control->SetDimmed( aDimmed );
  2547             }
  2372             }
  2548         }
  2373         }
  2549     _AKNTRACE_FUNC_EXIT;
       
  2550     }
  2374     }
  2551 
  2375 
  2552 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const
  2376 TBool CEikCba::IsCommandDimmed(TInt aCommandId) const
  2553     {
  2377     {
  2554     _AKNTRACE_FUNC_ENTER;
       
  2555     if( ButtonById(aCommandId) )
  2378     if( ButtonById(aCommandId) )
  2556         {
  2379         {
  2557         _AKNTRACE_FUNC_EXIT;
       
  2558         return ButtonById(aCommandId)->IsDimmed();
  2380         return ButtonById(aCommandId)->IsDimmed();
  2559         }
  2381         }
  2560     _AKNTRACE_FUNC_EXIT;
       
  2561     return EFalse;
  2382     return EFalse;
  2562     }
  2383     }
  2563 
  2384 
  2564 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible)
  2385 void CEikCba::MakeCommandVisible(TInt aCommandId, TBool aVisible)
  2565     {
  2386     {
  2566     _AKNTRACE_FUNC_ENTER;
       
  2567     CCoeControl* control( ButtonById( aCommandId ) );
  2387     CCoeControl* control( ButtonById( aCommandId ) );
  2568     if ( control )
  2388     if ( control )
  2569         {
  2389         {
  2570         if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) )
  2390         if ( SoftkeyStatusChangeAllowed( IndexById( aCommandId ), !aVisible ) )
  2571             {
  2391             {
  2572             control->MakeVisible( aVisible );
  2392             control->MakeVisible( aVisible );
  2573             }
  2393             }
  2574         }
  2394         }
  2575     _AKNTRACE_FUNC_EXIT;
       
  2576     }
  2395     }
  2577 
  2396 
  2578 TBool CEikCba::IsCommandVisible(TInt aCommandId) const
  2397 TBool CEikCba::IsCommandVisible(TInt aCommandId) const
  2579     {
  2398     {
  2580     _AKNTRACE_FUNC_ENTER;
       
  2581     if( ButtonById(aCommandId) )
  2399     if( ButtonById(aCommandId) )
  2582         {
  2400         {
  2583         _AKNTRACE_FUNC_EXIT;
       
  2584         return ButtonById(aCommandId)->IsVisible();
  2401         return ButtonById(aCommandId)->IsVisible();
  2585         }
  2402         }
  2586     _AKNTRACE_FUNC_EXIT;
       
  2587     return EFalse;        
  2403     return EFalse;        
  2588     }
  2404     }
  2589 
  2405 
  2590 void CEikCba::AnimateCommand(TInt /*aCommandId*/)
  2406 void CEikCba::AnimateCommand(TInt /*aCommandId*/)
  2591     {
  2407     {
  2592     _AKNTRACE_FUNC_ENTER;
       
  2593     _AKNTRACE_FUNC_EXIT;
       
  2594     }
  2408     }
  2595 
  2409 
  2596 
  2410 
  2597 // ---------------------------------------------------------------------------
  2411 // ---------------------------------------------------------------------------
  2598 // Sets the dimming status of a button with the specified position.
  2412 // Sets the dimming status of a button with the specified position.
  2599 // ---------------------------------------------------------------------------
  2413 // ---------------------------------------------------------------------------
  2600 //
  2414 //
  2601 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed )
  2415 void CEikCba::DimCommandByPosition( TInt aPosition, TBool aDimmed )
  2602     {
  2416     {
  2603     _AKNTRACE_FUNC_ENTER;
       
  2604     if ( aPosition >= iControlArray->Count() )
  2417     if ( aPosition >= iControlArray->Count() )
  2605         { 
  2418         { 
  2606         _AKNTRACE_FUNC_EXIT;
       
  2607         return;
  2419         return;
  2608         }
  2420         }
  2609 
  2421 
  2610     if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) )
  2422     if ( SoftkeyStatusChangeAllowed( aPosition, aDimmed ) )
  2611         {
  2423         {
  2612         TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ];
  2424         TEikGroupControl& groupCtrl = ( *iControlArray )[ aPosition ];
  2613         groupCtrl.iControl->SetDimmed( aDimmed );
  2425         groupCtrl.iControl->SetDimmed( aDimmed );
  2614         }
  2426         }
  2615     _AKNTRACE_FUNC_EXIT;
       
  2616     }
  2427     }
  2617 
  2428 
  2618 
  2429 
  2619 // ---------------------------------------------------------------------------
  2430 // ---------------------------------------------------------------------------
  2620 // Returns the dimming status of a button with the specified position.
  2431 // Returns the dimming status of a button with the specified position.
  2621 // ---------------------------------------------------------------------------
  2432 // ---------------------------------------------------------------------------
  2622 //
  2433 //
  2623 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const
  2434 TBool CEikCba::IsCommandDimmedByPosition( TInt aPosition ) const
  2624     {
  2435     {
  2625     _AKNTRACE_FUNC_ENTER;
       
  2626     if ( aPosition >= iControlArray->Count() ) 
  2436     if ( aPosition >= iControlArray->Count() ) 
  2627         {
  2437         {
  2628         _AKNTRACE_FUNC_EXIT;
       
  2629         return EFalse;    
  2438         return EFalse;    
  2630         }
  2439         }
  2631 
  2440 
  2632     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2441     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2633     _AKNTRACE_FUNC_EXIT;
       
  2634     return groupCtrl.iControl->IsDimmed();
  2442     return groupCtrl.iControl->IsDimmed();
  2635     }
  2443     }
  2636 
  2444 
  2637 
  2445 
  2638 // ---------------------------------------------------------------------------
  2446 // ---------------------------------------------------------------------------
  2639 // Sets the visibility of a button with the specified position.
  2447 // Sets the visibility of a button with the specified position.
  2640 // ---------------------------------------------------------------------------
  2448 // ---------------------------------------------------------------------------
  2641 //
  2449 //
  2642 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible )
  2450 void CEikCba::MakeCommandVisibleByPosition( TInt aPosition, TBool aVisible )
  2643     {
  2451     {
  2644     _AKNTRACE_FUNC_ENTER;
       
  2645     if ( aPosition >= iControlArray->Count() )
  2452     if ( aPosition >= iControlArray->Count() )
  2646         { 
  2453         { 
  2647         _AKNTRACE_FUNC_EXIT;
       
  2648         return;    
  2454         return;    
  2649         }
  2455         }
  2650 
  2456 
  2651     if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) )
  2457     if ( SoftkeyStatusChangeAllowed( aPosition, !aVisible ) )
  2652         {
  2458         {
  2661             // Just dim the button, don't hide it.
  2467             // Just dim the button, don't hide it.
  2662             groupCtrl.iControl->SetDimmed( !aVisible );
  2468             groupCtrl.iControl->SetDimmed( !aVisible );
  2663             groupCtrl.iControl->DrawDeferred();
  2469             groupCtrl.iControl->DrawDeferred();
  2664             }
  2470             }
  2665         }
  2471         }
  2666     _AKNTRACE_FUNC_EXIT;
       
  2667     }
  2472     }
  2668 
  2473 
  2669 
  2474 
  2670 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const
  2475 TBool CEikCba::IsCommandVisibleByPosition(TInt aPosition) const
  2671     {
  2476     {
  2672     _AKNTRACE_FUNC_ENTER;
       
  2673     if (aPosition >= iControlArray->Count()) 
  2477     if (aPosition >= iControlArray->Count()) 
  2674         {
  2478         {
  2675         _AKNTRACE_FUNC_EXIT;
       
  2676         return EFalse;    
  2479         return EFalse;    
  2677         }
  2480         }
  2678     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2481     TEikGroupControl& groupCtrl = (*iControlArray)[aPosition];
  2679 
  2482 
  2680     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  2483     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  2681         {
  2484         {
  2682         _AKNTRACE_FUNC_EXIT;
       
  2683         return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible();
  2485         return STATIC_CAST(CEikCbaButton*, groupCtrl.iControl)->IsVisible();
  2684         }
  2486         }
  2685         
  2487         
  2686     _AKNTRACE_FUNC_EXIT;    
       
  2687     return !groupCtrl.iControl->IsDimmed();
  2488     return !groupCtrl.iControl->IsDimmed();
  2688     }
  2489     }
  2689 
  2490 
  2690 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/)
  2491 void CEikCba::AnimateCommandByPosition(TInt /*aPosition*/)
  2691     {
  2492     {
  2692     _AKNTRACE_FUNC_ENTER;
       
  2693     _AKNTRACE_FUNC_EXIT;
       
  2694     }
  2493     }
  2695     
  2494     
  2696 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const
  2495 /*CCoeControl* CEikCba::GroupControlByPosition(TInt aPosition) const
  2697     {
  2496     {
  2698     if (aPosition >= iControlArray->Count())
  2497     if (aPosition >= iControlArray->Count())
  2709 // Gets a CBA button rectangle.
  2508 // Gets a CBA button rectangle.
  2710 // ---------------------------------------------------------------------------
  2509 // ---------------------------------------------------------------------------
  2711 //
  2510 //
  2712 TRect CEikCba::ButtonRectByPosition( TInt aPosition, TBool aRelativeToScreen )
  2511 TRect CEikCba::ButtonRectByPosition( TInt aPosition, TBool aRelativeToScreen )
  2713     {
  2512     {
  2714     _AKNTRACE_FUNC_ENTER;
       
  2715     TRect rect( 0, 0, 0, 0 );
  2513     TRect rect( 0, 0, 0, 0 );
  2716     
  2514     
  2717     if ( aPosition >= iControlArray->Count() || aPosition < 0 )
  2515     if ( aPosition >= iControlArray->Count() || aPosition < 0 )
  2718         {
  2516         {
  2719         _AKNTRACE_FUNC_EXIT;
       
  2720         return rect;
  2517         return rect;
  2721         }
  2518         }
  2722 
  2519 
  2723     if ( !AknLayoutUtils::PenEnabled() )
  2520     if ( !AknLayoutUtils::PenEnabled() )
  2724         {
  2521         {
  2738         TRect button2Rect( 0, 0, 0, 0 );
  2535         TRect button2Rect( 0, 0, 0, 0 );
  2739         TRect buttonMSKRect( 0, 0, 0, 0 );
  2536         TRect buttonMSKRect( 0, 0, 0, 0 );
  2740 
  2537 
  2741         if ( iFlags.IsSet( ECbaEmbedded ) )
  2538         if ( iFlags.IsSet( ECbaEmbedded ) )
  2742             {
  2539             {
  2743             // The touch area for the softkeys will be larger than the actual
  2540             TRect rect ( Rect() );
  2744             // softkey area (whole CBA area is used).
  2541             TAknLayoutRect layoutRect;
  2745             TInt buttonWidth = containerRect.Width() / 2;
  2542             layoutRect.LayoutRect(
  2746             TSize buttonSize( buttonWidth, containerRect.Height() );
  2543                     rect, 
       
  2544                     AknLayoutScalable_Avkon::popup_sk_window_g1( 0 ) );
       
  2545             
       
  2546             // Button widths are calculated based on cba area width
       
  2547             // margin width is taken from layout
       
  2548             TInt margin = layoutRect.Rect().iTl.iX - rect.iTl.iX;
       
  2549             TInt buttonWidth = ( rect.Width() - margin * 2 ) / 2;
       
  2550             TSize buttonSize ( buttonWidth, layoutRect.Rect().Height() );
  2747                     
  2551                     
  2748             button1Rect.SetRect( containerRect.iTl, buttonSize );
  2552             button1Rect = TRect(
  2749             button2Rect.SetRect( TPoint( button1Rect.iBr.iX,
  2553                     TPoint( rect.iTl.iX + margin, layoutRect.Rect().iTl.iY ),
  2750                                          containerRect.iTl.iY ), 
  2554                     buttonSize );
  2751                                  containerRect.iBr );
  2555             button2Rect = TRect( 
       
  2556                     TPoint( button1Rect.iBr.iX, layoutRect.Rect().iTl.iY ), 
       
  2557                     TPoint( rect.iBr.iX - margin, 
       
  2558                             layoutRect.Rect().iBr.iY ) );
  2752             }
  2559             }
  2753         else if ( AknLayoutFlags() & EAknLayoutCbaInRightPane )
  2560         else if ( AknLayoutFlags() & EAknLayoutCbaInRightPane )
  2754             {
  2561             {
  2755             // Landcsape nHD layout, button parent rectangle
  2562             // Landcsape nHD layout, button parent rectangle
  2756             // is the whole screen so aRelativeToScreen parameter
  2563             // is the whole screen so aRelativeToScreen parameter
  2874                 break;
  2681                 break;
  2875                 }
  2682                 }
  2876             }
  2683             }
  2877         }
  2684         }
  2878         
  2685         
  2879     _AKNTRACE_FUNC_EXIT;
       
  2880     return rect;
  2686     return rect;
  2881     }
  2687     }
  2882 
  2688 
  2883 
  2689 
  2884 CCoeControl* CEikCba::AsControl()
  2690 CCoeControl* CEikCba::AsControl()
  2885     {
  2691     {
  2886     _AKNTRACE_FUNC_ENTER;
       
  2887     _AKNTRACE_FUNC_EXIT;
       
  2888     return this;
  2692     return this;
  2889     }
  2693     }
  2890 
  2694 
  2891 const CCoeControl* CEikCba::AsControl() const
  2695 const CCoeControl* CEikCba::AsControl() const
  2892     {
  2696     {
  2893     _AKNTRACE_FUNC_ENTER;
       
  2894     _AKNTRACE_FUNC_EXIT;
       
  2895     return this;
  2697     return this;
  2896     }
  2698     }
  2897 
  2699 
  2898 
  2700 
  2899 void CEikCba::SetBoundingRect( const TRect& /*aBoundingRect*/ )
  2701 void CEikCba::SetBoundingRect( const TRect& /*aBoundingRect*/ )
  2900     {
  2702     {
  2901     _AKNTRACE_FUNC_ENTER;
       
  2902     if ( iFlags.IsSet( ECbaEmbedded ) )
  2703     if ( iFlags.IsSet( ECbaEmbedded ) )
  2903         {
  2704         {
  2904         _AKNTRACE_FUNC_EXIT;
       
  2905         return;
  2705         return;
  2906         }
  2706         }
  2907 
  2707 
  2908     // If background skin id has not been set from outside CBA, 
  2708     // If background skin id has not been set from outside CBA, 
  2909     // update it in case status pane layout has changed
  2709     // update it in case status pane layout has changed
  2916 
  2716 
  2917     // If CBA is inserted into a query dialog then it is positioned by the
  2717     // If CBA is inserted into a query dialog then it is positioned by the
  2918     // query control. 
  2718     // query control. 
  2919     if ( iFlags.IsSet( ECbaInsideDialog ) )
  2719     if ( iFlags.IsSet( ECbaInsideDialog ) )
  2920         {
  2720         {
  2921         _AKNTRACE_FUNC_EXIT;
       
  2922         return;
  2721         return;
  2923         }
  2722         }
  2924 
  2723 
  2925     TRect oldRect( Rect() );
  2724     TRect oldRect( Rect() );
  2926     
  2725     
  2943             SetMSKVisibility( ETrue );
  2742             SetMSKVisibility( ETrue );
  2944             TRAP_IGNORE( SetMSKIconL() );
  2743             TRAP_IGNORE( SetMSKIconL() );
  2945             }
  2744             }
  2946         
  2745         
  2947         // We must check for landscape mode bottom sks 
  2746         // We must check for landscape mode bottom sks 
  2948         TBool isLandscapeOrient = Layout_Meta_Data::IsLandscapeOrientation();
       
  2949         TInt bottomPaneVariety = 1;
  2747         TInt bottomPaneVariety = 1;
  2950         if ( isLandscapeOrient )
  2748         if ( Layout_Meta_Data::IsLandscapeOrientation() )
  2951             {
  2749             {
  2952             bottomPaneVariety = 6;
  2750             bottomPaneVariety = 6;
  2953             }
  2751             }
  2954             
  2752             
  2955         // SetBoundingRect is always called by status pane when it is changing visibility.
       
  2956         // If the status pane is invisible in landscape, softkey need to draw frame to cover
       
  2957         // the area of combine pane.
       
  2958         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
       
  2959         if (statusPane && !statusPane->IsVisible() && isLandscapeOrient &&
       
  2960             statusPane->PaneCapabilities(TUid::Uid(EEikStatusPaneUidCombined)).IsInCurrentLayout())
       
  2961             {
       
  2962             iFlags.Set( ECbaCombinePaneUncovered );
       
  2963             }
       
  2964         else
       
  2965             {
       
  2966             iFlags.Clear( ECbaCombinePaneUncovered );
       
  2967             }
       
  2968         
       
  2969         TAknWindowLineLayout controlPane( DoCompose(
  2753         TAknWindowLineLayout controlPane( DoCompose(
  2970             AknLayoutScalable_Avkon::application_window( 0 ),
  2754             AknLayoutScalable_Avkon::application_window( 0 ),
  2971             DoCompose( AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ),
  2755             DoCompose( AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ),
  2972                        AknLayoutScalable_Avkon::control_pane() ) ).LayoutLine() );
  2756                        AknLayoutScalable_Avkon::control_pane() ) ).LayoutLine() );
  2973         
  2757         
  2977         SetRect( cbarect.Rect() );
  2761         SetRect( cbarect.Rect() );
  2978 
  2762 
  2979         // Set correct window region incase we have been in stacon mode.
  2763         // Set correct window region incase we have been in stacon mode.
  2980         RRegion region;
  2764         RRegion region;
  2981         region.AddRect( Rect() );
  2765         region.AddRect( Rect() );
       
  2766             
       
  2767         CEikStatusPaneBase* statusPane = CEikStatusPaneBase::Current();
  2982         
  2768         
  2983         // If status indicators and clock are shown in control pane area,
  2769         // If status indicators and clock are shown in control pane area,
  2984         // then remove those areas from cba window region.
  2770         // then remove those areas from cba window region.
  2985         // 
  2771         // 
  2986         // NOTE: MSK is not supported in landscape.
  2772         // NOTE: MSK is not supported in landscape.
  2987         //
  2773         //
  2988         if ( statusPane &&
  2774         if ( statusPane &&
  2989              statusPane->IsVisible() &&
  2775              statusPane->IsVisible() &&
  2990              AknStatuspaneUtils::ExtendedFlatLayoutActive() )
  2776              AknStatuspaneUtils::ExtendedFlatLayoutActive() && 
  2991             { 
  2777              ( iBgIID == KAknsIIDQsnBgAreaControl || 
       
  2778                iBgIID == KAknsIIDQsnBgAreaControlIdle ||
       
  2779                iBgIID == KAknsIIDQsnBgAreaControlMp ||
       
  2780                ( iBgIID == KAknsIIDWallpaper &&
       
  2781                  AknStatuspaneUtils::IdleLayoutActive() ) ) ) 
       
  2782             {
       
  2783             TRect digitalClockRect( 0,0,0,0 );
       
  2784             TRect indicatorRect( 0,0,0,0 );
       
  2785  
  2992             if ( iBgIID == KAknsIIDQsnBgAreaControlMp )
  2786             if ( iBgIID == KAknsIIDQsnBgAreaControlMp )
  2993                 {
  2787                 {
  2994                 if ( !iIsClockIndicBgIIDSet )
  2788                 if ( !iIsClockIndicBgIIDSet )
  2995                     {
  2789                     {
  2996                     statusPane->SetCbaAreaBackgroundID(
  2790                     statusPane->SetCbaAreaBackgroundID(
  3007                         iBgIID,
  2801                         iBgIID,
  3008                         CEikStatusPaneBase::EDrawDeferred );
  2802                         CEikStatusPaneBase::EDrawDeferred );
  3009                     }
  2803                     }
  3010                 }
  2804                 }
  3011 
  2805 
  3012             if ( statusPane->PaneCapabilities(
  2806             TRAPD( err1,
  3013                      TUid::Uid( EEikStatusPaneUidCombined ) ).IsInCurrentLayout() )
  2807                    indicatorRect = statusPane->PaneRectL( TUid::Uid( 
  3014                 {
  2808                         EEikStatusPaneUidIndic ) ) );
  3015                 TRect combinedPaneRect( 0, 0, 0, 0 );
  2809                                    
  3016                 TRAPD( err,
  2810             TRAPD( err2,
  3017                        combinedPaneRect =
  2811                    digitalClockRect = statusPane->PaneRectL( TUid::Uid( 
  3018                            statusPane->PaneRectL( TUid::Uid( 
  2812                         EEikStatusPaneUidDigitalClock ) ) );
  3019                                EEikStatusPaneUidCombined ) ) );
  2813 
       
  2814             if ( !err1 && !err2 )
       
  2815                 {
       
  2816                 TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
       
  2817                 TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
       
  2818 
       
  2819                 if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) )
       
  2820                     {
       
  2821                     indicatorRect.Move(
       
  2822                         -cbaPositionRelativeToScreen.iX,
       
  2823                         -cbaPositionRelativeToScreen.iY );
       
  2824                         
       
  2825                     region.SubRect( indicatorRect );                              
       
  2826                     }
  3020                 
  2827                 
  3021                 if ( !err )
  2828                 if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) )
  3022                     {
  2829                     {
  3023                     TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
  2830                     digitalClockRect.Move(
  3024                     TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
  2831                         -cbaPositionRelativeToScreen.iX,
  3025                     
  2832                         -cbaPositionRelativeToScreen.iY );
  3026                     if ( cbaRectRelativeToScreen.Intersects( combinedPaneRect ) )
  2833                         
  3027                         {
  2834                     region.SubRect( digitalClockRect );       
  3028                         combinedPaneRect.Move(
       
  3029                             -cbaPositionRelativeToScreen.iX,
       
  3030                             -cbaPositionRelativeToScreen.iY );
       
  3031                             
       
  3032                         region.SubRect( combinedPaneRect );                              
       
  3033                         }
       
  3034                     }
       
  3035                 }
       
  3036             else
       
  3037                 {
       
  3038                 TRect digitalClockRect( 0, 0, 0, 0 );
       
  3039                 TRect indicatorRect( 0, 0, 0, 0 );
       
  3040 
       
  3041                 TRAPD( err1,
       
  3042                        indicatorRect = statusPane->PaneRectL( TUid::Uid( 
       
  3043                            EEikStatusPaneUidIndic ) ) );
       
  3044                                                
       
  3045                 TRAPD( err2,
       
  3046                        digitalClockRect = statusPane->PaneRectL( TUid::Uid( 
       
  3047                            EEikStatusPaneUidDigitalClock ) ) );
       
  3048                 
       
  3049                 if ( !err1 && !err2 )
       
  3050                     {
       
  3051                     TPoint cbaPositionRelativeToScreen( PositionRelativeToScreen() );
       
  3052                     TRect cbaRectRelativeToScreen( cbaPositionRelativeToScreen, Size() );
       
  3053 
       
  3054                     if ( cbaRectRelativeToScreen.Intersects( indicatorRect ) )
       
  3055                         {
       
  3056                         indicatorRect.Move(
       
  3057                             -cbaPositionRelativeToScreen.iX,
       
  3058                             -cbaPositionRelativeToScreen.iY );
       
  3059                             
       
  3060                         region.SubRect( indicatorRect );                              
       
  3061                         }
       
  3062                     
       
  3063                     if ( cbaRectRelativeToScreen.Intersects( digitalClockRect ) )
       
  3064                         {
       
  3065                         digitalClockRect.Move(
       
  3066                             -cbaPositionRelativeToScreen.iX,
       
  3067                             -cbaPositionRelativeToScreen.iY );
       
  3068                             
       
  3069                         region.SubRect( digitalClockRect );       
       
  3070                         }
       
  3071                     }
  2835                     }
  3072                 }
  2836                 }
  3073             }
  2837             }
  3074 
  2838 
  3075         if ( !region.CheckError() )
  2839         if ( !region.CheckError() )
  3204             SetMSKVisibility( EFalse );
  2968             SetMSKVisibility( EFalse );
  3205             }
  2969             }
  3206         
  2970         
  3207         DrawDeferred();
  2971         DrawDeferred();
  3208         }
  2972         }
  3209     _AKNTRACE_FUNC_EXIT;
       
  3210     }
  2973     }
  3211 
  2974 
  3212 
  2975 
  3213 // ---------------------------------------------------------------------------
  2976 // ---------------------------------------------------------------------------
  3214 // Subtracts the area occupied by the button group from the specified
  2977 // Subtracts the area occupied by the button group from the specified
  3215 // bounding rectangle.
  2978 // bounding rectangle.
  3216 // ---------------------------------------------------------------------------
  2979 // ---------------------------------------------------------------------------
  3217 //
  2980 //
  3218 void CEikCba::ReduceRect( TRect& aBoundingRect ) const
  2981 void CEikCba::ReduceRect( TRect& aBoundingRect ) const
  3219     {
  2982     {
  3220     _AKNTRACE_FUNC_ENTER;
       
  3221     // CBA inside Popup/Query Input does not reduce bounding rect
  2983     // CBA inside Popup/Query Input does not reduce bounding rect
  3222     if ( iFlags.IsSet( ECbaEmbedded ) || iFlags.IsSet( ECbaInsideDialog ) )
  2984     if ( iFlags.IsSet( ECbaEmbedded ) || iFlags.IsSet( ECbaInsideDialog ) )
  3223         {
  2985         {
  3224         _AKNTRACE_FUNC_EXIT;
       
  3225         return;
  2986         return;
  3226         }
  2987         }
  3227     
  2988     
  3228     if ( !IsVisible() )
  2989     if ( !IsVisible() )
  3229         {
  2990         {
  3230         _AKNTRACE_FUNC_EXIT;
       
  3231         return;
  2991         return;
  3232         }
  2992         }
  3233 
  2993 
  3234     const TInt aknLayoutFlags = AknLayoutFlags();
  2994     const TInt aknLayoutFlags = AknLayoutFlags();
  3235 
  2995 
  3347                 aBoundingRect = largestBoundingRect;
  3107                 aBoundingRect = largestBoundingRect;
  3348                 boundingRegion.Close();    
  3108                 boundingRegion.Close();    
  3349                 }
  3109                 }
  3350             }   
  3110             }   
  3351         }
  3111         }
  3352     _AKNTRACE_FUNC_EXIT;
       
  3353     }
  3112     }
  3354 
  3113 
  3355 
  3114 
  3356 CCoeControl* CEikCba::GroupControlById(TInt aCommandId)
  3115 CCoeControl* CEikCba::GroupControlById(TInt aCommandId)
  3357     {
  3116     {
  3358     _AKNTRACE_FUNC_ENTER;
       
  3359     _AKNTRACE_FUNC_EXIT;
       
  3360     return ButtonById(aCommandId);
  3117     return ButtonById(aCommandId);
  3361     }
  3118     }
  3362 
  3119 
  3363 
  3120 
  3364 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const
  3121 CCoeControl* CEikCba::GroupControlById(TInt aCommandId) const
  3365     {
  3122     {
  3366     _AKNTRACE_FUNC_ENTER;
       
  3367     _AKNTRACE_FUNC_EXIT;
       
  3368     return ButtonById(aCommandId);
  3123     return ButtonById(aCommandId);
  3369     }
  3124     }
  3370 
  3125 
  3371 TInt CEikCba::CommandId(TInt aCommandPos) const
  3126 TInt CEikCba::CommandId(TInt aCommandPos) const
  3372     {
  3127     {
  3373     _AKNTRACE_FUNC_ENTER;
       
  3374     _AKNTRACE_FUNC_EXIT;
       
  3375     return (*iControlArray)[aCommandPos].iId;
  3128     return (*iControlArray)[aCommandPos].iId;
  3376     }
  3129     }
  3377 
  3130 
  3378 TInt CEikCba::ButtonCount() const
  3131 TInt CEikCba::ButtonCount() const
  3379     {
  3132     {
  3380     _AKNTRACE_FUNC_ENTER;
       
  3381     _AKNTRACE_FUNC_EXIT;
       
  3382     return (iControlArray->Count()-1); // -1 for scroll bar;
  3133     return (iControlArray->Count()-1); // -1 for scroll bar;
  3383     }
  3134     }
  3384 
  3135 
  3385 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const 
  3136 CEikCommandButton* CEikCba::GroupControlAsButton(TInt /*aCommandId*/) const 
  3386     {
  3137     {
  3387     _AKNTRACE_FUNC_ENTER;
       
  3388     // It is not possible to convert a CBA button to a CEikCommandButton.
  3138     // It is not possible to convert a CBA button to a CEikCommandButton.
  3389     // Please use an interface that does not use a CEikCommandButton conversion,
  3139     // Please use an interface that does not use a CEikCommandButton conversion,
  3390     // e.g. CEikButtonGroupContainer::SetCommandL().
  3140     // e.g. CEikButtonGroupContainer::SetCommandL().
  3391 #if defined(_DEBUG)
  3141 #if defined(_DEBUG)
  3392     Panic(EEikPanicCBACannotConvertToCEikCommandButton);
  3142     Panic(EEikPanicCBACannotConvertToCEikCommandButton);
  3393 #endif
  3143 #endif
  3394     _AKNTRACE_FUNC_EXIT;
       
  3395     return NULL;
  3144     return NULL;
  3396     }
  3145     }
  3397 
  3146 
  3398 TUint CEikCba::ButtonGroupFlags() const 
  3147 TUint CEikCba::ButtonGroupFlags() const 
  3399     {
  3148     {
  3400     _AKNTRACE_FUNC_ENTER;
       
  3401     _AKNTRACE_FUNC_EXIT;
       
  3402     return iCbaFlags ;
  3149     return iCbaFlags ;
  3403     }
  3150     }
  3404 
  3151 
  3405 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags)
  3152 EXPORT_C void CEikCba::SetButtonGroupFlags(TInt aFlags)
  3406     {
  3153     {
  3407     _AKNTRACE_FUNC_ENTER;
       
  3408     iCbaFlags = aFlags;
  3154     iCbaFlags = aFlags;
  3409     
       
  3410     //has not supported semi-transparent, ignore the flag at this moment.
       
  3411     //TODO: if the tranparent style CBA is approved and the new icon was delivered, open it again.
       
  3412     
       
  3413     //steven yao
       
  3414     //iCbaFlags &= ~EEikCbaFlagSemiTransparent;
       
  3415     
       
  3416     if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && 
  3155     if (( iCbaFlags & EEikCbaFlagTransparent || iCbaFlags & EEikCbaFlagSemiTransparent ) && 
  3417             CAknEnv::Static()->TransparencyEnabled() )
  3156             CAknEnv::Static()->TransparencyEnabled() )
  3418         {
  3157         {
  3419         Window().SetRequiredDisplayMode( EColor16MA );
  3158         Window().SetRequiredDisplayMode( EColor16MA );
  3420         TInt err = Window().SetTransparencyAlphaChannel();
  3159         TInt err = Window().SetTransparencyAlphaChannel();
  3421         if( err == KErrNone )
  3160         if( err == KErrNone )
  3422             {
  3161             {
  3423             Window().SetBackgroundColor( ~0 );
  3162             Window().SetBackgroundColor( ~0 );
  3424             if ( iExtension && iExtension->iEnablePostingTransparency )
  3163             if ( iExtension && iExtension->iEnablePostingTransparency )
  3425                 {
  3164                 {
  3426                    iExtension->iEnablePostingTransparency = EFalse;            
  3165                	iExtension->iEnablePostingTransparency = EFalse;        	
  3427                    delete iExtension->iLskPostingOverlayBitmap;
  3166                	delete iExtension->iLskPostingOverlayBitmap;
  3428                    iExtension->iLskPostingOverlayBitmap = NULL;
  3167                	iExtension->iLskPostingOverlayBitmap = NULL;
  3429                    delete iExtension->iRskPostingOverlayBitmap;
  3168                	delete iExtension->iRskPostingOverlayBitmap;
  3430                    iExtension->iRskPostingOverlayBitmap = NULL;
  3169                	iExtension->iRskPostingOverlayBitmap = NULL;
  3431                    BroadcastPostingTransparency( EFalse );
  3170                	BroadcastPostingTransparency( EFalse );
  3432                    }           
  3171                	}           
  3433             }
  3172             }
  3434         else
  3173         else
  3435             {
  3174             {
  3436             iCbaFlags &= ~EEikCbaFlagTransparent;
  3175             iCbaFlags &= ~EEikCbaFlagTransparent;
  3437             }       
  3176             }       
  3438         }
  3177         }
  3439     else
  3178     else
  3440         {
  3179         {
  3441         iCbaFlags &= ~EEikCbaFlagTransparent;
  3180         iCbaFlags &= ~EEikCbaFlagTransparent;
  3442         }
  3181         }
       
  3182     if ( iCbaFlags & EEikCbaFlagSemiTransparent )
       
  3183         {
       
  3184         if ( iExtension )
       
  3185             {
       
  3186             iExtension->iSemiBgID = KAknsIIDQsnHomeBgWidget;
       
  3187             iExtension->iSemiBgCenterID = KAknsIIDQsnHomeBgWidgetCenter;
       
  3188             }
       
  3189         }
       
  3190     else
       
  3191         {
       
  3192         if ( iExtension )
       
  3193             {
       
  3194             iExtension->iSemiBgID = KAknsIIDNone;
       
  3195             iExtension->iSemiBgCenterID = KAknsIIDNone;
       
  3196             }
       
  3197         }
  3443     
  3198     
  3444     UpdateFonts();
  3199     UpdateFonts();
  3445     _AKNTRACE_FUNC_EXIT;
       
  3446     }
  3200     }
  3447 
  3201 
  3448 // -----------------------------------------------------------------------------
  3202 // -----------------------------------------------------------------------------
  3449 // CEikCba::SetSkinBackgroundId
  3203 // CEikCba::SetSkinBackgroundId
  3450 //
  3204 //
  3451 // -----------------------------------------------------------------------------
  3205 // -----------------------------------------------------------------------------
  3452 //
  3206 //
  3453 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID )
  3207 EXPORT_C void CEikCba::SetSkinBackgroundId( const TAknsItemID& aIID )
  3454     {
  3208     {
  3455     _AKNTRACE_FUNC_ENTER;
       
  3456     // Skin background is not drawn by embedded CBA.
  3209     // Skin background is not drawn by embedded CBA.
  3457     if ( iFlags.IsSet( ECbaEmbedded ) )
  3210     if ( iFlags.IsSet( ECbaEmbedded ) )
  3458         {
  3211         {
  3459     	iPopupVisible = ETrue;
       
  3460     	_AKNTRACE_FUNC_EXIT;
       
  3461         return;
  3212         return;
  3462         }
       
  3463     else
       
  3464         {
       
  3465         iPopupVisible = EFalse;
       
  3466         }
  3213         }
  3467 
  3214 
  3468     if ( iBgIID != KAknsIIDNone )
  3215     if ( iBgIID != KAknsIIDNone )
  3469         {
  3216         {
  3470         if ( iBgIID != aIID )
  3217         if ( iBgIID != aIID )
  3512         {
  3259         {
  3513         statusPane->SetCbaAreaBackgroundID(
  3260         statusPane->SetCbaAreaBackgroundID(
  3514             iBgIID,
  3261             iBgIID,
  3515             CEikStatusPaneBase::EDrawDeferred );
  3262             CEikStatusPaneBase::EDrawDeferred );
  3516         }
  3263         }
  3517     _AKNTRACE_FUNC_EXIT;
       
  3518     }
  3264     }
  3519 
  3265 
  3520 TKeyResponse CEikCba::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  3266 TKeyResponse CEikCba::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
  3521     {
  3267     {
  3522     _AKNTRACE_FUNC_ENTER;
       
  3523     if (aType != EEventKey)
  3268     if (aType != EEventKey)
  3524         {
  3269         {
  3525         _AKNTRACE_FUNC_EXIT;
       
  3526         return EKeyWasNotConsumed;
  3270         return EKeyWasNotConsumed;
  3527         }
  3271         }
  3528 
  3272 
  3529     // Return immediately if the control is invisible.
  3273     // Return immediately if the control is invisible.
  3530     if (!IsVisible() && !(iCbaFlags&EAknCBAFlagRespondWhenInvisible))
  3274     if (!IsVisible() && !(iCbaFlags&EAknCBAFlagRespondWhenInvisible))
  3531         {
  3275         {
  3532         _AKNTRACE_FUNC_EXIT;
       
  3533         return EKeyWasNotConsumed;
  3276         return EKeyWasNotConsumed;
  3534         }
  3277         }
  3535 
  3278 
  3536     TBool shiftControlPressed = 
  3279     TBool shiftControlPressed = 
  3537         (aKeyEvent.iModifiers & EModifierShift) ||
  3280         (aKeyEvent.iModifiers & EModifierShift) ||
  3540         (aKeyEvent.iModifiers & EModifierCtrl) || 
  3283         (aKeyEvent.iModifiers & EModifierCtrl) || 
  3541         (aKeyEvent.iModifiers & EModifierRightCtrl);  
  3284         (aKeyEvent.iModifiers & EModifierRightCtrl);  
  3542 
  3285 
  3543     TKeyResponse response(EKeyWasNotConsumed);
  3286     TKeyResponse response(EKeyWasNotConsumed);
  3544 
  3287 
  3545     CEikCbaButton* button1 =
       
  3546         static_cast<CEikCbaButton*>(
       
  3547             (*iControlArray)[KControlArrayCBAButton1Posn].iControl );
       
  3548     CEikCbaButton* button2 =
       
  3549         static_cast<CEikCbaButton*>(
       
  3550             (*iControlArray)[KControlArrayCBAButton2Posn].iControl );
       
  3551     CEikCbaButton* buttonMSK = NULL;
       
  3552     if ( iMSKset && AknLayoutUtils::MSKEnabled() )
       
  3553         {
       
  3554         buttonMSK =
       
  3555             static_cast<CEikCbaButton*>(
       
  3556                 (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl );
       
  3557         }
       
  3558     
       
  3559     // AknLaf - changed to use keys defined in AknKeys.h.
  3288     // AknLaf - changed to use keys defined in AknKeys.h.
  3560     // Left soft key will be returned also when MSK is enabled but not defined.
  3289     // Left soft key will be returned also when MSK is enabled but not defined.
  3561     if (aKeyEvent.iCode == EKeyCBA1)
  3290     if (aKeyEvent.iCode == EKeyCBA1)
  3562         {
  3291         {
  3563         if (KControlArrayCBAButton1Posn < iControlArray->Count())
  3292         if (KControlArrayCBAButton1Posn < iControlArray->Count())
  3564             {
  3293             {
  3565             if( button1->IsDimmed() )
       
  3566                 {
       
  3567                 return EKeyWasConsumed;
       
  3568                 }
       
  3569             // Return immediately if the button is invisible                        
  3294             // Return immediately if the button is invisible                        
  3570             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3295             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3571                  !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3296                  !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3572                  !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) )
  3297                  !(iCbaFlags & EAknCBAFlagRespondWhenInvisible) )
  3573                 {
  3298                 {
  3574                 _AKNTRACE_FUNC_EXIT;
       
  3575                 return EKeyWasConsumed;
  3299                 return EKeyWasConsumed;
  3576                 }
  3300                 }
  3577             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  3301             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  3578             TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId;
  3302             TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId;
  3579 
  3303 
  3580             // This will pass key event to application - no softkey command is processed.
  3304             // This will pass key event to application - no softkey command is processed.
  3581             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3305             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3582                 {
  3306                 {
  3583                 _AKNTRACE_FUNC_EXIT;
       
  3584                 return EKeyWasNotConsumed;
  3307                 return EKeyWasNotConsumed;
  3585                 }
  3308                 }
  3586 
  3309 
  3587             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3310             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3588                 {
  3311                 {
  3597         }
  3320         }
  3598     else if (aKeyEvent.iCode == EKeyCBA2)
  3321     else if (aKeyEvent.iCode == EKeyCBA2)
  3599         {
  3322         {
  3600         if (KControlArrayCBAButton2Posn < iControlArray->Count())
  3323         if (KControlArrayCBAButton2Posn < iControlArray->Count())
  3601             {
  3324             {
  3602             if( button2->IsDimmed() )
       
  3603                 {
       
  3604                 return EKeyWasConsumed;
       
  3605                 }
       
  3606             // Return immediately if the button is invisible.
  3325             // Return immediately if the button is invisible.
  3607             if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl &&
  3326             if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl &&
  3608                  !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && 
  3327                  !(*iControlArray)[KControlArrayCBAButton2Posn].iControl->IsVisible() && 
  3609                  !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3328                  !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3610                 {
  3329                 {
  3611                 _AKNTRACE_FUNC_EXIT;
       
  3612                 return EKeyWasConsumed;
  3330                 return EKeyWasConsumed;
  3613                 }
  3331                 }
  3614             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iId;
  3332             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iId;
  3615             TInt longCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iLongId;
  3333             TInt longCommand = (*iControlArray)[KControlArrayCBAButton2Posn].iLongId;
  3616 
  3334 
  3621                 }
  3339                 }
  3622             
  3340             
  3623             // This will pass key event to application - no softkey command is processed.
  3341             // This will pass key event to application - no softkey command is processed.
  3624             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3342             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3625                 {
  3343                 {
  3626                 _AKNTRACE_FUNC_EXIT;
       
  3627                 return EKeyWasNotConsumed;
  3344                 return EKeyWasNotConsumed;
  3628                 }
  3345                 }
  3629 
  3346 
  3630             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3347             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3631                 {
  3348                 {
  3632                 // Notify command observer only if multiple marking
  3349                 iCommandObserver->ProcessCommandL((TInt)shortCommand);
  3633                 // was not cancelled
       
  3634                 if ( !iExtension || !iExtension->CancelMultipleMarking(
       
  3635                         shortCommand ) )
       
  3636                     {
       
  3637                     iCommandObserver->ProcessCommandL( ( TInt ) shortCommand );
       
  3638                     }
       
  3639                 }
  3350                 }
  3640             else if (longCommand)
  3351             else if (longCommand)
  3641                 {
  3352                 {
  3642                 iCommandObserver->ProcessCommandL((TInt)longCommand);
  3353                 iCommandObserver->ProcessCommandL((TInt)longCommand);
  3643                 }
  3354                 }
  3652                 && AknLayoutUtils::MSKEnabled()
  3363                 && AknLayoutUtils::MSKEnabled()
  3653                 && iMSKset
  3364                 && iMSKset
  3654                 && aKeyEvent.iCode == EKeyOK
  3365                 && aKeyEvent.iCode == EKeyOK
  3655                 && !Window().IsFaded() )
  3366                 && !Window().IsFaded() )
  3656         {
  3367         {
  3657         if( buttonMSK->IsDimmed() )
       
  3658             {
       
  3659             return EKeyWasConsumed;
       
  3660             }
       
  3661         if (KControlArrayCBAButtonMSKPosn < iControlArray->Count())
  3368         if (KControlArrayCBAButtonMSKPosn < iControlArray->Count())
  3662             {
  3369             {
  3663             // Return immediately if the button is invisible.
  3370             // Return immediately if the button is invisible.
  3664             if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl &&
  3371             if ( (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl &&
  3665                  !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && 
  3372                  !(*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl->IsVisible() && 
  3666                  !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3373                  !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3667                 {
  3374                 {
  3668                 _AKNTRACE_FUNC_EXIT;
       
  3669                 return EKeyWasConsumed;
  3375                 return EKeyWasConsumed;
  3670                 }
  3376                 }
  3671 
  3377 
  3672             TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId;
  3378             TInt shortCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iId;
  3673             TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId;
  3379             TInt longCommand = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iLongId;
  3674 
  3380 
  3675             // This will pass key event to application - no softkey command is processed.
  3381             // This will pass key event to application - no softkey command is processed.
  3676             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3382             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3677                 {
  3383                 {
  3678                 _AKNTRACE_FUNC_EXIT;
       
  3679                 return EKeyWasNotConsumed;
  3384                 return EKeyWasNotConsumed;
  3680                 }
  3385                 }
  3681 
  3386 
  3682             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3387             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3683                 {
  3388                 {
  3721             // Return immediately if the button is invisible.                      
  3426             // Return immediately if the button is invisible.                      
  3722             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3427             if ( (*iControlArray)[KControlArrayCBAButton1Posn].iControl &&
  3723                 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3428                 !(*iControlArray)[KControlArrayCBAButton1Posn].iControl->IsVisible() && 
  3724                 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3429                 !(iCbaFlags&EAknCBAFlagRespondWhenInvisible) )
  3725                 {
  3430                 {
  3726                 _AKNTRACE_FUNC_EXIT;
       
  3727                 return EKeyWasConsumed;
  3431                 return EKeyWasConsumed;
  3728                 }
  3432                 }
  3729 
  3433 
  3730             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  3434             TInt shortCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iId;
  3731             TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId;
  3435             TInt longCommand = (*iControlArray)[KControlArrayCBAButton1Posn].iLongId;
  3732 
  3436 
  3733             // This will pass key event to application - no softkey command is processed.
  3437             // This will pass key event to application - no softkey command is processed.
  3734             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3438             if (shortCommand == EAknSoftkeyForwardKeyEvent)
  3735                 {
  3439                 {
  3736                 _AKNTRACE_FUNC_EXIT;
       
  3737                 return EKeyWasNotConsumed;
  3440                 return EKeyWasNotConsumed;
  3738                 }
  3441                 }
  3739 
  3442 
  3740             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3443             if (aKeyEvent.iRepeats == 0 && shortCommand)
  3741                 {
  3444                 {
  3763                 }
  3466                 }
  3764             response = EKeyWasConsumed;
  3467             response = EKeyWasConsumed;
  3765             }
  3468             }
  3766         }
  3469         }
  3767         
  3470         
  3768     _AKNTRACE_FUNC_EXIT;
       
  3769     return response;
  3471     return response;
  3770     }
  3472     }
  3771 
  3473 
  3772 EXPORT_C void* CEikCba::ExtensionInterface( TUid /*aInterface*/ )
  3474 EXPORT_C void* CEikCba::ExtensionInterface( TUid /*aInterface*/ )
  3773     {
  3475     {
  3774     _AKNTRACE_FUNC_ENTER;
       
  3775     _AKNTRACE_FUNC_EXIT;
       
  3776     return NULL;
  3476     return NULL;
  3777     }
  3477     }
  3778 
  3478 
  3779 
  3479 
  3780 // ---------------------------------------------------------------------------
  3480 // ---------------------------------------------------------------------------
  3783 // command observer if a cba button was tapped.
  3483 // command observer if a cba button was tapped.
  3784 // ---------------------------------------------------------------------------
  3484 // ---------------------------------------------------------------------------
  3785 //
  3485 //
  3786 void CEikCba::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  3486 void CEikCba::HandlePointerEventL( const TPointerEvent& aPointerEvent )
  3787     {
  3487     {
  3788     _AKNTRACE_FUNC_ENTER;
       
  3789     if ( !AknLayoutUtils::PenEnabled() )
  3488     if ( !AknLayoutUtils::PenEnabled() )
  3790         {
  3489         {
  3791         _AKNTRACE_FUNC_EXIT;
       
  3792         return;
  3490         return;
  3793         }
  3491         }
  3794     else if ( iFlags.IsSet( ECbaInsideDialog ) )
  3492     else if ( iFlags.IsSet( ECbaInsideDialog ) )
  3795         {
  3493         {
  3796         CCoeControl::HandlePointerEventL( aPointerEvent );
  3494         CCoeControl::HandlePointerEventL( aPointerEvent );
  3797         _AKNTRACE_FUNC_EXIT;
       
  3798         return;
  3495         return;
  3799         }
  3496         }
  3800 
  3497 
  3801     // If a child control is grabbing the pointer, we store the object pointer
  3498     // If a child control is grabbing the pointer, we store the object pointer
  3802     // before calling base class implementation. This is because the up event 
  3499     // before calling base class implementation. This is because the up event 
  3878         }
  3575         }
  3879 
  3576 
  3880     // If hits the left softkey.
  3577     // If hits the left softkey.
  3881     if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty )
  3578     if ( button1Rect.Contains( aPointerEvent.iPosition ) && !button1Empty )
  3882         {
  3579         {
  3883         if( button1->IsDimmed() )
       
  3884             {
       
  3885             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  3886             return;
       
  3887             }
       
  3888         if ( button1->IsVisible() )
  3580         if ( button1->IsVisible() )
  3889             {
  3581             {
  3890             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3582             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3891                 {
  3583                 {
  3892                 button1->SetPressedDown( ETrue );
  3584                 button1->SetPressedDown( ETrue );
  3942             noHits = ETrue;
  3634             noHits = ETrue;
  3943             }
  3635             }
  3944         }
  3636         }
  3945     else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty )
  3637     else if ( button2Rect.Contains( aPointerEvent.iPosition ) && !button2Empty )
  3946         {              
  3638         {              
  3947         if( button2->IsDimmed() )
       
  3948             {
       
  3949             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  3950             return;
       
  3951             }             
       
  3952         if ( button2->IsVisible() )
  3639         if ( button2->IsVisible() )
  3953             {
  3640             {
  3954             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3641             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3955                 {
  3642                 {
  3956                 button2->SetPressedDown( ETrue );
  3643                 button2->SetPressedDown( ETrue );
  4008         }
  3695         }
  4009     else if ( buttonMSK &&
  3696     else if ( buttonMSK &&
  4010               !buttonMSKEmpty &&
  3697               !buttonMSKEmpty &&
  4011               buttonMSKRect.Contains( aPointerEvent.iPosition ) )
  3698               buttonMSKRect.Contains( aPointerEvent.iPosition ) )
  4012         {
  3699         {
  4013         if( buttonMSK->IsDimmed() )
       
  4014             {
       
  4015             CCoeControl::HandlePointerEventL( aPointerEvent );
       
  4016             return;
       
  4017             }
       
  4018         if  ( buttonMSK->IsVisible() )
  3700         if  ( buttonMSK->IsVisible() )
  4019             {
  3701             {
  4020             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  3702             if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
  4021                 {
  3703                 {
  4022                 buttonMSK->SetPressedDown( ETrue );
  3704                 buttonMSK->SetPressedDown( ETrue );
  4162             for ( TInt i = 0; i < buttoncount; i++ )
  3844             for ( TInt i = 0; i < buttoncount; i++ )
  4163                 {
  3845                 {
  4164                 if ( (*iControlArray)[i].iControl == grabber )
  3846                 if ( (*iControlArray)[i].iControl == grabber )
  4165                     {
  3847                     {
  4166                     if ( !IsVisible() )
  3848                     if ( !IsVisible() )
  4167                         {
       
  4168                         _AKNTRACE_FUNC_EXIT;
       
  4169                         return;
  3849                         return;
  4170                         }
  3850                     
  4171                     // Send the button command to command observer.
  3851                     // Send the button command to command observer.
  4172                     TInt shortCommand = (*iControlArray)[i].iId;
  3852                     TInt shortCommand = (*iControlArray)[i].iId;
  4173                     if ( shortCommand &&
  3853                     if ( shortCommand &&
  4174                          i == KControlArrayCBAButtonMSKPosn &&
  3854                          i == KControlArrayCBAButtonMSKPosn &&
  4175                          iMSKCommandObserver )
  3855                          iMSKCommandObserver )
  4177                         iMSKCommandObserver->ProcessCommandL( shortCommand );
  3857                         iMSKCommandObserver->ProcessCommandL( shortCommand );
  4178                         }
  3858                         }
  4179 
  3859 
  4180                     if( shortCommand )
  3860                     if( shortCommand )
  4181                         {
  3861                         {
  4182                         // Notify command observer only if multiple marking
  3862                         iCommandObserver->ProcessCommandL( shortCommand );
  4183                         // was not cancelled
       
  4184                         if ( !iExtension || !iExtension->CancelMultipleMarking(
       
  4185                                 shortCommand ) )
       
  4186                             {
       
  4187                             iCommandObserver->ProcessCommandL( shortCommand );
       
  4188                             }
       
  4189                         }
  3863                         }
  4190 
  3864 
  4191                     break;
  3865                     break;
  4192                     }
  3866                     }
  4193                 }
  3867                 }
  4194             }
  3868             }
  4195         }
  3869         }
  4196     _AKNTRACE_FUNC_EXIT;
       
  4197     }
  3870     }
  4198 
  3871 
  4199 
  3872 
  4200 TSize CEikCba::MinimumSize()
  3873 TSize CEikCba::MinimumSize()
  4201     {
  3874     {
  4202     _AKNTRACE_FUNC_ENTER;
       
  4203     TSize size = CEikControlGroup::MinimumSize();
  3875     TSize size = CEikControlGroup::MinimumSize();
  4204     size.iWidth = iAvkonAppUi->ApplicationRect().Width();
  3876     size.iWidth = iAvkonAppUi->ApplicationRect().Width();
  4205     const TInt count = iControlArray->Count();
  3877     const TInt count = iControlArray->Count();
  4206     for (TInt ii = 0; ii < count; ii++)
  3878     for (TInt ii = 0; ii < count; ii++)
  4207         {
  3879         {
  4209         }
  3881         }
  4210     if (iLink)
  3882     if (iLink)
  4211         {
  3883         {
  4212         size.iHeight = Max(size.iHeight, iLink->Size().iHeight);
  3884         size.iHeight = Max(size.iHeight, iLink->Size().iHeight);
  4213         }
  3885         }
  4214     _AKNTRACE_FUNC_EXIT;
       
  4215     // Add a standard margin from the laf.
  3886     // Add a standard margin from the laf.
  4216     return size;
  3887     return size;
  4217     }
  3888     }
  4218 
  3889 
  4219 /**
  3890 /**
  4222 *
  3893 *
  4223 * @since ER5U 
  3894 * @since ER5U 
  4224 */
  3895 */
  4225 void CEikCba::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
  3896 void CEikCba::GetColorUseListL(CArrayFix<TCoeColorUse>& aColorUseList) const
  4226     {
  3897     {
  4227     _AKNTRACE_FUNC_ENTER;
       
  4228     CEikControlGroup::GetColorUseListL(aColorUseList);
  3898     CEikControlGroup::GetColorUseListL(aColorUseList);
  4229         
  3899         
  4230     TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::EActive|TCoeColorUse::ENormal|
  3900     TInt commonAttributes = TCoeColorUse::ESurrounds|TCoeColorUse::EActive|TCoeColorUse::ENormal|
  4231         TCoeColorUse::ENeutral;
  3901         TCoeColorUse::ENeutral;
  4232         
  3902         
  4237     aColorUseList.AppendL(colorUse);
  3907     aColorUseList.AppendL(colorUse);
  4238 
  3908 
  4239     colorUse.SetLogicalColor(EColorToolbarBackground);
  3909     colorUse.SetLogicalColor(EColorToolbarBackground);
  4240     colorUse.SetUse(TCoeColorUse::EBack|commonAttributes);
  3910     colorUse.SetUse(TCoeColorUse::EBack|commonAttributes);
  4241     aColorUseList.AppendL(colorUse);
  3911     aColorUseList.AppendL(colorUse);
  4242     _AKNTRACE_FUNC_EXIT;
       
  4243     }
  3912     }
  4244 
  3913 
  4245 
  3914 
  4246 // ---------------------------------------------------------------------------
  3915 // ---------------------------------------------------------------------------
  4247 // Handles a change to the control's resources of type aType
  3916 // Handles a change to the control's resources of type aType
  4248 // which are shared across the environment, e.g. colors or fonts.
  3917 // which are shared across the environment, e.g. colors or fonts.
  4249 // ---------------------------------------------------------------------------
  3918 // ---------------------------------------------------------------------------
  4250 //
  3919 //
  4251 void CEikCba::HandleResourceChange( TInt aType )
  3920 void CEikCba::HandleResourceChange( TInt aType )
  4252     {
  3921     {
  4253     _AKNTRACE_FUNC_ENTER;
       
  4254     CEikControlGroup::HandleResourceChange( aType );
  3922     CEikControlGroup::HandleResourceChange( aType );
  4255     
  3923     
  4256     switch ( aType )
  3924     switch ( aType )
  4257         {
  3925         {
  4258         case KAknsMessageSkinChange: 
  3926         case KAknsMessageSkinChange: 
  4289             {
  3957             {
  4290             if ( IsVisible() )
  3958             if ( IsVisible() )
  4291                 {
  3959                 {
  4292                 DoLayoutChange();
  3960                 DoLayoutChange();
  4293                 SetBoundingRect( TRect() );
  3961                 SetBoundingRect( TRect() );
  4294                 if( iExtension->iIfMskIconSet 
       
  4295                 	    && ( iCbaFlags & EEikCbaFlagAppMskIcon ) )
       
  4296                     {
       
  4297                     TRAP_IGNORE( UpdateIconL() );
       
  4298                     }
       
  4299                 if ( iFlags.IsSet( ECbaInsideDialog )
  3962                 if ( iFlags.IsSet( ECbaInsideDialog )
  4300                         || iFlags.IsSet( ECbaEmbedded ) )
  3963                         || iFlags.IsSet( ECbaEmbedded ) )
  4301                     {
  3964                     {
  4302                     DrawDeferred();
  3965                     DrawDeferred();
  4303                     }
  3966                     }
  4315                 
  3978                 
  4316         case KAknMessageFocusLost:
  3979         case KAknMessageFocusLost:
  4317             {
  3980             {
  4318             if ( iFlags.IsSet( ECbaInsideDialog ) )
  3981             if ( iFlags.IsSet( ECbaInsideDialog ) )
  4319                 {
  3982                 {
  4320                 _AKNTRACE_FUNC_EXIT;
       
  4321                 return;
  3983                 return;
  4322                 }
  3984                 }
  4323 
  3985 
  4324 
  3986 
  4325             CEikCbaButton* button1 =
  3987             CEikCbaButton* button1 =
  4374             }
  4036             }
  4375 
  4037 
  4376         case KEikMessageUnfadeWindows:
  4038         case KEikMessageUnfadeWindows:
  4377             {
  4039             {
  4378             DoLayoutChange();
  4040             DoLayoutChange();
       
  4041             SetFadeState();
  4379             
  4042             
  4380             if ( iFlags.IsSet( ECbaInsideDialog ) )
  4043             if ( iFlags.IsSet( ECbaInsideDialog ) )
  4381                 {
  4044                 {
  4382                 DrawDeferred();
  4045                 DrawDeferred();
  4383                 }
  4046                 }
  4401             {
  4064             {
  4402             if ( AknLayoutUtils::PenEnabled() &&
  4065             if ( AknLayoutUtils::PenEnabled() &&
  4403                  AknStatuspaneUtils::IdleLayoutActive() )
  4066                  AknStatuspaneUtils::IdleLayoutActive() )
  4404                 {
  4067                 {
  4405                 SetMSKVisibility( MskAllowed() );
  4068                 SetMSKVisibility( MskAllowed() );
  4406                 }
  4069                 }                
       
  4070             SetFadeState();
  4407             break;
  4071             break;
  4408             }
  4072             }
  4409 
  4073 
  4410         default:
  4074         default:
  4411             {
  4075             {
  4412             break;
  4076             break;
  4413             }
  4077             }
  4414         }
  4078         }
  4415     _AKNTRACE_FUNC_EXIT;
       
  4416     }
  4079     }
  4417 
  4080 
  4418 
  4081 
  4419 void CEikCba::DoSkinChange()
  4082 void CEikCba::DoSkinChange()
  4420     {
  4083     {
  4421     _AKNTRACE_FUNC_ENTER;
       
  4422     iExtension->iIfSkinChanged = ETrue;
  4084     iExtension->iIfSkinChanged = ETrue;
  4423     DoSetLayers( KAknsIIDNone );
  4085     DoSetLayers( KAknsIIDNone );
  4424     iExtension->iIfSkinChanged = EFalse;
  4086     iExtension->iIfSkinChanged = EFalse;
  4425     if ( iExtension )
  4087     if ( iExtension )
  4426         {
  4088         {
  4433     SizeChanged();
  4095     SizeChanged();
  4434     
  4096     
  4435     //Skin change uses DrawNow to flus draw cache before layoutchange.
  4097     //Skin change uses DrawNow to flus draw cache before layoutchange.
  4436     DrawNow();
  4098     DrawNow();
  4437     iFlags.Clear(ECbaChangeRecordedSkin);
  4099     iFlags.Clear(ECbaChangeRecordedSkin);
  4438     _AKNTRACE_FUNC_EXIT;
       
  4439     }
  4100     }
  4440 
  4101 
  4441 void CEikCba::DoColorChange()
  4102 void CEikCba::DoColorChange()
  4442     {
  4103     {
  4443     _AKNTRACE_FUNC_ENTER;
       
  4444     iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this));
  4104     iBrushAndPenContext->SetBrushColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this));
  4445     iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this));
  4105     iBrushAndPenContext->SetPenColor(iEikonEnv->ControlColor(EColorToolbarText, *this));
  4446     Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this));
  4106     Window().SetBackgroundColor(iEikonEnv->ControlColor(EColorToolbarBackground, *this));
  4447     // This is required for skin resource changes (as well as color resource change).
  4107     // This is required for skin resource changes (as well as color resource change).
  4448     CheckSkinAndUpdateContext();
  4108     CheckSkinAndUpdateContext();
  4449     TRAP_IGNORE( SetMSKIconL() );
  4109     TRAP_IGNORE( SetMSKIconL() );
  4450     SizeChanged();
  4110     SizeChanged();
  4451     iFlags.Clear(ECbaChangeRecordedColor);
  4111     iFlags.Clear(ECbaChangeRecordedColor);
  4452     _AKNTRACE_FUNC_EXIT;
       
  4453     }
  4112     }
  4454 
  4113 
  4455 
  4114 
  4456 void CEikCba::DoLayoutChange()
  4115 void CEikCba::DoLayoutChange()
  4457     {
  4116     {
  4458     _AKNTRACE_FUNC_ENTER;
       
  4459     SetBoundingRect( TRect() );
  4117     SetBoundingRect( TRect() );
  4460 
  4118 
  4461     UpdateFonts();
  4119     UpdateFonts();
  4462 
  4120 
  4463     TBool mskAllowed( MskAllowed() );
  4121     TBool mskAllowed( MskAllowed() );
  4497         {
  4155         {
  4498         TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) );
  4156         TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) );
  4499         }
  4157         }
  4500         
  4158         
  4501     iFlags.Clear( ECbaChangeRecordedLayout );
  4159     iFlags.Clear( ECbaChangeRecordedLayout );
  4502     _AKNTRACE_FUNC_EXIT;
       
  4503     }
  4160     }
  4504 
  4161 
  4505 
  4162 
  4506 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/)
  4163 void CEikCba::HandleScrollEventL(CEikScrollBar* /*aScrollBar*/, TEikScrollEvent /*aEventType*/)
  4507     {
  4164     {
  4508     _AKNTRACE_FUNC_ENTER;
       
  4509     User::Leave(KErrNotSupported);
  4165     User::Leave(KErrNotSupported);
  4510     _AKNTRACE_FUNC_EXIT;
       
  4511     }
  4166     }
  4512 
  4167 
  4513 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId)
  4168 TTypeUid::Ptr CEikCba::MopSupplyObject(TTypeUid aId)
  4514     {
  4169     {
  4515     _AKNTRACE_FUNC_ENTER;
       
  4516     if (aId.iUid == MAknsControlContext::ETypeId)
  4170     if (aId.iUid == MAknsControlContext::ETypeId)
  4517         {
  4171         {
  4518         if ( AknLayoutFlags() & EAknLayoutCbaInControlPane ||
  4172         if ( AknLayoutFlags() & EAknLayoutCbaInControlPane ||
  4519              AknLayoutFlags() & EAknLayoutCbaInRightPane )
  4173              AknLayoutFlags() & EAknLayoutCbaInRightPane )
  4520             {
  4174             {
  4521             _AKNTRACE_FUNC_EXIT;
       
  4522             return MAknsControlContext::SupplyMopObject( aId, iMLBgContext );
  4175             return MAknsControlContext::SupplyMopObject( aId, iMLBgContext );
  4523             }
  4176             }
  4524         else
  4177         else
  4525             {
  4178             {
  4526             // Always provide top object to mop-chain.
  4179             // Always provide top object to mop-chain.
  4527             // Bottom is parent of Top, so bottom is re-drawn
  4180             // Bottom is parent of Top, so bottom is re-drawn
  4528             // automatically when top is drawn.
  4181             // automatically when top is drawn.
  4529             // Ensure that the context exists.
       
  4530             TRAP_IGNORE( CheckAndCreateStaconContextsL() );
       
  4531 
       
  4532             _AKNTRACE_FUNC_EXIT;
       
  4533             return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop );
  4182             return MAknsControlContext::SupplyMopObject( aId, iStaconBgContextTop );
  4534             }
  4183             }
  4535         }
  4184         }
  4536         
  4185         
  4537     if ( aId.iUid == CEikCba::ETypeId )
  4186     if ( aId.iUid == CEikCba::ETypeId )
  4538         {
  4187         {
  4539         _AKNTRACE_FUNC_EXIT;
       
  4540         return aId.MakePtr( this );
  4188         return aId.MakePtr( this );
  4541         }
  4189         }
  4542         
  4190         
  4543     _AKNTRACE_FUNC_EXIT;
       
  4544     return CEikControlGroup::MopSupplyObject(aId);
  4191     return CEikControlGroup::MopSupplyObject(aId);
  4545     }
  4192     }
  4546 
  4193 
  4547 
  4194 
  4548 void CEikCba::Draw( const TRect& aRect ) const
  4195 void CEikCba::Draw( const TRect& aRect ) const
  4549     {
  4196     {
  4550     _AKNTRACE_FUNC_ENTER;
       
  4551     // Embedded CBA doesn't draw anything
  4197     // Embedded CBA doesn't draw anything
  4552     if ( iFlags.IsSet( ECbaInsideDialog ) )
  4198     if ( iFlags.IsSet( ECbaInsideDialog ) )
  4553         {
  4199         {
  4554         return;
  4200         return;
  4555         }
  4201         }
  4556     
       
  4557     if ( iCbaFlags & EEikCbaFlagSemiTransparent )
       
  4558         {
       
  4559         CWindowGc &gc = SystemGc();
       
  4560 
       
  4561         iExtension->DrawSemiTransparency( gc );
       
  4562         return;
       
  4563         }
       
  4564 
  4202 
  4565     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  4203     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  4566     
  4204     
  4567     const TRect rect( Rect() );
  4205     const TRect rect( Rect() );
  4568     CWindowGc& gc = SystemGc();
  4206     CWindowGc& gc = SystemGc();
       
  4207 
       
  4208     TRgb rgb( TRgb::Color16MA( 0 ) );
       
  4209     gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
       
  4210     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  4211     gc.SetBrushColor( rgb );        
       
  4212     gc.Clear();
       
  4213   
  4569     MAknsControlContext* cc = iMLBgContext;
  4214     MAknsControlContext* cc = iMLBgContext;
  4570     
  4215     
  4571     if ( iFlags.IsSet( ECbaEmbedded ) )
  4216     if ( iFlags.IsSet( ECbaEmbedded ) )
  4572         {
  4217         {
  4573         // Embedded CBA is drawn inside dialog
  4218         // Embedded CBA is drawn inside dialog
  4617                 gc.BitBlt( rightSKRect.iTl, iExtension->iRskPostingOverlayBitmap, 
  4262                 gc.BitBlt( rightSKRect.iTl, iExtension->iRskPostingOverlayBitmap, 
  4618                     TRect( rightSKSize ) );
  4263                     TRect( rightSKSize ) );
  4619                 gc.BitBlt( leftSKRect.iTl, iExtension->iLskPostingOverlayBitmap, 
  4264                 gc.BitBlt( leftSKRect.iTl, iExtension->iLskPostingOverlayBitmap, 
  4620                     TRect( leftSKSize ) );
  4265                     TRect( leftSKSize ) );
  4621                 }
  4266                 }
  4622             else if ( !( iCbaFlags & EEikCbaFlagTransparent ) )
  4267             else if ( !( ( iCbaFlags & EEikCbaFlagTransparent) || ( iCbaFlags & EEikCbaFlagSemiTransparent))  )
  4623                 {// Old way to render
  4268                 {// Old way to render
  4624                 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  4269                 if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  4625                     {
  4270                     {
  4626                     gc.SetPenStyle( CGraphicsContext::ENullPen );
  4271                     gc.SetPenStyle( CGraphicsContext::ENullPen );
  4627                     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  4272                     gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
  4634                     CEikCbaButton* button1 = static_cast<CEikCbaButton*>(
  4279                     CEikCbaButton* button1 = static_cast<CEikCbaButton*>(
  4635                         (*iControlArray)[KControlArrayCBAButton1Posn].iControl );
  4280                         (*iControlArray)[KControlArrayCBAButton1Posn].iControl );
  4636                     CEikCbaButton* button2 = static_cast<CEikCbaButton*>(
  4281                     CEikCbaButton* button2 = static_cast<CEikCbaButton*>(
  4637                         (*iControlArray)[KControlArrayCBAButton2Posn].iControl );
  4282                         (*iControlArray)[KControlArrayCBAButton2Posn].iControl );
  4638                     
  4283                     
  4639                     if ( IsMskEnabledLayoutActive() || iFlags.IsSet( ECbaCombinePaneUncovered ) )
  4284     		        if ( IsMskEnabledLayoutActive() )
  4640                         {
  4285                         {
  4641                         CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>(
  4286                         CEikCbaButton* buttonMSK = static_cast<CEikCbaButton*>(
  4642                             (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl );
  4287                             (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl );
  4643                         
  4288                         
  4644                         CFbsBitmap* middleMask =
  4289                         CFbsBitmap* middleMask =
  4645                             AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt );
  4290                             AknsUtils::GetCachedBitmap( skin, KAknsIIDQgnIndiSctrlSkMaskMiddlePrt );
  4646                         if ( middleMask )
  4291                         AknIconUtils::SetSize( middleMask, middleSKSize, EAspectRatioNotPreserved );
  4647                             {
       
  4648                             AknIconUtils::SetSize( middleMask, 
       
  4649                                     middleSKSize, EAspectRatioNotPreserved );
       
  4650                             }                        
       
  4651 
  4292 
  4652                         if( buttonMSK && buttonMSK->PressedDown() )
  4293                         if( buttonMSK && buttonMSK->PressedDown() )
  4653                             {
  4294                             {
  4654                             AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
  4295                             AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(),
  4655                                                       gc,
  4296                                                       gc,
  4741             gc.BitBlt( topSKRect.iTl, iExtension->iRskPostingOverlayBitmap, 
  4382             gc.BitBlt( topSKRect.iTl, iExtension->iRskPostingOverlayBitmap, 
  4742                 TRect( topSKRect.Size() ) );
  4383                 TRect( topSKRect.Size() ) );
  4743             gc.BitBlt( bottomSKRect.iTl, iExtension->iLskPostingOverlayBitmap, 
  4384             gc.BitBlt( bottomSKRect.iTl, iExtension->iLskPostingOverlayBitmap, 
  4744                 TRect( bottomSKRect.Size() ) );
  4385                 TRect( bottomSKRect.Size() ) );
  4745             }
  4386             }
  4746         else if ( !( iCbaFlags & EEikCbaFlagTransparent) )
  4387         else if ( !( ( iCbaFlags & EEikCbaFlagTransparent) || ( iCbaFlags & EEikCbaFlagSemiTransparent))  )
  4747             {
  4388             {
  4748             // Old way to render
  4389             // Old way to render
  4749             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  4390             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
  4750                 {
  4391                 {
  4751                 gc.SetPenStyle( CGraphicsContext::ENullPen );
  4392                 gc.SetPenStyle( CGraphicsContext::ENullPen );
  4800                                               KAknsIIDQgnFrSctrlSkButton,
  4441                                               KAknsIIDQgnFrSctrlSkButton,
  4801                                               KAknsIIDQgnFrSctrlSkButtonCenter );
  4442                                               KAknsIIDQgnFrSctrlSkButtonCenter );
  4802                     }
  4443                     }
  4803                 }
  4444                 }
  4804             }
  4445             }
       
  4446         else if ( ( iCbaFlags & EEikCbaFlagSemiTransparent) && iExtension )
       
  4447             {
       
  4448             if ( iExtension->iSemiBgID != KAknsIIDNone )
       
  4449                 {
       
  4450                 iExtension->DrawSemiTransparencyL( gc, rect );
       
  4451                 }
       
  4452             }
  4805         else
  4453         else
  4806             {
  4454             {
  4807             // No background since EEikCbaFlagTransparent is set.
  4455             // No background since EEikCbaFlagTransparent is set.
  4808             // Do nothing.
  4456             // Do nothing.
  4809             }
  4457             }
  4963                     }
  4611                     }
  4964                 }
  4612                 }
  4965             }
  4613             }
  4966         }
  4614         }
  4967     gc.SetOpaque( EFalse );        
  4615     gc.SetOpaque( EFalse );        
  4968     _AKNTRACE_FUNC_EXIT;    
       
  4969     }
  4616     }
  4970 
  4617 
  4971 
  4618 
  4972 // ---------------------------------------------------------------------------
  4619 // ---------------------------------------------------------------------------
  4973 // Gets a button control by the specified command ID.
  4620 // Gets a button control by the specified command ID.
  4974 // ---------------------------------------------------------------------------
  4621 // ---------------------------------------------------------------------------
  4975 //
  4622 //
  4976 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const
  4623 CCoeControl* CEikCba::ButtonById( TInt aCommandId ) const
  4977     {
  4624     {
  4978     _AKNTRACE_FUNC_ENTER;
       
  4979     _AKNTRACE_FUNC_EXIT;
       
  4980     return ControlById( aCommandId );
  4625     return ControlById( aCommandId );
  4981     }
  4626     }
  4982 
  4627 
  4983 
  4628 
  4984 // ---------------------------------------------------------------------------
  4629 // ---------------------------------------------------------------------------
  4985 // Creates the scroll bar frame & sets up the scroll bar.
  4630 // Creates the scroll bar frame & sets up the scroll bar.
  4986 // ---------------------------------------------------------------------------
  4631 // ---------------------------------------------------------------------------
  4987 //
  4632 //
  4988 void CEikCba::CreateScrollBarFrameL()
  4633 void CEikCba::CreateScrollBarFrameL()
  4989     {
  4634     {
  4990     _AKNTRACE_FUNC_ENTER;
       
  4991     if ( !iSBFrame )
  4635     if ( !iSBFrame )
  4992         {
  4636         {
  4993         iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue );
  4637         iSBFrame = new (ELeave) CEikCbaScrollBarFrame( this, this, ETrue );
  4994         }
  4638         }
  4995     iSBFrame->ConstructL();
  4639     iSBFrame->ConstructL();
  4996     _AKNTRACE_FUNC_EXIT;
       
  4997     }
  4640     }
  4998 
  4641 
  4999 
  4642 
  5000 TEikGroupControl CEikCba::VScrollBarAsGroupControl()
  4643 TEikGroupControl CEikCba::VScrollBarAsGroupControl()
  5001     {
  4644     {
  5002     _AKNTRACE_FUNC_ENTER;
       
  5003     // Extracts vertical scroll bar from the scroll bar frame.       
  4645     // Extracts vertical scroll bar from the scroll bar frame.       
  5004     TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, 
  4646     TEikGroupControl groupCtrl(iSBFrame->VerticalScrollBar(), 0, 
  5005         KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength);
  4647         KCbaScrollBarButtonWidth,TEikGroupControl::ESetLength);
  5006     _AKNTRACE_FUNC_EXIT;
       
  5007     return groupCtrl;
  4648     return groupCtrl;
  5008     }
  4649     }
  5009 
  4650 
  5010 void CEikCba::InsertScrollBarL()
  4651 void CEikCba::InsertScrollBarL()
  5011     {
  4652     {
  5012     _AKNTRACE_FUNC_ENTER;
       
  5013     TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl();
  4653     TEikGroupControl SBGroupCtrl = VScrollBarAsGroupControl();
  5014     // Insert vertical scroll bar into cba control group.
  4654     // Insert vertical scroll bar into cba control group.
  5015     InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn);
  4655     InsertControlL(SBGroupCtrl, KControlArrayScrollBarPosn);
  5016     _AKNTRACE_FUNC_EXIT;
       
  5017     }
  4656     }
  5018 
  4657 
  5019 
  4658 
  5020 // ---------------------------------------------------------------------------
  4659 // ---------------------------------------------------------------------------
  5021 // Replaces empty scroll bar with actual arrow head scroll bar.
  4660 // Replaces empty scroll bar with actual arrow head scroll bar.
  5022 // ---------------------------------------------------------------------------
  4661 // ---------------------------------------------------------------------------
  5023 //
  4662 //
  5024 void CEikCba::CreateArrowHeadScrollBarL()
  4663 void CEikCba::CreateArrowHeadScrollBarL()
  5025     {
  4664     {
  5026     _AKNTRACE_FUNC_ENTER;
       
  5027     if ( iSBFrame )
  4665     if ( iSBFrame )
  5028         {
  4666         {
  5029         iSBFrame->SwitchToArrowHeadScrollBarL();
  4667         iSBFrame->SwitchToArrowHeadScrollBarL();
  5030         iSBFrame->VerticalScrollBar()->SetContainingCba( this );
  4668         iSBFrame->VerticalScrollBar()->SetContainingCba( this );
  5031         if ( iControlArray->Count() > KControlArrayScrollBarPosn )
  4669         if ( iControlArray->Count() > KControlArrayScrollBarPosn )
  5032             {
  4670             {
  5033             iControlArray->Delete( KControlArrayScrollBarPosn );
  4671             iControlArray->Delete( KControlArrayScrollBarPosn );
  5034             }
  4672             }
  5035         InsertScrollBarL();
  4673         InsertScrollBarL();
  5036         }
  4674         }
  5037     _AKNTRACE_FUNC_EXIT;
       
  5038     }
  4675     }
  5039 
  4676 
  5040 
  4677 
  5041 void CEikCba::SizeChanged()
  4678 void CEikCba::SizeChanged()
  5042     {
  4679     {
  5043     _AKNTRACE_FUNC_ENTER;
       
  5044     if ( iFlags.IsSet( ECbaInsideDialog ) )
  4680     if ( iFlags.IsSet( ECbaInsideDialog ) )
  5045         {
  4681         {
  5046         Window().SetNonFading( EFalse );
  4682         Window().SetNonFading( EFalse );
  5047         SizeChangedInsideDialog();
  4683         SizeChangedInsideDialog();
  5048         _AKNTRACE_FUNC_EXIT;
       
  5049         return;
  4684         return;
  5050         }
  4685         }
  5051     else if ( iFlags.IsSet( ECbaEmbedded ) )
  4686     else if ( iFlags.IsSet( ECbaEmbedded ) )
  5052         {
  4687         {
  5053         Window().SetNonFading( EFalse );
  4688         Window().SetNonFading( EFalse );
  5054         SizeChangedInPopup();
  4689         SizeChangedInPopup();
  5055         _AKNTRACE_FUNC_EXIT;
       
  5056         return;
  4690         return;
  5057         }
  4691         }
  5058         
  4692         
  5059     const TInt aknLayoutFlags = AknLayoutFlags();
  4693     const TInt aknLayoutFlags = AknLayoutFlags();
  5060 
  4694 
  5115             }
  4749             }
  5116 
  4750 
  5117         // Broadcast current state to CEikCbaButtons
  4751         // Broadcast current state to CEikCbaButtons
  5118         BroadcastPostingTransparency( enabled );
  4752         BroadcastPostingTransparency( enabled );
  5119         }
  4753         }
  5120     _AKNTRACE_FUNC_EXIT;
       
  5121     }
  4754     }
  5122 
  4755 
  5123 // -----------------------------------------------------------------------------
  4756 // -----------------------------------------------------------------------------
  5124 // CEikCba::CheckSkinAndUpdateContext
  4757 // CEikCba::CheckSkinAndUpdateContext
  5125 //
  4758 //
  5126 // -----------------------------------------------------------------------------
  4759 // -----------------------------------------------------------------------------
  5127 //
  4760 //
  5128 void CEikCba::CheckSkinAndUpdateContext()
  4761 void CEikCba::CheckSkinAndUpdateContext()
  5129     {
  4762     {
  5130     _AKNTRACE_FUNC_ENTER;
       
  5131     if (AknsUtils::SkinInstance())
  4763     if (AknsUtils::SkinInstance())
  5132         {
  4764         {
  5133         // Use ENullBrush if there is skin background available.
  4765         // Use ENullBrush if there is skin background available.
  5134         iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush);
  4766         iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ENullBrush);
  5135         }
  4767         }
  5136     else
  4768     else
  5137         {
  4769         {
  5138         iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
  4770         iBrushAndPenContext->SetBrushStyle(CGraphicsContext::ESolidBrush);
  5139         }
  4771         }
  5140     _AKNTRACE_FUNC_EXIT;
       
  5141     }
  4772     }
  5142 
  4773 
  5143 void CEikCba::Reserved_MtsmPosition()
  4774 void CEikCba::Reserved_MtsmPosition()
  5144     {
  4775     {
  5145     _AKNTRACE_FUNC_ENTER;
       
  5146     _AKNTRACE_FUNC_EXIT;
       
  5147     }
  4776     }
  5148 
  4777 
  5149 void CEikCba::Reserved_MtsmObject()
  4778 void CEikCba::Reserved_MtsmObject()
  5150     {
  4779     {
  5151     _AKNTRACE_FUNC_ENTER;
       
  5152     _AKNTRACE_FUNC_EXIT;
       
  5153     }
  4780     }
  5154 
  4781 
  5155 TInt CEikCba::AknLayoutFlags() const
  4782 TInt CEikCba::AknLayoutFlags() const
  5156     {
  4783     {
  5157     _AKNTRACE_FUNC_ENTER;
       
  5158     TInt flags = 0;
  4784     TInt flags = 0;
  5159 
  4785 
  5160     TBool controlPane = ETrue;
  4786     TBool controlPane = ETrue;
  5161     TBool staconPane = EFalse;
  4787     TBool staconPane = EFalse;
  5162     TBool staconPaneLeft = EFalse;
  4788     TBool staconPaneLeft = EFalse;
  5221     if (rightPane)
  4847     if (rightPane)
  5222         {
  4848         {
  5223         flags |= EAknLayoutCbaInRightPane;
  4849         flags |= EAknLayoutCbaInRightPane;
  5224         }
  4850         }
  5225 
  4851 
  5226     _AKNTRACE_FUNC_EXIT;
       
  5227     return flags;
  4852     return flags;
  5228     }
  4853     }
  5229 
  4854 
  5230 
  4855 
  5231 // ---------------------------------------------------------------------------
  4856 // ---------------------------------------------------------------------------
  5232 // Handles size change events in bottom softkey layout.
  4857 // Handles size change events in bottom softkey layout.
  5233 // ---------------------------------------------------------------------------
  4858 // ---------------------------------------------------------------------------
  5234 //
  4859 //
  5235 void CEikCba::SizeChangedInControlPane()
  4860 void CEikCba::SizeChangedInControlPane()
  5236     {
  4861     {
  5237     _AKNTRACE_FUNC_ENTER;
       
  5238     TRect screen;
  4862     TRect screen;
  5239     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
  4863     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
  5240     
  4864     
  5241     TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
  4865     TBool isLandscape( Layout_Meta_Data::IsLandscapeOrientation() );
  5242     TInt spLayout( AknStatuspaneUtils::CurrentStatusPaneLayoutResId() );
  4866     TBool flatLscLayout( isLandscape &&
  5243     
  4867                          AknStatuspaneUtils::FlatLayoutActive() );
  5244     // Treat the empty status pane layout the same way as the flat layout
       
  5245     // in landscape orientation, as the CBA layout is the same in both.
       
  5246     TBool flatLscLayout(
       
  5247         isLandscape &&
       
  5248         ( spLayout == R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT || 
       
  5249           spLayout == R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ||
       
  5250           spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ||
       
  5251           spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT ||
       
  5252           spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT_NO_SOFTKEYS ||
       
  5253           spLayout == R_AVKON_WIDESCREEN_PANE_LAYOUT_IDLE_FLAT_NO_SOFTKEYS ||
       
  5254           spLayout == R_AVKON_STATUS_PANE_LAYOUT_EMPTY ) );
       
  5255     
  4868     
  5256     // We must check for landscape mode bottom softkeys.
  4869     // We must check for landscape mode bottom softkeys.
  5257     TInt bottomPaneVariety = isLandscape ? ( flatLscLayout ? 2 : 6 ) : 1;
  4870     TInt bottomPaneVariety = isLandscape ? ( flatLscLayout ? 2 : 6 ) : 1;
  5258     
  4871         
  5259     // Skip application_window between screen and area_bottom_pane since
       
  5260     // screen and application_window are always the same.
       
  5261     TAknWindowComponentLayout controlPane(
  4872     TAknWindowComponentLayout controlPane(
  5262         DoCompose(
  4873         DoCompose(
  5263             AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ),
  4874             AknLayoutScalable_Avkon::application_window( 0 ),
  5264             AknLayoutScalable_Avkon::control_pane() ) );
  4875             DoCompose(
       
  4876                 AknLayoutScalable_Avkon::area_bottom_pane( bottomPaneVariety ),
       
  4877                 AknLayoutScalable_Avkon::control_pane() ) ) );
  5265     
  4878     
  5266     TAknLayoutRect cbarect;
  4879     TAknLayoutRect cbarect;
  5267     cbarect.LayoutRect( screen, controlPane.LayoutLine() );
  4880     cbarect.LayoutRect( screen, controlPane.LayoutLine() );
  5268     TRect rect( cbarect.Rect().Size() );
  4881     TRect rect( cbarect.Rect().Size() );
  5269 
  4882 
  5274 
  4887 
  5275     TBool mskEnabledInApplication( AknLayoutUtils::MSKEnabled() && iMSKset );
  4888     TBool mskEnabledInApplication( AknLayoutUtils::MSKEnabled() && iMSKset );
  5276     
  4889     
  5277     // Set the softkey frame rectangles in touch layouts.
  4890     // Set the softkey frame rectangles in touch layouts.
  5278     if ( iExtension && AknLayoutUtils::PenEnabled() )
  4891     if ( iExtension && AknLayoutUtils::PenEnabled() )
  5279         {
  4892         {        
  5280         TAknLayoutRect layoutRect;
  4893         TAknLayoutRect layoutRect;
  5281         TBool frameSizeChanged( EFalse );
  4894         TBool frameSizeChanged( EFalse );
  5282 
  4895 
  5283         if ( mskEnabledInPlatform || flatLscLayout )
  4896         if ( mskEnabledInPlatform || flatLscLayout )
  5284             {
  4897             {
  5300             layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  4913             layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  5301                      AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  4914                      AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  5302                         .LayoutLine() );
  4915                         .LayoutLine() );
  5303             iExtension->iRightFrameInnerRect = layoutRect.Rect();
  4916             iExtension->iRightFrameInnerRect = layoutRect.Rect();
  5304 
  4917 
  5305             if ( mskEnabledInPlatform || ( isLandscape && iFlags.IsSet( ECbaCombinePaneUncovered ) ) )
  4918             if ( mskEnabledInPlatform )
  5306                 {
  4919                 {
  5307                 layoutRect.LayoutRect(
  4920                 layoutRect.LayoutRect(
  5308                     rect,
  4921                     rect,
  5309                     AknLayoutScalable_Avkon::control_pane_g7( 0 ).LayoutLine() );
  4922                     AknLayoutScalable_Avkon::control_pane_g7( 0 ).LayoutLine() );
  5310                 frameSizeChanged = frameSizeChanged || layoutRect.Rect() != iExtension->iMiddleFrameOuterRect;
  4923                 frameSizeChanged = frameSizeChanged || layoutRect.Rect() != iExtension->iMiddleFrameOuterRect;
  5325                 {
  4938                 {
  5326                 layoutRect.LayoutRect(
  4939                 layoutRect.LayoutRect(
  5327                     rect,
  4940                     rect,
  5328                     AknLayoutScalable_Avkon::bg_sctrl_sk_pane_cp1().LayoutLine() );
  4941                     AknLayoutScalable_Avkon::bg_sctrl_sk_pane_cp1().LayoutLine() );
  5329                 frameSizeChanged = layoutRect.Rect() != iExtension->iRightFrameOuterRect;
  4942                 frameSizeChanged = layoutRect.Rect() != iExtension->iRightFrameOuterRect;
  5330                 iExtension->iRightFrameOuterRect = layoutRect.Rect();
  4943 				iExtension->iRightFrameOuterRect = layoutRect.Rect();
  5331                 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  4944                 layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  5332                          AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  4945                          AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  5333                             .LayoutLine() );
  4946                             .LayoutLine() );
  5334                 iExtension->iRightFrameInnerRect = layoutRect.Rect();
  4947                 iExtension->iRightFrameInnerRect = layoutRect.Rect();
  5335             
  4948             
  5406         textVariety  = 0;
  5019         textVariety  = 0;
  5407         graphVariety = 4;
  5020         graphVariety = 4;
  5408         }
  5021         }
  5409         
  5022         
  5410     if ( iExtension->iEnablePostingTransparency ||
  5023     if ( iExtension->iEnablePostingTransparency ||
  5411          ( iCbaFlags & EEikCbaFlagTransparent ) )
  5024          ( iCbaFlags & EEikCbaFlagTransparent ) || ( iCbaFlags & EEikCbaFlagSemiTransparent ) )
  5412         {
  5025         {
  5413         textVariety = 6; // Outline font used
  5026         textVariety = 6; // Outline font used
  5414         }
  5027         }
  5415 
  5028 
  5416     // This uses correct coordinates to calculate the positions of softkey labels.
  5029     // This uses correct coordinates to calculate the positions of softkey labels.
  5498                 rect,
  5111                 rect,
  5499                 AKN_LAYOUT_WINDOW_Control_pane_elements_Line_1 );
  5112                 AKN_LAYOUT_WINDOW_Control_pane_elements_Line_1 );
  5500             }
  5113             }
  5501 
  5114 
  5502         TInt textMSKVariety = 3;
  5115         TInt textMSKVariety = 3;
  5503         TInt graphicMSKVariety = 1;
  5116         TInt graphicMSKVariety = 0;
  5504 
  5117 
  5505         if ( iCbaFlags & EEikCbaFlagAppMskIcon )
       
  5506         	{
       
  5507             graphicMSKVariety = 0 ;
       
  5508         	}
       
  5509         if ( mskEnabledInApplication && mskEnabledInPlatform )
  5118         if ( mskEnabledInApplication && mskEnabledInPlatform )
  5510             {
  5119             {
  5511             MSKSoftkey = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl;
  5120             MSKSoftkey = (*iControlArray)[KControlArrayCBAButtonMSKPosn].iControl;
  5512             MSKButton = static_cast<CEikCbaButton*>( MSKSoftkey );
  5121             MSKButton = static_cast<CEikCbaButton*>( MSKSoftkey );
  5513             
  5122             
  5552                 }
  5161                 }
  5553             }
  5162             }
  5554 
  5163 
  5555         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  5164         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  5556         const TBool transparentSoftkeys = 
  5165         const TBool transparentSoftkeys = 
  5557             iExtension->iEnablePostingTransparency || ( iCbaFlags & EEikCbaFlagTransparent );
  5166             iExtension->iEnablePostingTransparency || 
       
  5167             ( iCbaFlags & EEikCbaFlagTransparent ) || 
       
  5168             ( iCbaFlags & EEikCbaFlagSemiTransparent );
  5558         TRgb leftColor;
  5169         TRgb leftColor;
  5559         TRgb rightColor;
  5170         TRgb rightColor;
  5560         TRgb MSKColor;
  5171         TRgb MSKColor;
  5561         TInt errorl;
  5172         TInt errorl;
  5562         TInt errorr;
  5173         TInt errorr;
  5724             
  5335             
  5725         DrawDeferred();
  5336         DrawDeferred();
  5726         }
  5337         }
  5727 
  5338 
  5728     AknsUtils::RegisterControlPosition( this, posInScreen.iTl );
  5339     AknsUtils::RegisterControlPosition( this, posInScreen.iTl );
  5729     _AKNTRACE_FUNC_EXIT;
       
  5730     }
  5340     }
  5731 
  5341 
  5732 
  5342 
  5733 void CEikCba::SizeChangedInStaconPane()
  5343 void CEikCba::SizeChangedInStaconPane()
  5734     {  
  5344     {  
  5735     _AKNTRACE_FUNC_ENTER;  
       
  5736     TRect screen( iAvkonAppUi->ApplicationRect() );
  5345     TRect screen( iAvkonAppUi->ApplicationRect() );
  5737     TBool softKeysUpAndDownMirrored = EFalse;
  5346     TBool softKeysUpAndDownMirrored = EFalse;
  5738 
  5347 
  5739     TRAP_IGNORE( CheckAndCreateStaconContextsL() );
       
  5740     
       
  5741     TInt variety = 0;
  5348     TInt variety = 0;
  5742     if (AknLayoutFlags() & EAknLayoutCbaInStaconPaneLeft)
  5349     if (AknLayoutFlags() & EAknLayoutCbaInStaconPaneLeft)
  5743         {
  5350         {
  5744         variety = 1;
  5351         variety = 1;
  5745         }
  5352         }
  6081         
  5688         
  6082         DrawDeferred();
  5689         DrawDeferred();
  6083         }
  5690         }
  6084 
  5691 
  6085     AknsUtils::RegisterControlPosition( this, TPoint(0,0) );
  5692     AknsUtils::RegisterControlPosition( this, TPoint(0,0) );
  6086     _AKNTRACE_FUNC_EXIT;
       
  6087     }
  5693     }
  6088 
  5694 
  6089 
  5695 
  6090 //------------------------------------------------------------------------------
  5696 //------------------------------------------------------------------------------
  6091 // CEikCba::SizeChangedInRightPane()
  5697 // CEikCba::SizeChangedInRightPane()
  6092 //------------------------------------------------------------------------------
  5698 //------------------------------------------------------------------------------
  6093 //
  5699 //
  6094 void CEikCba::SizeChangedInRightPane()
  5700 void CEikCba::SizeChangedInRightPane()
  6095     {
  5701     {
  6096     _AKNTRACE_FUNC_ENTER;
       
  6097     TRect screen;
  5702     TRect screen;
  6098     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
  5703     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
  6099            
  5704            
  6100     TAknWindowComponentLayout rightAreaLayout(
  5705     TAknWindowComponentLayout rightAreaLayout(
  6101         AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
  5706         AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
  6356         
  5961         
  6357         DrawDeferred();
  5962         DrawDeferred();
  6358         }
  5963         }
  6359 
  5964 
  6360     AknsUtils::RegisterControlPosition( this, TPoint( 0, 0 ) );   
  5965     AknsUtils::RegisterControlPosition( this, TPoint( 0, 0 ) );   
  6361     _AKNTRACE_FUNC_EXIT;
       
  6362     }
  5966     }
  6363     
  5967     
  6364     
  5968     
  6365     
  5969     
  6366 void CEikCba::SizeChangedInsideDialog()
  5970 void CEikCba::SizeChangedInsideDialog()
  6367     {
  5971     {
  6368     _AKNTRACE_FUNC_ENTER;
       
  6369     // Give both LSK and RSK buttons half of the available space.
  5972     // Give both LSK and RSK buttons half of the available space.
  6370     //
  5973     //
  6371     if ( iControlArray )
  5974     if ( iControlArray )
  6372         {
  5975         {
  6373         TRect buttonRect1( Rect() );
  5976         TRect buttonRect1( Rect() );
  6386         if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl )
  5989         if ( (*iControlArray)[KControlArrayCBAButton2Posn].iControl )
  6387             {
  5990             {
  6388             (*iControlArray)[KControlArrayCBAButton2Posn].iControl->SetRect( buttonRect2 );
  5991             (*iControlArray)[KControlArrayCBAButton2Posn].iControl->SetRect( buttonRect2 );
  6389             }
  5992             }
  6390         }
  5993         }
  6391     _AKNTRACE_FUNC_EXIT;
       
  6392     }
  5994     }
  6393     
  5995     
  6394     
  5996     
  6395 void CEikCba::SizeChangedInPopup()
  5997 void CEikCba::SizeChangedInPopup()
  6396     {
  5998     {
  6397     _AKNTRACE_FUNC_ENTER;
       
  6398     TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) );
  5999     TRAP_IGNORE( iExtension->UpdateSoftkeyFrameL( EFalse ) );
  6399     
  6000     
  6400     TAknLayoutRect layoutRect;
  6001     TAknLayoutRect layoutRect;
  6401     TRect rect ( Rect() );
  6002     TRect rect ( Rect() );
  6402 
  6003 
  6420 
  6021 
  6421     layoutRect.LayoutRect( iExtension->iLeftFrameOuterRect,
  6022     layoutRect.LayoutRect( iExtension->iLeftFrameOuterRect,
  6422                  AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  6023                  AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  6423                      .LayoutLine() );
  6024                      .LayoutLine() );
  6424     iExtension->iLeftFrameInnerRect = layoutRect.Rect();
  6025     iExtension->iLeftFrameInnerRect = layoutRect.Rect();
       
  6026     UpdateLabels( ETrue );
  6425     
  6027     
  6426     layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  6028     layoutRect.LayoutRect( iExtension->iRightFrameOuterRect,
  6427                  AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  6029                  AknLayoutScalable_Avkon::bg_sctrl_sk_pane_g1()
  6428                      .LayoutLine() );
  6030                      .LayoutLine() );
  6429     iExtension->iRightFrameInnerRect = layoutRect.Rect();
  6031     iExtension->iRightFrameInnerRect = layoutRect.Rect();
  6437         if ( msk )
  6039         if ( msk )
  6438             {
  6040             {
  6439             msk->SetRect( TRect() );
  6041             msk->SetRect( TRect() );
  6440             }
  6042             }
  6441         }
  6043         }
  6442     _AKNTRACE_FUNC_EXIT;
       
  6443     }
  6044     }
  6444     
  6045     
  6445 
  6046 
  6446 void CEikCba::UpdateFonts()
  6047 void CEikCba::UpdateFonts()
  6447     {
  6048     {
  6448     _AKNTRACE_FUNC_ENTER;
       
  6449     // Control pane:
  6049     // Control pane:
  6450     // Use the layout dll to get the right font for the CBA.
  6050     // Use the layout dll to get the right font for the CBA.
  6451     TAknTextLineLayout layout(
  6051     TAknTextLineLayout layout(
  6452         AknLayoutScalable_Avkon::control_pane_t1(
  6052         AknLayoutScalable_Avkon::control_pane_t1(
  6453             Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0 ).LayoutLine() );
  6053             Layout_Meta_Data::IsLandscapeOrientation() ? 2 : 0 ).LayoutLine() );
  6473                                                    staconCustomfont );
  6073                                                    staconCustomfont );
  6474     
  6074     
  6475     // Right pane:    
  6075     // Right pane:    
  6476     TInt rightPaneTextVariety = 0;
  6076     TInt rightPaneTextVariety = 0;
  6477     
  6077     
  6478     if ( ( iExtension && iExtension->iEnablePostingTransparency ) ||
  6078     if ( iExtension->iEnablePostingTransparency ||
  6479          ( iCbaFlags & EEikCbaFlagTransparent ) )
  6079          ( iCbaFlags & EEikCbaFlagTransparent ) || ( iCbaFlags & EEikCbaFlagSemiTransparent ) )
  6480         {
  6080         {
  6481         rightPaneTextVariety = 1; // Outline font used
  6081         rightPaneTextVariety = 1; // Outline font used
  6482         }
  6082         }
  6483 
  6083 
  6484     TAknTextLineLayout rightPaneTextLayout(
  6084     TAknTextLineLayout rightPaneTextLayout(
  6492         }
  6092         }
  6493     const CFont* rightPaneCustomFont = 0;
  6093     const CFont* rightPaneCustomFont = 0;
  6494     iRightPaneLabelFont = 
  6094     iRightPaneLabelFont = 
  6495         AknLayoutUtils::FontFromId( 
  6095         AknLayoutUtils::FontFromId( 
  6496             rightPaneTextLayout.FontId(), rightPaneCustomFont );
  6096             rightPaneTextLayout.FontId(), rightPaneCustomFont );
  6497     _AKNTRACE_FUNC_EXIT;
       
  6498     }
  6097     }
  6499 
  6098 
  6500 // Enhanced CBA
  6099 // Enhanced CBA
  6501 
  6100 
  6502 // -----------------------------------------------------------------------------
  6101 // -----------------------------------------------------------------------------
  6505 // @since 5.0
  6104 // @since 5.0
  6506 // -----------------------------------------------------------------------------
  6105 // -----------------------------------------------------------------------------
  6507 #ifdef RD_ENHANCED_CBA
  6106 #ifdef RD_ENHANCED_CBA
  6508 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& aCommandList)
  6107 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& aCommandList)
  6509     {   
  6108     {   
  6510     _AKNTRACE_FUNC_ENTER;   
       
  6511     if( !iCommandTable )
  6109     if( !iCommandTable )
  6512         {        
  6110         {        
  6513         iCommandTable = CEikCommandTable::NewL();  
  6111         iCommandTable = CEikCommandTable::NewL();  
  6514         }
  6112         }
  6515     else
  6113     else
  6642             RemovePreviousCommand( controlId );
  6240             RemovePreviousCommand( controlId );
  6643             }
  6241             }
  6644         }
  6242         }
  6645         
  6243         
  6646     CleanupStack::PopAndDestroy(); // previousIds    
  6244     CleanupStack::PopAndDestroy(); // previousIds    
  6647     _AKNTRACE_FUNC_EXIT;
       
  6648     }
  6245     }
  6649 #else // !RD_ENHANCED_CBA
  6246 #else // !RD_ENHANCED_CBA
  6650 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& /*aCommandList*/)
  6247 EXPORT_C void CEikCba::OfferCommandListL(const RArray<TInt>& /*aCommandList*/)
  6651     {
  6248     {
  6652     _AKNTRACE_FUNC_ENTER;
       
  6653     User::Leave( KErrNotSupported );
  6249     User::Leave( KErrNotSupported );
  6654     _AKNTRACE_FUNC_EXIT;
       
  6655     }
  6250     }
  6656 #endif // RD_ENHANCED_CBA
  6251 #endif // RD_ENHANCED_CBA
  6657 
  6252 
  6658 // -----------------------------------------------------------------------------
  6253 // -----------------------------------------------------------------------------
  6659 // Used to offer list of commands for softkeys.
  6254 // Used to offer list of commands for softkeys.
  6661 // @since 5.0
  6256 // @since 5.0
  6662 // -----------------------------------------------------------------------------
  6257 // -----------------------------------------------------------------------------
  6663 #ifdef RD_ENHANCED_CBA
  6258 #ifdef RD_ENHANCED_CBA
  6664 EXPORT_C void CEikCba::OfferCommandListL(const TInt aResourceId)
  6259 EXPORT_C void CEikCba::OfferCommandListL(const TInt aResourceId)
  6665     {
  6260     {
  6666     _AKNTRACE_FUNC_ENTER;
       
  6667     if ( !iCommandTable ) // This is needed if cba was not constructed with enhanced cba.
  6261     if ( !iCommandTable ) // This is needed if cba was not constructed with enhanced cba.
  6668         {
  6262         {
  6669         iCommandTable = CEikCommandTable::NewL();
  6263         iCommandTable = CEikCommandTable::NewL();
  6670         }
  6264         }
  6671     
  6265     
  6807             RemovePreviousCommand( controlId );
  6401             RemovePreviousCommand( controlId );
  6808             }
  6402             }
  6809         }
  6403         }
  6810     
  6404     
  6811     CleanupStack::PopAndDestroy(); // previousIds 
  6405     CleanupStack::PopAndDestroy(); // previousIds 
  6812     _AKNTRACE_FUNC_EXIT;
       
  6813     }
  6406     }
  6814 #else // !RD_ENHANCED_CBA   
  6407 #else // !RD_ENHANCED_CBA   
  6815 EXPORT_C void CEikCba::OfferCommandListL(const TInt /*aResourceId*/)
  6408 EXPORT_C void CEikCba::OfferCommandListL(const TInt /*aResourceId*/)
  6816     {
  6409     {
  6817     _AKNTRACE_FUNC_ENTER;
       
  6818     User::Leave( KErrNotSupported );
  6410     User::Leave( KErrNotSupported );
  6819     _AKNTRACE_FUNC_EXIT;
       
  6820     }
  6411     }
  6821 #endif // RD_ENHANCED_CBA
  6412 #endif // RD_ENHANCED_CBA
  6822     
  6413     
  6823 // -----------------------------------------------------------------------------
  6414 // -----------------------------------------------------------------------------
  6824 // Used to check if a certain command have been approved to the current command set.
  6415 // Used to check if a certain command have been approved to the current command set.
  6826 // @since 5.0
  6417 // @since 5.0
  6827 // -----------------------------------------------------------------------------    
  6418 // -----------------------------------------------------------------------------    
  6828 #ifdef RD_ENHANCED_CBA  
  6419 #ifdef RD_ENHANCED_CBA  
  6829 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt aCommandId) const
  6420 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt aCommandId) const
  6830     {
  6421     {
  6831     _AKNTRACE_FUNC_ENTER;
       
  6832     _AKNTRACE_FUNC_EXIT;
       
  6833     return ButtonById(aCommandId) ? ETrue : EFalse; // check the iControlArray
  6422     return ButtonById(aCommandId) ? ETrue : EFalse; // check the iControlArray
  6834     }
  6423     }
  6835 #else // !RD_ENHANCED_CBA
  6424 #else // !RD_ENHANCED_CBA
  6836 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt /*aCommandId*/) const
  6425 EXPORT_C TBool CEikCba::IsCommandInGroup(const TInt /*aCommandId*/) const
  6837     {
  6426     {
  6838     _AKNTRACE_FUNC_ENTER;
       
  6839     _AKNTRACE_FUNC_EXIT;
       
  6840     return EFalse;
  6427     return EFalse;
  6841     }
  6428     }
  6842 #endif // RD_ENHANCED_CBA
  6429 #endif // RD_ENHANCED_CBA
  6843     
  6430     
  6844 // -----------------------------------------------------------------------------
  6431 // -----------------------------------------------------------------------------
  6848 // @since 5.0
  6435 // @since 5.0
  6849 // -----------------------------------------------------------------------------    
  6436 // -----------------------------------------------------------------------------    
  6850 #ifdef RD_ENHANCED_CBA  
  6437 #ifdef RD_ENHANCED_CBA  
  6851 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId)
  6438 EXPORT_C void CEikCba::ReplaceCommand(const TInt aReplaceCommandId, const TInt aResourceId)
  6852     {
  6439     {
  6853     _AKNTRACE_FUNC_ENTER;
       
  6854     TInt index = IndexById( aReplaceCommandId );
  6440     TInt index = IndexById( aReplaceCommandId );
  6855     TRAPD(err, SetCommandL( index, aResourceId ) );     
  6441     TRAPD(err, SetCommandL( index, aResourceId ) );     
  6856     _AKNTRACE_FUNC_EXIT;
       
  6857     }
  6442     }
  6858 #else
  6443 #else
  6859 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/)
  6444 EXPORT_C void CEikCba::ReplaceCommand(const TInt /*aReplaceCommandId*/, const TInt /*aResourceId*/)
  6860     {
  6445     {
  6861     _AKNTRACE_FUNC_ENTER;
       
  6862     _AKNTRACE_FUNC_EXIT;
       
  6863     }
  6446     }
  6864 #endif // RD_ENHANCED_CBA
  6447 #endif // RD_ENHANCED_CBA
  6865 
  6448 
  6866 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
  6449 void CEikCba::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
  6867     {
  6450     {
  6868     _AKNTRACE_FUNC_ENTER;
       
  6869     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  6451     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  6870         {
  6452         {
  6871         //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported );
  6453         //User::Panic( _L( "CBA inside dialog" ), KErrNotSupported );
  6872         _AKNTRACE_FUNC_EXIT;
       
  6873         return;
  6454         return;
  6874         }
  6455         }
  6875         
  6456         
  6876     if ( aEventType == EEventStateChanged )
  6457     if ( aEventType == EEventStateChanged )
  6877         {
  6458         {
  6902         if( command )
  6483         if( command )
  6903             {
  6484             {
  6904             iCommandObserver->ProcessCommandL( command );
  6485             iCommandObserver->ProcessCommandL( command );
  6905             }
  6486             }
  6906         }
  6487         }
  6907     _AKNTRACE_FUNC_EXIT;
       
  6908     }
  6488     }
  6909 
  6489 
  6910 
  6490 
  6911 void CEikCba::MakeVisible( TBool aVisible )
  6491 void CEikCba::MakeVisible( TBool aVisible )
  6912     {    
  6492     {    
  6913     _AKNTRACE_FUNC_ENTER;    
       
  6914     if ( aVisible )
  6493     if ( aVisible )
  6915         {
  6494         {
  6916         TBool redrawNeeded( EFalse );
  6495         TBool redrawNeeded( EFalse );
  6917 
  6496 
  6918         if ( AknLayoutUtils::PenEnabled() )
  6497         if ( AknLayoutUtils::PenEnabled() )
  6990         Window().ClearRedrawStore();
  6569         Window().ClearRedrawStore();
  6991         CEikControlGroup::MakeVisible( aVisible );
  6570         CEikControlGroup::MakeVisible( aVisible );
  6992         }
  6571         }
  6993 
  6572 
  6994     ReportContentChangedEvent();
  6573     ReportContentChangedEvent();
  6995     _AKNTRACE_FUNC_EXIT;
       
  6996     }
  6574     }
  6997 
  6575 
  6998 
  6576 
  6999 // -----------------------------------------------------------------------------
  6577 // -----------------------------------------------------------------------------
  7000 // Sets layer images and rects.
  6578 // Sets layer images and rects.
  7001 // @since 5.0
  6579 // @since 5.0
  7002 // -----------------------------------------------------------------------------
  6580 // -----------------------------------------------------------------------------
  7003 void CEikCba::DoSetLayers( const TAknsItemID& aIID )
  6581 void CEikCba::DoSetLayers( const TAknsItemID& aIID )
  7004     {
  6582     {
  7005     _AKNTRACE_FUNC_ENTER;
       
  7006     // Skin background is not drawn by embedded CBA.
  6583     // Skin background is not drawn by embedded CBA.
  7007     if ( iFlags.IsSet( ECbaEmbedded ) )
  6584     if ( iFlags.IsSet( ECbaEmbedded ) )
  7008         {
  6585         {
  7009         _AKNTRACE_FUNC_EXIT;
       
  7010         return;
  6586         return;
  7011         }
  6587         }
  7012 
  6588 
  7013     TAknLayoutRect cbarect;
  6589     TAknLayoutRect cbarect;
  7014     TRect screen;
  6590     TRect screen;
  7223 
  6799 
  7224         TRAP_IGNORE( iMLBgContext->SetLayerMaskAndSizeL( maskIID, cbaRect ) );
  6800         TRAP_IGNORE( iMLBgContext->SetLayerMaskAndSizeL( maskIID, cbaRect ) );
  7225         }
  6801         }
  7226         
  6802         
  7227     DrawDeferred();
  6803     DrawDeferred();
  7228     _AKNTRACE_FUNC_EXIT;
       
  7229     }
  6804     }
  7230 
  6805 
  7231 
  6806 
  7232 void CEikCba::LayoutControl( CCoeControl* aControl, const TRect& aRect )
  6807 void CEikCba::LayoutControl( CCoeControl* aControl, const TRect& aRect )
  7233     {   
  6808     {   
  7234     _AKNTRACE_FUNC_ENTER;   
       
  7235     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  6809     if ( !iFlags.IsSet( ECbaInsideDialog ) )
  7236         {
  6810         {
  7237         TRect rect( aRect );        
  6811         TRect rect( aRect );        
  7238         // aid_value_unit2 is 10ux10u rectangle.
  6812         // aid_value_unit2 is 10ux10u rectangle.
  7239         TAknWindowComponentLayout unit( AknLayoutScalable_Avkon::aid_value_unit2() );
  6813         TAknWindowComponentLayout unit( AknLayoutScalable_Avkon::aid_value_unit2() );
  7244             rect.Move( delta, delta );
  6818             rect.Move( delta, delta );
  7245             }        
  6819             }        
  7246         aControl->SetRect( rect );
  6820         aControl->SetRect( rect );
  7247         aControl->ComponentControl( 0 )->SetRect( rect );            
  6821         aControl->ComponentControl( 0 )->SetRect( rect );            
  7248         }
  6822         }
  7249     _AKNTRACE_FUNC_EXIT;
       
  7250     }
  6823     }
  7251 
  6824 
  7252 void CEikCba::BroadcastPostingTransparency( TBool aEnable )
  6825 void CEikCba::BroadcastPostingTransparency( TBool aEnable )
  7253     {
  6826     {
  7254     _AKNTRACE_FUNC_ENTER;
       
  7255     // Communicate change to CBA buttons.
  6827     // Communicate change to CBA buttons.
  7256     for ( TInt i = 0; i < iControlArray->Count(); i++ ) 
  6828     for ( TInt i = 0; i < iControlArray->Count(); i++ ) 
  7257         {
  6829         {
  7258         if ( i != KControlArrayScrollBarPosn ) // To avoid tinkering with scrollbar.
  6830         if ( i != KControlArrayScrollBarPosn ) // To avoid tinkering with scrollbar.
  7259             {
  6831             {
  7263                 {
  6835                 {
  7264                 button->SetTextBitmapMode( aEnable );
  6836                 button->SetTextBitmapMode( aEnable );
  7265                 }
  6837                 }
  7266             }
  6838             }
  7267         }
  6839         }
  7268     _AKNTRACE_FUNC_EXIT;
  6840     }
       
  6841 
       
  6842 
       
  6843 // ---------------------------------------------------------------------------
       
  6844 // CEikCba::SetFadeState
       
  6845 // Sets the CBA faded if it's contents are empty.
       
  6846 // ---------------------------------------------------------------------------
       
  6847 //
       
  6848 void CEikCba::SetFadeState()
       
  6849     {
       
  6850     TBool canBeFaded =
       
  6851         IsEmpty() && !( ( iCbaFlags & EEikCbaFlagTransparent )
       
  6852         || ( iExtension && iExtension->iEnablePostingTransparency ) );
       
  6853 
       
  6854     // No unfading when system is faded
       
  6855     if ( !( !canBeFaded
       
  6856             && static_cast<CAknAppUi*>( iCoeEnv->AppUi() )->IsFaded() ) )
       
  6857         {
       
  6858         Window().SetFaded( canBeFaded, RWindowTreeNode::EFadeIncludeChildren );
       
  6859         }
  7269     }
  6860     }
  7270 
  6861 
  7271 
  6862 
  7272 // ---------------------------------------------------------------------------
  6863 // ---------------------------------------------------------------------------
  7273 // CEikCba::UpdateLabels
  6864 // CEikCba::UpdateLabels
  7274 // Updates softkey labels in case of embedded softkeys.
  6865 // Updates softkey labels in case of embedded softkeys.
  7275 // ---------------------------------------------------------------------------
  6866 // ---------------------------------------------------------------------------
  7276 //
  6867 //
  7277 void CEikCba::UpdateLabels( TBool aDrawDeferred )
  6868 void CEikCba::UpdateLabels( TBool aDrawDeferred )
  7278     {
  6869     {
  7279     _AKNTRACE_FUNC_ENTER;
       
  7280     if ( iControlArray->Count() != 0)
  6870     if ( iControlArray->Count() != 0)
  7281         {
  6871         {
  7282         CCoeControl *leftSoftkey = ( *iControlArray )
  6872         CCoeControl *leftSoftkey = ( *iControlArray )
  7283             [ KControlArrayCBAButton1Posn ].iControl;
  6873             [ KControlArrayCBAButton1Posn ].iControl;
  7284         CCoeControl *rightSoftkey = ( *iControlArray )
  6874         CCoeControl *rightSoftkey = ( *iControlArray )
  7397         if ( aDrawDeferred )
  6987         if ( aDrawDeferred )
  7398             {
  6988             {
  7399             DrawDeferred();
  6989             DrawDeferred();
  7400             }
  6990             }
  7401         }
  6991         }
  7402     _AKNTRACE_FUNC_EXIT;
       
  7403     }
  6992     }
  7404     
  6993     
  7405 
  6994 
  7406 // -----------------------------------------------------------------------------
  6995 // -----------------------------------------------------------------------------
  7407 // EikSoftkeyPostingTransparency::MakeTransparent
  6996 // EikSoftkeyPostingTransparency::MakeTransparent
  7409 //
  6998 //
  7410 EXPORT_C TInt EikSoftkeyPostingTransparency::MakeTransparent(
  6999 EXPORT_C TInt EikSoftkeyPostingTransparency::MakeTransparent(
  7411     CEikButtonGroupContainer& aButtonGroupContainer,
  7000     CEikButtonGroupContainer& aButtonGroupContainer,
  7412     TBool aEnable )
  7001     TBool aEnable )
  7413     {
  7002     {
  7414     _AKNTRACE_FUNC_ENTER;
       
  7415     CEikCba* cba = dynamic_cast<CEikCba*>( aButtonGroupContainer.ButtonGroup() );
  7003     CEikCba* cba = dynamic_cast<CEikCba*>( aButtonGroupContainer.ButtonGroup() );
  7416     TInt ret = KErrNone;
  7004     TInt ret = KErrNone;
  7417     if ( cba )
  7005     if ( cba )
  7418         {
  7006         {
  7419         if ( aEnable && ( cba->ButtonGroupFlags() & EEikCbaFlagTransparent ) )
  7007         if ( aEnable && ( cba->ButtonGroupFlags() & EEikCbaFlagTransparent ) )
  7425         else
  7013         else
  7426             {
  7014             {
  7427             cba->EnablePostingTransparency( aEnable );
  7015             cba->EnablePostingTransparency( aEnable );
  7428             }
  7016             }
  7429         }
  7017         }
  7430     _AKNTRACE_FUNC_EXIT;
       
  7431     return ret;
  7018     return ret;
  7432     }
  7019     }
  7433 
  7020 
  7434 // -----------------------------------------------------------------------------
  7021 // -----------------------------------------------------------------------------
  7435 // CEikCba::EnablePostingTransparency
  7022 // CEikCba::EnablePostingTransparency
  7436 //
  7023 //
  7437 // -----------------------------------------------------------------------------
  7024 // -----------------------------------------------------------------------------
  7438 //
  7025 //
  7439 void CEikCba::EnablePostingTransparency( TBool aEnable )
  7026 void CEikCba::EnablePostingTransparency( TBool aEnable )
  7440     {
  7027     {
  7441     _AKNTRACE_FUNC_ENTER;
       
  7442     if ( iExtension )
  7028     if ( iExtension )
  7443         {
  7029         {
  7444         if ( iExtension->iEnablePostingTransparency != aEnable )
  7030         if ( iExtension->iEnablePostingTransparency != aEnable )
  7445             {
  7031             {
  7446             iExtension->iEnablePostingTransparency = aEnable;
  7032             iExtension->iEnablePostingTransparency = aEnable;
  7469                 }
  7055                 }
  7470 
  7056 
  7471             DrawDeferred();
  7057             DrawDeferred();
  7472             }
  7058             }
  7473         }
  7059         }
  7474     _AKNTRACE_FUNC_EXIT;
       
  7475     }
  7060     }
  7476 
  7061 
  7477 
  7062 
  7478 // ---------------------------------------------------------------------------
  7063 // ---------------------------------------------------------------------------
  7479 // CEikCba::IsEmpty
  7064 // CEikCba::IsEmpty
  7480 // Checks if the CBA has no commands.
  7065 // Checks if the CBA has no commands.
  7481 // ---------------------------------------------------------------------------
  7066 // ---------------------------------------------------------------------------
  7482 //
  7067 //
  7483 EXPORT_C TBool CEikCba::IsEmpty() const
  7068 EXPORT_C TBool CEikCba::IsEmpty() const
  7484     {
  7069     {
  7485     _AKNTRACE_FUNC_ENTER;
       
  7486     TBool isEmpty( ETrue );
  7070     TBool isEmpty( ETrue );
  7487 
  7071 
  7488     if ( iFlags.IsSet( ECbaInsideDialog ) )
  7072     if ( iFlags.IsSet( ECbaInsideDialog ) )
  7489         {
  7073         {
  7490         // Not supported for full screen query.
  7074         // Not supported for full screen query.
  7515                     }
  7099                     }
  7516                 }
  7100                 }
  7517             }
  7101             }
  7518         }
  7102         }
  7519 
  7103 
  7520     _AKNTRACE_FUNC_EXIT;
       
  7521     return isEmpty;
  7104     return isEmpty;
  7522     }
  7105     }
  7523     
  7106     
  7524     
  7107     
  7525 // ---------------------------------------------------------------------------
  7108 // ---------------------------------------------------------------------------
  7527 // Returns flags.
  7110 // Returns flags.
  7528 // ---------------------------------------------------------------------------
  7111 // ---------------------------------------------------------------------------
  7529 //
  7112 //
  7530 TBitFlags CEikCba::Flags() 
  7113 TBitFlags CEikCba::Flags() 
  7531     {
  7114     {
  7532     _AKNTRACE_FUNC_ENTER;
       
  7533     _AKNTRACE_FUNC_EXIT;
       
  7534     return iFlags;
  7115     return iFlags;
  7535     }
  7116     }
  7536 
  7117 
  7537 
  7118 
  7538 // ---------------------------------------------------------------------------
  7119 // ---------------------------------------------------------------------------
  7540 // Sets content observer.
  7121 // Sets content observer.
  7541 // ---------------------------------------------------------------------------
  7122 // ---------------------------------------------------------------------------
  7542 //
  7123 //
  7543 void CEikCba::SetContentObserver( TCallBack aCallBack )
  7124 void CEikCba::SetContentObserver( TCallBack aCallBack )
  7544     {
  7125     {
  7545     _AKNTRACE_FUNC_ENTER;
       
  7546     if ( iExtension )
  7126     if ( iExtension )
  7547         {
  7127         {
  7548         iExtension->iContentObserver = aCallBack;
  7128         iExtension->iContentObserver = aCallBack;
  7549         }
  7129         }
  7550     _AKNTRACE_FUNC_EXIT;
       
  7551     }
  7130     }
  7552 
  7131 
  7553 
  7132 
  7554 // ---------------------------------------------------------------------------
  7133 // ---------------------------------------------------------------------------
  7555 // CEikCba::ReportContentChangedEvent
  7134 // CEikCba::ReportContentChangedEvent
  7557 // or vice versa.
  7136 // or vice versa.
  7558 // ---------------------------------------------------------------------------
  7137 // ---------------------------------------------------------------------------
  7559 //     
  7138 //     
  7560 void CEikCba::ReportContentChangedEvent()
  7139 void CEikCba::ReportContentChangedEvent()
  7561     {
  7140     {
  7562     _AKNTRACE_FUNC_ENTER;
       
  7563     if ( ItemSpecificSoftkey() )
  7141     if ( ItemSpecificSoftkey() )
  7564         {
  7142         {
  7565         UpdateItemSpecificSoftkey(
  7143         UpdateItemSpecificSoftkey(
  7566                 iExtension->Active() && !Window().IsFaded() );
  7144                 iExtension->Active() && !Window().IsFaded() );
  7567         }
  7145         }
  7568 
  7146 
  7569     if ( !iFlags.IsSet( ECbaEmbedded ) )
  7147     if ( !iFlags.IsSet( ECbaEmbedded ) )
  7570         {
  7148         {
  7571         _AKNTRACE_FUNC_EXIT;
       
  7572         return;
  7149         return;
  7573         }
  7150         }
  7574 
  7151 
  7575     TBool isEmpty( !IsVisible() || IsEmpty() );
  7152     TBool isEmpty( !IsVisible() || IsEmpty() );
  7576     TBool reportStateChanged( EFalse );
  7153     TBool reportStateChanged( EFalse );
  7594         if ( iExtension && iExtension->iContentObserver.iFunction )
  7171         if ( iExtension && iExtension->iContentObserver.iFunction )
  7595             {
  7172             {
  7596             iExtension->iContentObserver.CallBack(); // return value ignored
  7173             iExtension->iContentObserver.CallBack(); // return value ignored
  7597             }
  7174             }
  7598         }
  7175         }
  7599     _AKNTRACE_FUNC_EXIT;
       
  7600     }
  7176     }
  7601 
  7177 
  7602 // ---------------------------------------------------------------------------
  7178 // ---------------------------------------------------------------------------
  7603 // CEikCba::DrawEmbeddedSoftkey
  7179 // CEikCba::DrawEmbeddedSoftkey
  7604 // Draws embedded softkey
  7180 // Draws embedded softkey
  7607 void CEikCba::DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl,
  7183 void CEikCba::DrawEmbeddedSoftkey( TEikGroupControl& aGroupControl,
  7608                                    const TRect& aRect,
  7184                                    const TRect& aRect,
  7609                                    CWindowGc& aGc,
  7185                                    CWindowGc& aGc,
  7610                                    CFbsBitmap* /*aMask*/ ) const
  7186                                    CFbsBitmap* /*aMask*/ ) const
  7611     {
  7187     {
  7612     _AKNTRACE_FUNC_ENTER;
       
  7613     CEikCbaButton* button = 
  7188     CEikCbaButton* button = 
  7614         static_cast<CEikCbaButton*>( aGroupControl.iControl );
  7189         static_cast<CEikCbaButton*>( aGroupControl.iControl );
  7615     
  7190     
  7616     TAknLayoutRect layoutRect;
  7191     TAknLayoutRect layoutRect;
  7617     TRect innerRect;
  7192     TRect innerRect;
  7637                                   aRect,
  7212                                   aRect,
  7638                                   innerRect,
  7213                                   innerRect,
  7639                                   KAknsIIDQgnFrSctrlSkButton,
  7214                                   KAknsIIDQgnFrSctrlSkButton,
  7640                                   KAknsIIDQgnFrSctrlSkButtonCenter);
  7215                                   KAknsIIDQgnFrSctrlSkButtonCenter);
  7641         }
  7216         }
  7642     _AKNTRACE_FUNC_EXIT;
       
  7643     }
  7217     }
  7644 
  7218 
  7645 TBool CEikCba::UpdateIconL()
  7219 TBool CEikCba::UpdateIconL()
  7646         {
  7220         {
  7647         _AKNTRACE_FUNC_ENTER;
       
  7648         if ( iFlags.IsSet( ECbaInsideDialog ) )
  7221         if ( iFlags.IsSet( ECbaInsideDialog ) )
  7649             {
  7222             {
  7650             _AKNTRACE_FUNC_EXIT;
       
  7651             return EFalse;
  7223             return EFalse;
  7652             }
  7224             }
  7653         
  7225         
  7654         if ( !iExtension->iIfMskIconSet ||
  7226         if ( !iExtension->iIfMskIconSet ||
  7655              !MskAllowed() )
  7227              !MskAllowed() )
  7656             {
  7228             {
  7657             _AKNTRACE_FUNC_EXIT;
       
  7658             return EFalse;         
  7229             return EFalse;         
  7659             }
  7230             }
  7660         
  7231         
  7661         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  7232         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
  7662         if ( !skin )
  7233         if ( !skin )
  7663             { 
  7234             { 
  7664             _AKNTRACE_FUNC_EXIT;
       
  7665             return EFalse;
  7235             return EFalse;
  7666             }
  7236             }
  7667     
  7237     
  7668         TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn );
  7238         TEikGroupControl &gCtrl = iControlArray->At( KControlArrayCBAButtonMSKPosn );
  7669 
  7239 
  7670         CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl );
  7240         CEikCbaButton *button = static_cast<CEikCbaButton*>( gCtrl.iControl );
  7671         if ( !button )
  7241         if ( !button )
  7672             {
  7242             {
  7673             _AKNTRACE_FUNC_EXIT;
       
  7674             return EFalse;
  7243             return EFalse;
  7675             }
  7244             }
  7676    
  7245    
  7677         CFbsBitmap *bitmap = NULL;
  7246         CFbsBitmap *bitmap = NULL;
  7678         CFbsBitmap *mask = NULL;
  7247         CFbsBitmap *mask = NULL;
  7679       
  7248       
  7680         TInt graphicMSKVariety = 1;
       
  7681         if ( iCbaFlags & EEikCbaFlagAppMskIcon )
       
  7682         	{
       
  7683             graphicMSKVariety = 0 ;
       
  7684         	}
       
  7685         TAknLayoutRect qgn_graf_sk_msk;
  7249         TAknLayoutRect qgn_graf_sk_msk;
  7686         TRect rect;
  7250         TRect rect;
  7687         qgn_graf_sk_msk.LayoutRect(
  7251         qgn_graf_sk_msk.LayoutRect(
  7688             rect,
  7252             rect,
  7689             AknLayoutScalable_Avkon::control_pane_g4( graphicMSKVariety ).LayoutLine() );
  7253             AknLayoutScalable_Avkon::control_pane_g4( 0 ).LayoutLine() );
  7690 
  7254 
  7691         TSize iconSize( qgn_graf_sk_msk.Rect().Width(),
  7255         TSize iconSize( qgn_graf_sk_msk.Rect().Width(),
  7692                         qgn_graf_sk_msk.Rect().Height() );
  7256                         qgn_graf_sk_msk.Rect().Height() );
  7693         
  7257         
  7694         AknsUtils::CreateIconL(
  7258         AknsUtils::CreateIconL(
  7720             button->ReplaceImageByLabel(); // remove old image
  7284             button->ReplaceImageByLabel(); // remove old image
  7721             }
  7285             }
  7722     
  7286     
  7723         button->SetContainerWindowL( *this );
  7287         button->SetContainerWindowL( *this );
  7724     
  7288     
  7725         _AKNTRACE_FUNC_EXIT;
       
  7726         return ETrue;
  7289         return ETrue;
  7727         
  7290     	
  7728         }
  7291         }
  7729 
  7292 
  7730 
  7293 
  7731 // ---------------------------------------------------------------------------
  7294 // ---------------------------------------------------------------------------
  7732 // Checks if the middle softkey should be used.
  7295 // Checks if the middle softkey should be used.
  7734 // when on layout changes etc.
  7297 // when on layout changes etc.
  7735 // ---------------------------------------------------------------------------
  7298 // ---------------------------------------------------------------------------
  7736 //     
  7299 //     
  7737 TBool CEikCba::MskAllowed() const
  7300 TBool CEikCba::MskAllowed() const
  7738     {
  7301     {
  7739     _AKNTRACE_FUNC_ENTER;
       
  7740     _AKNTRACE_FUNC_EXIT;
       
  7741     return ( iMSKEnabledInPlatform &&
  7302     return ( iMSKEnabledInPlatform &&
  7742              AknLayoutUtils::MSKEnabled() &&
  7303              AknLayoutUtils::MSKEnabled() &&
  7743              IsMskEnabledLayoutActive() );
  7304              IsMskEnabledLayoutActive() );
  7744     }
  7305     }
  7745 
  7306 
  7750 // ---------------------------------------------------------------------------
  7311 // ---------------------------------------------------------------------------
  7751 //     
  7312 //     
  7752 TBool CEikCba::SoftkeyStatusChangeAllowed(
  7313 TBool CEikCba::SoftkeyStatusChangeAllowed(
  7753         TInt aSoftkeyPosition, TBool aDisabled )
  7314         TInt aSoftkeyPosition, TBool aDisabled )
  7754     {
  7315     {
  7755     _AKNTRACE_FUNC_ENTER;
       
  7756     TBool allowChange( ETrue );
  7316     TBool allowChange( ETrue );
  7757     if ( aSoftkeyPosition == KControlArrayCBAButton1Posn )
  7317     if ( aSoftkeyPosition == KControlArrayCBAButton1Posn )
  7758         {
  7318         {
  7759         if ( aDisabled )
  7319         if ( aDisabled )
  7760             {
  7320             {
  7761             iFlags.Set( ECbaItemSoftkeyDisabledByClient );
  7321             iFlags.Set( ECbaItemSoftkeyDisabledByClient );
  7762             }
  7322             }
  7763         else
  7323         else
  7764             {
  7324             {
  7765             iFlags.Clear( ECbaItemSoftkeyDisabledByClient );
  7325             iFlags.Clear( ECbaItemSoftkeyDisabledByClient );
  7766             if ( iFlags.IsSet( ECbaItemSoftkeyDisabled ) &&
  7326             if ( iFlags.IsSet( ECbaItemSoftkeyDisabled ) )
  7767                      iFlags.IsSet( ECbaItemSpecificSoftkeyInUse ) )
       
  7768                 {
  7327                 {
  7769                 allowChange = EFalse;
  7328                 allowChange = EFalse;
  7770                 }
  7329                 }
  7771             }
  7330             }
  7772         }
  7331         }
  7773     _AKNTRACE_FUNC_EXIT;
       
  7774     return allowChange;
  7332     return allowChange;
  7775     }
  7333     }
  7776 
  7334 
  7777 
  7335 
  7778 // ---------------------------------------------------------------------------
  7336 // ---------------------------------------------------------------------------
  7780 // Returns item specific softkey control if it state should be updated.
  7338 // Returns item specific softkey control if it state should be updated.
  7781 // ---------------------------------------------------------------------------
  7339 // ---------------------------------------------------------------------------
  7782 //
  7340 //
  7783 TEikGroupControl* CEikCba::ItemSpecificSoftkey() const
  7341 TEikGroupControl* CEikCba::ItemSpecificSoftkey() const
  7784     {
  7342     {
  7785     _AKNTRACE_FUNC_ENTER;
       
  7786     TEikGroupControl* lsk( NULL );
  7343     TEikGroupControl* lsk( NULL );
  7787     if ( iFlags.IsSet( ECbaItemSpecificSoftkeyInUse ) )
  7344     if ( iFlags.IsSet( ECbaItemSpecificSoftkeyInUse ) )
  7788         {
  7345         {
  7789         TEikGroupControl& leftSoftkey =
  7346         TEikGroupControl& leftSoftkey =
  7790             ( *iControlArray ) [ KControlArrayCBAButton1Posn ];
  7347             ( *iControlArray ) [ KControlArrayCBAButton1Posn ];
  7792                 || iFlags.IsSet( ECbaItemSoftkeyDisabled ) )
  7349                 || iFlags.IsSet( ECbaItemSoftkeyDisabled ) )
  7793             {
  7350             {
  7794             lsk = &leftSoftkey;
  7351             lsk = &leftSoftkey;
  7795             }
  7352             }
  7796         }
  7353         }
  7797     _AKNTRACE_FUNC_EXIT;
       
  7798     return lsk;
  7354     return lsk;
  7799     }
  7355     }
  7800 
  7356 
  7801 
  7357 
  7802 // ---------------------------------------------------------------------------
  7358 // ---------------------------------------------------------------------------
  7804 // Updates item specific softkey.
  7360 // Updates item specific softkey.
  7805 // ---------------------------------------------------------------------------
  7361 // ---------------------------------------------------------------------------
  7806 //     
  7362 //     
  7807 void CEikCba::UpdateItemSpecificSoftkey( TBool aVisibleCollection )
  7363 void CEikCba::UpdateItemSpecificSoftkey( TBool aVisibleCollection )
  7808     {
  7364     {
  7809     _AKNTRACE_FUNC_ENTER;
       
  7810     if ( iFlags.IsSet( ECbaSingleClickEnabled )
  7365     if ( iFlags.IsSet( ECbaSingleClickEnabled )
  7811             && iExtension && iExtension->iItemActionMenu )
  7366             && iExtension && iExtension->iItemActionMenu )
  7812         {
  7367         {
  7813         TEikGroupControl* leftSk = ItemSpecificSoftkey();
  7368         TEikGroupControl* leftSk = ItemSpecificSoftkey();
  7814         if ( leftSk )
  7369         if ( leftSk )
  7817                     iExtension->iItemActionMenu->CollectionSoftkeyVisible(
  7372                     iExtension->iItemActionMenu->CollectionSoftkeyVisible(
  7818                             aVisibleCollection ) );
  7373                             aVisibleCollection ) );
  7819             UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk );
  7374             UpdateItemSpecificSoftkey( *leftSk->iControl, enableSk );
  7820             }
  7375             }
  7821         }
  7376         }
  7822     _AKNTRACE_FUNC_EXIT;
       
  7823     }
  7377     }
  7824 
  7378 
  7825 
  7379 
  7826 // ---------------------------------------------------------------------------
  7380 // ---------------------------------------------------------------------------
  7827 // CEikCba::UpdateItemSpecificSoftkey
  7381 // CEikCba::UpdateItemSpecificSoftkey
  7828 // Updates item specific softkey.
  7382 // Updates item specific softkey.
  7829 // ---------------------------------------------------------------------------
  7383 // ---------------------------------------------------------------------------
  7830 //
  7384 //
  7831 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable )
  7385 void CEikCba::UpdateItemSpecificSoftkey( CCoeControl& aControl, TBool aEnable )
  7832     {
  7386     {
  7833     _AKNTRACE_FUNC_ENTER;
       
  7834     if ( iFlags.IsSet( ECbaKeepItemSoftkeyVisible  ))
       
  7835         {
       
  7836         _AKNTRACE_FUNC_EXIT;
       
  7837         return;
       
  7838         }    
       
  7839     TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() );
  7387     TBool skEnabled( aControl.IsVisible() && !aControl.IsDimmed() );
  7840     TBool changeState( EFalse );
  7388     TBool changeState( EFalse );
  7841     if ( !aEnable )
  7389     if ( !aEnable )
  7842         {
  7390         {
  7843         iFlags.Set( ECbaItemSoftkeyDisabled );
  7391         iFlags.Set( ECbaItemSoftkeyDisabled );
  7865             {
  7413             {
  7866             aControl.SetDimmed( !aEnable );
  7414             aControl.SetDimmed( !aEnable );
  7867             aControl.DrawDeferred();
  7415             aControl.DrawDeferred();
  7868             }
  7416             }
  7869         }
  7417         }
  7870     _AKNTRACE_FUNC_EXIT;
  7418     }
  7871     }
       
  7872 
       
  7873 
       
  7874 // ---------------------------------------------------------------------------
       
  7875 // CEikCba::UpdateMultipleMarkingSoftkey
       
  7876 // Updates RSK when multiple marking is activated or deactivated.
       
  7877 // ---------------------------------------------------------------------------
       
  7878 //     
       
  7879 void CEikCba::UpdateMultipleMarkingSoftkey()
       
  7880     {
       
  7881     _AKNTRACE_FUNC_ENTER;
       
  7882     if ( iFlags.IsSet( ECbaSingleClickEnabled )
       
  7883             && iExtension && iExtension->iItemActionMenu )
       
  7884         {
       
  7885         TBool markingActive(
       
  7886                 iExtension->iItemActionMenu->MarkingMode(
       
  7887                         ).MultipleMarkingActive() );
       
  7888         TBool markingActivated( iFlags.IsSet( ECbaMultipleMarkingActive ) );
       
  7889         if ( markingActive && !markingActivated )
       
  7890             {
       
  7891             TRAPD( error, 
       
  7892                 AddCommandSetToStackL( R_AVKON_SOFTKEYS_OPTIONS_CANCEL ) );
       
  7893                 
       
  7894             if ( error == KErrNone )
       
  7895                 {
       
  7896                 iFlags.Set( ECbaMultipleMarkingActive );
       
  7897                 }
       
  7898             }
       
  7899         else if ( !markingActive && markingActivated )
       
  7900             {
       
  7901             RemoveCommandFromStack(
       
  7902                     KControlArrayCBAButton1Posn, EAknSoftkeyOptions );
       
  7903             RemoveCommandFromStack(
       
  7904                     KControlArrayCBAButton2Posn, EAknSoftkeyCancel );
       
  7905             iFlags.Clear( ECbaMultipleMarkingActive );
       
  7906             }
       
  7907         }
       
  7908     _AKNTRACE_FUNC_EXIT;
       
  7909     }
       
  7910 
       
  7911 
       
  7912 // ---------------------------------------------------------------------------
       
  7913 // CEikCba::CommandChangeAllowed
       
  7914 // ---------------------------------------------------------------------------
       
  7915 //     
       
  7916 TBool CEikCba::CommandChangeAllowed() const
       
  7917     {
       
  7918     return ( !( iFlags.IsSet( ECbaSingleClickEnabled ) 
       
  7919             && iFlags.IsSet( ECbaMultipleMarkingActive ) ) );
       
  7920     }
       
  7921 
       
  7922 
       
  7923 // ---------------------------------------------------------------------------
       
  7924 // CEikCba::CheckAndCreateStaconContextsL
       
  7925 // Creates the skin background contexts used in StaCon layout.
       
  7926 // ---------------------------------------------------------------------------
       
  7927 //
       
  7928 void CEikCba::CheckAndCreateStaconContextsL()
       
  7929     {
       
  7930     if ( !iStaconBgContextTop && !iStaconBgContextBottom )
       
  7931         {
       
  7932         TRect screen;
       
  7933         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
  7934         
       
  7935         // There is a need for two layers in each context: one for wallpaper, 
       
  7936         // the other for skin graphics.
       
  7937         if ( !iStaconBgContextTop )
       
  7938             {
       
  7939             iStaconBgContextTop =
       
  7940                 CAknsMaskedLayerBackgroundControlContext::NewL(
       
  7941                     KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN );
       
  7942             }
       
  7943         
       
  7944         if ( !iStaconBgContextBottom )
       
  7945             {
       
  7946             iStaconBgContextBottom =
       
  7947                 CAknsMaskedLayerBackgroundControlContext::NewL(
       
  7948                     KAknsIIDWallpaper, TRect( 0, 0, 1, 1 ), ETrue, ECbaLayerN );
       
  7949             }
       
  7950             
       
  7951         for ( TInt i = 0; i < ECbaLayerN; i++ )
       
  7952             {
       
  7953             iStaconBgContextBottom->SetLayerImage( i, KAknsIIDNone );
       
  7954             }
       
  7955     
       
  7956         TAknLayoutRect layoutRect;
       
  7957         layoutRect.LayoutRect( screen,
       
  7958                                AknLayoutScalable_Avkon::area_top_pane( 2 ) );
       
  7959         TRect staconTop( layoutRect.Rect() );
       
  7960     
       
  7961         layoutRect.LayoutRect( screen,
       
  7962                                AknLayoutScalable_Avkon::area_bottom_pane( 2 ) );        
       
  7963         TRect staconBottom( layoutRect.Rect() );
       
  7964     
       
  7965         // Set layers to stacon contexts.
       
  7966         // Set bottom as parent to top, so that top is re-drawn, if bottom is drawn.
       
  7967         iStaconBgContextTop->SetLayerImage( ECbaLayerWallpaper,
       
  7968                                             KAknsIIDWallpaper );
       
  7969         iStaconBgContextTop->SetLayerRect( ECbaLayerWallpaper, screen );
       
  7970         iStaconBgContextTop->SetLayerImage( ECbaLayerBackground,
       
  7971                                             KAknsIIDQsnBgAreaStaconRt );
       
  7972         iStaconBgContextTop->SetLayerRect( ECbaLayerBackground, staconTop );
       
  7973     
       
  7974         iStaconBgContextBottom->SetLayerImage( ECbaLayerWallpaper,
       
  7975                                                KAknsIIDWallpaper );
       
  7976         iStaconBgContextBottom->SetLayerRect( ECbaLayerWallpaper, screen );
       
  7977         iStaconBgContextBottom->SetLayerImage( ECbaLayerBackground,
       
  7978                                                KAknsIIDQsnBgAreaStaconRb );
       
  7979         iStaconBgContextBottom->SetLayerRect( ECbaLayerBackground, staconBottom );
       
  7980         iStaconBgContextBottom->SetParentPos( TPoint( 0, 0 ) );
       
  7981     
       
  7982         iStaconBgContextTop->SetParentContext( iStaconBgContextBottom );
       
  7983     
       
  7984         TBool idle = AknLayoutFlags() & EAknLayoutCbaInStaconPaneIdle;
       
  7985         if ( idle )
       
  7986             {
       
  7987             iStaconBgContextTop->SetLayerMaskAndSizeL(
       
  7988                 KAknsIIDQgnGrafBgLscTopMaskIcon, staconTop );
       
  7989             iStaconBgContextBottom->SetLayerMaskAndSizeL(
       
  7990                 KAknsIIDQgnGrafBgLscBottomMaskIcon, staconBottom );
       
  7991             }
       
  7992         }
       
  7993     }
       
  7994 
       
  7995 
  7419 
  7996 
  7420 
  7997 //
  7421 //
  7998 // class CEikCbaButton
  7422 // class CEikCbaButton
  7999 //
  7423 //
  8000 
  7424 
  8001 CEikCbaButton::~CEikCbaButton()
  7425 CEikCbaButton::~CEikCbaButton()
  8002     {
  7426     {
  8003     _AKNTRACE_FUNC_ENTER;
       
  8004     AKNTASHOOK_REMOVE();
  7427     AKNTASHOOK_REMOVE();
  8005     delete iLabel;
  7428     delete iLabel;
  8006     if ( iImage )
  7429     if ( iImage )
  8007         {
  7430         {
  8008         iImage->SetMask( iMask );
  7431         iImage->SetMask( iMask );
  8010     delete iImage;    
  7433     delete iImage;    
  8011     delete iSfeMask;
  7434     delete iSfeMask;
  8012     delete iButtonOptions;
  7435     delete iButtonOptions;
  8013     delete iText;
  7436     delete iText;
  8014 
  7437 
  8015     _AKNTRACE_FUNC_EXIT;
       
  8016     }
  7438     }
  8017 
  7439 
  8018 void CEikCbaButton::ConstructL(TGulAlignmentValue aAlignment)
  7440 void CEikCbaButton::ConstructL(TGulAlignmentValue aAlignment)
  8019     {
  7441     {
  8020     _AKNTRACE_FUNC_ENTER;
       
  8021     iLabel = new(ELeave) CEikLabel;    
  7442     iLabel = new(ELeave) CEikLabel;    
  8022     iPressedDown = EFalse;    
  7443     iPressedDown = EFalse;    
  8023     iLabel->SetBufferReserveLengthL(KMaxCbaLabelLength);
  7444     iLabel->SetBufferReserveLengthL(KMaxCbaLabelLength);
  8024     UpdateLabelText(TPtrC());
  7445     UpdateLabelText(TPtrC());
  8025     iLabel->SetAlignment(aAlignment);
  7446     iLabel->SetAlignment(aAlignment);
  8030     if ( iUseTextBitmap )
  7451     if ( iUseTextBitmap )
  8031         {
  7452         {
  8032         iLabel->MakeVisible( EFalse );
  7453         iLabel->MakeVisible( EFalse );
  8033         }
  7454         }
  8034     AKNTASHOOK_ADDL( this, "CEikCbaButton" );
  7455     AKNTASHOOK_ADDL( this, "CEikCbaButton" );
  8035     _AKNTRACE_FUNC_EXIT;
       
  8036     }
  7456     }
  8037 
  7457 
  8038 void CEikCbaButton::AddCommandL(const TDesC& aText)
  7458 void CEikCbaButton::AddCommandL(const TDesC& aText)
  8039     {
  7459     {
  8040     _AKNTRACE_FUNC_ENTER;
       
  8041     UpdateLabelText(aText);
  7460     UpdateLabelText(aText);
  8042     _AKNTRACE_FUNC_EXIT;
       
  8043     }
  7461     }
  8044 
  7462 
  8045 struct STempCleanup
  7463 struct STempCleanup
  8046     {
  7464     {
  8047     CDesCArray* iText;
  7465     CDesCArray* iText;
  8048     CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions;
  7466     CArrayFix<CEikCbaButton::SButtonOptions>* iButtonOptions;
  8049     };
  7467     };
  8050 
  7468 
  8051 LOCAL_C void CleanupTemp(TAny* aPtr)
  7469 LOCAL_C void CleanupTemp(TAny* aPtr)
  8052     {
  7470     {
  8053     _AKNTRACE_FUNC_ENTER;
       
  8054     STempCleanup& temp = *(STempCleanup*)aPtr;
  7471     STempCleanup& temp = *(STempCleanup*)aPtr;
  8055     const TInt count = temp.iText->Count();
  7472     const TInt count = temp.iText->Count();
  8056     if (temp.iButtonOptions->Count() == count)
  7473     if (temp.iButtonOptions->Count() == count)
  8057         {
  7474         {
  8058         temp.iButtonOptions->Delete(count - 1);
  7475         temp.iButtonOptions->Delete(count - 1);
  8059         }
  7476         }
  8060     temp.iText->Delete(count - 1);
  7477     temp.iText->Delete(count - 1);
  8061     _AKNTRACE_FUNC_EXIT;
       
  8062     }
  7478     }
  8063 
  7479 
  8064 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText)
  7480 void CEikCbaButton::PushCommandL(TInt aCommandId,const TDesC& aText)
  8065     {
  7481     {
  8066     _AKNTRACE_FUNC_ENTER;
       
  8067     if (!iButtonOptions)
  7482     if (!iButtonOptions)
  8068         {
  7483         {
  8069         iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1);
  7484         iButtonOptions = new(ELeave) CArrayFixFlat<SButtonOptions>(1);
  8070         }
  7485         }
  8071     if (!iText)
  7486     if (!iText)
  8084     options.iDimmed = iLabel->IsDimmed();
  7499     options.iDimmed = iLabel->IsDimmed();
  8085     iLabel->SetDimmed(EFalse);
  7500     iLabel->SetDimmed(EFalse);
  8086     iButtonOptions->AppendL(options);
  7501     iButtonOptions->AppendL(options);
  8087     UpdateLabelText(aText);
  7502     UpdateLabelText(aText);
  8088     CleanupStack::Pop(); // temp
  7503     CleanupStack::Pop(); // temp
  8089     _AKNTRACE_FUNC_EXIT;
       
  8090     }
  7504     }
  8091 
  7505 
  8092 TInt CEikCbaButton::PopCommand()
  7506 TInt CEikCbaButton::PopCommand()
  8093     {
  7507     {
  8094     _AKNTRACE_FUNC_ENTER;
       
  8095     if (!iButtonOptions)
  7508     if (!iButtonOptions)
  8096         {
  7509         {
  8097         _AKNTRACE_FUNC_EXIT;
       
  8098         return -1; 
  7510         return -1; 
  8099         }
  7511         }
  8100 
  7512 
  8101     TInt count = iButtonOptions->Count();
  7513     TInt count = iButtonOptions->Count();
  8102     --count;
  7514     --count;
  8103         
  7515         
  8104     if (count < 0)
  7516     if (count < 0)
  8105         {
  7517         {
  8106         _AKNTRACE_FUNC_EXIT;
       
  8107         return -1;
  7518         return -1;
  8108         }
  7519         }
  8109 
  7520 
  8110     const SButtonOptions buttonOptions = (*iButtonOptions)[count];
  7521     const SButtonOptions buttonOptions = (*iButtonOptions)[count];
  8111     iButtonOptions->Delete(count);
  7522     iButtonOptions->Delete(count);
  8126         }
  7537         }
  8127     else
  7538     else
  8128         {
  7539         {
  8129         iImage->DrawNow();
  7540         iImage->DrawNow();
  8130         }
  7541         }
  8131     _AKNTRACE_FUNC_EXIT;
       
  8132     return buttonOptions.iCommandId;
  7542     return buttonOptions.iCommandId;
  8133     }
  7543     }
  8134 
  7544 
  8135 void CEikCbaButton::RemoveCommand(TInt aCommandId)
  7545 void CEikCbaButton::RemoveCommand(TInt aCommandId)
  8136     {
  7546     {
  8137     _AKNTRACE_FUNC_ENTER;
       
  8138     if (!iButtonOptions)
  7547     if (!iButtonOptions)
  8139         {
  7548         {
  8140         _AKNTRACE_FUNC_EXIT;
       
  8141         return;
  7549         return;
  8142         }
  7550         }
  8143     TInt index = IndexFromCommandId(aCommandId);
  7551     TInt index = IndexFromCommandId(aCommandId);
  8144     if (index != KErrNotFound)
  7552     if (index != KErrNotFound)
  8145         {
  7553         {
  8151             iButtonOptions = NULL;
  7559             iButtonOptions = NULL;
  8152             delete iText;
  7560             delete iText;
  8153             iText = NULL;
  7561             iText = NULL;
  8154             }
  7562             }
  8155         }
  7563         }
  8156     _AKNTRACE_FUNC_EXIT;
       
  8157     }
  7564     }
  8158 
  7565 
  8159 void CEikCbaButton::RemovePreviousCommand()
  7566 void CEikCbaButton::RemovePreviousCommand()
  8160     {
  7567     {
  8161     _AKNTRACE_FUNC_ENTER;
       
  8162     if (!iButtonOptions)
  7568     if (!iButtonOptions)
  8163         {
  7569         {
  8164         _AKNTRACE_FUNC_EXIT;
       
  8165         return;
  7570         return;
  8166         }
  7571         }
  8167     TInt index = iButtonOptions->Count() - 2;
  7572     TInt index = iButtonOptions->Count() - 2;
  8168     if (index >= 0)
  7573     if (index >= 0)
  8169         {
  7574         {
  8170         iButtonOptions->Delete(index);
  7575         iButtonOptions->Delete(index);
  8171         iText->Delete(index);
  7576         iText->Delete(index);
  8172         }
  7577         }
  8173     _AKNTRACE_FUNC_EXIT;
       
  8174     }
  7578     }
  8175 
  7579 
  8176 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId)
  7580 TInt CEikCbaButton::IndexFromCommandId(TInt aCommandId)
  8177     {
  7581     {
  8178     _AKNTRACE_FUNC_ENTER;
       
  8179     TInt index;
  7582     TInt index;
  8180     TKeyArrayFix key(0, ECmpTInt);
  7583     TKeyArrayFix key(0, ECmpTInt);
  8181     SButtonOptions options;
  7584     SButtonOptions options;
  8182     options.iCommandId = aCommandId;
  7585     options.iCommandId = aCommandId;
  8183     if (iButtonOptions->Find(options, key, index) == KErrNone)
  7586     if (iButtonOptions->Find(options, key, index) == KErrNone)
  8184         {
  7587         {
  8185         _AKNTRACE_FUNC_EXIT;
       
  8186         return index;
  7588         return index;
  8187         }
  7589         }
  8188     else
  7590     else
  8189         {
  7591         {
  8190         _AKNTRACE_FUNC_EXIT;
       
  8191         return KErrNotFound;
  7592         return KErrNotFound;
  8192         }    
  7593         }
  8193     }
  7594     }
  8194 
  7595 
  8195 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer)
  7596 void CEikCbaButton::SetContainerWindowL(const CCoeControl& aContainer)
  8196     {
  7597     {
  8197     _AKNTRACE_FUNC_ENTER;
       
  8198     CCoeControl::SetContainerWindowL(aContainer);
  7598     CCoeControl::SetContainerWindowL(aContainer);
  8199     if (!iDoImage)
  7599     if (!iDoImage)
  8200         {
  7600         {
  8201         iLabel->SetContainerWindowL(aContainer);
  7601         iLabel->SetContainerWindowL(aContainer);
  8202         }
  7602         }
  8203     else
  7603     else
  8204         {
  7604         {
  8205         iImage->SetContainerWindowL(aContainer);
  7605         iImage->SetContainerWindowL(aContainer);
  8206         }
  7606         }
  8207     _AKNTRACE_FUNC_EXIT;
       
  8208     }
  7607     }
  8209 
  7608 
  8210 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment)
  7609 void CEikCbaButton::ConstructFromResourceL(TResourceReader& aReader, TGulAlignmentValue anAlignment)
  8211     {
  7610     {
  8212     _AKNTRACE_FUNC_ENTER;
       
  8213     ConstructL(anAlignment);
  7611     ConstructL(anAlignment);
  8214     UpdateLabelText(aReader.ReadTPtrC());
  7612     UpdateLabelText(aReader.ReadTPtrC());
  8215     aReader.ReadTPtrC(); // bmp filename
  7613     aReader.ReadTPtrC(); // bmp filename
  8216     aReader.ReadInt16(); // bmp id
  7614     aReader.ReadInt16(); // bmp id
  8217     aReader.ReadInt16(); // bmp mask id
  7615     aReader.ReadInt16(); // bmp mask id
  8218     _AKNTRACE_FUNC_EXIT;
       
  8219     }
  7616     }
  8220 
  7617 
  8221 TSize CEikCbaButton::MinimumSize()
  7618 TSize CEikCbaButton::MinimumSize()
  8222     {
  7619     {
  8223     _AKNTRACE_FUNC_ENTER;
       
  8224     if (!iDoImage)
  7620     if (!iDoImage)
  8225         {
  7621         {
  8226         _AKNTRACE_FUNC_EXIT;
       
  8227         return iLabel->MinimumSize();
  7622         return iLabel->MinimumSize();
  8228         }
  7623         }
  8229     else
  7624     else
  8230         {
  7625         {
  8231         _AKNTRACE_FUNC_EXIT;
       
  8232         return iImage->MinimumSize();
  7626         return iImage->MinimumSize();
  8233         }
  7627         }
  8234     }
  7628     }
  8235 
  7629 
  8236 TInt CEikCbaButton::CountComponentControls() const
  7630 TInt CEikCbaButton::CountComponentControls() const
  8237     {
  7631     {
  8238     _AKNTRACE_FUNC_ENTER;
       
  8239     _AKNTRACE_FUNC_EXIT;
       
  8240     return 1;
  7632     return 1;
  8241     }
  7633     }
  8242 
  7634 
  8243 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const
  7635 CCoeControl* CEikCbaButton::ComponentControl(TInt aIndex) const
  8244     {
  7636     {
  8245     _AKNTRACE_FUNC_ENTER;
       
  8246     if (aIndex==0)
  7637     if (aIndex==0)
  8247         {
  7638         {
  8248         if (!iDoImage)
  7639         if (!iDoImage)
  8249             {
  7640             {
  8250             _AKNTRACE_FUNC_EXIT;
       
  8251             return iLabel;
  7641             return iLabel;
  8252             }
  7642             }
  8253         else
  7643         else
  8254             {
  7644             {
  8255             // If SfeMask is available, then check the effect state (iPressedDown).
  7645             // If SfeMask is available, then check the effect state (iPressedDown).
  8265                     } 
  7655                     } 
  8266                 }
  7656                 }
  8267             return iImage;
  7657             return iImage;
  8268             }
  7658             }
  8269         }
  7659         }
  8270     _AKNTRACE_FUNC_EXIT;
       
  8271     return 0;
  7660     return 0;
  8272     }
  7661     }
  8273 
  7662 
  8274 
  7663 
  8275 // ---------------------------------------------------------------------------
  7664 // ---------------------------------------------------------------------------
  8276 // Handles size change events for CBA button.
  7665 // Handles size change events for CBA button.
  8277 // ---------------------------------------------------------------------------
  7666 // ---------------------------------------------------------------------------
  8278 //
  7667 //
  8279 void CEikCbaButton::SizeChanged()
  7668 void CEikCbaButton::SizeChanged()
  8280     {
  7669     {
  8281     _AKNTRACE_FUNC_ENTER;
       
  8282     // Resizing is done at CEikCba::SizeChanged().
  7670     // Resizing is done at CEikCba::SizeChanged().
  8283     // We cannot resize here because this control has wrong
  7671     // We cannot resize here because this control has wrong
  8284     // coordinate system available.
  7672     // coordinate system available.
  8285     _AKNTRACE_FUNC_EXIT;
  7673 
  8286     }
  7674     }
  8287 
  7675 
  8288 
  7676 
  8289 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
  7677 EXPORT_C void CEikCbaButton::HandlePointerEventL(const TPointerEvent& aPointerEvent) 
  8290     { 
  7678     { 
  8291     _AKNTRACE_FUNC_ENTER; 
       
  8292     CCoeControl::HandlePointerEventL(aPointerEvent); 
  7679     CCoeControl::HandlePointerEventL(aPointerEvent); 
  8293     _AKNTRACE_FUNC_EXIT;
       
  8294     }    
  7680     }    
  8295 
  7681 
  8296 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ )
  7682 EXPORT_C void* CEikCbaButton::ExtensionInterface( TUid /*aInterface*/ )
  8297     {
  7683     {
  8298     _AKNTRACE_FUNC_ENTER;
       
  8299     _AKNTRACE_FUNC_EXIT;
       
  8300     return NULL;
  7684     return NULL;
  8301     }
  7685     }
  8302 
  7686 
  8303 void CEikCbaButton::SetDimmed(TBool aDimmed)
  7687 void CEikCbaButton::SetDimmed(TBool aDimmed)
  8304     {
  7688     {
  8305     _AKNTRACE_FUNC_ENTER;
       
  8306     CCoeControl::SetDimmed(aDimmed);
  7689     CCoeControl::SetDimmed(aDimmed);
  8307     if (!iDoImage)
  7690     if (!iDoImage)
  8308         {
  7691         {
  8309         iLabel->SetDimmed(aDimmed);
  7692         iLabel->SetDimmed(aDimmed);
  8310         }
  7693         }
  8311     else
  7694     else
  8312         {
  7695         {
  8313         // Drawing dimmed CEikImages don't work (problem in uiklaf).
  7696         // Drawing dimmed CEikImages don't work (problem in uiklaf).
  8314         //iImage->SetDimmed(aDimmed);
  7697         //iImage->SetDimmed(aDimmed);
  8315         }
  7698         }
  8316     _AKNTRACE_FUNC_EXIT;
       
  8317     }
  7699     }
  8318 
  7700 
  8319 
  7701 
  8320 // ---------------------------------------------------------------------------
  7702 // ---------------------------------------------------------------------------
  8321 // Updates the softkey label.
  7703 // Updates the softkey label.
  8322 // ---------------------------------------------------------------------------
  7704 // ---------------------------------------------------------------------------
  8323 //
  7705 //
  8324 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText )
  7706 void CEikCbaButton::UpdateLabelText( TPtrC aLabelText )
  8325     {
  7707     {
  8326     _AKNTRACE_FUNC_ENTER;
       
  8327     // Updates the label text with the given label, using tab delimited
  7708     // Updates the label text with the given label, using tab delimited
  8328     // label text to identify normal / alternative labels.
  7709     // label text to identify normal / alternative labels.
  8329     if ( aLabelText.Length() > KMaxCbaLabelLength )
  7710     if ( aLabelText.Length() > KMaxCbaLabelLength )
  8330         {
  7711         {
  8331         // Cannot take more chars than maximum buffer size.
  7712         // Cannot take more chars than maximum buffer size.
  8354     TRAP_IGNORE( iLabel->SetTextL( iLongLabelText ) ); 
  7735     TRAP_IGNORE( iLabel->SetTextL( iLongLabelText ) ); 
  8355     if ( IsReadyToDraw() )
  7736     if ( IsReadyToDraw() )
  8356         {
  7737         {
  8357         TruncateLabelText();
  7738         TruncateLabelText();
  8358         }
  7739         }
  8359     _AKNTRACE_FUNC_EXIT;
       
  8360     }
  7740     }
  8361 
  7741 
  8362 
  7742 
  8363 void CEikCbaButton::SetTextBitmapMode( TBool aEnableBitmap )
  7743 void CEikCbaButton::SetTextBitmapMode( TBool aEnableBitmap )
  8364     {
  7744     {
  8365     _AKNTRACE_FUNC_ENTER;
       
  8366     iUseTextBitmap = aEnableBitmap;
  7745     iUseTextBitmap = aEnableBitmap;
  8367     if ( iLabel )
  7746     if ( iLabel )
  8368         {
  7747         {
  8369         iLabel->MakeVisible( !aEnableBitmap );
  7748         iLabel->MakeVisible( !aEnableBitmap );
  8370         }
  7749         }
  8371     _AKNTRACE_FUNC_EXIT;
       
  8372     }
  7750     }
  8373 
  7751 
  8374 void CEikCbaButton::DrawToContext( CBitmapContext& aContext, CBitmapContext& aMaskContext, const TPoint& aOffset ) const
  7752 void CEikCbaButton::DrawToContext( CBitmapContext& aContext, CBitmapContext& aMaskContext, const TPoint& aOffset ) const
  8375     {
  7753     {
  8376     _AKNTRACE_FUNC_ENTER;
       
  8377     if ( iLabel )
  7754     if ( iLabel )
  8378         {
  7755         {
  8379         // Draw text into EColor16MA bitmap
  7756         // Draw text into EColor16MA bitmap
  8380         aContext.SetOrigin( -aOffset );
  7757         aContext.SetOrigin( -aOffset );
  8381         iLabel->DrawToContext( aContext, NULL );
  7758         iLabel->DrawToContext( aContext, NULL );
  8384         // The mask should have a black background and the text in white.
  7761         // The mask should have a black background and the text in white.
  8385         TRgb maskColor = KRgbWhite;
  7762         TRgb maskColor = KRgbWhite;
  8386         aMaskContext.SetOrigin( -aOffset );
  7763         aMaskContext.SetOrigin( -aOffset );
  8387         iLabel->DrawToContext( aMaskContext, &maskColor );
  7764         iLabel->DrawToContext( aMaskContext, &maskColor );
  8388         }
  7765         }
  8389     _AKNTRACE_FUNC_EXIT;
       
  8390     }
  7766     }
  8391 
  7767 
  8392 void CEikCbaButton::SwitchToShortTextL(TBool aShortText)
  7768 void CEikCbaButton::SwitchToShortTextL(TBool aShortText)
  8393     {
  7769     {
  8394     _AKNTRACE_FUNC_ENTER;
       
  8395     if (aShortText)
  7770     if (aShortText)
  8396         {
  7771         {
  8397         iLabel->SetTextL(iShortLabelText);
  7772         iLabel->SetTextL(iShortLabelText);
  8398         }
  7773         }
  8399     else
  7774     else
  8412         }
  7787         }
  8413     else
  7788     else
  8414         {
  7789         {
  8415         iImage->DrawDeferred();
  7790         iImage->DrawDeferred();
  8416         }
  7791         }
  8417     _AKNTRACE_FUNC_EXIT;
       
  8418     }
  7792     }
  8419 
  7793 
  8420 void CEikCbaButton::SetLabelFont(const CFont* aLabelFont)
  7794 void CEikCbaButton::SetLabelFont(const CFont* aLabelFont)
  8421     {    
  7795     {    
  8422     _AKNTRACE_FUNC_ENTER;    
       
  8423     iLabel->SetFont(aLabelFont);
  7796     iLabel->SetFont(aLabelFont);
  8424     _AKNTRACE_FUNC_EXIT;
       
  8425     }
  7797     }
  8426 
  7798 
  8427 void CEikCbaButton::TruncateLabelText()
  7799 void CEikCbaButton::TruncateLabelText()
  8428     {
  7800     {
  8429     _AKNTRACE_FUNC_ENTER;
       
  8430     // Truncation removed from here, as it was not bidi-text compatible.
  7801     // Truncation removed from here, as it was not bidi-text compatible.
  8431     // Let CEikLabel handle truncation instead.
  7802     // Let CEikLabel handle truncation instead.
  8432     iLabel->CropText();
  7803     iLabel->CropText();
  8433     _AKNTRACE_FUNC_EXIT;
       
  8434     }
  7804     }
  8435 
  7805 
  8436 TBool CEikCbaButton::IsEmptyText() const
  7806 TBool CEikCbaButton::IsEmptyText() const
  8437     {
  7807     {
  8438     _AKNTRACE_FUNC_ENTER;
       
  8439     if ( iDoImage )
  7808     if ( iDoImage )
  8440         {
  7809         {
  8441         _AKNTRACE_FUNC_EXIT;
       
  8442         return EFalse;
  7810         return EFalse;
  8443         }
  7811         }
  8444         
  7812         
  8445     TPtrC text( iFullLabelText );
  7813     TPtrC text( iFullLabelText );
  8446     TBool allSpaces = ETrue;
  7814     TBool allSpaces = ETrue;
  8452             allSpaces = EFalse;
  7820             allSpaces = EFalse;
  8453             break;
  7821             break;
  8454             }
  7822             }
  8455         }
  7823         }
  8456         
  7824         
  8457     _AKNTRACE_FUNC_EXIT;
       
  8458     return allSpaces;
  7825     return allSpaces;
  8459     }
  7826     }
  8460 
  7827 
  8461 void CEikCbaButton::ConstructEmptyButtonL()
  7828 void CEikCbaButton::ConstructEmptyButtonL()
  8462     {
  7829     {
  8463     _AKNTRACE_FUNC_ENTER;
       
  8464     ConstructL( EHRightVCenter ); // creates label
  7830     ConstructL( EHRightVCenter ); // creates label
  8465     _LIT(KEmptyText, "");
  7831     _LIT(KEmptyText, "");
  8466     TPtrC16 ptr(KEmptyText);
  7832     TPtrC16 ptr(KEmptyText);
  8467     UpdateLabelText( ptr );
  7833     UpdateLabelText( ptr );
  8468     _AKNTRACE_FUNC_EXIT;
       
  8469     }
  7834     }
  8470 
  7835 
  8471 TBool CEikCbaButton::PressedDown() const
  7836 TBool CEikCbaButton::PressedDown() const
  8472     {    
  7837     {    
  8473     _AKNTRACE_FUNC_ENTER;
       
  8474     _AKNTRACE_FUNC_EXIT;
       
  8475     return iPressedDown;
  7838     return iPressedDown;
  8476     }
  7839     }
  8477     
  7840     
  8478 void CEikCbaButton::SetPressedDown( const TBool aPressedDown )
  7841 void CEikCbaButton::SetPressedDown( const TBool aPressedDown )
  8479     {
  7842     {
  8480     _AKNTRACE_FUNC_ENTER;
       
  8481     iPressedDown = aPressedDown;
  7843     iPressedDown = aPressedDown;
  8482     _AKNTRACE_FUNC_EXIT;
       
  8483     }
  7844     }
  8484 
  7845 
  8485 // -----------------------------------------------------------------------------
  7846 // -----------------------------------------------------------------------------
  8486 // EikSoftkeyImage::SetImage
  7847 // EikSoftkeyImage::SetImage
  8487 //
  7848 //
  8490 EXPORT_C void EikSoftkeyImage::SetImage(
  7851 EXPORT_C void EikSoftkeyImage::SetImage(
  8491     CEikButtonGroupContainer* aButtonGroupContainer, 
  7852     CEikButtonGroupContainer* aButtonGroupContainer, 
  8492     CEikImage& aImage, 
  7853     CEikImage& aImage, 
  8493     TBool aLeft)
  7854     TBool aLeft)
  8494     { // static
  7855     { // static
  8495     _AKNTRACE_FUNC_ENTER;
       
  8496     TInt commandPos = aLeft ? 0 : 2;
  7856     TInt commandPos = aLeft ? 0 : 2;
  8497     TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos);
  7857     TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos);
  8498     CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId);
  7858     CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId);
  8499     if ( cbaButton )
  7859     if ( cbaButton )
  8500         {
  7860         {
  8505         aButtonGroupContainer->SetRect(aButtonGroupContainer->Rect());        
  7865         aButtonGroupContainer->SetRect(aButtonGroupContainer->Rect());        
  8506         // Draw previosly set image
  7866         // Draw previosly set image
  8507         cbaButton->DrawNow();
  7867         cbaButton->DrawNow();
  8508         aButtonGroupContainer->DrawNow();       
  7868         aButtonGroupContainer->DrawNow();       
  8509         }    
  7869         }    
  8510     _AKNTRACE_FUNC_EXIT;
       
  8511     }
  7870     }
  8512 
  7871 
  8513 // -----------------------------------------------------------------------------
  7872 // -----------------------------------------------------------------------------
  8514 // EikSoftkeyImage::SetLabel
  7873 // EikSoftkeyImage::SetLabel
  8515 //
  7874 //
  8517 //
  7876 //
  8518 EXPORT_C void EikSoftkeyImage::SetLabel(
  7877 EXPORT_C void EikSoftkeyImage::SetLabel(
  8519     CEikButtonGroupContainer* aButtonGroupContainer, 
  7878     CEikButtonGroupContainer* aButtonGroupContainer, 
  8520     TBool aLeft)
  7879     TBool aLeft)
  8521     { // static
  7880     { // static
  8522     _AKNTRACE_FUNC_ENTER; 
       
  8523     TInt commandPos = aLeft ? 0 : 2;
  7881     TInt commandPos = aLeft ? 0 : 2;
  8524     TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos);
  7882     TInt commandId = aButtonGroupContainer->ButtonGroup()->CommandId(commandPos);
  8525     CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId);
  7883     CEikCbaButton* cbaButton = (CEikCbaButton*) aButtonGroupContainer->ControlOrNull(commandId);
  8526     if ( cbaButton )
  7884     if ( cbaButton )
  8527         {
  7885         {
  8533         aButtonGroupContainer->SetBoundingRect(screenRect);   
  7891         aButtonGroupContainer->SetBoundingRect(screenRect);   
  8534         // Draw previosly set label
  7892         // Draw previosly set label
  8535         cbaButton->DrawNow();
  7893         cbaButton->DrawNow();
  8536         aButtonGroupContainer->DrawNow();      
  7894         aButtonGroupContainer->DrawNow();      
  8537         }    
  7895         }    
  8538     _AKNTRACE_FUNC_EXIT;
       
  8539     }
  7896     }
  8540 
  7897 
  8541 // -----------------------------------------------------------------------------
  7898 // -----------------------------------------------------------------------------
  8542 // CEikCbaButton::SetImage
  7899 // CEikCbaButton::SetImage
  8543 //
  7900 //
  8544 // -----------------------------------------------------------------------------
  7901 // -----------------------------------------------------------------------------
  8545 //
  7902 //
  8546 void CEikCbaButton::SetImage(CEikImage &aImage)
  7903 void CEikCbaButton::SetImage(CEikImage &aImage)
  8547     {
  7904     {
  8548     _AKNTRACE_FUNC_ENTER;
       
  8549     iDoImage = ETrue;
  7905     iDoImage = ETrue;
  8550    
  7906    
  8551     if ( iImage )
  7907     if ( iImage )
  8552         {
  7908         {
  8553         iImage->SetMask( iMask );
  7909         iImage->SetMask( iMask );
  8562         }
  7918         }
  8563     else
  7919     else
  8564         {
  7920         {
  8565         ReplaceImageByLabel();          
  7921         ReplaceImageByLabel();          
  8566         }
  7922         }
  8567     _AKNTRACE_FUNC_EXIT;
       
  8568     }
  7923     }
  8569 
  7924 
  8570 // -----------------------------------------------------------------------------
  7925 // -----------------------------------------------------------------------------
  8571 // CEikCbaButton::PrepareImageL
  7926 // CEikCbaButton::PrepareImageL
  8572 // Prepares Image for softkey feedback effect. Creates needed mask for 
  7927 // Prepares Image for softkey feedback effect. Creates needed mask for 
  8573 // pressed down state.
  7928 // pressed down state.
  8574 // -----------------------------------------------------------------------------
  7929 // -----------------------------------------------------------------------------
  8575 //
  7930 //
  8576 void CEikCbaButton::PrepareImageL()
  7931 void CEikCbaButton::PrepareImageL()
  8577     {
  7932     {
  8578     _AKNTRACE_FUNC_ENTER;
       
  8579     // 50% transparent pressed down image is made with a alternative mask
  7933     // 50% transparent pressed down image is made with a alternative mask
  8580     // which is created when a image is set to CEikCbaButton. 
  7934     // which is created when a image is set to CEikCbaButton. 
  8581     // Original mask is copied and each of its pixels color components is 
  7935     // Original mask is copied and each of its pixels color components is 
  8582     // halved. Bit-shifting to the right makes color value to half --> 
  7936     // halved. Bit-shifting to the right makes color value to half --> 
  8583     // image looks 50% transparent with this mask
  7937     // image looks 50% transparent with this mask
  8584     const CFbsBitmap* mask = iImage->Mask(); 
  7938     const CFbsBitmap* mask = iImage->Mask(); 
  8585     iMask = mask;    
  7939     iMask = mask;    
  8586     
  7940     
  8587     if ( !iMask )
  7941     if ( !iMask )
  8588         {
  7942         {
  8589         _AKNTRACE_FUNC_EXIT;
       
  8590         return;
  7943         return;
  8591         }
  7944         }
  8592 
  7945 
  8593     iSfeMask = new (ELeave) CFbsBitmap;                         
  7946     iSfeMask = new (ELeave) CFbsBitmap;                         
  8594     User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) );
  7947     User::LeaveIfError( iSfeMask->Create( mask->SizeInPixels(), mask->DisplayMode() ) );
  8620         
  7973         
  8621     iSfeMask->UnlockHeap();
  7974     iSfeMask->UnlockHeap();
  8622     CleanupStack::PopAndDestroy( device ); // device        
  7975     CleanupStack::PopAndDestroy( device ); // device        
  8623     
  7976     
  8624     delete gc;      
  7977     delete gc;      
  8625     _AKNTRACE_FUNC_EXIT;
       
  8626     }
  7978     }
  8627 // -----------------------------------------------------------------------------
  7979 // -----------------------------------------------------------------------------
  8628 // CEikCbaButton::ReplaceImageByLabel
  7980 // CEikCbaButton::ReplaceImageByLabel
  8629 //
  7981 //
  8630 // -----------------------------------------------------------------------------
  7982 // -----------------------------------------------------------------------------
  8631 //
  7983 //
  8632 void CEikCbaButton::ReplaceImageByLabel()
  7984 void CEikCbaButton::ReplaceImageByLabel()
  8633     {
  7985     {
  8634     _AKNTRACE_FUNC_ENTER;
       
  8635     iDoImage = EFalse;
  7986     iDoImage = EFalse;
  8636     if ( iImage )
  7987     if ( iImage )
  8637         {
  7988         {
  8638         // avoid mem leak.
  7989         // avoid mem leak.
  8639         iImage->SetMask( iMask );
  7990         iImage->SetMask( iMask );
  8640         delete iImage;
  7991         delete iImage;
  8641         iImage = NULL;          
  7992         iImage = NULL;          
  8642         delete iSfeMask;
  7993         delete iSfeMask;
  8643         iSfeMask = NULL;
  7994         iSfeMask = NULL;
  8644         }    
  7995         }    
  8645     _AKNTRACE_FUNC_EXIT;
       
  8646     }
  7996     }
  8647 
  7997 
  8648 //
  7998 //
  8649 // CEikEnhancedCbaButton
  7999 // CEikEnhancedCbaButton
  8650 //
  8000 //
  8652 // -----------------------------------------------------------------------------
  8002 // -----------------------------------------------------------------------------
  8653 // default constructor
  8003 // default constructor
  8654 // -----------------------------------------------------------------------------
  8004 // -----------------------------------------------------------------------------
  8655 CEikEnhancedCbaButton::CEikEnhancedCbaButton()
  8005 CEikEnhancedCbaButton::CEikEnhancedCbaButton()
  8656     {
  8006     {
  8657     _AKNTRACE_FUNC_ENTER;
       
  8658     _AKNTRACE_FUNC_EXIT;
       
  8659     }
  8007     }
  8660 
  8008 
  8661 // -----------------------------------------------------------------------------
  8009 // -----------------------------------------------------------------------------
  8662 // default destructor
  8010 // default destructor
  8663 // -----------------------------------------------------------------------------
  8011 // -----------------------------------------------------------------------------
  8664 CEikEnhancedCbaButton::~CEikEnhancedCbaButton()
  8012 CEikEnhancedCbaButton::~CEikEnhancedCbaButton()
  8665     {
  8013     {
  8666     _AKNTRACE_FUNC_ENTER;
       
  8667     _AKNTRACE_FUNC_EXIT;
       
  8668     }
  8014     }
  8669 
  8015 
  8670 // -----------------------------------------------------------------------------
  8016 // -----------------------------------------------------------------------------
  8671 // Sets command type for current button
  8017 // Sets command type for current button
  8672 // @param aCommandType Command type to be set
  8018 // @param aCommandType Command type to be set
  8673 // -----------------------------------------------------------------------------
  8019 // -----------------------------------------------------------------------------
  8674 #ifdef RD_ENHANCED_CBA
  8020 #ifdef RD_ENHANCED_CBA
  8675 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType )
  8021 void CEikEnhancedCbaButton::SetCommandType( const TInt aCommandType )
  8676     {
  8022     {
  8677     _AKNTRACE_FUNC_ENTER;
       
  8678     iCommandType = aCommandType; 
  8023     iCommandType = aCommandType; 
  8679     _AKNTRACE_FUNC_EXIT;
       
  8680     }
  8024     }
  8681 #else    
  8025 #else    
  8682 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ )
  8026 void CEikEnhancedCbaButton::SetCommandType( const TInt /*aCommandType*/ )
  8683     {
  8027     {
  8684     _AKNTRACE_FUNC_ENTER;
       
  8685     _AKNTRACE_FUNC_EXIT;
       
  8686     }
  8028     }
  8687 #endif // RD_ENHANCED_CBA
  8029 #endif // RD_ENHANCED_CBA
  8688 // -----------------------------------------------------------------------------
  8030 // -----------------------------------------------------------------------------
  8689 // returns command's type for current button
  8031 // returns command's type for current button
  8690 // @return TInt command's type 
  8032 // @return TInt command's type 
  8691 // -----------------------------------------------------------------------------
  8033 // -----------------------------------------------------------------------------
  8692 
  8034 
  8693 TInt CEikEnhancedCbaButton::CommandType() const
  8035 TInt CEikEnhancedCbaButton::CommandType() const
  8694     {
  8036     {
  8695     _AKNTRACE_FUNC_ENTER;
       
  8696     _AKNTRACE_FUNC_EXIT;
       
  8697 #ifdef RD_ENHANCED_CBA    
  8037 #ifdef RD_ENHANCED_CBA    
  8698     return iCommandType;
  8038     return iCommandType;
  8699 #else
  8039 #else
  8700     return 0;
  8040     return 0;
  8701 #endif // RD_ENHANCED_CBA        
  8041 #endif // RD_ENHANCED_CBA        
  8705 // returns command id for current button
  8045 // returns command id for current button
  8706 // @return TInt command's id
  8046 // @return TInt command's id
  8707 // -----------------------------------------------------------------------------
  8047 // -----------------------------------------------------------------------------
  8708 TInt CEikEnhancedCbaButton::CommandId() const
  8048 TInt CEikEnhancedCbaButton::CommandId() const
  8709     {
  8049     {
  8710     _AKNTRACE_FUNC_ENTER;
       
  8711     _AKNTRACE_FUNC_EXIT;
       
  8712 #ifdef RD_ENHANCED_CBA    
  8050 #ifdef RD_ENHANCED_CBA    
  8713     return iCommandId;
  8051     return iCommandId;
  8714 #else
  8052 #else
  8715     return 0;
  8053     return 0;
  8716 #endif // RD_ENHANCED_CBA
  8054 #endif // RD_ENHANCED_CBA
  8721 // @param aReader created resource reader for reading information from resource file    
  8059 // @param aReader created resource reader for reading information from resource file    
  8722 // -----------------------------------------------------------------------------
  8060 // -----------------------------------------------------------------------------
  8723 #ifdef RD_ENHANCED_CBA
  8061 #ifdef RD_ENHANCED_CBA
  8724 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader)
  8062 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader& aReader)
  8725     {   
  8063     {   
  8726     _AKNTRACE_FUNC_ENTER   
       
  8727     // Alignment set to right.
  8064     // Alignment set to right.
  8728     ConstructL( EHRightVCenter ); // creates label
  8065     ConstructL( EHRightVCenter ); // creates label
  8729     iCommandType = aReader.ReadUint8();
  8066     iCommandType = aReader.ReadUint8();
  8730     iCommandId = aReader.ReadInt16();
  8067     iCommandId = aReader.ReadInt16();
  8731     // iFullLabelText.Copy( aReader.ReadTPtrC() );
  8068     // iFullLabelText.Copy( aReader.ReadTPtrC() );
  8732     UpdateLabelText( aReader.ReadTPtrC() );
  8069     UpdateLabelText( aReader.ReadTPtrC() );
  8733     
  8070     
  8734     aReader.ReadTPtrC(); // bmp filename
  8071     aReader.ReadTPtrC(); // bmp filename
  8735     aReader.ReadInt16(); // bmp id
  8072     aReader.ReadInt16(); // bmp id
  8736     aReader.ReadInt16(); // bmp mask id
  8073     aReader.ReadInt16(); // bmp mask id
  8737     _AKNTRACE_FUNC_EXIT;
       
  8738     }
  8074     }
  8739 #else    
  8075 #else    
  8740 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&)
  8076 void CEikEnhancedCbaButton::ConstructFromResourceL(TResourceReader&)
  8741     {   
  8077     {   
  8742     _AKNTRACE_FUNC_ENTER;
       
  8743     _AKNTRACE_FUNC_EXIT;    
       
  8744     }
  8078     }
  8745 #endif // RD_ENHANCED_CBA    
  8079 #endif // RD_ENHANCED_CBA    
  8746     
  8080     
  8747 // -----------------------------------------------------------------------------
  8081 // -----------------------------------------------------------------------------
  8748 // Constructs empty button with id EAknSoftkeyEmpty
  8082 // Constructs empty button with id EAknSoftkeyEmpty
  8749 // -----------------------------------------------------------------------------
  8083 // -----------------------------------------------------------------------------
  8750 void CEikEnhancedCbaButton::ConstructEmptyButtonL()
  8084 void CEikEnhancedCbaButton::ConstructEmptyButtonL()
  8751     {
  8085     {
  8752     _AKNTRACE_FUNC_ENTER;
       
  8753     _AKNTRACE_FUNC_EXIT;
       
  8754 #ifdef RD_ENHANCED_CBA    
  8086 #ifdef RD_ENHANCED_CBA    
  8755     ConstructL( EHRightVCenter ); // creates label
  8087     ConstructL( EHRightVCenter ); // creates label
  8756     iCommandType = EEikCommandTypeAnyCommand;
  8088     iCommandType = EEikCommandTypeAnyCommand;
  8757     iCommandId = EAknSoftkeyEmpty;
  8089     iCommandId = EAknSoftkeyEmpty;
  8758     _LIT(KEmptyText, "");
  8090     _LIT(KEmptyText, "");
  8765 // Used to get the label's text for the button
  8097 // Used to get the label's text for the button
  8766 // @return TPtrC label text
  8098 // @return TPtrC label text
  8767 // -----------------------------------------------------------------------------    
  8099 // -----------------------------------------------------------------------------    
  8768 TPtrC* CEikEnhancedCbaButton::LabelText()
  8100 TPtrC* CEikEnhancedCbaButton::LabelText()
  8769     {
  8101     {
  8770     _AKNTRACE_FUNC_ENTER;
       
  8771     _AKNTRACE_FUNC_EXIT;
       
  8772 #ifdef RD_ENHANCED_CBA    
  8102 #ifdef RD_ENHANCED_CBA    
  8773     return &iLongLabelText; 
  8103     return &iLongLabelText; 
  8774 #else
  8104 #else
  8775     return NULL;
  8105     return NULL;
  8776 #endif
  8106 #endif
  8780 // CEikCommandTable
  8110 // CEikCommandTable
  8781 //
  8111 //
  8782 
  8112 
  8783 CEikCommandTable* CEikCommandTable::NewL()
  8113 CEikCommandTable* CEikCommandTable::NewL()
  8784     {
  8114     {
  8785     _AKNTRACE_FUNC_ENTER;
       
  8786     _AKNTRACE_FUNC_EXIT;
       
  8787 #ifdef RD_ENHANCED_CBA    
  8115 #ifdef RD_ENHANCED_CBA    
  8788     CEikCommandTable* self = CEikCommandTable::NewLC();
  8116     CEikCommandTable* self = CEikCommandTable::NewLC();
  8789     CleanupStack::Pop( self );
  8117     CleanupStack::Pop( self );
  8790     return self;    
  8118     return self;    
  8791 #else
  8119 #else
  8793 #endif         
  8121 #endif         
  8794     }
  8122     }
  8795     
  8123     
  8796 CEikCommandTable* CEikCommandTable::NewLC()
  8124 CEikCommandTable* CEikCommandTable::NewLC()
  8797     {
  8125     {
  8798     _AKNTRACE_FUNC_ENTER;
       
  8799     _AKNTRACE_FUNC_EXIT;
       
  8800 #ifdef RD_ENHANCED_CBA    
  8126 #ifdef RD_ENHANCED_CBA    
  8801     CEikCommandTable* self = new (ELeave) CEikCommandTable;
  8127     CEikCommandTable* self = new (ELeave) CEikCommandTable;
  8802     CleanupStack::PushL( self );
  8128     CleanupStack::PushL( self );
  8803     self->ConstructL();
  8129     self->ConstructL();
  8804     return self; 
  8130     return self; 
  8811 // Construction for command table
  8137 // Construction for command table
  8812 // priority configuration is read from the resource file
  8138 // priority configuration is read from the resource file
  8813 // -----------------------------------------------------------------------------
  8139 // -----------------------------------------------------------------------------
  8814 void CEikCommandTable::ConstructL()
  8140 void CEikCommandTable::ConstructL()
  8815     {
  8141     {
  8816     _AKNTRACE_FUNC_ENTER;
       
  8817 #ifdef RD_ENHANCED_CBA    
  8142 #ifdef RD_ENHANCED_CBA    
  8818     // Get the cba priority configuration
  8143     // Get the cba priority configuration
  8819     TResourceReader reader;
  8144     TResourceReader reader;
  8820     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_EIK_CBA_PRIORITIES );
  8145     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_EIK_CBA_PRIORITIES );
  8821     
  8146     
  8827     
  8152     
  8828     for ( TInt i = 0; i < count; i++ )
  8153     for ( TInt i = 0; i < count; i++ )
  8829         {       
  8154         {       
  8830         TInt priorities( reader.ReadInt16() ); // Amount of priorities for current button.
  8155         TInt priorities( reader.ReadInt16() ); // Amount of priorities for current button.
  8831         RArray<TInt> arr;
  8156         RArray<TInt> arr;
  8832         CleanupClosePushL( arr );
       
  8833         for ( TInt ii = 0; ii < priorities; ii++ )
  8157         for ( TInt ii = 0; ii < priorities; ii++ )
  8834             {
  8158             {
  8835             TInt8 commandType( reader.ReadInt8() );
  8159             TInt8 commandType( reader.ReadInt8() );
  8836             arr.AppendL( commandType );
  8160             arr.Append( commandType );
  8837             }
  8161             }
  8838         iPriorities.AppendL( arr );
  8162         iPriorities.Append( arr );
  8839         CleanupStack::Pop(); //arr
       
  8840         }
  8163         }
  8841     
  8164     
  8842     CleanupStack::PopAndDestroy(); // reader
  8165     CleanupStack::PopAndDestroy(); // reader
  8843 #endif    
  8166 #endif    
  8844     _AKNTRACE_FUNC_EXIT;
       
  8845     }
  8167     }
  8846     
  8168     
  8847 #ifdef RD_ENHANCED_CBA
  8169 #ifdef RD_ENHANCED_CBA
  8848 CEikCommandTable::CEikCommandTable() : iPriorities(1)
  8170 CEikCommandTable::CEikCommandTable() : iPriorities(1)
  8849 #else    
  8171 #else    
  8853     }
  8175     }
  8854 
  8176 
  8855     
  8177     
  8856 CEikCommandTable::~CEikCommandTable()
  8178 CEikCommandTable::~CEikCommandTable()
  8857     {
  8179     {
  8858     _AKNTRACE_FUNC_ENTER;
       
  8859 #ifdef RD_ENHANCED_CBA    
  8180 #ifdef RD_ENHANCED_CBA    
  8860     iCommandButtons.Reset(); // Reset array
  8181     iCommandButtons.Reset(); // Reset array
  8861     for(TInt i = 0; i < iPriorities.Count(); i++)
  8182     for(TInt i = 0; i < iPriorities.Count(); i++)
  8862         {
  8183         {
  8863         iPriorities[i].Reset();
  8184         iPriorities[i].Reset();
  8864         }
  8185         }
  8865     iPriorities.Reset();
  8186     iPriorities.Reset();
  8866 #endif    
  8187 #endif    
  8867     _AKNTRACE_FUNC_EXIT;
       
  8868     }
  8188     }
  8869     
  8189     
  8870 // -----------------------------------------------------------------------------
  8190 // -----------------------------------------------------------------------------
  8871 // Used to add a command to CommandTable
  8191 // Used to add a command to CommandTable
  8872 // @param aButton button to be added
  8192 // @param aButton button to be added
  8873 // -----------------------------------------------------------------------------
  8193 // -----------------------------------------------------------------------------
  8874 #ifndef RD_ENHANCED_CBA    
  8194 #ifndef RD_ENHANCED_CBA    
  8875 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) 
  8195 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* /*aButton*/) 
  8876     {
  8196     {
  8877     _AKNTRACE_FUNC_ENTER;
       
  8878     _AKNTRACE_FUNC_EXIT;
       
  8879     return KErrNone;
  8197     return KErrNone;
  8880     }
  8198     }
  8881 #else     
  8199 #else     
  8882 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) 
  8200 TInt CEikCommandTable::AddCommandL(CEikEnhancedCbaButton* aButton) 
  8883     {
  8201     {
  8884     _AKNTRACE_FUNC_ENTER;
       
  8885     // CommandType tells in which button this command should be placed
  8202     // CommandType tells in which button this command should be placed
  8886     TInt commandType( aButton->CommandType() );
  8203     TInt commandType( aButton->CommandType() );
  8887     TInt index( KErrNotFound );
  8204     TInt index( KErrNotFound );
  8888     
  8205     
  8889     // Find button and index for this button.
  8206     // Find button and index for this button.
  8920     if( button == iPriorities.Count() )
  8237     if( button == iPriorities.Count() )
  8921         {
  8238         {
  8922         delete aButton;
  8239         delete aButton;
  8923         aButton = NULL;
  8240         aButton = NULL;
  8924         }       
  8241         }       
  8925     _AKNTRACE_FUNC_EXIT;
       
  8926     return KErrNone;
  8242     return KErrNone;
  8927     }
  8243     }
  8928 #endif // RD_ENHANCED_CBA    
  8244 #endif // RD_ENHANCED_CBA    
  8929     
  8245     
  8930 // -----------------------------------------------------------------------------
  8246 // -----------------------------------------------------------------------------
  8932 // @param aCommandId Id to be checked.
  8248 // @param aCommandId Id to be checked.
  8933 // -----------------------------------------------------------------------------
  8249 // -----------------------------------------------------------------------------
  8934 #ifndef RD_ENHANCED_CBA
  8250 #ifndef RD_ENHANCED_CBA
  8935 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const
  8251 TBool CEikCommandTable::IsCommandPlaced(const TInt /*aCommandId*/) const
  8936     {
  8252     {
  8937     _AKNTRACE_FUNC_ENTER;
       
  8938 #else // !RD_ENHANCED_CBA  
  8253 #else // !RD_ENHANCED_CBA  
  8939 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const
  8254 TBool CEikCommandTable::IsCommandPlaced(const TInt aCommandId) const
  8940     {
  8255     {
  8941     _AKNTRACE_FUNC_ENTER;
       
  8942     TInt count( iCommandButtons.Count() );
  8256     TInt count( iCommandButtons.Count() );
  8943     
  8257     
  8944     for ( TInt i = 0; i < count; i++ )
  8258     for ( TInt i = 0; i < count; i++ )
  8945         {
  8259         {
  8946         if ( iCommandButtons[i] )
  8260         if ( iCommandButtons[i] )
  8947             {
  8261             {
  8948             if ( iCommandButtons[i]->CommandId() == aCommandId )
  8262             if ( iCommandButtons[i]->CommandId() == aCommandId )
  8949                 {
  8263                 {
  8950                 _AKNTRACE_FUNC_EXIT;
       
  8951                 return ETrue;
  8264                 return ETrue;
  8952                 }              
  8265                 }              
  8953             }
  8266             }
  8954         }
  8267         }
  8955 #endif // RD_ENHANCED_CBA
  8268 #endif // RD_ENHANCED_CBA
  8956     _AKNTRACE_FUNC_EXIT;
       
  8957     return EFalse; // if no match for command id
  8269     return EFalse; // if no match for command id
  8958     }
  8270     }
  8959     
  8271     
  8960 // -----------------------------------------------------------------------------
  8272 // -----------------------------------------------------------------------------
  8961 // Used to replace command with a new command.
  8273 // Used to replace command with a new command.
  8963 // @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the CommandTable.
  8275 // @param aResourceId Id for new ENHANCED_CBA_BUTTON resource to be placed in the CommandTable.
  8964 // -----------------------------------------------------------------------------
  8276 // -----------------------------------------------------------------------------
  8965 #ifndef RD_ENHANCED_CBA    
  8277 #ifndef RD_ENHANCED_CBA    
  8966 void CEikCommandTable::ReplaceCommandL( const TInt /*aCommandId*/, const TInt /*aResourceId*/ )
  8278 void CEikCommandTable::ReplaceCommandL( const TInt /*aCommandId*/, const TInt /*aResourceId*/ )
  8967     {
  8279     {
  8968     _AKNTRACE_FUNC_ENTER;
       
  8969 #else // !RD_ENHANCED_CBA    
  8280 #else // !RD_ENHANCED_CBA    
  8970 void CEikCommandTable::ReplaceCommandL( const TInt aCommandId, const TInt aResourceId )
  8281 void CEikCommandTable::ReplaceCommandL( const TInt aCommandId, const TInt aResourceId )
  8971     {
  8282     {
  8972     _AKNTRACE_FUNC_ENTER;
       
  8973     // If the command is not in the command table, return.
  8283     // If the command is not in the command table, return.
  8974     if( !IsCommandPlaced( aCommandId ) )
  8284     if( !IsCommandPlaced( aCommandId ) )
  8975         {
  8285         {
  8976         _AKNTRACE_FUNC_EXIT;
       
  8977         return;
  8286         return;
  8978         }   
  8287         }   
  8979     
  8288     
  8980     TInt index( iCommandButtons.Count() );
  8289     TInt index( iCommandButtons.Count() );
  8981     
  8290     
  9010     iCommandButtons[index] = button; // transfers ownership
  8319     iCommandButtons[index] = button; // transfers ownership
  9011     
  8320     
  9012     // Delete old button.
  8321     // Delete old button.
  9013     delete oldButton;
  8322     delete oldButton;
  9014 #endif // !RD_ENHANCED_CBA    
  8323 #endif // !RD_ENHANCED_CBA    
  9015     _AKNTRACE_FUNC_EXIT;
       
  9016     }
  8324     }
  9017     
  8325     
  9018 // -----------------------------------------------------------------------------
  8326 // -----------------------------------------------------------------------------
  9019 // Used to get CEikEnhancedCbaButton for current control button (1-4).
  8327 // Used to get CEikEnhancedCbaButton for current control button (1-4).
  9020 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions.
  8328 // @param aCommandIndex Index for requested button, use enum TCommandTableCbaPositions.
  9021 // @return CEikCbaButton for current position, NULL if no button placed in that position.
  8329 // @return CEikCbaButton for current position, NULL if no button placed in that position.
  9022 // -----------------------------------------------------------------------------
  8330 // -----------------------------------------------------------------------------
  9023 #ifdef RD_ENHANCED_CBA
  8331 #ifdef RD_ENHANCED_CBA
  9024 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex )
  8332 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt aCommandIndex )
  9025     {
  8333     {
  9026     _AKNTRACE_FUNC_ENTER;
       
  9027     _AKNTRACE_FUNC_EXIT;
       
  9028     return iCommandButtons[aCommandIndex]; 
  8334     return iCommandButtons[aCommandIndex]; 
  9029     }
  8335     }
  9030 #else // RD_ENHANCED_CBA
  8336 #else // RD_ENHANCED_CBA
  9031 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ )
  8337 CEikEnhancedCbaButton* CEikCommandTable::Command( const TInt /*aCommandIndex*/ )
  9032     {
  8338     {
  9033     _AKNTRACE_FUNC_ENTER;
       
  9034     _AKNTRACE_FUNC_EXIT;
       
  9035     return NULL;
  8339     return NULL;
  9036     }
  8340     }
  9037 #endif // RD_ENHANCED_CBA
  8341 #endif // RD_ENHANCED_CBA
  9038 
  8342 
  9039 // -----------------------------------------------------------------------------
  8343 // -----------------------------------------------------------------------------
  9040 // Reset CommandTable
  8344 // Reset CommandTable
  9041 // -----------------------------------------------------------------------------    
  8345 // -----------------------------------------------------------------------------    
  9042 void CEikCommandTable::Reset()
  8346 void CEikCommandTable::Reset()
  9043     {
  8347     {
  9044     _AKNTRACE_FUNC_ENTER;
       
  9045     _AKNTRACE_FUNC_EXIT;
       
  9046 #ifdef RD_ENHANCED_CBA 
  8348 #ifdef RD_ENHANCED_CBA 
  9047     iCommandButtons.Reset();
  8349     iCommandButtons.Reset();
  9048 #endif // RD_ENHANCED_CBA
  8350 #endif // RD_ENHANCED_CBA
  9049     }
  8351     }
  9050 
  8352 
  9053 // -----------------------------------------------------------------------------
  8355 // -----------------------------------------------------------------------------
  9054 EXPORT_C void AknCbaContentObserver::SetContentObserver( 
  8356 EXPORT_C void AknCbaContentObserver::SetContentObserver( 
  9055         CEikCba* aCba, 
  8357         CEikCba* aCba, 
  9056         TCallBack aCallBack )
  8358         TCallBack aCallBack )
  9057     {
  8359     {
  9058     _AKNTRACE_FUNC_ENTER;
       
  9059     if ( aCba )
  8360     if ( aCba )
  9060         {
  8361         {
  9061         aCba->SetContentObserver( aCallBack );
  8362         aCba->SetContentObserver( aCallBack );
  9062         }
  8363         }
  9063     _AKNTRACE_FUNC_EXIT;
       
  9064     }
  8364     }
  9065 
  8365 
  9066 // End of file
  8366 // End of file