uifw/AvKon/src/AknTabGrpGraphics.cpp
changeset 0 2f259fa3e83a
child 51 fcdfafb36fe7
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Class for drawing tab graphics.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDE FILES
       
    20 #include <avkon.mbg>
       
    21 #include <fbs.h>
       
    22 #include <bitdev.h>
       
    23 #include <aknlayoutscalable_avkon.cdl.h>
       
    24 #include <AknIconUtils.h>
       
    25 #include <AknsUtils.h>
       
    26 #include <layoutmetadata.cdl.h>
       
    27 #include <akniconconfig.h>
       
    28 
       
    29 // USER INCLUDE FILES
       
    30 #include "AknTabGrpGraphics.h"
       
    31 #include "AknUtils.h"
       
    32 #include "aknappui.h"
       
    33 #include "AknStatuspaneUtils.h"
       
    34 #include "AknDebug.h"
       
    35 
       
    36 // CONSTANTS
       
    37 
       
    38 /**
       
    39 * These are the fading parameters used in drawing the "hidden" tabs.
       
    40 * The hidden tabs are drawn with faded graphics context to make them
       
    41 * appear slightly lighter in color than the actual visible tabs and thus to
       
    42 * make them stand out from them. These values work for most of the themes
       
    43 * but it would be better if these were defined in the skin content.
       
    44 * 
       
    45 * Currently the fading is not used as custom fading parameters are not
       
    46 * supported by all display drivers (parameters are not used if
       
    47 * SYMBIAN_USE_FAST_FADING is defined).
       
    48 */
       
    49 //const TUint8 KHiddenFadeBlackMap( 20 );
       
    50 //const TUint8 KHiddenFadeWhiteMap( 255 );
       
    51 
       
    52 // ============================ MEMBER FUNCTIONS ===============================
       
    53 
       
    54 // -----------------------------------------------------------------------------
       
    55 // CAknTabGroupGraphics::CAknTabGroupGraphics
       
    56 // C++ default constructor can NOT contain any code, that
       
    57 // might leave.
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 CAknTabGroupGraphics::CAknTabGroupGraphics()
       
    61     {
       
    62     iTabGroupBackgroundAvailable = ETrue;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CAknTabGroupGraphics::ConstructL
       
    67 // Symbian 2nd phase constructor can leave.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CAknTabGroupGraphics::ConstructL()
       
    71     {
       
    72     TRAPD( err, LoadTabGraphicsL() );
       
    73     if ( err != KErrNone )
       
    74         {
       
    75         iTabGroupBackgroundAvailable = EFalse;
       
    76         }
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CAknTabGroupGraphics::NewL
       
    81 // Two-phased constructor.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 CAknTabGroupGraphics* CAknTabGroupGraphics::NewL()
       
    85     {
       
    86     CAknTabGroupGraphics* self =
       
    87         new (ELeave) CAknTabGroupGraphics();
       
    88     CleanupStack::PushL( self );
       
    89     self->ConstructL();
       
    90     CleanupStack::Pop( self );
       
    91     return self;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // Destructor
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 CAknTabGroupGraphics::~CAknTabGroupGraphics()
       
    99     {
       
   100     delete iActiveTabLeft;
       
   101     delete iActiveTabLeftMask;
       
   102     delete iActiveTabMiddle;
       
   103     delete iActiveTabMiddleMask;
       
   104     delete iActiveTabRight;
       
   105     delete iActiveTabRightMask;
       
   106 
       
   107     delete iPassiveTabLeft;
       
   108     delete iPassiveTabLeftMask;
       
   109     delete iPassiveTabMiddle;
       
   110     delete iPassiveTabMiddleMask;
       
   111     delete iPassiveTabRight;
       
   112     delete iPassiveTabRightMask;
       
   113     }
       
   114 
       
   115 void CAknTabGroupGraphics::SetTabGroupBackgroundParent( TRect aParent )
       
   116     {
       
   117     iTabGroupBackgroundParent = aParent;
       
   118     }
       
   119     
       
   120 #if 0
       
   121 
       
   122 CAknTabGroupGraphics::SAknTabGroupBackground CAknTabGroupGraphics::CreateTabGroupBackgroundL( TInt aAvkonBitmapId)
       
   123     {
       
   124     CAknTabGroupGraphics::SAknTabGroupBackground emptyTabGroupBackGround;
       
   125 
       
   126     if ( !TabGroupBackgroundAvailable() )
       
   127         {
       
   128         return emptyTabGroupBackGround;
       
   129         }
       
   130 
       
   131     TBool longTabs    = EFalse;
       
   132     TInt numberOfTabs = 0;
       
   133     TInt activeTab    = 0;
       
   134 
       
   135     switch ( aAvkonBitmapId )
       
   136         {
       
   137         case EMbmAvkonQgn_graf_tab_21:
       
   138             {
       
   139             longTabs     = EFalse;
       
   140             numberOfTabs = 2;
       
   141             activeTab    = 1;
       
   142             break;
       
   143             }
       
   144         case EMbmAvkonQgn_graf_tab_22:
       
   145             {
       
   146             longTabs     = EFalse;
       
   147             numberOfTabs = 2;
       
   148             activeTab    = 2;
       
   149             break;
       
   150             }
       
   151         case EMbmAvkonQgn_graf_tab_31:
       
   152             {
       
   153             longTabs     = EFalse;
       
   154             numberOfTabs = 3;
       
   155             activeTab    = 1;
       
   156             break;
       
   157             }
       
   158         case EMbmAvkonQgn_graf_tab_32:
       
   159             {
       
   160             longTabs     = EFalse;
       
   161             numberOfTabs = 3;
       
   162             activeTab    = 2;
       
   163             break;
       
   164             }
       
   165         case EMbmAvkonQgn_graf_tab_33:
       
   166             {
       
   167             longTabs     = EFalse;
       
   168             numberOfTabs = 3;
       
   169             activeTab    = 3;
       
   170             break;
       
   171             }
       
   172         case EMbmAvkonQgn_graf_tab_41:
       
   173             {
       
   174             longTabs     = EFalse;
       
   175             numberOfTabs = 4;
       
   176             activeTab    = 1;
       
   177             break;
       
   178             }
       
   179         case EMbmAvkonQgn_graf_tab_42:
       
   180             {
       
   181             longTabs     = EFalse;
       
   182             numberOfTabs = 4;
       
   183             activeTab    = 2;
       
   184             break;
       
   185             }
       
   186         case EMbmAvkonQgn_graf_tab_43:
       
   187             {
       
   188             longTabs     = EFalse;
       
   189             numberOfTabs = 4;
       
   190             activeTab    = 3;
       
   191             break;
       
   192             }
       
   193         case EMbmAvkonQgn_graf_tab_44:
       
   194             {
       
   195             longTabs     = EFalse;
       
   196             numberOfTabs = 4;
       
   197             activeTab    = 4;
       
   198             break;
       
   199             }
       
   200         case EMbmAvkonQgn_graf_tab_long_21:
       
   201             {
       
   202             longTabs     = ETrue;
       
   203             numberOfTabs = 2;
       
   204             activeTab    = 1;
       
   205             break;
       
   206             }
       
   207         case EMbmAvkonQgn_graf_tab_long_22:
       
   208             {
       
   209             longTabs     = ETrue;
       
   210             numberOfTabs = 2;
       
   211             activeTab    = 2;
       
   212             break;
       
   213             }
       
   214         case EMbmAvkonQgn_graf_tab_long_31:
       
   215             {
       
   216             longTabs     = ETrue;
       
   217             numberOfTabs = 3;
       
   218             activeTab    = 1;
       
   219             break;
       
   220             }
       
   221         case EMbmAvkonQgn_graf_tab_long_32:
       
   222             {
       
   223             longTabs     = ETrue;
       
   224             numberOfTabs = 3;
       
   225             activeTab    = 2;
       
   226             break;
       
   227             }
       
   228         case EMbmAvkonQgn_graf_tab_long_33:
       
   229             {
       
   230             longTabs     = ETrue;
       
   231             numberOfTabs = 3;
       
   232             activeTab    = 3;
       
   233             break;
       
   234             }
       
   235         default:
       
   236             {
       
   237             break;
       
   238             }
       
   239         }
       
   240         
       
   241     return CreateTabGroupBackgroundL( longTabs, numberOfTabs, activeTab );
       
   242     }
       
   243 
       
   244 CAknTabGroupGraphics::SAknTabGroupBackground CAknTabGroupGraphics::CreateTabGroupBackgroundL(
       
   245     TBool aLongTabs, TInt aNumberOfTabs, TInt aActiveTab )
       
   246     {
       
   247     CAknTabGroupGraphics::SAknTabGroupBackground       tabGroupBackGround;
       
   248     CAknTabGroupGraphics::SAknTabGroupBackgroundLayout tabGroupBackGroundLayout;
       
   249 
       
   250     AknIconConfig::TPreferredDisplayMode mode;
       
   251     AknIconConfig::PreferredDisplayMode( mode,
       
   252                                          AknIconConfig::EImageTypeOffscreen );
       
   253 
       
   254     TDisplayMode bitmapDisplayMode = mode.iBitmapMode;
       
   255     TDisplayMode maskDisplayMode   = EGray256;
       
   256     TSize size( iTabGroupBackgroundParent.Size() );
       
   257 
       
   258     // BITMAP
       
   259     tabGroupBackGround.iBitmap = new (ELeave) CFbsBitmap();
       
   260     CleanupStack::PushL( tabGroupBackGround.iBitmap );
       
   261     User::LeaveIfError( tabGroupBackGround.iBitmap->Create( size, bitmapDisplayMode ) );
       
   262     CFbsBitmapDevice* bitmapDevice = CFbsBitmapDevice::NewL( tabGroupBackGround.iBitmap );
       
   263     CleanupStack::PushL( bitmapDevice );
       
   264     CFbsBitGc* bitmapGc;
       
   265     User::LeaveIfError( bitmapDevice->CreateContext( bitmapGc ) );
       
   266 
       
   267     // Clear background first...
       
   268     bitmapGc->SetBrushColor( KRgbBlack );
       
   269     bitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   270     bitmapGc->DrawRect( iTabGroupBackgroundParent );
       
   271 
       
   272     bitmapGc->SetBrushStyle( CGraphicsContext::ENullBrush );
       
   273     DrawTabGroupBackgroundL( CAknTabGroupGraphics::ENormal,
       
   274                              aLongTabs,
       
   275                              aNumberOfTabs,
       
   276                              aActiveTab,
       
   277                              bitmapGc,
       
   278                              tabGroupBackGroundLayout,
       
   279                              ENone );
       
   280     delete bitmapGc;
       
   281 
       
   282     CleanupStack::Pop( 2, tabGroupBackGround.iBitmap );
       
   283     delete bitmapDevice;
       
   284     bitmapGc = NULL;
       
   285     bitmapDevice = NULL;
       
   286 
       
   287     // MASK
       
   288     tabGroupBackGround.iMask = new (ELeave) CFbsBitmap();
       
   289     CleanupStack::PushL( tabGroupBackGround.iMask );
       
   290     User::LeaveIfError( tabGroupBackGround.iMask->Create( size, maskDisplayMode ) );
       
   291     bitmapDevice = CFbsBitmapDevice::NewL( tabGroupBackGround.iMask );
       
   292     CleanupStack::PushL( bitmapDevice );
       
   293     User::LeaveIfError( bitmapDevice->CreateContext( bitmapGc ) );
       
   294 
       
   295     // Clear background first...
       
   296     bitmapGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   297     if ( maskDisplayMode == EGray256 )
       
   298         {
       
   299         bitmapGc->SetBrushColor( KRgbBlack );
       
   300         }
       
   301     else
       
   302         {
       
   303         bitmapGc->SetBrushColor( KRgbWhite );
       
   304         }
       
   305     bitmapGc->DrawRect( iTabGroupBackgroundParent );
       
   306 
       
   307     bitmapGc->SetBrushStyle( CGraphicsContext::ENullBrush );
       
   308     DrawTabGroupBackgroundL( CAknTabGroupGraphics::EMaskOnly,
       
   309                              aLongTabs,
       
   310                              aNumberOfTabs,
       
   311                              aActiveTab,
       
   312                              bitmapGc,
       
   313                              tabGroupBackGroundLayout,
       
   314                              ENone);
       
   315     delete bitmapGc;
       
   316 
       
   317     CleanupStack::Pop( 2, tabGroupBackGround.iMask );
       
   318     delete bitmapDevice;
       
   319 
       
   320     return tabGroupBackGround;
       
   321     }
       
   322     
       
   323 #endif
       
   324 
       
   325 
       
   326 // ---------------------------------------------------------------------------
       
   327 // Draws normal tab background from given parameters.
       
   328 // ---------------------------------------------------------------------------
       
   329 //
       
   330 void CAknTabGroupGraphics::DrawTabGroupBackgroundL(
       
   331     TTabDrawMode aTabDrawMode,
       
   332     TBool aLongTabs,
       
   333     TInt aNumberOfTabs,
       
   334     TInt aActiveTab,
       
   335     CBitmapContext* aGc,
       
   336     SAknTabGroupBackgroundLayout& aLayout,
       
   337     TTabsHidden aTabsHidden,
       
   338     TTabAnimationType aAnimation ) const
       
   339     {
       
   340     switch ( aNumberOfTabs )
       
   341         {
       
   342         case 2:
       
   343             {
       
   344             if ( aLongTabs )
       
   345                 {
       
   346                 DrawTwoLongTabBackground( aTabDrawMode,
       
   347                                           aActiveTab,
       
   348                                           aGc,
       
   349                                           aLayout );
       
   350                 }
       
   351             else
       
   352                 {
       
   353                 DrawTwoTabBackground( aTabDrawMode,
       
   354                                       aActiveTab,
       
   355                                       aGc,
       
   356                                       aLayout );
       
   357                 }
       
   358             break;
       
   359             }
       
   360         case 3:
       
   361             {
       
   362             if ( aLongTabs )
       
   363                 {
       
   364                 DrawThreeLongTabBackground( aTabDrawMode,
       
   365                                             aActiveTab,
       
   366                                             aGc,
       
   367                                             aLayout );
       
   368                 }
       
   369             else
       
   370                 {
       
   371                 DrawThreeTabBackground( aTabDrawMode,
       
   372                                         aActiveTab,
       
   373                                         aGc,
       
   374                                         aLayout,
       
   375                                         aTabsHidden,
       
   376                                         aAnimation );
       
   377                 }
       
   378             break;
       
   379             }
       
   380         case 4:
       
   381             {
       
   382             DrawFourTabBackground( aTabDrawMode,
       
   383                                    aActiveTab,
       
   384                                    aGc,
       
   385                                    aLayout );
       
   386             break;
       
   387             }
       
   388         default:
       
   389             {
       
   390 #ifdef AVKON_RDEBUG_ERROR
       
   391             RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab layout !") );
       
   392 #endif
       
   393             }
       
   394         }
       
   395 
       
   396     if ( !aLayout.iUse )
       
   397         {
       
   398         aLayout.iFirstTab.iActive  = EFalse;
       
   399         aLayout.iSecondTab.iActive = EFalse;
       
   400         aLayout.iThirdTab.iActive  = EFalse;
       
   401         aLayout.iFourthTab.iActive = EFalse;
       
   402 
       
   403         if ( aActiveTab == 1 )
       
   404             {
       
   405             aLayout.iFirstTab.iActive = ETrue;
       
   406             }
       
   407         else if ( aActiveTab == 2 )
       
   408             {
       
   409             aLayout.iSecondTab.iActive = ETrue;
       
   410             }
       
   411         else if ( aActiveTab == 3 )
       
   412             {
       
   413             aLayout.iThirdTab.iActive = ETrue;
       
   414             }
       
   415         else if ( aActiveTab == 4 )
       
   416             {
       
   417             aLayout.iFourthTab.iActive = ETrue;
       
   418             }
       
   419         }
       
   420     }
       
   421 
       
   422 void CAknTabGroupGraphics::DrawTabGroupNarrowBackgroundL(
       
   423     TTabDrawMode aTabDrawMode,
       
   424     TBool aLongTabs,
       
   425     TInt aNumberOfTabs,
       
   426     TInt aActiveTab,
       
   427     CBitmapContext* aGc,
       
   428     SAknTabGroupBackgroundLayout& aLayout ) const
       
   429     {
       
   430     switch ( aNumberOfTabs )
       
   431         {
       
   432         case 2:
       
   433             {
       
   434             if ( aLongTabs )
       
   435                 {
       
   436                 if ( !aLayout.iUse )
       
   437                     {
       
   438                     aLayout = TwoLongTabNarrowBackground( aActiveTab );
       
   439                     }
       
   440                 aLayout.iUse = ETrue;
       
   441                 DrawTwoLongTabNarrowBackground( aTabDrawMode,
       
   442                                                 aActiveTab,
       
   443                                                 aGc,
       
   444                                                 aLayout );
       
   445                 }
       
   446             else
       
   447                 {
       
   448                 if ( !aLayout.iUse )
       
   449                     {
       
   450                     aLayout = TwoTabNarrowBackground( aActiveTab );
       
   451                     }
       
   452                 aLayout.iUse = ETrue;
       
   453                 DrawTwoTabNarrowBackground( aTabDrawMode,
       
   454                                             aActiveTab,
       
   455                                             aGc,
       
   456                                             aLayout );
       
   457                 }
       
   458             break;
       
   459             }
       
   460         case 3:
       
   461             {
       
   462             if ( aLongTabs )
       
   463                 {
       
   464                 if ( !aLayout.iUse )
       
   465                     {
       
   466                     aLayout = ThreeLongTabNarrowBackground( aActiveTab );
       
   467                     }
       
   468                 aLayout.iUse = ETrue;
       
   469                 DrawThreeLongTabNarrowBackground( aTabDrawMode,
       
   470                                                   aActiveTab,
       
   471                                                   aGc,
       
   472                                                   aLayout );
       
   473                 }
       
   474             else
       
   475                 {
       
   476                 if ( !aLayout.iUse )
       
   477                     {
       
   478                     aLayout = ThreeTabNarrowBackground( aActiveTab );
       
   479                     }
       
   480                 aLayout.iUse = ETrue;
       
   481                 DrawThreeTabNarrowBackground( aTabDrawMode,
       
   482                                               aActiveTab,
       
   483                                               aGc,
       
   484                                               aLayout );
       
   485                 }
       
   486             break;
       
   487             }
       
   488         case 4:
       
   489             {
       
   490             if ( !aLayout.iUse )
       
   491                 {
       
   492                 aLayout = FourTabNarrowBackground( aActiveTab );
       
   493                 }
       
   494             aLayout.iUse = ETrue;
       
   495             DrawFourTabNarrowBackground( aTabDrawMode,
       
   496                                          aActiveTab,
       
   497                                          aGc,
       
   498                                          aLayout );
       
   499             break;
       
   500             }
       
   501         default:
       
   502             {
       
   503 #ifdef AVKON_RDEBUG_ERROR
       
   504             RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab layout !") );
       
   505 #endif
       
   506             }
       
   507         }
       
   508 
       
   509         if ( !aLayout.iUse )
       
   510             {
       
   511             aLayout.iFirstTab.iActive  = EFalse;
       
   512             aLayout.iSecondTab.iActive = EFalse;
       
   513             aLayout.iThirdTab.iActive  = EFalse;
       
   514             aLayout.iFourthTab.iActive = EFalse;
       
   515 
       
   516             if ( aActiveTab == 1 )
       
   517                 {
       
   518                 aLayout.iFirstTab.iActive = ETrue;
       
   519                 }
       
   520             else if ( aActiveTab == 2 )
       
   521                 {
       
   522                 aLayout.iSecondTab.iActive = ETrue;
       
   523                 }
       
   524             else if ( aActiveTab == 3 )
       
   525                 {
       
   526                 aLayout.iThirdTab.iActive = ETrue;
       
   527                 }
       
   528             else if ( aActiveTab == 4 )
       
   529                 {
       
   530                 aLayout.iFourthTab.iActive = ETrue;
       
   531                 }
       
   532             }
       
   533     }
       
   534 
       
   535 TBool CAknTabGroupGraphics::TabClickedL( TInt aTabComponent,
       
   536                                          const TRect& aTabRect,
       
   537                                          const TPoint& aPoint,
       
   538                                          TBool aIsActiveTab )
       
   539     {
       
   540     CFbsBitmap* mask = NULL;
       
   541 
       
   542     switch ( aTabComponent )
       
   543         {
       
   544         case ELeft:
       
   545             if ( aIsActiveTab )
       
   546                 {
       
   547                 mask = iActiveTabLeftMask;
       
   548                 }
       
   549             else
       
   550                 {
       
   551                 mask = iPassiveTabLeftMask;
       
   552                 }
       
   553             break;
       
   554 
       
   555         case EMiddle:
       
   556             if ( aIsActiveTab )
       
   557                 {
       
   558                 mask = iActiveTabMiddleMask;
       
   559                 }
       
   560             else
       
   561                 {
       
   562                 mask = iPassiveTabMiddleMask;
       
   563                 }
       
   564             break;
       
   565 
       
   566         case ERight:
       
   567             if ( aIsActiveTab )
       
   568                 {
       
   569                 mask = iActiveTabRightMask;
       
   570                 }
       
   571             else
       
   572                 {
       
   573                 mask = iPassiveTabRightMask;
       
   574                 }
       
   575             break;
       
   576 
       
   577         default:
       
   578             User::Leave( KErrArgument );
       
   579             break;
       
   580         }
       
   581 
       
   582     // scale coordinates to bitmap origin
       
   583     TPoint point( aPoint.iX - aTabRect.iTl.iX, aPoint.iY - aTabRect.iTl.iY );
       
   584 
       
   585     if ( AknStatuspaneUtils::StaconPaneActive() )
       
   586         {
       
   587         point.iY = aTabRect.iBr.iY - aPoint.iY;
       
   588         }
       
   589 
       
   590     TBool retval = EFalse;
       
   591     TRgb pixel;
       
   592     // Note that mask must be in uncomressed state here.
       
   593     // That is taken care of in CAknTabGroupGraphics::LoadTabGraphicsL().
       
   594     mask->GetPixel( pixel, point );
       
   595 
       
   596     if ( pixel != KRgbBlack )
       
   597         {
       
   598         retval = ETrue;
       
   599         }
       
   600 
       
   601     return retval;
       
   602     }
       
   603 
       
   604 
       
   605 // ---------------------------------------------------------------------------
       
   606 // Gets the whole tab rectangle in relation to the tab group container.
       
   607 // ---------------------------------------------------------------------------
       
   608 //
       
   609 TRect CAknTabGroupGraphics::TabRectFromLayout(
       
   610     const SAknTabLayout& aLayout )
       
   611     {
       
   612     TRect tabRect( aLayout.iLeft );
       
   613     tabRect.BoundingRect( aLayout.iMiddle );
       
   614     tabRect.BoundingRect( aLayout.iRight );
       
   615     return tabRect;
       
   616     }
       
   617 
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // Adjusts the tab part rectangles by the specified x and y offsets.
       
   621 // ---------------------------------------------------------------------------
       
   622 //
       
   623 void CAknTabGroupGraphics::AdjustTabLayoutRect(
       
   624     SAknTabLayout& aLayout, TInt aXOffset, TInt aYOffset ) const
       
   625     {
       
   626     aLayout.iLeft.Move( aXOffset, aYOffset );
       
   627     aLayout.iRight.Move( aXOffset, aYOffset );
       
   628     aLayout.iMiddle.iTl.iX = aLayout.iLeft.iBr.iX;    
       
   629     aLayout.iMiddle.iBr.iX = aLayout.iRight.iTl.iX;
       
   630     }
       
   631 
       
   632 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoTabBackground( TInt aActiveTab ) const
       
   633     {
       
   634     SAknTabGroupBackgroundLayout aLayout;
       
   635 
       
   636     TRect parentRect( iTabGroupBackgroundParent );
       
   637 
       
   638     // navi tabs 2 pane
       
   639     TRect naviTabsTwoPaneRect(
       
   640         RectFromLayout( parentRect,
       
   641                         AknLayoutScalable_Avkon::navi_tabs_2_pane() ) );
       
   642 
       
   643     TInt tabsActivePassivePaneOption = 0;
       
   644     if ( aActiveTab != 1 )
       
   645         {
       
   646         tabsActivePassivePaneOption = 1;
       
   647         }
       
   648 
       
   649     // Tabs two passive pane
       
   650     TRect tabsTwoPassivePaneRect(
       
   651         RectFromLayout( naviTabsTwoPaneRect,
       
   652                         AknLayoutScalable_Avkon::tabs_2_passive_pane(
       
   653                             tabsActivePassivePaneOption ) ) );
       
   654 
       
   655     // Tabs two active pane
       
   656     TRect tabsTwoActivePaneRect(
       
   657         RectFromLayout( naviTabsTwoPaneRect,
       
   658                         AknLayoutScalable_Avkon::tabs_2_active_pane(
       
   659                             tabsActivePassivePaneOption ) ) );
       
   660 
       
   661     // bg active tab pane
       
   662     TRect tabsBackgroundActivePaneRect(
       
   663         RectFromLayout( tabsTwoActivePaneRect,
       
   664                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp1( 0 ) ) );
       
   665 
       
   666     // bg passive tab pane
       
   667     TRect tabsBackgroundFirstPassivePaneRect(
       
   668         RectFromLayout( tabsTwoPassivePaneRect,
       
   669                         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp1( 0 ) ) );
       
   670 
       
   671     // Active tab left
       
   672     TRect activeTabLeftPaneRect(
       
   673         RectFromLayout( tabsBackgroundActivePaneRect,
       
   674                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp1() ) );
       
   675 
       
   676     // Active tab middle
       
   677     TRect activeTabMiddlePaneRect(
       
   678         RectFromLayout( tabsBackgroundActivePaneRect,
       
   679                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp1() ) );
       
   680 
       
   681     // Active tab right
       
   682     TRect activeTabRightPaneRect(
       
   683         RectFromLayout( tabsBackgroundActivePaneRect,
       
   684                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp1() ) );
       
   685 
       
   686     // First passive tab left
       
   687     TRect firstPassiveTabLeftPaneRect(
       
   688         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   689                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp1() ) );
       
   690 
       
   691     // First passive tab middle
       
   692     TRect firstPassiveTabMiddlePaneRect(
       
   693         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   694                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp1() ) );
       
   695 
       
   696     // First passive tab right
       
   697     TRect firstPassiveTabRightPaneRect(
       
   698         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   699                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp1() ) );
       
   700 
       
   701     if ( aActiveTab == 1 )
       
   702         {
       
   703         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
   704         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
   705         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
   706 
       
   707         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
   708         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
   709         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
   710         }
       
   711     else
       
   712         {
       
   713         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
   714         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
   715         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
   716 
       
   717         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
   718         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
   719         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
   720         }
       
   721 
       
   722     TRect nullRect(0,0,0,0);
       
   723 
       
   724     aLayout.iThirdTab.iLeft   = nullRect;
       
   725     aLayout.iThirdTab.iMiddle = nullRect;
       
   726     aLayout.iThirdTab.iRight  = nullRect;
       
   727 
       
   728     aLayout.iFourthTab.iLeft   = nullRect;
       
   729     aLayout.iFourthTab.iMiddle = nullRect;
       
   730     aLayout.iFourthTab.iRight  = nullRect;
       
   731 
       
   732     return aLayout;
       
   733     }
       
   734 
       
   735 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoTabNarrowBackground(TInt aActiveTab) const
       
   736     {
       
   737     SAknTabGroupBackgroundLayout aLayout;
       
   738 
       
   739     // navi tabs pane
       
   740     TRect parentRect( NarrowParentRect() );
       
   741 
       
   742     // navi tabs 2 pane
       
   743     TRect naviTabsTwoPaneRect(
       
   744         RectFromLayout( parentRect,
       
   745                         AknLayoutScalable_Avkon::navi_tabs_2_pane_srt() ) );
       
   746 
       
   747     TInt tabsActivePassivePaneOption = 0;
       
   748     if ( aActiveTab == 1 )
       
   749         {
       
   750         tabsActivePassivePaneOption = 0;
       
   751         }
       
   752     else
       
   753         {
       
   754         tabsActivePassivePaneOption = 1;
       
   755         }
       
   756 
       
   757     // Tabs two passive pane
       
   758     TRect tabsTwoPassivePaneRect(
       
   759         RectFromLayout( naviTabsTwoPaneRect,
       
   760                         AknLayoutScalable_Avkon::tabs_2_passive_pane_srt(
       
   761                             tabsActivePassivePaneOption ) ) );
       
   762 
       
   763     // Tabs two active pane
       
   764     TRect tabsTwoActivePaneRect(
       
   765         RectFromLayout( naviTabsTwoPaneRect,
       
   766                         AknLayoutScalable_Avkon::tabs_2_active_pane_srt(
       
   767                             tabsActivePassivePaneOption ) ) );
       
   768 
       
   769     // bg active tab pane
       
   770     TRect tabsBackgroundActivePaneRect(
       
   771         RectFromLayout( tabsTwoActivePaneRect,
       
   772                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp1_srt( 0 ) ) );
       
   773 
       
   774     // bg passive tab pane
       
   775     TRect tabsBackgroundFirstPassivePaneRect(
       
   776         RectFromLayout( tabsTwoPassivePaneRect,
       
   777                         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp1_srt( 0 ) ) );
       
   778 
       
   779 
       
   780     // Active tab left
       
   781     TRect activeTabLeftPaneRect(
       
   782         RectFromLayout( tabsBackgroundActivePaneRect,
       
   783                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp1_srt() ) );
       
   784 
       
   785     // Active tab middle
       
   786     TRect activeTabMiddlePaneRect(
       
   787         RectFromLayout( tabsBackgroundActivePaneRect,
       
   788                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp1_srt() ) );
       
   789 
       
   790     // Active tab right
       
   791     TRect activeTabRightPaneRect(
       
   792         RectFromLayout( tabsBackgroundActivePaneRect,
       
   793                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp1_srt() ) );
       
   794 
       
   795 
       
   796 
       
   797     // First passive tab left
       
   798     TRect firstPassiveTabLeftPaneRect(
       
   799         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   800                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp1_srt() ) );
       
   801 
       
   802     // First passive tab middle
       
   803     TRect firstPassiveTabMiddlePaneRect(
       
   804         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   805                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp1_srt() ) );
       
   806 
       
   807     // First passive tab right
       
   808     TRect firstPassiveTabRightPaneRect(
       
   809         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
   810                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp1_srt() ) );
       
   811 
       
   812     if ( aActiveTab == 1 )
       
   813         {
       
   814         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
   815         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
   816         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
   817 
       
   818         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
   819         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
   820         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
   821         }
       
   822     else
       
   823         {
       
   824         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
   825         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
   826         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
   827 
       
   828         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
   829         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
   830         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
   831         }
       
   832 
       
   833     TRect nullRect( 0,0,0,0 );
       
   834     
       
   835     aLayout.iThirdTab.iLeft   = nullRect;
       
   836     aLayout.iThirdTab.iMiddle = nullRect;
       
   837     aLayout.iThirdTab.iRight  = nullRect;
       
   838 
       
   839     aLayout.iFourthTab.iLeft   = nullRect;
       
   840     aLayout.iFourthTab.iMiddle = nullRect;
       
   841     aLayout.iFourthTab.iRight  = nullRect;
       
   842 
       
   843     return aLayout;
       
   844     }
       
   845 
       
   846 void CAknTabGroupGraphics::DrawTwoTabBackground(
       
   847     TTabDrawMode aTabDrawMode,
       
   848     TInt aActiveTab,
       
   849     CBitmapContext* aGc,
       
   850     SAknTabGroupBackgroundLayout& aLayout ) const
       
   851     {
       
   852     // If not given layout, then get the default layout
       
   853     if ( !aLayout.iUse )
       
   854         {
       
   855         aLayout = TwoTabBackground( aActiveTab );
       
   856         }
       
   857 
       
   858     if ( aActiveTab == 1 )
       
   859         {
       
   860         DrawPassiveTab( aTabDrawMode,
       
   861                         aLayout.iSecondTab.iLeft,
       
   862                         aLayout.iSecondTab.iMiddle,
       
   863                         aLayout.iSecondTab.iRight,
       
   864                         aGc );
       
   865                         
       
   866         DrawActiveTab( aTabDrawMode,
       
   867                        aLayout.iFirstTab.iLeft,
       
   868                        aLayout.iFirstTab.iMiddle,
       
   869                        aLayout.iFirstTab.iRight,
       
   870                        aGc );
       
   871         }
       
   872     else
       
   873         {
       
   874         DrawPassiveTab( aTabDrawMode,
       
   875                         aLayout.iFirstTab.iLeft,
       
   876                         aLayout.iFirstTab.iMiddle,
       
   877                         aLayout.iFirstTab.iRight,
       
   878                         aGc );
       
   879 
       
   880         DrawActiveTab( aTabDrawMode,
       
   881                        aLayout.iSecondTab.iLeft,
       
   882                        aLayout.iSecondTab.iMiddle,
       
   883                        aLayout.iSecondTab.iRight,
       
   884                        aGc );
       
   885         }
       
   886     }
       
   887 
       
   888 void CAknTabGroupGraphics::DrawTwoTabNarrowBackground(
       
   889     TTabDrawMode aTabDrawMode,
       
   890     TInt aActiveTab,
       
   891     CBitmapContext* aGc,
       
   892     SAknTabGroupBackgroundLayout& aLayout ) const
       
   893     {
       
   894     // If not given layout, then get the default layout
       
   895     if ( !aLayout.iUse )
       
   896         {
       
   897         aLayout = TwoTabBackground( aActiveTab );
       
   898         }
       
   899 
       
   900     if ( aActiveTab == 1 )
       
   901         {
       
   902         DrawPassiveTab( aTabDrawMode,
       
   903                         aLayout.iSecondTab.iLeft,
       
   904                         aLayout.iSecondTab.iMiddle,
       
   905                         aLayout.iSecondTab.iRight,
       
   906                         aGc );
       
   907                         
       
   908         DrawActiveTab( aTabDrawMode,
       
   909                        aLayout.iFirstTab.iLeft,
       
   910                        aLayout.iFirstTab.iMiddle,
       
   911                        aLayout.iFirstTab.iRight,
       
   912                        aGc );
       
   913         }
       
   914     else
       
   915         {
       
   916         DrawPassiveTab( aTabDrawMode,
       
   917                         aLayout.iFirstTab.iLeft,
       
   918                         aLayout.iFirstTab.iMiddle,
       
   919                         aLayout.iFirstTab.iRight,
       
   920                         aGc );
       
   921                         
       
   922         DrawActiveTab( aTabDrawMode,
       
   923                        aLayout.iSecondTab.iLeft,
       
   924                        aLayout.iSecondTab.iMiddle,
       
   925                        aLayout.iSecondTab.iRight,
       
   926                        aGc );
       
   927         }
       
   928     }
       
   929 
       
   930 
       
   931 // ---------------------------------------------------------------------------
       
   932 // Extracts tab group background layout from layout data for three tab layout.
       
   933 // ---------------------------------------------------------------------------
       
   934 //
       
   935 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeTabBackground(
       
   936     TInt aActiveTab ) const
       
   937     {
       
   938     SAknTabGroupBackgroundLayout layout;
       
   939 
       
   940     // parent
       
   941     TRect parentRect( iTabGroupBackgroundParent );
       
   942 
       
   943     // navi tabs 3 pane
       
   944     TRect naviTabsThreePaneRect(
       
   945         RectFromLayout( parentRect,
       
   946                         AknLayoutScalable_Avkon::navi_tabs_3_pane() ) );
       
   947 
       
   948     TRect tabsPassiveFirstPaneRect;
       
   949     TRect tabsPassiveSecondPaneRect;
       
   950     TRect tabsActivePaneRect;
       
   951 
       
   952     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
   953     TRect parent( naviTabsThreePaneRect );
       
   954     TAknWindowComponentLayout firstTab(
       
   955         AknLayoutScalable_Avkon::tabs_3_active_pane( 0 ) );
       
   956     TAknWindowComponentLayout secondTab(
       
   957         AknLayoutScalable_Avkon::tabs_3_passive_pane( 0 ) );
       
   958     TAknWindowComponentLayout thirdTab(
       
   959         AknLayoutScalable_Avkon::tabs_3_passive_pane_cp( 0 ) );
       
   960 
       
   961 	// Revise the invalid parameter.
       
   962     if (aActiveTab <= 0)
       
   963         aActiveTab = 1;
       
   964     
       
   965     if ( aActiveTab == 1 )
       
   966         {
       
   967         tabsActivePaneRect        = RectFromLayout( parent, firstTab );
       
   968         tabsPassiveFirstPaneRect  = RectFromLayout( parent, secondTab );
       
   969         tabsPassiveSecondPaneRect = RectFromLayout( parent, thirdTab );
       
   970         }
       
   971     else if ( aActiveTab == 2 )
       
   972         {
       
   973         tabsPassiveFirstPaneRect  = RectFromLayout( parent, firstTab );
       
   974         tabsActivePaneRect        = RectFromLayout( parent, secondTab );
       
   975         tabsPassiveSecondPaneRect = RectFromLayout( parent, thirdTab );
       
   976         }
       
   977     else if ( aActiveTab == 3 )
       
   978         {
       
   979         tabsPassiveFirstPaneRect  = RectFromLayout( parent, firstTab );
       
   980         tabsPassiveSecondPaneRect = RectFromLayout( parent, secondTab );
       
   981         tabsActivePaneRect        = RectFromLayout( parent, thirdTab );
       
   982         }
       
   983 
       
   984     // Tabs 3 first passive tab pane
       
   985     TRect tabsThreePassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
   986 
       
   987     // Tabs 3 second passive tab pane
       
   988     TRect tabsThreePassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
   989 
       
   990     // Tabs 3 active tab pane
       
   991     TRect tabsThreeActivePaneRect( tabsActivePaneRect );
       
   992     
       
   993     TAknWindowComponentLayout passivePaneLayout(
       
   994         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp2( 0 ) );
       
   995     
       
   996     TAknWindowComponentLayout passiveTabLayout1(
       
   997         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp2() );
       
   998         
       
   999     TAknWindowComponentLayout passiveTabLayout2(
       
  1000         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp2() );
       
  1001         
       
  1002     TAknWindowComponentLayout passiveTabLayout3(
       
  1003         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp2() );
       
  1004         
       
  1005     // bg active tab pane
       
  1006     TRect tabsBackgroundActivePaneRect(
       
  1007     RectFromLayout( tabsThreeActivePaneRect,
       
  1008                     AknLayoutScalable_Avkon::bg_active_tab_pane_cp2( 0 ) ) );
       
  1009 
       
  1010     // bg first passive tab pane
       
  1011     TRect tabsBackgroundFirstPassivePaneRect(
       
  1012         RectFromLayout( tabsThreePassiveFirstPaneRect,
       
  1013                         passivePaneLayout ) );
       
  1014 
       
  1015     // bg second passive tab pane
       
  1016     TRect tabsBackgroundSecondPassivePaneRect(
       
  1017         RectFromLayout( tabsThreePassiveSecondPaneRect,
       
  1018                         passivePaneLayout ) );
       
  1019 
       
  1020 
       
  1021     // Active tab left
       
  1022     TRect activeTabLeftPaneRect(
       
  1023         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1024                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp2() ) );
       
  1025 
       
  1026     // Active tab middle
       
  1027     TRect activeTabMiddlePaneRect(
       
  1028         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1029                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp2() ) );
       
  1030 
       
  1031     // Active tab right
       
  1032     TRect activeTabRightPaneRect(
       
  1033         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1034                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp2() ) );
       
  1035 
       
  1036 
       
  1037     // First passive tab left
       
  1038     TRect firstPassiveTabLeftPaneRect(
       
  1039         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1040                         passiveTabLayout1 ) );
       
  1041 
       
  1042     // First passive tab middle
       
  1043     TRect firstPassiveTabMiddlePaneRect(
       
  1044         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1045                         passiveTabLayout2 ) );
       
  1046 
       
  1047     // First passive tab right
       
  1048     TRect firstPassiveTabRightPaneRect(
       
  1049         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1050                         passiveTabLayout3 ) );
       
  1051 
       
  1052 
       
  1053     // Second passive tab left
       
  1054     TRect secondPassiveTabLeftPaneRect(
       
  1055         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1056                         passiveTabLayout1 ) );
       
  1057 
       
  1058     // Second passive tab middle
       
  1059     TRect secondPassiveTabMiddlePaneRect(
       
  1060         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1061                         passiveTabLayout2 ) );
       
  1062 
       
  1063     // Second passive tab right
       
  1064     TRect secondPassiveTabRightPaneRect(
       
  1065         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1066                         passiveTabLayout3 ) );
       
  1067 
       
  1068     if ( aActiveTab == 1 )
       
  1069         {
       
  1070         layout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  1071         layout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  1072         layout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  1073 
       
  1074         layout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1075         layout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1076         layout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  1077 
       
  1078         layout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1079         layout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1080         layout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1081         }
       
  1082     else if ( aActiveTab == 2 )
       
  1083         {
       
  1084         layout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1085         layout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1086         layout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1087 
       
  1088         layout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  1089         layout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  1090         layout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  1091 
       
  1092         layout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1093         layout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1094         layout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1095         }
       
  1096     else if ( aActiveTab == 3 )
       
  1097         {
       
  1098         layout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1099         layout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1100         layout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1101 
       
  1102         layout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1103         layout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1104         layout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  1105 
       
  1106         layout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  1107         layout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  1108         layout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  1109         }
       
  1110 
       
  1111     layout.iFourthTab.iLeft.SetRect( 0, 0, 0, 0 );
       
  1112     layout.iFourthTab.iMiddle.SetRect( 0, 0, 0, 0 );
       
  1113     layout.iFourthTab.iRight.SetRect( 0, 0, 0, 0 );
       
  1114     
       
  1115     // Calculate the amount of horizontal overlap in the tab backgrounds
       
  1116     // since the hidden tab rectangles are not read from layout data
       
  1117     // and must be adjusted to correspond with the "real" tabs.
       
  1118     TInt xOverlap = layout.iFirstTab.iRight.iTl.iX -
       
  1119                         layout.iSecondTab.iLeft.iTl.iX;
       
  1120     
       
  1121     layout.iHiddenTabLeft.iLeft = TRect( layout.iFirstTab.iLeft.iTl.iX -
       
  1122                                              layout.iFirstTab.iMiddle.Width() -
       
  1123                                              layout.iFirstTab.iLeft.Width(),
       
  1124                                           layout.iFirstTab.iLeft.iTl.iY,
       
  1125                                           layout.iFirstTab.iLeft.iTl.iX -
       
  1126                                               layout.iFirstTab.iMiddle.Width(),
       
  1127                                           layout.iFirstTab.iLeft.iBr.iY  );
       
  1128     layout.iHiddenTabLeft.iLeft.Move( xOverlap, 0 );
       
  1129     
       
  1130     layout.iHiddenTabLeft.iMiddle = TRect( layout.iFirstTab.iLeft.iTl.iX -
       
  1131                                                layout.iFirstTab.iMiddle.Width(),
       
  1132                                            layout.iFirstTab.iLeft.iTl.iY,
       
  1133                                            layout.iFirstTab.iLeft.iTl.iX,
       
  1134                                            layout.iFirstTab.iLeft.iBr.iY );
       
  1135     layout.iHiddenTabLeft.iMiddle.Move( xOverlap, 0 );
       
  1136     
       
  1137     layout.iHiddenTabLeft.iRight = layout.iFirstTab.iLeft;
       
  1138     layout.iHiddenTabLeft.iRight.Move( xOverlap, 0 );
       
  1139     
       
  1140     layout.iHiddenTabRight.iLeft = layout.iThirdTab.iRight;
       
  1141     layout.iHiddenTabRight.iLeft.Move( -xOverlap, 0 );
       
  1142     layout.iHiddenTabRight.iMiddle = TRect( layout.iThirdTab.iRight.iBr.iX,
       
  1143                                             layout.iThirdTab.iRight.iTl.iY,
       
  1144                                             layout.iThirdTab.iRight.iBr.iX +
       
  1145                                                 layout.iThirdTab.iMiddle.Width(),
       
  1146                                             layout.iThirdTab.iRight.iBr.iY );
       
  1147     layout.iHiddenTabRight.iMiddle.Move( -xOverlap, 0 );
       
  1148     
       
  1149     layout.iHiddenTabRight.iRight = TRect( layout.iThirdTab.iRight.iBr.iX +
       
  1150                                                layout.iThirdTab.iMiddle.Width(),
       
  1151                                            layout.iThirdTab.iRight.iTl.iY,
       
  1152                                            layout.iThirdTab.iRight.iBr.iX +
       
  1153                                                layout.iThirdTab.iMiddle.Width() +
       
  1154                                                layout.iThirdTab.iRight.Width(),
       
  1155                                            layout.iThirdTab.iRight.iBr.iY );
       
  1156     layout.iHiddenTabRight.iRight.Move( -xOverlap, 0 );
       
  1157 
       
  1158     return layout;
       
  1159     }
       
  1160 
       
  1161 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeTabNarrowBackground(TInt aActiveTab) const
       
  1162     {
       
  1163     SAknTabGroupBackgroundLayout aLayout;
       
  1164 
       
  1165     // navi tabs pane
       
  1166     TRect parentRect( NarrowParentRect() );
       
  1167 
       
  1168     // navi tabs 3 pane
       
  1169     TRect naviTabsThreePaneRect(
       
  1170         RectFromLayout( parentRect,
       
  1171                         AknLayoutScalable_Avkon::navi_tabs_3_pane_srt() ) );
       
  1172 
       
  1173     TRect tabsPassiveFirstPaneRect;
       
  1174     TRect tabsPassiveSecondPaneRect;
       
  1175     TRect tabsActivePaneRect;
       
  1176 
       
  1177     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
  1178     TRect parent = naviTabsThreePaneRect;
       
  1179     TAknWindowComponentLayout aFirstTab(
       
  1180         AknLayoutScalable_Avkon::tabs_3_active_pane_srt( 0 ) );
       
  1181     TAknWindowComponentLayout aSecondTab(
       
  1182         AknLayoutScalable_Avkon::tabs_3_passive_pane_srt( 0 ) );
       
  1183     TAknWindowComponentLayout aThirdTab(
       
  1184         AknLayoutScalable_Avkon::tabs_3_passive_pane_cp_srt( 0 ) );
       
  1185 
       
  1186     if ( aActiveTab == 1 )
       
  1187         {
       
  1188         tabsActivePaneRect        =  RectFromLayout( parent, aFirstTab );
       
  1189         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aSecondTab );
       
  1190         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1191         }
       
  1192     else if ( aActiveTab == 2 )
       
  1193         {
       
  1194         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1195         tabsActivePaneRect        =  RectFromLayout( parent, aSecondTab );
       
  1196         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1197         }
       
  1198     else if ( aActiveTab == 3 )
       
  1199         {
       
  1200         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1201         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aSecondTab );
       
  1202         tabsActivePaneRect        =  RectFromLayout( parent, aThirdTab );
       
  1203         }
       
  1204 
       
  1205     // Tabs 3 first passive tab pane
       
  1206     TRect tabsThreePassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
  1207 
       
  1208     // Tabs 3 second passive tab pane
       
  1209     TRect tabsThreePassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
  1210 
       
  1211     // Tabs 3 active tab pane
       
  1212     TRect tabsThreeActivePaneRect( tabsActivePaneRect );
       
  1213     
       
  1214     TAknWindowComponentLayout passivePaneLayout(
       
  1215         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp2_srt( 0 ) );
       
  1216     
       
  1217     TAknWindowComponentLayout passiveTabLayout1(
       
  1218         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp2_srt() );
       
  1219         
       
  1220     TAknWindowComponentLayout passiveTabLayout2(
       
  1221         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp2_srt() );
       
  1222         
       
  1223     TAknWindowComponentLayout passiveTabLayout3(
       
  1224         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp2_srt() );
       
  1225 
       
  1226     // bg active tab pane
       
  1227     TRect tabsBackgroundActivePaneRect(
       
  1228         RectFromLayout( tabsThreeActivePaneRect,
       
  1229                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp2_srt( 0 ) ) );
       
  1230 
       
  1231     // bg first passive tab pane
       
  1232     TRect tabsBackgroundFirstPassivePaneRect(
       
  1233         RectFromLayout( tabsThreePassiveFirstPaneRect,
       
  1234                         passivePaneLayout ) );
       
  1235 
       
  1236     // bg second passive tab pane
       
  1237     TRect tabsBackgroundSecondPassivePaneRect(
       
  1238         RectFromLayout( tabsThreePassiveSecondPaneRect,
       
  1239                         passivePaneLayout ) );
       
  1240 
       
  1241     // Active tab left
       
  1242     TRect activeTabLeftPaneRect(
       
  1243         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1244                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp2_srt() ) );
       
  1245 
       
  1246     // Active tab middle
       
  1247     TRect activeTabMiddlePaneRect(
       
  1248         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1249                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp2_srt() ) );
       
  1250 
       
  1251     // Active tab right
       
  1252     TRect activeTabRightPaneRect(
       
  1253         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1254                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp2_srt() ) );
       
  1255 
       
  1256     // First passive tab left
       
  1257     TRect firstPassiveTabLeftPaneRect(
       
  1258         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1259                         passiveTabLayout1 ) );
       
  1260 
       
  1261     // First passive tab middle
       
  1262     TRect firstPassiveTabMiddlePaneRect(
       
  1263         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1264                         passiveTabLayout2 ) );
       
  1265 
       
  1266     // First passive tab right
       
  1267     TRect firstPassiveTabRightPaneRect(
       
  1268         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1269                         passiveTabLayout3 ) );
       
  1270 
       
  1271     // Second passive tab left
       
  1272     TRect secondPassiveTabLeftPaneRect(
       
  1273         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1274                         passiveTabLayout1 ) );
       
  1275 
       
  1276     // Second passive tab middle
       
  1277     TRect secondPassiveTabMiddlePaneRect(
       
  1278         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1279                         passiveTabLayout2 ) );
       
  1280 
       
  1281     // Second passive tab right
       
  1282     TRect secondPassiveTabRightPaneRect(
       
  1283         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1284                         passiveTabLayout3 ) );
       
  1285 
       
  1286     if ( aActiveTab == 1 )
       
  1287         {
       
  1288         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  1289         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  1290         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  1291 
       
  1292         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1293         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1294         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  1295 
       
  1296         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1297         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1298         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1299         }
       
  1300     else if ( aActiveTab == 2 )
       
  1301         {
       
  1302         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1303         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1304         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1305 
       
  1306         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  1307         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  1308         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  1309 
       
  1310         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1311         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1312         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1313         }
       
  1314     else if ( aActiveTab == 3 )
       
  1315         {
       
  1316         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1317         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1318         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1319 
       
  1320         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1321         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1322         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  1323 
       
  1324         aLayout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  1325         aLayout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  1326         aLayout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  1327         }
       
  1328 
       
  1329     aLayout.iFourthTab.iLeft = TRect(0,0,0,0);
       
  1330     aLayout.iFourthTab.iMiddle = TRect(0,0,0,0);
       
  1331     aLayout.iFourthTab.iRight = TRect(0,0,0,0);
       
  1332 
       
  1333     return aLayout;
       
  1334     }
       
  1335 
       
  1336 
       
  1337 // ---------------------------------------------------------------------------
       
  1338 // Draws the tab group background in three tab layout.
       
  1339 // ---------------------------------------------------------------------------
       
  1340 //
       
  1341 void CAknTabGroupGraphics::DrawThreeTabBackground(
       
  1342     TTabDrawMode aTabDrawMode,
       
  1343     TInt aActiveTab,
       
  1344     CBitmapContext* aGc,
       
  1345     SAknTabGroupBackgroundLayout& aLayout,
       
  1346     TTabsHidden aTabsHidden,
       
  1347     TTabAnimationType aAnimation ) const
       
  1348     {
       
  1349     TInt animActiveTab( aActiveTab );
       
  1350     if ( aAnimation && aActiveTab == 2 )
       
  1351         {
       
  1352         // Move the tab highlight already during the animation.
       
  1353         animActiveTab = aAnimation == ECycleToLeft ? aActiveTab - 1 :
       
  1354                                                      aActiveTab + 1;
       
  1355         }
       
  1356 
       
  1357     // If not given layout, then get the default layout.
       
  1358     if ( !aLayout.iUse )
       
  1359         {
       
  1360         aLayout = ThreeTabBackground( animActiveTab );
       
  1361         }
       
  1362 
       
  1363     TInt xOffset( aLayout.iFirstTab.iRight.iBr.iX -
       
  1364                       aLayout.iSecondTab.iLeft.iTl.iX );
       
  1365     
       
  1366     if ( aActiveTab == 1 )
       
  1367         {
       
  1368         if ( aTabsHidden == EOnRightSide )
       
  1369             {
       
  1370             DrawPassiveTab( aTabDrawMode,
       
  1371                             aLayout.iHiddenTabRight.iLeft,
       
  1372                             aLayout.iHiddenTabRight.iMiddle,
       
  1373                             aLayout.iHiddenTabRight.iRight,
       
  1374                             aGc,
       
  1375                             ETrue );
       
  1376             }
       
  1377 
       
  1378         DrawPassiveTab( aTabDrawMode,
       
  1379                         aLayout.iThirdTab.iLeft,
       
  1380                         aLayout.iThirdTab.iMiddle,
       
  1381                         aLayout.iThirdTab.iRight,
       
  1382                         aGc );
       
  1383 
       
  1384         DrawPassiveTab( aTabDrawMode,
       
  1385                         aLayout.iSecondTab.iLeft,
       
  1386                         aLayout.iSecondTab.iMiddle,
       
  1387                         aLayout.iSecondTab.iRight,
       
  1388                         aGc );
       
  1389 
       
  1390         DrawActiveTab( aTabDrawMode,
       
  1391                        aLayout.iFirstTab.iLeft,
       
  1392                        aLayout.iFirstTab.iMiddle,
       
  1393                        aLayout.iFirstTab.iRight,
       
  1394                        aGc );
       
  1395         }
       
  1396     else if ( aActiveTab == 2 )
       
  1397         {
       
  1398         switch ( aTabsHidden )
       
  1399             {
       
  1400             case EOnLeftSide:
       
  1401                 {
       
  1402                 TRect bitRect( aLayout.iHiddenTabLeft.iLeft );
       
  1403                 bitRect.Resize( xOffset, 0 );
       
  1404                 DrawPassiveTabBit( aTabDrawMode,
       
  1405                                    ERight,
       
  1406                                    bitRect,
       
  1407                                    aGc );
       
  1408                 DrawPassiveTab( aTabDrawMode,
       
  1409                                 aLayout.iHiddenTabLeft.iLeft,
       
  1410                                 aLayout.iHiddenTabLeft.iMiddle,
       
  1411                                 aLayout.iHiddenTabLeft.iRight,
       
  1412                                 aGc,
       
  1413                                 aAnimation != ECycleToLeft ? ETrue : EFalse  );
       
  1414                 break;
       
  1415                 }
       
  1416             case EOnRightSide:
       
  1417                 {
       
  1418                 TRect bitRect( aLayout.iHiddenTabRight.iRight );
       
  1419                 bitRect.Move( -xOffset, 0 );
       
  1420                 bitRect.Resize( xOffset, 0 );
       
  1421                 DrawPassiveTabBit( aTabDrawMode,
       
  1422                                    ELeft,
       
  1423                                    bitRect,
       
  1424                                    aGc );
       
  1425                 DrawPassiveTab( aTabDrawMode,
       
  1426                                 aLayout.iHiddenTabRight.iLeft,
       
  1427                                 aLayout.iHiddenTabRight.iMiddle,
       
  1428                                 aLayout.iHiddenTabRight.iRight,
       
  1429                                 aGc,
       
  1430                                 aAnimation != ECycleToRight ? ETrue : EFalse  );
       
  1431                 break;
       
  1432                 }
       
  1433             case EOnBothSides:
       
  1434                 {
       
  1435                 DrawPassiveTab( aTabDrawMode,
       
  1436                                 aLayout.iHiddenTabLeft.iLeft,
       
  1437                                 aLayout.iHiddenTabLeft.iMiddle,
       
  1438                                 aLayout.iHiddenTabLeft.iRight,
       
  1439                                 aGc,
       
  1440                                 aAnimation != ECycleToLeft ? ETrue : EFalse  );
       
  1441 
       
  1442                 DrawPassiveTab( aTabDrawMode,
       
  1443                                 aLayout.iHiddenTabRight.iLeft,
       
  1444                                 aLayout.iHiddenTabRight.iMiddle,
       
  1445                                 aLayout.iHiddenTabRight.iRight,
       
  1446                                 aGc,
       
  1447                                 aAnimation != ECycleToRight ? ETrue : EFalse  );
       
  1448                 break;
       
  1449                 }
       
  1450             case ETwoOnBothSides:
       
  1451                 {
       
  1452                 TRect bitRect( aLayout.iHiddenTabLeft.iLeft );
       
  1453                 bitRect.Resize( xOffset, 0 );
       
  1454                 DrawPassiveTabBit( aTabDrawMode,
       
  1455                                    ERight,
       
  1456                                    bitRect,
       
  1457                                    aGc );
       
  1458                 DrawPassiveTab( aTabDrawMode,
       
  1459                                 aLayout.iHiddenTabLeft.iLeft,
       
  1460                                 aLayout.iHiddenTabLeft.iMiddle,
       
  1461                                 aLayout.iHiddenTabLeft.iRight,
       
  1462                                 aGc,
       
  1463                                 aAnimation != ECycleToLeft ? ETrue : EFalse );
       
  1464 
       
  1465                 bitRect = aLayout.iHiddenTabRight.iRight;
       
  1466                 bitRect.Move( -xOffset, 0 );
       
  1467                 bitRect.Resize( xOffset, 0 );
       
  1468                 DrawPassiveTabBit( aTabDrawMode,
       
  1469                                    ELeft,
       
  1470                                    bitRect,
       
  1471                                    aGc );
       
  1472                 DrawPassiveTab( aTabDrawMode,
       
  1473                                 aLayout.iHiddenTabRight.iLeft,
       
  1474                                 aLayout.iHiddenTabRight.iMiddle,
       
  1475                                 aLayout.iHiddenTabRight.iRight,
       
  1476                                 aGc,
       
  1477                                 aAnimation != ECycleToRight ? ETrue : EFalse);
       
  1478                 break;
       
  1479                 }
       
  1480             case ENone:
       
  1481             default:
       
  1482                 {
       
  1483                 break;
       
  1484                 }
       
  1485             }
       
  1486 
       
  1487         if ( aAnimation == ECycleToLeft )
       
  1488             {
       
  1489             DrawPassiveTab( aTabDrawMode,
       
  1490                             aLayout.iThirdTab.iLeft,
       
  1491                             aLayout.iThirdTab.iMiddle,
       
  1492                             aLayout.iThirdTab.iRight,
       
  1493                             aGc,
       
  1494                             ETrue );
       
  1495             DrawPassiveTab( aTabDrawMode,
       
  1496                             aLayout.iSecondTab.iLeft,
       
  1497                             aLayout.iSecondTab.iMiddle,
       
  1498                             aLayout.iSecondTab.iRight,
       
  1499                             aGc );
       
  1500              DrawActiveTab( aTabDrawMode,
       
  1501                             aLayout.iFirstTab.iLeft,
       
  1502                             aLayout.iFirstTab.iMiddle,
       
  1503                             aLayout.iFirstTab.iRight,
       
  1504                             aGc );
       
  1505             }
       
  1506         else if ( aAnimation == ECycleToRight )
       
  1507             {
       
  1508             DrawPassiveTab( aTabDrawMode,
       
  1509                             aLayout.iFirstTab.iLeft,
       
  1510                             aLayout.iFirstTab.iMiddle,
       
  1511                             aLayout.iFirstTab.iRight,
       
  1512                             aGc,
       
  1513                             ETrue );
       
  1514             DrawPassiveTab( aTabDrawMode,
       
  1515                             aLayout.iSecondTab.iLeft,
       
  1516                             aLayout.iSecondTab.iMiddle,
       
  1517                             aLayout.iSecondTab.iRight,
       
  1518                             aGc );
       
  1519             DrawActiveTab( aTabDrawMode,
       
  1520                            aLayout.iThirdTab.iLeft,
       
  1521                            aLayout.iThirdTab.iMiddle,
       
  1522                            aLayout.iThirdTab.iRight,
       
  1523                            aGc );
       
  1524             }
       
  1525         else
       
  1526             {
       
  1527             DrawPassiveTab( aTabDrawMode,
       
  1528                             aLayout.iFirstTab.iLeft,
       
  1529                             aLayout.iFirstTab.iMiddle,
       
  1530                             aLayout.iFirstTab.iRight,
       
  1531                             aGc );
       
  1532     
       
  1533             DrawPassiveTab( aTabDrawMode,
       
  1534                             aLayout.iThirdTab.iLeft,
       
  1535                             aLayout.iThirdTab.iMiddle,
       
  1536                             aLayout.iThirdTab.iRight,
       
  1537                             aGc );
       
  1538     
       
  1539             if ( aAnimation )
       
  1540                 {
       
  1541                 DrawPassiveTab( aTabDrawMode,
       
  1542                                 aLayout.iSecondTab.iLeft,
       
  1543                                 aLayout.iSecondTab.iMiddle,
       
  1544                                 aLayout.iSecondTab.iRight,
       
  1545                                 aGc );
       
  1546                 }
       
  1547             else
       
  1548                 {
       
  1549                 DrawActiveTab( aTabDrawMode,
       
  1550                                aLayout.iSecondTab.iLeft,
       
  1551                                aLayout.iSecondTab.iMiddle,
       
  1552                                aLayout.iSecondTab.iRight,
       
  1553                                aGc );
       
  1554                 }
       
  1555             }
       
  1556         }
       
  1557     else if ( aActiveTab == 3 )
       
  1558         {
       
  1559         if ( aTabsHidden == EOnLeftSide )
       
  1560             {
       
  1561             DrawPassiveTab( aTabDrawMode,
       
  1562                             aLayout.iHiddenTabLeft.iLeft,
       
  1563                             aLayout.iHiddenTabLeft.iMiddle,
       
  1564                             aLayout.iHiddenTabLeft.iRight,
       
  1565                             aGc,
       
  1566                             ETrue  );
       
  1567             }
       
  1568         
       
  1569         DrawPassiveTab( aTabDrawMode,
       
  1570                         aLayout.iFirstTab.iLeft,
       
  1571                         aLayout.iFirstTab.iMiddle,
       
  1572                         aLayout.iFirstTab.iRight,
       
  1573                         aGc );
       
  1574 
       
  1575         DrawPassiveTab( aTabDrawMode,
       
  1576                         aLayout.iSecondTab.iLeft,
       
  1577                         aLayout.iSecondTab.iMiddle,
       
  1578                         aLayout.iSecondTab.iRight,
       
  1579                         aGc );
       
  1580 
       
  1581         DrawActiveTab( aTabDrawMode,
       
  1582                        aLayout.iThirdTab.iLeft,
       
  1583                        aLayout.iThirdTab.iMiddle,
       
  1584                        aLayout.iThirdTab.iRight,
       
  1585                        aGc );
       
  1586         }
       
  1587     }
       
  1588 
       
  1589 
       
  1590 // ---------------------------------------------------------------------------
       
  1591 // Draws the tab group background in three tab narrow layout.
       
  1592 // ---------------------------------------------------------------------------
       
  1593 //
       
  1594 void CAknTabGroupGraphics::DrawThreeTabNarrowBackground(
       
  1595     TTabDrawMode aTabDrawMode,
       
  1596     TInt aActiveTab,
       
  1597     CBitmapContext* aGc,
       
  1598     SAknTabGroupBackgroundLayout& aLayout ) const
       
  1599     {
       
  1600     // If not given layout, then get the default layout
       
  1601     if ( !aLayout.iUse )
       
  1602         {
       
  1603         aLayout = ThreeTabBackground( aActiveTab );
       
  1604         }
       
  1605 
       
  1606     if ( aActiveTab == 1 )
       
  1607         {
       
  1608         DrawPassiveTab( aTabDrawMode,
       
  1609                         aLayout.iThirdTab.iLeft,
       
  1610                         aLayout.iThirdTab.iMiddle,
       
  1611                         aLayout.iThirdTab.iRight,
       
  1612                         aGc );
       
  1613         
       
  1614         DrawPassiveTab( aTabDrawMode,
       
  1615                         aLayout.iSecondTab.iLeft,
       
  1616                         aLayout.iSecondTab.iMiddle,
       
  1617                         aLayout.iSecondTab.iRight,
       
  1618                         aGc );
       
  1619         
       
  1620         DrawActiveTab( aTabDrawMode,
       
  1621                        aLayout.iFirstTab.iLeft,
       
  1622                        aLayout.iFirstTab.iMiddle,
       
  1623                        aLayout.iFirstTab.iRight,
       
  1624                        aGc );
       
  1625         }
       
  1626     else if ( aActiveTab == 2 )
       
  1627         {
       
  1628         DrawPassiveTab( aTabDrawMode,
       
  1629                         aLayout.iFirstTab.iLeft,
       
  1630                         aLayout.iFirstTab.iMiddle,
       
  1631                         aLayout.iFirstTab.iRight,
       
  1632                         aGc );
       
  1633         
       
  1634         DrawPassiveTab( aTabDrawMode,
       
  1635                         aLayout.iThirdTab.iLeft,
       
  1636                         aLayout.iThirdTab.iMiddle,
       
  1637                         aLayout.iThirdTab.iRight,
       
  1638                         aGc );
       
  1639         
       
  1640         DrawActiveTab( aTabDrawMode,
       
  1641                        aLayout.iSecondTab.iLeft,
       
  1642                        aLayout.iSecondTab.iMiddle,
       
  1643                        aLayout.iSecondTab.iRight,
       
  1644                        aGc );
       
  1645         }
       
  1646     else if ( aActiveTab == 3 )
       
  1647         {
       
  1648         DrawPassiveTab( aTabDrawMode,
       
  1649                         aLayout.iFirstTab.iLeft,
       
  1650                         aLayout.iFirstTab.iMiddle,
       
  1651                         aLayout.iFirstTab.iRight,
       
  1652                         aGc );
       
  1653         
       
  1654         DrawPassiveTab( aTabDrawMode,
       
  1655                         aLayout.iSecondTab.iLeft,
       
  1656                         aLayout.iSecondTab.iMiddle,
       
  1657                         aLayout.iSecondTab.iRight,
       
  1658                         aGc );
       
  1659         
       
  1660         DrawActiveTab( aTabDrawMode,
       
  1661                        aLayout.iThirdTab.iLeft,
       
  1662                        aLayout.iThirdTab.iMiddle,
       
  1663                        aLayout.iThirdTab.iRight,
       
  1664                        aGc );
       
  1665         }
       
  1666     }
       
  1667 
       
  1668 
       
  1669 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::FourTabBackground(
       
  1670     TInt aActiveTab ) const
       
  1671     {
       
  1672     SAknTabGroupBackgroundLayout aLayout;
       
  1673 
       
  1674     TRect parentRect( iTabGroupBackgroundParent );
       
  1675 
       
  1676     // navi tabs 4 pane
       
  1677     TRect naviTabsFourPaneRect(
       
  1678         RectFromLayout( parentRect,
       
  1679                         AknLayoutScalable_Avkon::navi_tabs_4_pane() ) );
       
  1680 
       
  1681     TRect tabsPassiveFirstPaneRect;
       
  1682     TRect tabsPassiveSecondPaneRect;
       
  1683     TRect tabsPassiveThirdPaneRect;
       
  1684     TRect tabsActivePaneRect;
       
  1685 
       
  1686     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
  1687     TRect parent = naviTabsFourPaneRect;
       
  1688     TAknWindowComponentLayout aFirstTab(  AknLayoutScalable_Avkon::tabs_4_active_pane(0) );
       
  1689     TAknWindowComponentLayout aSecondTab( AknLayoutScalable_Avkon::tabs_4_passive_pane_cp(0) );
       
  1690     TAknWindowComponentLayout aThirdTab(  AknLayoutScalable_Avkon::tabs_4_passive_pane(0) );
       
  1691     TAknWindowComponentLayout aFourthTab( AknLayoutScalable_Avkon::tabs_4_passive_pane_cp2(0) );
       
  1692 
       
  1693     if ( aActiveTab == 1 )
       
  1694         {
       
  1695         tabsActivePaneRect        =  RectFromLayout( parent, aFirstTab );
       
  1696         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aSecondTab );
       
  1697         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1698         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1699         }
       
  1700     else if ( aActiveTab == 2 )
       
  1701         {
       
  1702         tabsActivePaneRect        =  RectFromLayout( parent, aSecondTab );
       
  1703         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1704         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1705         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1706         }
       
  1707     else if ( aActiveTab == 3 )
       
  1708         {
       
  1709         tabsActivePaneRect        =  RectFromLayout( parent, aThirdTab );
       
  1710         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1711         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aSecondTab );
       
  1712         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1713         }
       
  1714     else if ( aActiveTab == 4 )
       
  1715         {
       
  1716         tabsActivePaneRect        =  RectFromLayout( parent, aFourthTab );
       
  1717         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1718         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aSecondTab );
       
  1719         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aThirdTab );
       
  1720         }
       
  1721     
       
  1722     TAknWindowComponentLayout passivePaneLayout(
       
  1723         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp3( 0 ) );
       
  1724 
       
  1725     TAknWindowComponentLayout passiveTabLayout1(
       
  1726         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp3() );
       
  1727         
       
  1728     TAknWindowComponentLayout passiveTabLayout2(
       
  1729         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp3() );
       
  1730         
       
  1731     TAknWindowComponentLayout passiveTabLayout3(
       
  1732         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp3() );
       
  1733         
       
  1734         
       
  1735     // Tabs 4 first passive tab pane
       
  1736     TRect tabsFourPassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
  1737 
       
  1738     // Tabs 4 second passive tab pane
       
  1739     TRect tabsFourPassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
  1740 
       
  1741     // Tabs 4 third passive tab pane
       
  1742     TRect tabsFourPassiveThirdPaneRect( tabsPassiveThirdPaneRect );
       
  1743 
       
  1744     // Tabs 4 active tab pane
       
  1745     TRect tabsFourActivePaneRect( tabsActivePaneRect );
       
  1746 
       
  1747     // bg active tab pane
       
  1748     TRect tabsBackgroundActivePaneRect(
       
  1749         RectFromLayout( tabsFourActivePaneRect,
       
  1750                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp3( 0 ) ) );
       
  1751 
       
  1752     // bg first passive tab pane
       
  1753     TRect tabsBackgroundFirstPassivePaneRect(
       
  1754         RectFromLayout( tabsFourPassiveFirstPaneRect, passivePaneLayout ) );
       
  1755 
       
  1756     // bg second passive tab pane
       
  1757     TRect tabsBackgroundSecondPassivePaneRect(
       
  1758         RectFromLayout( tabsFourPassiveSecondPaneRect, passivePaneLayout ) );
       
  1759 
       
  1760     // bg third passive tab pane
       
  1761     TRect tabsBackgroundThirdPassivePaneRect(
       
  1762         RectFromLayout( tabsFourPassiveThirdPaneRect, passivePaneLayout ) );
       
  1763 
       
  1764     // Active tab left
       
  1765     TRect activeTabLeftPaneRect(
       
  1766         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1767                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp3() ) );
       
  1768 
       
  1769     // Active tab middle
       
  1770     TRect activeTabMiddlePaneRect(
       
  1771         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1772                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp3() ) );
       
  1773 
       
  1774     // Active tab right
       
  1775     TRect activeTabRightPaneRect(
       
  1776         RectFromLayout( tabsBackgroundActivePaneRect,
       
  1777                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp3() ) );
       
  1778 
       
  1779     // First passive tab left
       
  1780     TRect firstPassiveTabLeftPaneRect(
       
  1781         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1782                         passiveTabLayout1 ) );
       
  1783 
       
  1784     // First passive tab middle
       
  1785     TRect firstPassiveTabMiddlePaneRect(
       
  1786         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1787                         passiveTabLayout2 ) );
       
  1788 
       
  1789     // First passive tab right
       
  1790     TRect firstPassiveTabRightPaneRect(
       
  1791         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  1792                         passiveTabLayout3 ) );
       
  1793 
       
  1794     // Second passive tab left
       
  1795     TRect secondPassiveTabLeftPaneRect(
       
  1796         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1797                         passiveTabLayout1 ) );
       
  1798 
       
  1799     // Second passive tab middle
       
  1800     TRect secondPassiveTabMiddlePaneRect(
       
  1801         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1802                         passiveTabLayout2 ) );
       
  1803 
       
  1804     // Second passive tab right
       
  1805     TRect secondPassiveTabRightPaneRect(
       
  1806         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  1807                         passiveTabLayout3 ) );
       
  1808 
       
  1809     // Third passive tab left
       
  1810     TRect thirdPassiveTabLeftPaneRect(
       
  1811         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  1812                         passiveTabLayout1 ) );
       
  1813 
       
  1814     // third passive tab middle
       
  1815     TRect thirdPassiveTabMiddlePaneRect(
       
  1816         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  1817                         passiveTabLayout2 ) );
       
  1818 
       
  1819     // third passive tab right
       
  1820     TRect thirdPassiveTabRightPaneRect(
       
  1821         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  1822                         passiveTabLayout3 ) );
       
  1823 
       
  1824     if ( aActiveTab == 1 )
       
  1825         {
       
  1826         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  1827         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  1828         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  1829 
       
  1830         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1831         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1832         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  1833 
       
  1834         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1835         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1836         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1837 
       
  1838         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  1839         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  1840         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  1841         }
       
  1842     else if ( aActiveTab == 2 )
       
  1843         {
       
  1844         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1845         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1846         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1847 
       
  1848         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  1849         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  1850         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  1851 
       
  1852         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1853         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1854         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  1855 
       
  1856         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  1857         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  1858         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  1859         }
       
  1860     else if ( aActiveTab == 3 )
       
  1861         {
       
  1862         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1863         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1864         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1865 
       
  1866         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1867         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1868         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  1869 
       
  1870         aLayout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  1871         aLayout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  1872         aLayout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  1873 
       
  1874         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  1875         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  1876         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  1877         }
       
  1878     else if ( aActiveTab == 4 )
       
  1879         {
       
  1880         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  1881         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  1882         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  1883 
       
  1884         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  1885         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  1886         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  1887 
       
  1888         aLayout.iThirdTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  1889         aLayout.iThirdTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  1890         aLayout.iThirdTab.iRight  = thirdPassiveTabRightPaneRect;
       
  1891 
       
  1892         aLayout.iFourthTab.iLeft   = activeTabLeftPaneRect;
       
  1893         aLayout.iFourthTab.iMiddle = activeTabMiddlePaneRect;
       
  1894         aLayout.iFourthTab.iRight  = activeTabRightPaneRect;
       
  1895         }
       
  1896 
       
  1897     return aLayout;
       
  1898     }
       
  1899 
       
  1900 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::FourTabNarrowBackground(TInt aActiveTab) const
       
  1901     {
       
  1902     SAknTabGroupBackgroundLayout aLayout;
       
  1903 
       
  1904     // navi tabs pane
       
  1905     TRect parentRect( NarrowParentRect() );
       
  1906 
       
  1907     // navi tabs 4 pane
       
  1908     TRect naviTabsFourPaneRect(
       
  1909         RectFromLayout( parentRect,
       
  1910                         AknLayoutScalable_Avkon::navi_tabs_4_pane_srt() ) );
       
  1911 
       
  1912     TRect tabsPassiveFirstPaneRect;
       
  1913     TRect tabsPassiveSecondPaneRect;
       
  1914     TRect tabsPassiveThirdPaneRect;
       
  1915     TRect tabsActivePaneRect;
       
  1916     
       
  1917     TRect parent = naviTabsFourPaneRect;
       
  1918     
       
  1919     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
  1920     TAknWindowComponentLayout aFirstTab( 
       
  1921         AknLayoutScalable_Avkon::tabs_4_active_pane_srt(0) );
       
  1922         
       
  1923     TAknWindowComponentLayout aSecondTab(
       
  1924         AknLayoutScalable_Avkon::tabs_4_passive_pane_cp_srt(0) );
       
  1925         
       
  1926     TAknWindowComponentLayout aThirdTab(
       
  1927         AknLayoutScalable_Avkon::tabs_4_passive_pane_srt(0) );
       
  1928         
       
  1929     TAknWindowComponentLayout aFourthTab(
       
  1930         AknLayoutScalable_Avkon::tabs_4_passive_pane_cp2_srt(0) );
       
  1931 
       
  1932     if ( aActiveTab == 1 )
       
  1933         {
       
  1934         tabsActivePaneRect        =  RectFromLayout( parent, aFirstTab );
       
  1935         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aSecondTab );
       
  1936         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1937         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1938         }
       
  1939     else if ( aActiveTab == 2 )
       
  1940         {
       
  1941         tabsActivePaneRect        =  RectFromLayout( parent, aSecondTab );
       
  1942         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1943         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aThirdTab );
       
  1944         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1945         }
       
  1946     else if ( aActiveTab == 3 )
       
  1947         {
       
  1948         tabsActivePaneRect        =  RectFromLayout( parent, aThirdTab );
       
  1949         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1950         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aSecondTab );
       
  1951         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aFourthTab );
       
  1952         }
       
  1953     else if ( aActiveTab == 4 )
       
  1954         {
       
  1955         tabsActivePaneRect        =  RectFromLayout( parent, aFourthTab );
       
  1956         tabsPassiveFirstPaneRect  =  RectFromLayout( parent, aFirstTab );
       
  1957         tabsPassiveSecondPaneRect =  RectFromLayout( parent, aSecondTab );
       
  1958         tabsPassiveThirdPaneRect  =  RectFromLayout( parent, aThirdTab );
       
  1959         }
       
  1960 
       
  1961     // Tabs 4 first passive tab pane
       
  1962     TRect tabsFourPassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
  1963 
       
  1964     // Tabs 4 second passive tab pane
       
  1965     TRect tabsFourPassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
  1966 
       
  1967     // Tabs 4 third passive tab pane
       
  1968     TRect tabsFourPassiveThirdPaneRect( tabsPassiveThirdPaneRect );
       
  1969 
       
  1970     // Tabs 4 active tab pane
       
  1971     TRect tabsFourActivePaneRect( tabsActivePaneRect );
       
  1972 
       
  1973     TAknWindowComponentLayout passivePaneLayout(
       
  1974         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp3_srt( 0 ) );
       
  1975 
       
  1976     TAknWindowComponentLayout passiveTabLayout1(
       
  1977         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp3_srt() );
       
  1978         
       
  1979     TAknWindowComponentLayout passiveTabLayout2(
       
  1980         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp3_srt() );
       
  1981         
       
  1982     TAknWindowComponentLayout passiveTabLayout3(
       
  1983         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp3_srt() );
       
  1984 
       
  1985     // bg active tab pane
       
  1986     TRect tabsBackgroundActivePaneRect(
       
  1987         RectFromLayout( tabsFourActivePaneRect,
       
  1988                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp3_srt( 0 ) ) );
       
  1989 
       
  1990     // bg first passive tab pane
       
  1991     TRect tabsBackgroundFirstPassivePaneRect(
       
  1992         RectFromLayout( tabsFourPassiveFirstPaneRect, passivePaneLayout ) );
       
  1993 
       
  1994     // bg second passive tab pane
       
  1995     TRect tabsBackgroundSecondPassivePaneRect(
       
  1996         RectFromLayout( tabsFourPassiveSecondPaneRect, passivePaneLayout ) );
       
  1997 
       
  1998     // bg third passive tab pane
       
  1999     TRect tabsBackgroundThirdPassivePaneRect(
       
  2000         RectFromLayout( tabsFourPassiveThirdPaneRect, passivePaneLayout ) );
       
  2001 
       
  2002 
       
  2003     // Active tab left
       
  2004     TRect activeTabLeftPaneRect(
       
  2005         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2006                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp3_copy1() ) );
       
  2007 
       
  2008     // Active tab middle
       
  2009     TRect activeTabMiddlePaneRect(
       
  2010         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2011                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp3_copy1() ) );
       
  2012 
       
  2013     // Active tab right
       
  2014     TRect activeTabRightPaneRect(
       
  2015         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2016                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp3_copy1() ) );
       
  2017 
       
  2018 
       
  2019     // First passive tab left
       
  2020     TRect firstPassiveTabLeftPaneRect(
       
  2021         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2022                         passiveTabLayout1 ) );
       
  2023 
       
  2024     // First passive tab middle
       
  2025     TRect firstPassiveTabMiddlePaneRect(
       
  2026         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2027                         passiveTabLayout2 ) );
       
  2028 
       
  2029     // First passive tab right
       
  2030     TRect firstPassiveTabRightPaneRect(
       
  2031         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2032                         passiveTabLayout3 ) );
       
  2033 
       
  2034 
       
  2035     // Second passive tab left
       
  2036     TRect secondPassiveTabLeftPaneRect(
       
  2037         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2038                         passiveTabLayout1 ) );
       
  2039 
       
  2040     // Second passive tab middle
       
  2041     TRect secondPassiveTabMiddlePaneRect(
       
  2042         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2043                         passiveTabLayout2 ) );
       
  2044 
       
  2045     // Second passive tab right
       
  2046     TRect secondPassiveTabRightPaneRect(
       
  2047         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2048                         passiveTabLayout3 ) );
       
  2049 
       
  2050 
       
  2051     // Third passive tab left
       
  2052     TRect thirdPassiveTabLeftPaneRect(
       
  2053         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  2054                         passiveTabLayout1 ) );
       
  2055 
       
  2056     // third passive tab middle
       
  2057     TRect thirdPassiveTabMiddlePaneRect(
       
  2058         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  2059                         passiveTabLayout2 ) );
       
  2060 
       
  2061     // third passive tab right
       
  2062     TRect thirdPassiveTabRightPaneRect(
       
  2063         RectFromLayout( tabsBackgroundThirdPassivePaneRect,
       
  2064                         passiveTabLayout3 ) );
       
  2065 
       
  2066 
       
  2067     if ( aActiveTab == 1 )
       
  2068         {
       
  2069         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  2070         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  2071         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  2072 
       
  2073         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2074         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2075         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  2076 
       
  2077         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2078         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2079         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  2080 
       
  2081         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  2082         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  2083         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  2084         }
       
  2085     else if ( aActiveTab == 2 )
       
  2086         {
       
  2087         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2088         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2089         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2090 
       
  2091         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  2092         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  2093         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  2094 
       
  2095         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2096         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2097         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  2098 
       
  2099         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  2100         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  2101         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  2102         }
       
  2103     else if ( aActiveTab == 3 )
       
  2104         {
       
  2105         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2106         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2107         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2108 
       
  2109         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2110         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2111         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  2112 
       
  2113         aLayout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  2114         aLayout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  2115         aLayout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  2116 
       
  2117         aLayout.iFourthTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  2118         aLayout.iFourthTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  2119         aLayout.iFourthTab.iRight  = thirdPassiveTabRightPaneRect;
       
  2120         }
       
  2121     else if ( aActiveTab == 4 )
       
  2122         {
       
  2123         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2124         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2125         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2126 
       
  2127         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2128         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2129         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  2130 
       
  2131         aLayout.iThirdTab.iLeft   = thirdPassiveTabLeftPaneRect;
       
  2132         aLayout.iThirdTab.iMiddle = thirdPassiveTabMiddlePaneRect;
       
  2133         aLayout.iThirdTab.iRight  = thirdPassiveTabRightPaneRect;
       
  2134 
       
  2135         aLayout.iFourthTab.iLeft   = activeTabLeftPaneRect;
       
  2136         aLayout.iFourthTab.iMiddle = activeTabMiddlePaneRect;
       
  2137         aLayout.iFourthTab.iRight  = activeTabRightPaneRect;
       
  2138         }
       
  2139 
       
  2140     return aLayout;
       
  2141     }
       
  2142 
       
  2143 void CAknTabGroupGraphics::DrawFourTabBackground( TTabDrawMode aTabDrawMode,
       
  2144                                                   TInt aActiveTab,
       
  2145                                                   CBitmapContext* aGc,
       
  2146                                                   SAknTabGroupBackgroundLayout& aLayout ) const
       
  2147     {
       
  2148     // If not given layout, then get the default layout
       
  2149     if ( !aLayout.iUse )
       
  2150         {
       
  2151         aLayout = FourTabBackground( aActiveTab );
       
  2152         }
       
  2153 
       
  2154     if ( aActiveTab == 1 )
       
  2155         {
       
  2156         DrawPassiveTab( aTabDrawMode,
       
  2157                         aLayout.iFourthTab.iLeft,
       
  2158                         aLayout.iFourthTab.iMiddle,
       
  2159                         aLayout.iFourthTab.iRight,
       
  2160                         aGc );
       
  2161         
       
  2162         DrawPassiveTab( aTabDrawMode,
       
  2163                         aLayout.iThirdTab.iLeft,
       
  2164                         aLayout.iThirdTab.iMiddle,
       
  2165                         aLayout.iThirdTab.iRight,
       
  2166                         aGc );
       
  2167         
       
  2168         DrawPassiveTab( aTabDrawMode,
       
  2169                         aLayout.iSecondTab.iLeft,
       
  2170                         aLayout.iSecondTab.iMiddle,
       
  2171                         aLayout.iSecondTab.iRight,
       
  2172                         aGc );
       
  2173         
       
  2174         DrawActiveTab( aTabDrawMode,
       
  2175                        aLayout.iFirstTab.iLeft,
       
  2176                        aLayout.iFirstTab.iMiddle,
       
  2177                        aLayout.iFirstTab.iRight,
       
  2178                        aGc );
       
  2179         }
       
  2180     else if ( aActiveTab == 2 )
       
  2181         {
       
  2182         DrawPassiveTab( aTabDrawMode,
       
  2183                         aLayout.iFourthTab.iLeft,
       
  2184                         aLayout.iFourthTab.iMiddle,
       
  2185                         aLayout.iFourthTab.iRight,
       
  2186                         aGc );
       
  2187         
       
  2188         DrawPassiveTab( aTabDrawMode,
       
  2189                         aLayout.iThirdTab.iLeft,
       
  2190                         aLayout.iThirdTab.iMiddle,
       
  2191                         aLayout.iThirdTab.iRight,
       
  2192                         aGc );
       
  2193         
       
  2194         DrawPassiveTab( aTabDrawMode,
       
  2195                         aLayout.iFirstTab.iLeft,
       
  2196                         aLayout.iFirstTab.iMiddle,
       
  2197                         aLayout.iFirstTab.iRight,
       
  2198                         aGc );
       
  2199         
       
  2200         DrawActiveTab( aTabDrawMode,
       
  2201                        aLayout.iSecondTab.iLeft,
       
  2202                        aLayout.iSecondTab.iMiddle,
       
  2203                        aLayout.iSecondTab.iRight,
       
  2204                        aGc );
       
  2205         }
       
  2206     else if ( aActiveTab == 3 )
       
  2207         {
       
  2208         DrawPassiveTab( aTabDrawMode,
       
  2209                         aLayout.iFirstTab.iLeft,
       
  2210                         aLayout.iFirstTab.iMiddle,
       
  2211                         aLayout.iFirstTab.iRight,
       
  2212                         aGc );
       
  2213         
       
  2214         DrawPassiveTab( aTabDrawMode,
       
  2215                         aLayout.iSecondTab.iLeft,
       
  2216                         aLayout.iSecondTab.iMiddle,
       
  2217                         aLayout.iSecondTab.iRight,
       
  2218                         aGc );
       
  2219         
       
  2220         DrawPassiveTab( aTabDrawMode,
       
  2221                         aLayout.iFourthTab.iLeft,
       
  2222                         aLayout.iFourthTab.iMiddle,
       
  2223                         aLayout.iFourthTab.iRight,
       
  2224                         aGc );
       
  2225         
       
  2226         DrawActiveTab( aTabDrawMode,
       
  2227                        aLayout.iThirdTab.iLeft,
       
  2228                        aLayout.iThirdTab.iMiddle,
       
  2229                        aLayout.iThirdTab.iRight,
       
  2230                        aGc );
       
  2231         }
       
  2232     else if ( aActiveTab == 4 )
       
  2233         {
       
  2234         DrawPassiveTab( aTabDrawMode,
       
  2235                         aLayout.iFirstTab.iLeft,
       
  2236                         aLayout.iFirstTab.iMiddle,
       
  2237                         aLayout.iFirstTab.iRight,
       
  2238                         aGc );
       
  2239         
       
  2240         DrawPassiveTab( aTabDrawMode,
       
  2241                         aLayout.iSecondTab.iLeft,
       
  2242                         aLayout.iSecondTab.iMiddle,
       
  2243                         aLayout.iSecondTab.iRight,
       
  2244                         aGc );
       
  2245         
       
  2246         DrawPassiveTab( aTabDrawMode,
       
  2247                         aLayout.iThirdTab.iLeft,
       
  2248                         aLayout.iThirdTab.iMiddle,
       
  2249                         aLayout.iThirdTab.iRight,
       
  2250                         aGc );
       
  2251         
       
  2252         DrawActiveTab( aTabDrawMode,
       
  2253                        aLayout.iFourthTab.iLeft,
       
  2254                        aLayout.iFourthTab.iMiddle,
       
  2255                        aLayout.iFourthTab.iRight,
       
  2256                        aGc );
       
  2257         }
       
  2258     }
       
  2259 
       
  2260 void CAknTabGroupGraphics::DrawFourTabNarrowBackground( TTabDrawMode aTabDrawMode,
       
  2261                                                         TInt aActiveTab,
       
  2262                                                         CBitmapContext* aGc,
       
  2263                                                         SAknTabGroupBackgroundLayout& aLayout ) const
       
  2264     {
       
  2265     // If not given layout, then get the default layout
       
  2266     if ( !aLayout.iUse )
       
  2267         {
       
  2268         aLayout = FourTabBackground( aActiveTab );
       
  2269         }
       
  2270 
       
  2271     if ( aActiveTab == 1 )
       
  2272         {
       
  2273         DrawPassiveTab( aTabDrawMode,
       
  2274                         aLayout.iFourthTab.iLeft,
       
  2275                         aLayout.iFourthTab.iMiddle,
       
  2276                         aLayout.iFourthTab.iRight,
       
  2277                         aGc );
       
  2278         
       
  2279         DrawPassiveTab( aTabDrawMode,
       
  2280                         aLayout.iThirdTab.iLeft,
       
  2281                         aLayout.iThirdTab.iMiddle,
       
  2282                         aLayout.iThirdTab.iRight,
       
  2283                         aGc );
       
  2284         
       
  2285         DrawPassiveTab( aTabDrawMode,
       
  2286                         aLayout.iSecondTab.iLeft,
       
  2287                         aLayout.iSecondTab.iMiddle,
       
  2288                         aLayout.iSecondTab.iRight,
       
  2289                         aGc );
       
  2290         
       
  2291         DrawActiveTab( aTabDrawMode,
       
  2292                        aLayout.iFirstTab.iLeft,
       
  2293                        aLayout.iFirstTab.iMiddle,
       
  2294                        aLayout.iFirstTab.iRight,
       
  2295                        aGc );
       
  2296         }
       
  2297     else if ( aActiveTab == 2 )
       
  2298         {
       
  2299         DrawPassiveTab( aTabDrawMode,
       
  2300                         aLayout.iFourthTab.iLeft,
       
  2301                         aLayout.iFourthTab.iMiddle,
       
  2302                         aLayout.iFourthTab.iRight,
       
  2303                         aGc );
       
  2304         
       
  2305         DrawPassiveTab( aTabDrawMode, 
       
  2306                         aLayout.iThirdTab.iLeft,
       
  2307                         aLayout.iThirdTab.iMiddle,
       
  2308                         aLayout.iThirdTab.iRight,
       
  2309                         aGc );
       
  2310         
       
  2311         DrawPassiveTab( aTabDrawMode,
       
  2312                         aLayout.iFirstTab.iLeft,
       
  2313                         aLayout.iFirstTab.iMiddle,
       
  2314                         aLayout.iFirstTab.iRight,
       
  2315                         aGc );
       
  2316         
       
  2317         DrawActiveTab( aTabDrawMode,
       
  2318                        aLayout.iSecondTab.iLeft,
       
  2319                        aLayout.iSecondTab.iMiddle,
       
  2320                        aLayout.iSecondTab.iRight,
       
  2321                        aGc );
       
  2322         }
       
  2323     else if ( aActiveTab == 3 )
       
  2324         {
       
  2325         // Note the drawing order of passive tabs
       
  2326         DrawPassiveTab( aTabDrawMode,
       
  2327                         aLayout.iFirstTab.iLeft,
       
  2328                         aLayout.iFirstTab.iMiddle,
       
  2329                         aLayout.iFirstTab.iRight,
       
  2330                         aGc );
       
  2331         
       
  2332         DrawPassiveTab( aTabDrawMode,
       
  2333                         aLayout.iSecondTab.iLeft,
       
  2334                         aLayout.iSecondTab.iMiddle,
       
  2335                         aLayout.iSecondTab.iRight,
       
  2336                         aGc );
       
  2337         
       
  2338         DrawPassiveTab( aTabDrawMode,
       
  2339                         aLayout.iFourthTab.iLeft,
       
  2340                         aLayout.iFourthTab.iMiddle,
       
  2341                         aLayout.iFourthTab.iRight,
       
  2342                         aGc );
       
  2343         
       
  2344         DrawActiveTab( aTabDrawMode,
       
  2345                        aLayout.iThirdTab.iLeft,
       
  2346                        aLayout.iThirdTab.iMiddle,
       
  2347                        aLayout.iThirdTab.iRight,
       
  2348                        aGc );
       
  2349         }
       
  2350     else if ( aActiveTab == 4 )
       
  2351         {
       
  2352         // Note the drawing order of passive tabs
       
  2353         DrawPassiveTab( aTabDrawMode,
       
  2354                         aLayout.iFirstTab.iLeft,
       
  2355                         aLayout.iFirstTab.iMiddle,
       
  2356                         aLayout.iFirstTab.iRight,
       
  2357                         aGc );
       
  2358         
       
  2359         DrawPassiveTab( aTabDrawMode,
       
  2360                         aLayout.iSecondTab.iLeft,
       
  2361                         aLayout.iSecondTab.iMiddle,
       
  2362                         aLayout.iSecondTab.iRight,
       
  2363                         aGc );
       
  2364         
       
  2365         DrawPassiveTab( aTabDrawMode,
       
  2366                         aLayout.iThirdTab.iLeft,
       
  2367                         aLayout.iThirdTab.iMiddle,
       
  2368                         aLayout.iThirdTab.iRight,
       
  2369                         aGc );
       
  2370         
       
  2371         DrawActiveTab( aTabDrawMode,
       
  2372                        aLayout.iFourthTab.iLeft,
       
  2373                        aLayout.iFourthTab.iMiddle,
       
  2374                        aLayout.iFourthTab.iRight,
       
  2375                        aGc );
       
  2376         }
       
  2377     }
       
  2378 
       
  2379 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoLongTabBackground(TInt aActiveTab) const
       
  2380     {
       
  2381     SAknTabGroupBackgroundLayout aLayout;
       
  2382 
       
  2383     // screen
       
  2384     TRect screenRect;
       
  2385     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  2386     
       
  2387     TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  2388 
       
  2389     TRect parentRect( iTabGroupBackgroundParent );
       
  2390 
       
  2391     // two tabs pane
       
  2392     TRect naviTabsTwoPaneRect(
       
  2393         RectFromLayout( parentRect,
       
  2394                         AknLayoutScalable_Avkon::navi_tabs_2_long_pane() ) );
       
  2395 
       
  2396     TInt tabsActivePassivePaneOption = ( aActiveTab == 1 ) ? 0 : 1;
       
  2397 
       
  2398     // Tabs two passive pane
       
  2399     TRect tabsTwoPassivePaneRect(
       
  2400         RectFromLayout( naviTabsTwoPaneRect,
       
  2401                         AknLayoutScalable_Avkon::tabs_2_long_passive_pane(
       
  2402                             tabsActivePassivePaneOption ) ) );
       
  2403 
       
  2404     // Tabs two active pane
       
  2405     TRect tabsTwoActivePaneRect(
       
  2406         RectFromLayout( naviTabsTwoPaneRect,
       
  2407                         AknLayoutScalable_Avkon::tabs_2_long_active_pane(
       
  2408                             tabsActivePassivePaneOption ) ) );
       
  2409 
       
  2410     // bg active tab pane
       
  2411     TRect tabsBackgroundActivePaneRect(
       
  2412         RectFromLayout( tabsTwoActivePaneRect,
       
  2413                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp4(
       
  2414                             landscape ) ) );
       
  2415 
       
  2416     // bg passive tab pane
       
  2417     TRect tabsBackgroundFirstPassivePaneRect(
       
  2418         RectFromLayout( tabsTwoPassivePaneRect,
       
  2419                         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp4(
       
  2420                             landscape ) ) );
       
  2421 
       
  2422     // Active tab left
       
  2423     TRect activeTabLeftPaneRect(
       
  2424         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2425                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp4() ) );
       
  2426 
       
  2427     // Active tab middle
       
  2428     TRect activeTabMiddlePaneRect(
       
  2429         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2430                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp4() ) );
       
  2431 
       
  2432     // Active tab right
       
  2433     TRect activeTabRightPaneRect(
       
  2434         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2435                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp4() ) );
       
  2436 
       
  2437     // First passive tab left
       
  2438     TRect firstPassiveTabLeftPaneRect(
       
  2439         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2440                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp4() ) );
       
  2441 
       
  2442     // First passive tab middle
       
  2443     TRect firstPassiveTabMiddlePaneRect(
       
  2444         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2445                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp4() ) );
       
  2446 
       
  2447     // First passive tab right
       
  2448     TRect firstPassiveTabRightPaneRect(
       
  2449         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2450                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp4() ) );
       
  2451 
       
  2452     if ( aActiveTab == 1 )
       
  2453         {
       
  2454         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  2455         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  2456         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  2457 
       
  2458         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2459         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2460         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  2461         }
       
  2462     else
       
  2463         {
       
  2464         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2465         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2466         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2467 
       
  2468         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  2469         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  2470         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  2471         }
       
  2472 
       
  2473     TRect nullRect( 0,0,0,0 );
       
  2474 
       
  2475     aLayout.iThirdTab.iLeft   = nullRect;
       
  2476     aLayout.iThirdTab.iMiddle = nullRect;
       
  2477     aLayout.iThirdTab.iRight  = nullRect;
       
  2478 
       
  2479     aLayout.iFourthTab.iLeft   = nullRect;
       
  2480     aLayout.iFourthTab.iMiddle = nullRect;
       
  2481     aLayout.iFourthTab.iRight  = nullRect;
       
  2482 
       
  2483     return aLayout;
       
  2484     }
       
  2485 
       
  2486 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoLongTabNarrowBackground(TInt aActiveTab) const
       
  2487     {
       
  2488     SAknTabGroupBackgroundLayout aLayout;
       
  2489 
       
  2490     TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  2491 
       
  2492     // navi tabs pane
       
  2493     TRect parentRect( NarrowParentRect() );
       
  2494 
       
  2495     // two tabs pane
       
  2496     TRect naviTabsTwoPaneRect(
       
  2497         RectFromLayout( parentRect,
       
  2498                         AknLayoutScalable_Avkon::navi_tabs_2_long_pane_srt() ) );
       
  2499 
       
  2500     TInt tabsActivePassivePaneOption = ( aActiveTab == 1 ) ? 0 : 1;
       
  2501 
       
  2502     // Tabs two passive pane
       
  2503     TRect tabsTwoPassivePaneRect(
       
  2504         RectFromLayout( naviTabsTwoPaneRect,
       
  2505                         AknLayoutScalable_Avkon::tabs_2_long_passive_pane_srt(
       
  2506                             tabsActivePassivePaneOption ) ) );
       
  2507 
       
  2508     // Tabs two active pane
       
  2509     TRect tabsTwoActivePaneRect(
       
  2510         RectFromLayout( naviTabsTwoPaneRect,
       
  2511                         AknLayoutScalable_Avkon::tabs_2_long_active_pane_srt(
       
  2512                             tabsActivePassivePaneOption ) ) );
       
  2513 
       
  2514     // bg active tab pane
       
  2515     TRect tabsBackgroundActivePaneRect(
       
  2516         RectFromLayout( tabsTwoActivePaneRect,
       
  2517                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp4_srt(
       
  2518                             landscape ) ) );
       
  2519 
       
  2520     // bg passive tab pane
       
  2521     TRect tabsBackgroundFirstPassivePaneRect(
       
  2522         RectFromLayout( tabsTwoPassivePaneRect,
       
  2523                         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp4_srt(
       
  2524                             landscape ) ) );
       
  2525 
       
  2526     // Active tab left
       
  2527     TRect activeTabLeftPaneRect(
       
  2528         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2529                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp4_srt() ) );
       
  2530 
       
  2531     // Active tab middle
       
  2532     TRect activeTabMiddlePaneRect(
       
  2533         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2534                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp4_srt() ) );
       
  2535 
       
  2536     // Active tab right
       
  2537     TRect activeTabRightPaneRect(
       
  2538         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2539                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp4_srt() ) );
       
  2540 
       
  2541     // First passive tab left
       
  2542     TRect firstPassiveTabLeftPaneRect(
       
  2543         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2544                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp4_srt() ) );
       
  2545 
       
  2546     // First passive tab middle
       
  2547     TRect firstPassiveTabMiddlePaneRect(
       
  2548         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2549                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp4_srt() ) );
       
  2550 
       
  2551     // First passive tab right
       
  2552     TRect firstPassiveTabRightPaneRect(
       
  2553         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2554                         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp4_srt() ) );
       
  2555 
       
  2556 
       
  2557     if ( aActiveTab == 1 )
       
  2558         {
       
  2559         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  2560         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  2561         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  2562 
       
  2563         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2564         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2565         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  2566         }
       
  2567     else
       
  2568         {
       
  2569         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2570         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2571         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2572 
       
  2573         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  2574         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  2575         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  2576         }
       
  2577 
       
  2578     TRect nullRect( 0,0,0,0 );
       
  2579 
       
  2580     aLayout.iThirdTab.iLeft   = nullRect;
       
  2581     aLayout.iThirdTab.iMiddle = nullRect;
       
  2582     aLayout.iThirdTab.iRight  = nullRect;
       
  2583 
       
  2584     aLayout.iFourthTab.iLeft   = nullRect;
       
  2585     aLayout.iFourthTab.iMiddle = nullRect;
       
  2586     aLayout.iFourthTab.iRight  = nullRect;
       
  2587 
       
  2588     return aLayout;
       
  2589     }
       
  2590 
       
  2591 void CAknTabGroupGraphics::DrawTwoLongTabBackground(
       
  2592     TTabDrawMode aTabDrawMode,
       
  2593     TInt aActiveTab,
       
  2594     CBitmapContext* aGc,
       
  2595     SAknTabGroupBackgroundLayout& aLayout ) const
       
  2596     {
       
  2597     // If not given layout, then get the default layout
       
  2598     if ( !aLayout.iUse )
       
  2599         {
       
  2600         aLayout = TwoLongTabBackground( aActiveTab );
       
  2601         }
       
  2602 
       
  2603     if ( aActiveTab == 1 )
       
  2604         {
       
  2605         DrawPassiveTab( aTabDrawMode,
       
  2606                         aLayout.iSecondTab.iLeft,
       
  2607                         aLayout.iSecondTab.iMiddle,
       
  2608                         aLayout.iSecondTab.iRight,
       
  2609                         aGc );
       
  2610                         
       
  2611         DrawActiveTab( aTabDrawMode,
       
  2612                        aLayout.iFirstTab.iLeft,
       
  2613                        aLayout.iFirstTab.iMiddle,
       
  2614                        aLayout.iFirstTab.iRight,
       
  2615                        aGc );
       
  2616         }
       
  2617     else
       
  2618         {
       
  2619         DrawPassiveTab( aTabDrawMode,
       
  2620                         aLayout.iFirstTab.iLeft,
       
  2621                         aLayout.iFirstTab.iMiddle,
       
  2622                         aLayout.iFirstTab.iRight,
       
  2623                         aGc );
       
  2624                         
       
  2625         DrawActiveTab( aTabDrawMode,
       
  2626                        aLayout.iSecondTab.iLeft,
       
  2627                        aLayout.iSecondTab.iMiddle,
       
  2628                        aLayout.iSecondTab.iRight,
       
  2629                        aGc );
       
  2630         }
       
  2631     }
       
  2632 
       
  2633 void CAknTabGroupGraphics::DrawTwoLongTabNarrowBackground(
       
  2634     TTabDrawMode aTabDrawMode,
       
  2635     TInt aActiveTab,
       
  2636     CBitmapContext* aGc,
       
  2637     SAknTabGroupBackgroundLayout& aLayout ) const
       
  2638     {
       
  2639     // If not given layout, then get the default layout
       
  2640     if ( !aLayout.iUse )
       
  2641         {
       
  2642         aLayout = TwoLongTabBackground( aActiveTab );
       
  2643         }
       
  2644 
       
  2645     if ( aActiveTab == 1 )
       
  2646         {
       
  2647         DrawPassiveTab( aTabDrawMode,
       
  2648                         aLayout.iSecondTab.iLeft,
       
  2649                         aLayout.iSecondTab.iMiddle,
       
  2650                         aLayout.iSecondTab.iRight,
       
  2651                         aGc );
       
  2652                         
       
  2653         DrawActiveTab( aTabDrawMode,
       
  2654                        aLayout.iFirstTab.iLeft,
       
  2655                        aLayout.iFirstTab.iMiddle,
       
  2656                        aLayout.iFirstTab.iRight,
       
  2657                        aGc );
       
  2658         }
       
  2659     else
       
  2660         {
       
  2661         DrawPassiveTab( aTabDrawMode,
       
  2662                         aLayout.iFirstTab.iLeft,
       
  2663                         aLayout.iFirstTab.iMiddle,
       
  2664                         aLayout.iFirstTab.iRight,
       
  2665                         aGc );
       
  2666                         
       
  2667         DrawActiveTab( aTabDrawMode,
       
  2668                        aLayout.iSecondTab.iLeft, 
       
  2669                        aLayout.iSecondTab.iMiddle,
       
  2670                        aLayout.iSecondTab.iRight,
       
  2671                        aGc );
       
  2672         }
       
  2673     }
       
  2674 
       
  2675 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeLongTabBackground(TInt aActiveTab) const
       
  2676     {
       
  2677     SAknTabGroupBackgroundLayout aLayout;
       
  2678     
       
  2679     // screen
       
  2680     TRect screenRect;
       
  2681     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  2682     
       
  2683     TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  2684 
       
  2685     TRect parentRect( iTabGroupBackgroundParent );
       
  2686 
       
  2687     // navi tabs 3 pane
       
  2688     TRect naviTabsThreePaneRect(
       
  2689         RectFromLayout( parentRect,
       
  2690                         AknLayoutScalable_Avkon::navi_tabs_3_long_pane() ) );
       
  2691 
       
  2692     TRect tabsPassiveFirstPaneRect;
       
  2693     TRect tabsPassiveSecondPaneRect;
       
  2694     TRect tabsActivePaneRect;
       
  2695 
       
  2696     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
  2697     TRect parent( naviTabsThreePaneRect );
       
  2698     
       
  2699     TAknWindowComponentLayout aFirstTab(
       
  2700         AknLayoutScalable_Avkon::tabs_3_long_active_pane( 0 ) );
       
  2701     
       
  2702     TAknWindowComponentLayout aSecondTab(
       
  2703         AknLayoutScalable_Avkon::tabs_3_long_passive_pane( 0 ) );
       
  2704     
       
  2705     TAknWindowComponentLayout aThirdTab(
       
  2706         AknLayoutScalable_Avkon::tabs_3_long_passive_pane_cp( 0 ) );
       
  2707         
       
  2708     if ( aActiveTab == 1 )
       
  2709         {
       
  2710         tabsActivePaneRect        = RectFromLayout( parent, aFirstTab );
       
  2711         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aSecondTab );
       
  2712         tabsPassiveSecondPaneRect = RectFromLayout( parent, aThirdTab );
       
  2713         }
       
  2714     else if ( aActiveTab == 2 )
       
  2715         {
       
  2716         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aFirstTab );
       
  2717         tabsActivePaneRect        = RectFromLayout( parent, aSecondTab );
       
  2718         tabsPassiveSecondPaneRect = RectFromLayout( parent, aThirdTab );
       
  2719         }
       
  2720     else if ( aActiveTab == 3 )
       
  2721         {
       
  2722         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aFirstTab );
       
  2723         tabsPassiveSecondPaneRect = RectFromLayout( parent, aSecondTab );
       
  2724         tabsActivePaneRect        = RectFromLayout( parent, aThirdTab );
       
  2725         }
       
  2726 
       
  2727     // Tabs 3 first passive tab pane
       
  2728     TRect tabsThreePassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
  2729 
       
  2730     // Tabs 3 second passive tab pane
       
  2731     TRect tabsThreePassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
  2732 
       
  2733     // Tabs 3 active tab pane
       
  2734     TRect tabsThreeActivePaneRect( tabsActivePaneRect );
       
  2735     
       
  2736     TAknWindowComponentLayout passivePaneLayout(
       
  2737         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp5( landscape ) );
       
  2738         
       
  2739     TAknWindowComponentLayout passiveTabLayout1(
       
  2740         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp5() );
       
  2741         
       
  2742     TAknWindowComponentLayout passiveTabLayout2(
       
  2743         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp5() );
       
  2744     
       
  2745     TAknWindowComponentLayout passiveTabLayout3(
       
  2746         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp5() );
       
  2747 
       
  2748     // bg active tab pane
       
  2749     TRect tabsBackgroundActivePaneRect(
       
  2750         RectFromLayout( tabsThreeActivePaneRect,
       
  2751                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp5( landscape ) ) );
       
  2752 
       
  2753     // bg first passive tab pane
       
  2754     TRect tabsBackgroundFirstPassivePaneRect(
       
  2755         RectFromLayout( tabsThreePassiveFirstPaneRect,
       
  2756                         passivePaneLayout ) );
       
  2757 
       
  2758     // bg second passive tab pane
       
  2759     TRect tabsBackgroundSecondPassivePaneRect(
       
  2760         RectFromLayout( tabsThreePassiveSecondPaneRect,
       
  2761                         passivePaneLayout ) );
       
  2762 
       
  2763 
       
  2764     // Active tab left
       
  2765     TRect activeTabLeftPaneRect(
       
  2766         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2767                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp5() ) );
       
  2768 
       
  2769     // Active tab middle
       
  2770     TRect activeTabMiddlePaneRect(
       
  2771         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2772                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp5() ) );
       
  2773 
       
  2774     // Active tab right
       
  2775     TRect activeTabRightPaneRect(
       
  2776         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2777                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp5() ) );
       
  2778 
       
  2779 
       
  2780     // First passive tab left
       
  2781     TRect firstPassiveTabLeftPaneRect(
       
  2782         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2783                         passiveTabLayout1 ) );
       
  2784 
       
  2785     // First passive tab middle
       
  2786     TRect firstPassiveTabMiddlePaneRect(
       
  2787         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2788                         passiveTabLayout2 ) );
       
  2789 
       
  2790     // First passive tab right
       
  2791     TRect firstPassiveTabRightPaneRect(
       
  2792         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2793                         passiveTabLayout3 ) );
       
  2794 
       
  2795 
       
  2796     // Second passive tab left
       
  2797     TRect secondPassiveTabLeftPaneRect(
       
  2798         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2799                         passiveTabLayout1 ) );
       
  2800 
       
  2801     // Second passive tab middle
       
  2802     TRect secondPassiveTabMiddlePaneRect(
       
  2803         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2804                         passiveTabLayout2 ) );
       
  2805 
       
  2806     // Second passive tab right
       
  2807     TRect secondPassiveTabRightPaneRect(
       
  2808         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2809                         passiveTabLayout3 ) );
       
  2810 
       
  2811     if ( aActiveTab == 1 )
       
  2812         {
       
  2813         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  2814         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  2815         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  2816 
       
  2817         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2818         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2819         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  2820 
       
  2821         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2822         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2823         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  2824         }
       
  2825     else if ( aActiveTab == 2 )
       
  2826         {
       
  2827         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2828         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2829         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2830 
       
  2831         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  2832         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  2833         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  2834 
       
  2835         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2836         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2837         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  2838         }
       
  2839     else if ( aActiveTab == 3 )
       
  2840         {
       
  2841         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  2842         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  2843         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  2844 
       
  2845         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  2846         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  2847         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  2848 
       
  2849         aLayout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  2850         aLayout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  2851         aLayout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  2852         }
       
  2853 
       
  2854     aLayout.iFourthTab.iLeft   = TRect(0,0,0,0);
       
  2855     aLayout.iFourthTab.iMiddle = TRect(0,0,0,0);
       
  2856     aLayout.iFourthTab.iRight  = TRect(0,0,0,0);
       
  2857 
       
  2858     return aLayout;
       
  2859     }
       
  2860 
       
  2861 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeLongTabNarrowBackground(
       
  2862     TInt aActiveTab ) const
       
  2863     {
       
  2864     SAknTabGroupBackgroundLayout aLayout;
       
  2865     
       
  2866     TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  2867     
       
  2868     // navi tabs pane
       
  2869     TRect parentRect( NarrowParentRect() );
       
  2870 
       
  2871     // navi tabs 3 pane
       
  2872     TRect naviTabsThreePaneRect(
       
  2873         RectFromLayout( parentRect,
       
  2874                         AknLayoutScalable_Avkon::navi_tabs_3_long_pane_srt() ) );
       
  2875 
       
  2876     TRect tabsPassiveFirstPaneRect;
       
  2877     TRect tabsPassiveSecondPaneRect;
       
  2878     TRect tabsActivePaneRect;
       
  2879 
       
  2880     // We don't want to use options, just assume that active and passive tabs are same sizes.
       
  2881     TRect parent( naviTabsThreePaneRect );
       
  2882     
       
  2883     TAknWindowComponentLayout aFirstTab(
       
  2884         AknLayoutScalable_Avkon::tabs_3_long_active_pane_srt( 0 ) );
       
  2885         
       
  2886     TAknWindowComponentLayout aSecondTab(
       
  2887         AknLayoutScalable_Avkon::tabs_3_long_passive_pane_srt( 0 ) );
       
  2888         
       
  2889     TAknWindowComponentLayout aThirdTab(
       
  2890         AknLayoutScalable_Avkon::tabs_3_long_passive_pane_cp_srt( 0 ) );
       
  2891 
       
  2892     if ( aActiveTab == 1 )
       
  2893         {
       
  2894         tabsActivePaneRect        = RectFromLayout( parent, aFirstTab );
       
  2895         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aSecondTab );
       
  2896         tabsPassiveSecondPaneRect = RectFromLayout( parent, aThirdTab );
       
  2897         }
       
  2898     else if ( aActiveTab == 2)
       
  2899         {
       
  2900         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aFirstTab );
       
  2901         tabsActivePaneRect        = RectFromLayout( parent, aSecondTab );
       
  2902         tabsPassiveSecondPaneRect = RectFromLayout( parent, aThirdTab );
       
  2903         }
       
  2904     else if ( aActiveTab == 3)
       
  2905         {
       
  2906         tabsPassiveFirstPaneRect  = RectFromLayout( parent, aFirstTab );
       
  2907         tabsPassiveSecondPaneRect = RectFromLayout( parent, aSecondTab );
       
  2908         tabsActivePaneRect        = RectFromLayout( parent, aThirdTab );
       
  2909         }
       
  2910 
       
  2911     // Tabs 3 first passive tab pane
       
  2912     TRect tabsThreePassiveFirstPaneRect( tabsPassiveFirstPaneRect );
       
  2913 
       
  2914     // Tabs 3 second passive tab pane
       
  2915     TRect tabsThreePassiveSecondPaneRect( tabsPassiveSecondPaneRect );
       
  2916 
       
  2917     // Tabs 3 active tab pane
       
  2918     TRect tabsThreeActivePaneRect( tabsActivePaneRect );
       
  2919     
       
  2920     TAknWindowComponentLayout passivePaneLayout(
       
  2921         AknLayoutScalable_Avkon::bg_passive_tab_pane_cp5_srt( landscape ) );
       
  2922     TAknWindowComponentLayout passiveLayout1(
       
  2923         AknLayoutScalable_Avkon::bg_passive_tab_pane_g1_cp5_srt() );
       
  2924     TAknWindowComponentLayout passiveLayout2(
       
  2925         AknLayoutScalable_Avkon::bg_passive_tab_pane_g2_cp5_srt() );
       
  2926     TAknWindowComponentLayout passiveLayout3(
       
  2927         AknLayoutScalable_Avkon::bg_passive_tab_pane_g3_cp5_srt() );
       
  2928 
       
  2929     // bg active tab pane
       
  2930     TRect tabsBackgroundActivePaneRect(
       
  2931         RectFromLayout( tabsThreeActivePaneRect,
       
  2932                         AknLayoutScalable_Avkon::bg_active_tab_pane_cp5_srt( landscape ) ) );
       
  2933 
       
  2934     // bg first passive tab pane
       
  2935     TRect tabsBackgroundFirstPassivePaneRect(
       
  2936         RectFromLayout( tabsThreePassiveFirstPaneRect,
       
  2937                         passivePaneLayout ) );
       
  2938 
       
  2939     // bg second passive tab pane
       
  2940     TRect tabsBackgroundSecondPassivePaneRect(
       
  2941         RectFromLayout( tabsThreePassiveSecondPaneRect,
       
  2942                         passivePaneLayout ) );
       
  2943 
       
  2944 
       
  2945     // Active tab left
       
  2946     TRect activeTabLeftPaneRect(
       
  2947         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2948                         AknLayoutScalable_Avkon::bg_active_tab_pane_g1_cp5_srt() ) );
       
  2949 
       
  2950     // Active tab middle
       
  2951     TRect activeTabMiddlePaneRect(
       
  2952         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2953                         AknLayoutScalable_Avkon::bg_active_tab_pane_g2_cp5_srt() ) );
       
  2954 
       
  2955     // Active tab right
       
  2956     TRect activeTabRightPaneRect(
       
  2957         RectFromLayout( tabsBackgroundActivePaneRect,
       
  2958                         AknLayoutScalable_Avkon::bg_active_tab_pane_g3_cp5_srt() ) );
       
  2959 
       
  2960 
       
  2961     // First passive tab left
       
  2962     TRect firstPassiveTabLeftPaneRect(
       
  2963         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2964                         passiveLayout1 ) );
       
  2965 
       
  2966     // First passive tab middle
       
  2967     TRect firstPassiveTabMiddlePaneRect(
       
  2968         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2969                         passiveLayout2 ) );
       
  2970 
       
  2971     // First passive tab right
       
  2972     TRect firstPassiveTabRightPaneRect(
       
  2973         RectFromLayout( tabsBackgroundFirstPassivePaneRect,
       
  2974                         passiveLayout3 ) );
       
  2975 
       
  2976 
       
  2977     // Second passive tab left
       
  2978     TRect secondPassiveTabLeftPaneRect(
       
  2979         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2980                         passiveLayout1 ) );
       
  2981 
       
  2982     // Second passive tab middle
       
  2983     TRect secondPassiveTabMiddlePaneRect(
       
  2984         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2985                         passiveLayout2 ) );
       
  2986 
       
  2987     // Second passive tab right
       
  2988     TRect secondPassiveTabRightPaneRect(
       
  2989         RectFromLayout( tabsBackgroundSecondPassivePaneRect,
       
  2990                         passiveLayout3 ) );
       
  2991 
       
  2992 
       
  2993     if ( aActiveTab == 1 )
       
  2994         {
       
  2995         aLayout.iFirstTab.iLeft   = activeTabLeftPaneRect;
       
  2996         aLayout.iFirstTab.iMiddle = activeTabMiddlePaneRect;
       
  2997         aLayout.iFirstTab.iRight  = activeTabRightPaneRect;
       
  2998 
       
  2999         aLayout.iSecondTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  3000         aLayout.iSecondTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  3001         aLayout.iSecondTab.iRight  = firstPassiveTabRightPaneRect;
       
  3002 
       
  3003         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  3004         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  3005         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  3006         }
       
  3007     else if ( aActiveTab == 2)
       
  3008         {
       
  3009         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  3010         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  3011         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  3012 
       
  3013         aLayout.iSecondTab.iLeft   = activeTabLeftPaneRect;
       
  3014         aLayout.iSecondTab.iMiddle = activeTabMiddlePaneRect;
       
  3015         aLayout.iSecondTab.iRight  = activeTabRightPaneRect;
       
  3016 
       
  3017         aLayout.iThirdTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  3018         aLayout.iThirdTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  3019         aLayout.iThirdTab.iRight  = secondPassiveTabRightPaneRect;
       
  3020         }
       
  3021     else if ( aActiveTab == 3)
       
  3022         {
       
  3023         aLayout.iFirstTab.iLeft   = firstPassiveTabLeftPaneRect;
       
  3024         aLayout.iFirstTab.iMiddle = firstPassiveTabMiddlePaneRect;
       
  3025         aLayout.iFirstTab.iRight  = firstPassiveTabRightPaneRect;
       
  3026 
       
  3027         aLayout.iSecondTab.iLeft   = secondPassiveTabLeftPaneRect;
       
  3028         aLayout.iSecondTab.iMiddle = secondPassiveTabMiddlePaneRect;
       
  3029         aLayout.iSecondTab.iRight  = secondPassiveTabRightPaneRect;
       
  3030 
       
  3031         aLayout.iThirdTab.iLeft   = activeTabLeftPaneRect;
       
  3032         aLayout.iThirdTab.iMiddle = activeTabMiddlePaneRect;
       
  3033         aLayout.iThirdTab.iRight  = activeTabRightPaneRect;
       
  3034         }
       
  3035 
       
  3036     aLayout.iFourthTab.iLeft   = TRect(0,0,0,0);
       
  3037     aLayout.iFourthTab.iMiddle = TRect(0,0,0,0);
       
  3038     aLayout.iFourthTab.iRight  = TRect(0,0,0,0);
       
  3039 
       
  3040     return aLayout;
       
  3041     }
       
  3042 
       
  3043 void CAknTabGroupGraphics::DrawThreeLongTabBackground( TTabDrawMode aTabDrawMode,
       
  3044                                                        TInt aActiveTab, CBitmapContext* aGc,
       
  3045                                                        SAknTabGroupBackgroundLayout& aLayout ) const
       
  3046     {
       
  3047     // If not given layout, then get the default layout
       
  3048     if ( !aLayout.iUse )
       
  3049         {
       
  3050         aLayout = ThreeLongTabBackground( aActiveTab );
       
  3051         }
       
  3052 
       
  3053     if ( aActiveTab == 1 )
       
  3054         {
       
  3055         DrawPassiveTab( aTabDrawMode,
       
  3056                         aLayout.iThirdTab.iLeft,
       
  3057                         aLayout.iThirdTab.iMiddle,
       
  3058                         aLayout.iThirdTab.iRight,
       
  3059                         aGc );
       
  3060         DrawPassiveTab( aTabDrawMode,
       
  3061                         aLayout.iSecondTab.iLeft,
       
  3062                         aLayout.iSecondTab.iMiddle,
       
  3063                         aLayout.iSecondTab.iRight,
       
  3064                         aGc );
       
  3065         DrawActiveTab( aTabDrawMode,
       
  3066                        aLayout.iFirstTab.iLeft,
       
  3067                        aLayout.iFirstTab.iMiddle,
       
  3068                        aLayout.iFirstTab.iRight,
       
  3069                        aGc );
       
  3070         }
       
  3071     else if ( aActiveTab == 2)
       
  3072         {
       
  3073         DrawPassiveTab( aTabDrawMode,
       
  3074                         aLayout.iFirstTab.iLeft,
       
  3075                         aLayout.iFirstTab.iMiddle,
       
  3076                         aLayout.iFirstTab.iRight,
       
  3077                         aGc );
       
  3078         DrawPassiveTab( aTabDrawMode,
       
  3079                         aLayout.iThirdTab.iLeft,
       
  3080                         aLayout.iThirdTab.iMiddle,
       
  3081                         aLayout.iThirdTab.iRight,
       
  3082                         aGc );
       
  3083         DrawActiveTab( aTabDrawMode,
       
  3084                         aLayout.iSecondTab.iLeft,
       
  3085                         aLayout.iSecondTab.iMiddle,
       
  3086                         aLayout.iSecondTab.iRight,
       
  3087                         aGc );
       
  3088         }
       
  3089     else if ( aActiveTab == 3)
       
  3090         {
       
  3091         DrawPassiveTab( aTabDrawMode,
       
  3092                         aLayout.iFirstTab.iLeft,
       
  3093                         aLayout.iFirstTab.iMiddle,
       
  3094                         aLayout.iFirstTab.iRight,
       
  3095                         aGc );
       
  3096         DrawPassiveTab( aTabDrawMode,
       
  3097                         aLayout.iSecondTab.iLeft,
       
  3098                         aLayout.iSecondTab.iMiddle,
       
  3099                         aLayout.iSecondTab.iRight,
       
  3100                         aGc );
       
  3101         DrawActiveTab( aTabDrawMode,
       
  3102                        aLayout.iThirdTab.iLeft,
       
  3103                        aLayout.iThirdTab.iMiddle,
       
  3104                        aLayout.iThirdTab.iRight,
       
  3105                        aGc );
       
  3106         }
       
  3107     }
       
  3108 
       
  3109 void CAknTabGroupGraphics::DrawThreeLongTabNarrowBackground( TTabDrawMode aTabDrawMode,
       
  3110                                                              TInt aActiveTab,
       
  3111                                                              CBitmapContext* aGc,
       
  3112                                                              SAknTabGroupBackgroundLayout& aLayout ) const
       
  3113     {
       
  3114     // If not given layout, then get the default layout
       
  3115     if ( !aLayout.iUse )
       
  3116         {
       
  3117         aLayout = ThreeLongTabBackground( aActiveTab );
       
  3118         }
       
  3119 
       
  3120     if ( aActiveTab == 1 )
       
  3121         {
       
  3122         DrawPassiveTab( aTabDrawMode,
       
  3123                         aLayout.iThirdTab.iLeft,
       
  3124                         aLayout.iThirdTab.iMiddle,
       
  3125                         aLayout.iThirdTab.iRight,
       
  3126                         aGc );
       
  3127         DrawPassiveTab( aTabDrawMode,
       
  3128                         aLayout.iSecondTab.iLeft,
       
  3129                         aLayout.iSecondTab.iMiddle,
       
  3130                         aLayout.iSecondTab.iRight,
       
  3131                         aGc );
       
  3132         DrawActiveTab( aTabDrawMode,
       
  3133                        aLayout.iFirstTab.iLeft,
       
  3134                        aLayout.iFirstTab.iMiddle,
       
  3135                        aLayout.iFirstTab.iRight,
       
  3136                        aGc );
       
  3137         }
       
  3138     else if ( aActiveTab == 2)
       
  3139         {
       
  3140         DrawPassiveTab( aTabDrawMode,
       
  3141                         aLayout.iFirstTab.iLeft,
       
  3142                         aLayout.iFirstTab.iMiddle,
       
  3143                         aLayout.iFirstTab.iRight,
       
  3144                         aGc );
       
  3145         DrawPassiveTab( aTabDrawMode,
       
  3146                         aLayout.iThirdTab.iLeft,
       
  3147                         aLayout.iThirdTab.iMiddle,
       
  3148                         aLayout.iThirdTab.iRight,
       
  3149                         aGc );
       
  3150         DrawActiveTab( aTabDrawMode,
       
  3151                         aLayout.iSecondTab.iLeft,
       
  3152                         aLayout.iSecondTab.iMiddle,
       
  3153                         aLayout.iSecondTab.iRight,
       
  3154                         aGc );
       
  3155         }
       
  3156     else if ( aActiveTab == 3)
       
  3157         {
       
  3158         DrawPassiveTab( aTabDrawMode,
       
  3159                         aLayout.iFirstTab.iLeft,
       
  3160                         aLayout.iFirstTab.iMiddle,
       
  3161                         aLayout.iFirstTab.iRight,
       
  3162                         aGc );
       
  3163         DrawPassiveTab( aTabDrawMode,
       
  3164                         aLayout.iSecondTab.iLeft,
       
  3165                         aLayout.iSecondTab.iMiddle,
       
  3166                         aLayout.iSecondTab.iRight,
       
  3167                         aGc );
       
  3168         DrawActiveTab( aTabDrawMode,
       
  3169                        aLayout.iThirdTab.iLeft,
       
  3170                        aLayout.iThirdTab.iMiddle,
       
  3171                        aLayout.iThirdTab.iRight,
       
  3172                        aGc );
       
  3173         }
       
  3174     }
       
  3175 
       
  3176 
       
  3177 // ---------------------------------------------------------------------------
       
  3178 // Draws single tab graphics for an active tab.
       
  3179 // ---------------------------------------------------------------------------
       
  3180 //
       
  3181 void CAknTabGroupGraphics::DrawActiveTab( TTabDrawMode aTabDrawMode,
       
  3182                                           TRect aLeft,
       
  3183                                           TRect aMiddle,
       
  3184                                           TRect aRight,
       
  3185                                           CBitmapContext* aGc ) const
       
  3186     {
       
  3187     AknIconUtils::SetSize( iActiveTabLeft,
       
  3188                            aLeft.Size(),
       
  3189                            EAspectRatioNotPreserved );
       
  3190 
       
  3191     AknIconUtils::SetSize( iActiveTabMiddle,
       
  3192                            aMiddle.Size(),
       
  3193                            EAspectRatioNotPreserved );
       
  3194 
       
  3195     AknIconUtils::SetSize( iActiveTabRight,
       
  3196                            aRight.Size(),
       
  3197                            EAspectRatioNotPreserved );
       
  3198 
       
  3199     TRect rect( aLeft );
       
  3200 
       
  3201     if ( aTabDrawMode == CAknTabGroupGraphics::ENoDraw )
       
  3202         {
       
  3203         return;
       
  3204         }
       
  3205     else if ( aTabDrawMode == CAknTabGroupGraphics::ENormal )
       
  3206         {
       
  3207         aGc->BitBltMasked( rect.iTl,
       
  3208                            iActiveTabLeft,
       
  3209                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3210                            iActiveTabLeftMask,
       
  3211                            ETrue );
       
  3212 
       
  3213         rect = aMiddle;
       
  3214         aGc->BitBltMasked( rect.iTl,
       
  3215                            iActiveTabMiddle,
       
  3216                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3217                            iActiveTabMiddleMask,
       
  3218                            ETrue );
       
  3219 
       
  3220         rect = aRight;
       
  3221         aGc->BitBltMasked( rect.iTl,
       
  3222                            iActiveTabRight,
       
  3223                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3224                            iActiveTabRightMask,
       
  3225                            ETrue );
       
  3226         }
       
  3227     else if ( aTabDrawMode == CAknTabGroupGraphics::EBitmapOnly )
       
  3228         {
       
  3229         aGc->BitBlt( rect.iTl,
       
  3230                      iActiveTabLeft,
       
  3231                      TRect( 0, 0, rect.Width(), rect.Height() ) );
       
  3232         rect = aMiddle;
       
  3233 
       
  3234         aGc->BitBlt( rect.iTl,
       
  3235                      iActiveTabMiddle,
       
  3236                      TRect( 0, 0, rect.Width(), rect.Height() ) );
       
  3237 
       
  3238         rect = aRight;
       
  3239         aGc->BitBlt( rect.iTl,
       
  3240                      iActiveTabRight,
       
  3241                      TRect( 0, 0, rect.Width(), rect.Height() ) );
       
  3242 
       
  3243         }
       
  3244     else if ( aTabDrawMode == CAknTabGroupGraphics::EMaskOnly )
       
  3245         {
       
  3246         aGc->BitBltMasked( rect.iTl,
       
  3247                            iActiveTabLeftMask,
       
  3248                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3249                            iActiveTabLeftMask,
       
  3250                            ETrue );
       
  3251 
       
  3252         rect = aMiddle;
       
  3253         aGc->BitBltMasked( rect.iTl,
       
  3254                            iActiveTabMiddleMask,
       
  3255                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3256                            iActiveTabMiddleMask,
       
  3257                            ETrue );
       
  3258 
       
  3259         rect = aRight;
       
  3260         aGc->BitBltMasked( rect.iTl,
       
  3261                            iActiveTabRightMask,
       
  3262                            TRect( 0, 0, rect.Width(), rect.Height() ),
       
  3263                            iActiveTabRightMask,
       
  3264                            ETrue );
       
  3265         }
       
  3266     }
       
  3267 
       
  3268 
       
  3269 // ---------------------------------------------------------------------------
       
  3270 // Draws single tab graphics for a passive tab.
       
  3271 // ---------------------------------------------------------------------------
       
  3272 //
       
  3273 void CAknTabGroupGraphics::DrawPassiveTab( TTabDrawMode aDrawMode,
       
  3274                                            TRect aLeft,
       
  3275                                            TRect aMiddle,
       
  3276                                            TRect aRight,
       
  3277                                            CBitmapContext* aGc,
       
  3278                                            TBool aFaded ) const
       
  3279     {
       
  3280     AknIconUtils::SetSize( iPassiveTabLeft,
       
  3281                            aLeft.Size(),
       
  3282                            EAspectRatioNotPreserved );
       
  3283 
       
  3284     AknIconUtils::SetSize( iPassiveTabMiddle,
       
  3285                            aMiddle.Size(),
       
  3286                            EAspectRatioNotPreserved );
       
  3287 
       
  3288     AknIconUtils::SetSize( iPassiveTabRight,
       
  3289                            aRight.Size(),
       
  3290                            EAspectRatioNotPreserved );
       
  3291 
       
  3292     TRect rect( aLeft );
       
  3293     
       
  3294     if ( aDrawMode != CAknTabGroupGraphics::ENoDraw )
       
  3295         {
       
  3296         if ( aFaded )
       
  3297             {
       
  3298             // Fading not currently supported.
       
  3299             /*aGc->SetFadingParameters( KHiddenFadeBlackMap,
       
  3300                                       KHiddenFadeWhiteMap );
       
  3301             aGc->SetFaded( ETrue );*/
       
  3302             }
       
  3303         }
       
  3304     else
       
  3305         {
       
  3306         return;
       
  3307         }
       
  3308     
       
  3309     if ( aDrawMode == CAknTabGroupGraphics::ENormal )
       
  3310         {
       
  3311         aGc->BitBltMasked( rect.iTl,
       
  3312                            iPassiveTabLeft,
       
  3313                            TRect( rect.Size() ),
       
  3314                            iPassiveTabLeftMask,
       
  3315                            ETrue );
       
  3316         rect = aMiddle;
       
  3317         aGc->BitBltMasked( rect.iTl,
       
  3318                            iPassiveTabMiddle,
       
  3319                            TRect( rect.Size() ),
       
  3320                            iPassiveTabMiddleMask,
       
  3321                            ETrue );
       
  3322 
       
  3323         rect = aRight;
       
  3324         aGc->BitBltMasked( rect.iTl,
       
  3325                            iPassiveTabRight,
       
  3326                            TRect( rect.Size() ),
       
  3327                            iPassiveTabRightMask,
       
  3328                            ETrue);
       
  3329         }
       
  3330     else if ( aDrawMode == CAknTabGroupGraphics::EBitmapOnly )
       
  3331         {
       
  3332         aGc->BitBlt( rect.iTl, iPassiveTabLeft, TRect( rect.Size() ) );
       
  3333 
       
  3334         rect = aMiddle;
       
  3335         aGc->BitBlt( rect.iTl, iPassiveTabMiddle, TRect( rect.Size() ) );
       
  3336 
       
  3337         rect = aRight;
       
  3338         aGc->BitBlt( rect.iTl, iPassiveTabRight, TRect( rect.Size() ) );
       
  3339         }
       
  3340     else if ( aDrawMode == CAknTabGroupGraphics::EMaskOnly )
       
  3341         {
       
  3342         aGc->BitBltMasked( rect.iTl,
       
  3343                            iPassiveTabLeftMask,
       
  3344                            TRect( rect.Size() ),
       
  3345                            iPassiveTabLeftMask,
       
  3346                            ETrue );
       
  3347 
       
  3348         rect = aMiddle;
       
  3349         aGc->BitBltMasked( rect.iTl,
       
  3350                            iPassiveTabMiddleMask,
       
  3351                            TRect( rect.Size() ),
       
  3352                            iPassiveTabMiddleMask,
       
  3353                            ETrue );
       
  3354 
       
  3355         rect = aRight;
       
  3356         aGc->BitBltMasked( rect.iTl,
       
  3357                            iPassiveTabRightMask,
       
  3358                            TRect( rect.Size() ),
       
  3359                            iPassiveTabRightMask,
       
  3360                            ETrue );
       
  3361         }
       
  3362 
       
  3363     if ( aFaded )
       
  3364         {
       
  3365         // Fading not currently supported.
       
  3366         //aGc->SetFaded( EFalse );
       
  3367         }
       
  3368     }
       
  3369 
       
  3370 
       
  3371 // ---------------------------------------------------------------------------
       
  3372 // Draws single tab part graphics for a passive tab.
       
  3373 // ---------------------------------------------------------------------------
       
  3374 //
       
  3375 void CAknTabGroupGraphics::DrawPassiveTabBit( TTabDrawMode aDrawMode,
       
  3376                                               TTabPart aTabPart,
       
  3377                                               TRect aRect,
       
  3378                                               CBitmapContext* aGc ) const
       
  3379     {
       
  3380     if ( aDrawMode == CAknTabGroupGraphics::ENoDraw )
       
  3381         {
       
  3382         return;
       
  3383         }
       
  3384     
       
  3385     // The passive tab bits are always parts of the hidden tabs and
       
  3386     // as such always drawn faded.
       
  3387     // Fading not currently supported.
       
  3388     //aGc->SetFadingParameters( KHiddenFadeBlackMap, KHiddenFadeWhiteMap );
       
  3389     //aGc->SetFaded( ETrue );
       
  3390 
       
  3391     CFbsBitmap* passiveTabBit     = NULL;
       
  3392     CFbsBitmap* passiveTabBitMask = NULL;
       
  3393     
       
  3394     TSize rectSize( aRect.Size() );
       
  3395     
       
  3396     switch ( aTabPart )
       
  3397         {
       
  3398         case ERight:
       
  3399             {
       
  3400             AknIconUtils::SetSize( iPassiveTabRight,
       
  3401                                    rectSize,
       
  3402                                    EAspectRatioNotPreserved );
       
  3403             passiveTabBit     = iPassiveTabRight;
       
  3404             passiveTabBitMask = iPassiveTabRightMask;
       
  3405             break;
       
  3406             }
       
  3407 
       
  3408         case ELeft:
       
  3409             {
       
  3410             AknIconUtils::SetSize( iPassiveTabLeft,
       
  3411                                    rectSize,
       
  3412                                    EAspectRatioNotPreserved );
       
  3413             passiveTabBit     = iPassiveTabLeft;
       
  3414             passiveTabBitMask = iPassiveTabLeftMask;
       
  3415             break;
       
  3416             }
       
  3417 
       
  3418         default:
       
  3419             {
       
  3420             return;
       
  3421             }
       
  3422         }
       
  3423 
       
  3424     if ( aDrawMode == CAknTabGroupGraphics::ENormal )
       
  3425         {
       
  3426         aGc->BitBltMasked( aRect.iTl,
       
  3427                            passiveTabBit,
       
  3428                            TRect( rectSize ),
       
  3429                            passiveTabBitMask,
       
  3430                            ETrue );
       
  3431         }
       
  3432     else if ( aDrawMode == CAknTabGroupGraphics::EBitmapOnly )
       
  3433         {
       
  3434         aGc->BitBlt( aRect.iTl, passiveTabBit, TRect( rectSize ) );
       
  3435         }
       
  3436     else if ( aDrawMode == CAknTabGroupGraphics::EMaskOnly )
       
  3437         {
       
  3438         aGc->BitBltMasked( aRect.iTl,
       
  3439                            passiveTabBitMask,
       
  3440                            TRect( rectSize ),
       
  3441                            passiveTabBitMask,
       
  3442                            ETrue );
       
  3443         }
       
  3444 
       
  3445     // Fading not currently supported.
       
  3446     //aGc->SetFaded( EFalse );
       
  3447     }
       
  3448 
       
  3449 
       
  3450 void CAknTabGroupGraphics::LoadTabGraphicsL()
       
  3451     {
       
  3452     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  3453     TAknsItemID iid;
       
  3454 
       
  3455     // active tabs
       
  3456     iid = KAknsIIDQgnGrafTabActiveL;
       
  3457     AknsUtils::CreateIconL( skin,
       
  3458                             iid,
       
  3459                             iActiveTabLeft,
       
  3460                             iActiveTabLeftMask,
       
  3461                             AknIconUtils::AvkonIconFileName(),
       
  3462                             EMbmAvkonQgn_graf_tab_active_l,
       
  3463                             EMbmAvkonQgn_graf_tab_active_l_mask );
       
  3464 
       
  3465     iid = KAknsIIDQgnGrafTabActiveM;
       
  3466     AknsUtils::CreateIconL( skin,
       
  3467                             iid,
       
  3468                             iActiveTabMiddle,
       
  3469                             iActiveTabMiddleMask,
       
  3470                             AknIconUtils::AvkonIconFileName(),
       
  3471                             EMbmAvkonQgn_graf_tab_active_m,
       
  3472                             EMbmAvkonQgn_graf_tab_active_m_mask );
       
  3473 
       
  3474     iid = KAknsIIDQgnGrafTabActiveR;
       
  3475     AknsUtils::CreateIconL( skin,
       
  3476                             iid,
       
  3477                             iActiveTabRight,
       
  3478                             iActiveTabRightMask,
       
  3479                             AknIconUtils::AvkonIconFileName(),
       
  3480                             EMbmAvkonQgn_graf_tab_active_r,
       
  3481                             EMbmAvkonQgn_graf_tab_active_r_mask );
       
  3482 
       
  3483     // passive tabs
       
  3484     iid = KAknsIIDQgnGrafTabPassiveL;
       
  3485     AknsUtils::CreateIconL( skin,
       
  3486                             iid,
       
  3487                             iPassiveTabLeft,
       
  3488                             iPassiveTabLeftMask,
       
  3489                             AknIconUtils::AvkonIconFileName(),
       
  3490                             EMbmAvkonQgn_graf_tab_passive_l,
       
  3491                             EMbmAvkonQgn_graf_tab_passive_l_mask );
       
  3492 
       
  3493     iid = KAknsIIDQgnGrafTabPassiveM;
       
  3494     AknsUtils::CreateIconL( skin,
       
  3495                             iid,
       
  3496                             iPassiveTabMiddle,
       
  3497                             iPassiveTabMiddleMask,
       
  3498                             AknIconUtils::AvkonIconFileName(),
       
  3499                             EMbmAvkonQgn_graf_tab_passive_m,
       
  3500                             EMbmAvkonQgn_graf_tab_passive_m_mask );
       
  3501 
       
  3502     iid = KAknsIIDQgnGrafTabPassiveR;
       
  3503     AknsUtils::CreateIconL( skin,
       
  3504                             iid,
       
  3505                             iPassiveTabRight,
       
  3506                             iPassiveTabRightMask,
       
  3507                             AknIconUtils::AvkonIconFileName(),
       
  3508                             EMbmAvkonQgn_graf_tab_passive_r,
       
  3509                             EMbmAvkonQgn_graf_tab_passive_r_mask );
       
  3510 
       
  3511     // Disable compression of the masks because the pointer event
       
  3512     // hit-test needs to use CFbsBitmap::GetPixel()-method.
       
  3513     AknIconUtils::DisableCompression( iActiveTabLeftMask );
       
  3514     AknIconUtils::DisableCompression( iActiveTabMiddleMask );
       
  3515     AknIconUtils::DisableCompression( iActiveTabRightMask );
       
  3516     AknIconUtils::DisableCompression( iPassiveTabLeftMask );
       
  3517     AknIconUtils::DisableCompression( iPassiveTabMiddleMask );
       
  3518     AknIconUtils::DisableCompression( iPassiveTabRightMask );
       
  3519     }
       
  3520 
       
  3521 TRect CAknTabGroupGraphics::RectFromLayout( TRect aParent,
       
  3522                                             TAknWindowComponentLayout aComponentLayout ) const
       
  3523     {
       
  3524     TAknLayoutRect layoutRect;
       
  3525     layoutRect.LayoutRect( aParent, aComponentLayout );
       
  3526     return layoutRect.Rect();
       
  3527     }
       
  3528 
       
  3529 
       
  3530 TRect CAknTabGroupGraphics::NarrowParentRect() const
       
  3531     {
       
  3532     // screen
       
  3533     TRect screenRect;
       
  3534     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screenRect );
       
  3535     
       
  3536     TBool landscape( Layout_Meta_Data::IsLandscapeOrientation() );
       
  3537 
       
  3538     // top area
       
  3539     TAknWindowComponentLayout areaLayout;
       
  3540     if ( landscape )
       
  3541         {
       
  3542         areaLayout = AknLayoutScalable_Avkon::area_top_pane( 8 );
       
  3543         }
       
  3544     else
       
  3545         {
       
  3546         areaLayout = AknLayoutScalable_Avkon::area_top_pane( 6 );
       
  3547         }
       
  3548     TRect areaRect( RectFromLayout( screenRect, areaLayout ) );
       
  3549 
       
  3550     // navi pane
       
  3551     TRect naviRect(
       
  3552         RectFromLayout( areaRect, AknLayoutScalable_Avkon::navi_pane( 2 ) ) );
       
  3553 
       
  3554     // short navi pane
       
  3555     TAknWindowComponentLayout naviSrtLayout;
       
  3556     if ( landscape )
       
  3557         {
       
  3558         naviSrtLayout = AknLayoutScalable_Avkon::navi_pane_srt( 0 );
       
  3559         }
       
  3560     else
       
  3561         {
       
  3562         naviSrtLayout = AknLayoutScalable_Avkon::navi_pane_srt( 3 );
       
  3563         }
       
  3564     TRect naviSrtRect( RectFromLayout( areaRect, naviSrtLayout ) );
       
  3565 
       
  3566     TRect parentRect( naviSrtRect );
       
  3567     
       
  3568     // Set relative to navipane coordinates
       
  3569     parentRect.Move( -naviRect.iTl.iX, 0 );
       
  3570     parentRect.iTl.iY = 0;
       
  3571     parentRect.SetHeight( iTabGroupBackgroundParent.Height() );
       
  3572 
       
  3573     // navi navi pane
       
  3574     TRect naviNaviPaneRect(
       
  3575         RectFromLayout( parentRect,
       
  3576                         AknLayoutScalable_Avkon::navi_navi_pane_srt() ) );
       
  3577 
       
  3578     // navi tabs pane
       
  3579     TRect naviNaviTabsPaneRect(
       
  3580         RectFromLayout( naviNaviPaneRect,
       
  3581                         AknLayoutScalable_Avkon::navi_navi_tabs_pane_srt() ) );
       
  3582 
       
  3583     if ( !landscape )
       
  3584         {
       
  3585         // In portrait mode the indicator pane width must be 
       
  3586         // taken into account separately.
       
  3587         TAknWindowLineLayout indicatorPaneLayout(
       
  3588             AknLayoutScalable_Avkon::uni_indicator_pane( 1 ).LayoutLine() );
       
  3589         naviNaviTabsPaneRect.Move(
       
  3590             AknLayoutUtils::LayoutMirrored() ? indicatorPaneLayout.iW :
       
  3591                                                -indicatorPaneLayout.iW,
       
  3592             0 );
       
  3593         }
       
  3594 
       
  3595     return naviNaviTabsPaneRect;
       
  3596     }
       
  3597 
       
  3598 
       
  3599 TBool CAknTabGroupGraphics::TabGroupBackgroundAvailable()
       
  3600     {
       
  3601     // 1. If SVG icons are not available, return false. We don't
       
  3602     //    want to use bitmap versions because those would look ugly in
       
  3603     //    this case (we prefer to default then to old style bitmaps).
       
  3604     //
       
  3605     // 2. If currently acive skin provides old bitmap tabs we
       
  3606     //    don't want to override those for skin backwards
       
  3607     //    compatibility reasons. But not in stacon pane because
       
  3608     //    many old skins do not look good in that layout.
       
  3609     //
       
  3610     // 3. Finally check if scalable UI data is not available
       
  3611     //    we cannot draw tabs from SVG because we don't have
       
  3612     //    access to layout data.
       
  3613 
       
  3614 #ifndef __SCALABLE_ICONS
       
  3615     return EFalse; // 1
       
  3616 #endif
       
  3617 
       
  3618     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
  3619     TAknsItemID iid;
       
  3620     iid.Set( EAknsMajorAvkon, EMbmAvkonQgn_graf_tab_21 );
       
  3621 
       
  3622     if ( AknsUtils::GetCachedBitmap( skin, iid ) &&
       
  3623          !AknStatuspaneUtils::StaconPaneActive() )
       
  3624         {
       
  3625         return EFalse; // 2.
       
  3626         }
       
  3627 
       
  3628     return iTabGroupBackgroundAvailable; // 3
       
  3629     }
       
  3630 
       
  3631 // End of file