uifw/AvKon/src/AknTabGrpGraphics.cpp
branchRCL_3
changeset 72 a5e7a4f63858
parent 56 d48ab3b357f1
equal deleted inserted replaced
64:85902f042028 72:a5e7a4f63858
    47 * SYMBIAN_USE_FAST_FADING is defined).
    47 * SYMBIAN_USE_FAST_FADING is defined).
    48 */
    48 */
    49 //const TUint8 KHiddenFadeBlackMap( 20 );
    49 //const TUint8 KHiddenFadeBlackMap( 20 );
    50 //const TUint8 KHiddenFadeWhiteMap( 255 );
    50 //const TUint8 KHiddenFadeWhiteMap( 255 );
    51 
    51 
    52 
       
    53 /****************************** New functions for refactoring tab drawing logic ******************************/
       
    54 /**
       
    55  * Specifies the structure of each drawing instruction
       
    56  */
       
    57 struct TTabInstruction
       
    58     {
       
    59     // 1 - Active tab, 2 - Passive tab, 3 - HighLight tab, 4 - Bit tab right, 5 - Bit tab left.
       
    60     TInt    iTabStyle;
       
    61 
       
    62     // 1 - iFirstTab, 2 - iSecondTab, 3 - iThirdTab, 4 - iFourthTab, 5 - iHiddenTabLeft, 6 - iHiddenTabRight.
       
    63     TInt    iLayoutIdx;
       
    64     
       
    65     // Rect for DrawPassiveTabBit.
       
    66     TRect   iBitTabRect;
       
    67     
       
    68     // Fade for DrawPassiveTab.
       
    69     TBool   iPassiveFade;
       
    70     };
       
    71 
       
    72 /******************** Three help functions for setting struct TTabInstruction. *******************/
       
    73 /**
       
    74  * Composes the instructions used for drawing passive bit tab.
       
    75  * 
       
    76  */
       
    77 void AssemblyPassiveTabBitInstruction( 
       
    78     TTabInstruction& instruction,
       
    79     TInt aTabStyle,
       
    80     TRect &aRect )
       
    81     {
       
    82     instruction.iTabStyle = aTabStyle;
       
    83     instruction.iBitTabRect = aRect;
       
    84     }
       
    85 
       
    86 /**
       
    87  * Composes the instructions used for drawing passive or highlight tab.
       
    88  * 
       
    89  */
       
    90 void AssemblyPassiveOrHighlightTabInstruction( 
       
    91     TTabInstruction& instruction,
       
    92     TInt aHighlightTab, 
       
    93     TInt aLayoutIdx, 
       
    94     TBool aFade )
       
    95     {
       
    96     if (aHighlightTab != 0 && aHighlightTab == aLayoutIdx)
       
    97         {
       
    98         //Highlight tab
       
    99         instruction.iTabStyle = 3;
       
   100         }
       
   101     else
       
   102         {
       
   103         instruction.iTabStyle = 2;
       
   104         }
       
   105     instruction.iLayoutIdx = aLayoutIdx;
       
   106     instruction.iPassiveFade = aFade;
       
   107     }
       
   108 
       
   109 /**
       
   110  * Composes the instructions for drawing active tab.
       
   111  * 
       
   112  */
       
   113 void AssemblyActiveTabInstruction(
       
   114     TTabInstruction& instruction,
       
   115     TInt aLayoutIdx )
       
   116     {
       
   117     instruction.iTabStyle = 1;
       
   118     instruction.iLayoutIdx = aLayoutIdx;
       
   119     }
       
   120 
       
   121 
       
   122 // ============================ MEMBER FUNCTIONS ===============================
    52 // ============================ MEMBER FUNCTIONS ===============================
   123 
    53 
   124 // -----------------------------------------------------------------------------
    54 // -----------------------------------------------------------------------------
   125 // CAknTabGroupGraphics::CAknTabGroupGraphics
    55 // CAknTabGroupGraphics::CAknTabGroupGraphics
   126 // C++ default constructor can NOT contain any code, that
    56 // C++ default constructor can NOT contain any code, that
   185 void CAknTabGroupGraphics::SetTabGroupBackgroundParent( TRect aParent )
   115 void CAknTabGroupGraphics::SetTabGroupBackgroundParent( TRect aParent )
   186     {
   116     {
   187     iTabGroupBackgroundParent = aParent;
   117     iTabGroupBackgroundParent = aParent;
   188     }
   118     }
   189     
   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 
   190 // ---------------------------------------------------------------------------
   326 // ---------------------------------------------------------------------------
   191 // Draws normal tab background from given parameters.
   327 // Draws normal tab background from given parameters.
   192 // ---------------------------------------------------------------------------
   328 // ---------------------------------------------------------------------------
   193 //
   329 //
   194 void CAknTabGroupGraphics::DrawTabGroupBackground(
   330 void CAknTabGroupGraphics::DrawTabGroupBackgroundL(
   195     TTabDrawMode aTabDrawMode,
   331     TTabDrawMode aTabDrawMode,
   196     TBool aLongTabs,
   332     TBool aLongTabs,
   197     TInt aNumberOfTabs,
   333     TInt aNumberOfTabs,
   198     TInt aActiveTab,
   334     TInt aActiveTab,
   199     CBitmapContext* aGc,
   335     CBitmapContext* aGc,
   200     SAknTabGroupBackgroundLayout& aLayout,
   336     SAknTabGroupBackgroundLayout& aLayout,
   201     TTabsHidden aTabsHidden,
   337     TTabsHidden aTabsHidden,
   202     TTabAnimationType aAnimation,
   338     TTabAnimationType aAnimation ) const
   203     TInt aHighlightTab ) const
   339     {
   204     {
   340     switch ( aNumberOfTabs )
   205     //Set the layout for tab background;
       
   206     ReviseLayoutForTabBackground(aLayout, aNumberOfTabs, aLongTabs, aActiveTab, EFalse, aAnimation);
       
   207     
       
   208     TInt insCnt = 0;
       
   209     TTabInstruction instruction[8];
       
   210     
       
   211     switch (aNumberOfTabs)
       
   212         {
   341         {
   213         case 2:
   342         case 2:
   214             {
   343             {
   215             if (aActiveTab == 1)
   344             if ( aLongTabs )
   216                 {
   345                 {
   217                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
   346                 DrawTwoLongTabBackground( aTabDrawMode,
   218                 AssemblyActiveTabInstruction(instruction[insCnt++], 1);
   347                                           aActiveTab,
       
   348                                           aGc,
       
   349                                           aLayout );
   219                 }
   350                 }
   220             else
   351             else
   221                 {
   352                 {
   222                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
   353                 DrawTwoTabBackground( aTabDrawMode,
   223                 AssemblyActiveTabInstruction(instruction[insCnt++], 2);
   354                                       aActiveTab,
       
   355                                       aGc,
       
   356                                       aLayout );
   224                 }
   357                 }
   225             }
       
   226             break;
   358             break;
       
   359             }
   227         case 3:
   360         case 3:
   228             {
   361             {
   229             if ( aLongTabs )
   362             if ( aLongTabs )
   230                 {
   363                 {
   231                 if (aActiveTab == 1)
   364                 DrawThreeLongTabBackground( aTabDrawMode,
   232                     {
   365                                             aActiveTab,
   233                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
   366                                             aGc,
   234                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
   367                                             aLayout );
   235                     AssemblyActiveTabInstruction(instruction[insCnt++], 1);
       
   236                     }
       
   237                 else if ( aActiveTab == 2)
       
   238                     {
       
   239                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   240                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
       
   241                     AssemblyActiveTabInstruction(instruction[insCnt++], 2);
       
   242                     }
       
   243                 else if ( aActiveTab == 3)
       
   244                     {
       
   245                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   246                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   247                     AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   248                     }
       
   249                 }
   368                 }
   250             else
   369             else
   251                 {
   370                 {
   252                 TInt xOffset(aLayout.iFirstTab.iRight.iBr.iX - aLayout.iSecondTab.iLeft.iTl.iX);
   371                 DrawThreeTabBackground( aTabDrawMode,
   253                 
   372                                         aActiveTab,
   254                 if (aActiveTab == 1)
   373                                         aGc,
   255                     {
   374                                         aLayout,
   256                     if (aTabsHidden == EOnRightSide)
   375                                         aTabsHidden,
   257                         {
   376                                         aAnimation );
   258                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 6, ETrue);
       
   259                         }
       
   260                     
       
   261                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
       
   262                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   263                     AssemblyActiveTabInstruction(instruction[insCnt++], 1);
       
   264                     }
       
   265                 else if (aActiveTab == 2)
       
   266                     {
       
   267                     switch (aTabsHidden)
       
   268                         {
       
   269                         case EOnLeftSide:
       
   270                             {
       
   271                             TRect bitRect(aLayout.iHiddenTabLeft.iLeft);
       
   272                             bitRect.Resize(xOffset, 0);
       
   273                             AssemblyPassiveTabBitInstruction(instruction[insCnt++], 5, bitRect);
       
   274                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 5,
       
   275                                     aAnimation != ECycleToLeft ? ETrue : EFalse);
       
   276                             }
       
   277                             break;
       
   278                         case EOnRightSide:
       
   279                             {
       
   280                             TRect bitRect(aLayout.iHiddenTabRight.iRight);
       
   281                             bitRect.Move(-xOffset, 0);
       
   282                             bitRect.Resize(xOffset, 0);
       
   283                             AssemblyPassiveTabBitInstruction(instruction[insCnt++], 4, bitRect);
       
   284                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 6,
       
   285                                     aAnimation != ECycleToRight ? ETrue : EFalse);
       
   286                             }
       
   287                             break;
       
   288                         case EOnBothSides:
       
   289                             {
       
   290                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 5,
       
   291                                     aAnimation != ECycleToLeft ? ETrue : EFalse);
       
   292                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 6,
       
   293                                     aAnimation != ECycleToRight ? ETrue : EFalse);
       
   294                             }
       
   295                             break;
       
   296                         case ETwoOnBothSides:
       
   297                             {
       
   298                             TRect bitRect(aLayout.iHiddenTabLeft.iLeft);
       
   299                             bitRect.Resize(xOffset, 0);
       
   300                             AssemblyPassiveTabBitInstruction(instruction[insCnt++], 5, bitRect);
       
   301                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 5,
       
   302                                     aAnimation != ECycleToLeft ? ETrue : EFalse);
       
   303 
       
   304                             bitRect = aLayout.iHiddenTabRight.iRight;
       
   305                             bitRect.Move(-xOffset, 0);
       
   306                             bitRect.Resize(xOffset, 0);
       
   307                             AssemblyPassiveTabBitInstruction(instruction[insCnt++], 4, bitRect);
       
   308                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 6,
       
   309                                     aAnimation != ECycleToRight ? ETrue : EFalse);
       
   310                             }
       
   311                             break;
       
   312                         case ENone:
       
   313                         default:
       
   314                             break;
       
   315                         }
       
   316 
       
   317                     if (aAnimation == ECycleToLeft)
       
   318                         {
       
   319                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, ETrue);
       
   320                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   321                         AssemblyActiveTabInstruction(instruction[insCnt++], 1);
       
   322                         }
       
   323                     else if ( aAnimation == ECycleToRight )
       
   324                         {
       
   325                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, ETrue);
       
   326                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   327                         AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   328                         }
       
   329                     else
       
   330                         {
       
   331                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   332                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
       
   333                 
       
   334                         if (aAnimation)
       
   335                             {
       
   336                             AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   337                             }
       
   338                         else
       
   339                             {
       
   340                             AssemblyActiveTabInstruction(instruction[insCnt++], 2);
       
   341                             }
       
   342                         }
       
   343                     }
       
   344                 else if (aActiveTab == 3)
       
   345                     {
       
   346                     if (aTabsHidden == EOnLeftSide)
       
   347                         {
       
   348                         AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 5, ETrue);
       
   349                         }
       
   350                     
       
   351                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   352                     AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   353                     AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   354                     }
       
   355                 }
   377                 }
   356             }
       
   357             break;
   378             break;
       
   379             }
   358         case 4:
   380         case 4:
   359             {
   381             {
   360             if (aActiveTab == 1)
   382             DrawFourTabBackground( aTabDrawMode,
   361                 {
   383                                    aActiveTab,
   362                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 4, EFalse);
   384                                    aGc,
   363                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
   385                                    aLayout );
   364                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   365                 AssemblyActiveTabInstruction(instruction[insCnt++], 1);
       
   366                 }
       
   367             else if ( aActiveTab == 2 )
       
   368                 {
       
   369                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 4, EFalse);
       
   370                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
       
   371                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   372                 AssemblyActiveTabInstruction(instruction[insCnt++], 2);
       
   373                 }
       
   374             else if ( aActiveTab == 3 )
       
   375                 {
       
   376                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   377                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   378                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 4, EFalse);
       
   379                 AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   380                 }
       
   381             else if ( aActiveTab == 4 )
       
   382                 {
       
   383                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 1, EFalse);
       
   384                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 2, EFalse);
       
   385                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], aHighlightTab, 3, EFalse);
       
   386                 AssemblyActiveTabInstruction(instruction[insCnt++], 4);
       
   387                 }
       
   388             }
       
   389             break;
   386             break;
       
   387             }
   390         default:
   388         default:
   391             {
   389             {
   392 #ifdef AVKON_RDEBUG_ERROR
   390 #ifdef AVKON_RDEBUG_ERROR
   393             RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab group background !") );
   391             RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab layout !") );
   394 #endif
   392 #endif
   395             break;
   393             }
   396             }
   394         }
   397         }
   395 
   398     
   396     if ( !aLayout.iUse )
   399     //Draw tab background according to instructions
   397         {
   400     ProcessDrawTabInstructions(instruction, insCnt, aTabDrawMode, aLayout, aGc);
   398         aLayout.iFirstTab.iActive  = EFalse;
   401     
   399         aLayout.iSecondTab.iActive = EFalse;
   402     ReviseLayoutUseFlag(aLayout, aActiveTab);
   400         aLayout.iThirdTab.iActive  = EFalse;
   403     }
   401         aLayout.iFourthTab.iActive = EFalse;
   404 
   402 
   405 void CAknTabGroupGraphics::DrawTabGroupNarrowBackground(
   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(
   406     TTabDrawMode aTabDrawMode,
   423     TTabDrawMode aTabDrawMode,
   407     TBool aLongTabs,
   424     TBool aLongTabs,
   408     TInt aNumberOfTabs,
   425     TInt aNumberOfTabs,
   409     TInt aActiveTab,
   426     TInt aActiveTab,
   410     CBitmapContext* aGc,
   427     CBitmapContext* aGc,
   411     SAknTabGroupBackgroundLayout& aLayout ) const
   428     SAknTabGroupBackgroundLayout& aLayout ) const
   412     {
   429     {
   413     //Set the layout for tab background;
       
   414     ReviseLayoutForTabBackground(aLayout, aNumberOfTabs, aLongTabs, aActiveTab, ETrue, ENoAnimation);
       
   415     
       
   416     TInt insCnt = 0;
       
   417     TTabInstruction instruction[6];
       
   418     
       
   419     switch ( aNumberOfTabs )
   430     switch ( aNumberOfTabs )
   420         {
   431         {
   421         case 2:
   432         case 2:
   422             {
   433             {
   423             if (aActiveTab == 1)
   434             if ( aLongTabs )
   424                 {
   435                 {
   425                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
   436                 if ( !aLayout.iUse )
   426                 AssemblyActiveTabInstruction(instruction[insCnt++], 1);
   437                     {
       
   438                     aLayout = TwoLongTabNarrowBackground( aActiveTab );
       
   439                     }
       
   440                 aLayout.iUse = ETrue;
       
   441                 DrawTwoLongTabNarrowBackground( aTabDrawMode,
       
   442                                                 aActiveTab,
       
   443                                                 aGc,
       
   444                                                 aLayout );
   427                 }
   445                 }
   428             else
   446             else
   429                 {
   447                 {
   430                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
   448                 if ( !aLayout.iUse )
   431                 AssemblyActiveTabInstruction(instruction[insCnt++], 2);
   449                     {
       
   450                     aLayout = TwoTabNarrowBackground( aActiveTab );
       
   451                     }
       
   452                 aLayout.iUse = ETrue;
       
   453                 DrawTwoTabNarrowBackground( aTabDrawMode,
       
   454                                             aActiveTab,
       
   455                                             aGc,
       
   456                                             aLayout );
   432                 }
   457                 }
   433             }
       
   434             break;
   458             break;
       
   459             }
   435         case 3:
   460         case 3:
   436             {
   461             {
   437             if (aActiveTab == 1)
   462             if ( aLongTabs )
   438                 {
   463                 {
   439                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 3, EFalse);
   464                 if ( !aLayout.iUse )
   440                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
   465                     {
   441                 AssemblyActiveTabInstruction(instruction[insCnt++], 1);
   466                     aLayout = ThreeLongTabNarrowBackground( aActiveTab );
       
   467                     }
       
   468                 aLayout.iUse = ETrue;
       
   469                 DrawThreeLongTabNarrowBackground( aTabDrawMode,
       
   470                                                   aActiveTab,
       
   471                                                   aGc,
       
   472                                                   aLayout );
   442                 }
   473                 }
   443             else if (aActiveTab == 2)
   474             else
   444                 {
   475                 {
   445                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
   476                 if ( !aLayout.iUse )
   446                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 3, EFalse);
   477                     {
   447                 AssemblyActiveTabInstruction(instruction[insCnt++], 2);
   478                     aLayout = ThreeTabNarrowBackground( aActiveTab );
       
   479                     }
       
   480                 aLayout.iUse = ETrue;
       
   481                 DrawThreeTabNarrowBackground( aTabDrawMode,
       
   482                                               aActiveTab,
       
   483                                               aGc,
       
   484                                               aLayout );
   448                 }
   485                 }
   449             else if (aActiveTab == 3)
   486             break;
       
   487             }
       
   488         case 4:
       
   489             {
       
   490             if ( !aLayout.iUse )
   450                 {
   491                 {
   451                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
   492                 aLayout = FourTabNarrowBackground( aActiveTab );
   452                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
       
   453                 AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   454                 }
   493                 }
   455             }
   494             aLayout.iUse = ETrue;
       
   495             DrawFourTabNarrowBackground( aTabDrawMode,
       
   496                                          aActiveTab,
       
   497                                          aGc,
       
   498                                          aLayout );
   456             break;
   499             break;
   457         case 4:
   500             }
   458             {
   501         default:
   459             if (aActiveTab == 1)
   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 )
   460                 {
   517                 {
   461                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 4, EFalse);
   518                 aLayout.iFirstTab.iActive = ETrue;
   462                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 3, EFalse);
       
   463                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
       
   464                 AssemblyActiveTabInstruction(instruction[insCnt++], 1);
       
   465                 }
   519                 }
   466             else if (aActiveTab == 2)
   520             else if ( aActiveTab == 2 )
   467                 {
   521                 {
   468                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 4, EFalse);
   522                 aLayout.iSecondTab.iActive = ETrue;
   469                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 3, EFalse);
       
   470                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
       
   471                 AssemblyActiveTabInstruction(instruction[insCnt++], 2);
       
   472                 }
   523                 }
   473             else if (aActiveTab == 3)
   524             else if ( aActiveTab == 3 )
   474                 {
   525                 {
   475                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
   526                 aLayout.iThirdTab.iActive = ETrue;
   476                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
       
   477                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 4, EFalse);
       
   478                 AssemblyActiveTabInstruction(instruction[insCnt++], 3);
       
   479                 }
   527                 }
   480             else if (aActiveTab == 4)
   528             else if ( aActiveTab == 4 )
   481                 {
   529                 {
   482                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 1, EFalse);
   530                 aLayout.iFourthTab.iActive = ETrue;
   483                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 2, EFalse);
       
   484                 AssemblyPassiveOrHighlightTabInstruction(instruction[insCnt++], 0, 3, EFalse);
       
   485                 AssemblyActiveTabInstruction(instruction[insCnt++], 4);
       
   486                 }
   531                 }
   487             }
   532             }
   488             break;
   533     }
   489         default:
       
   490             {
       
   491 #ifdef AVKON_RDEBUG_ERROR
       
   492             RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab narrow background !") );
       
   493 #endif
       
   494             break;
       
   495             }
       
   496         }
       
   497     
       
   498     //Draw tab background according to instructions
       
   499     ProcessDrawTabInstructions(instruction, insCnt, aTabDrawMode, aLayout, aGc);
       
   500     
       
   501     ReviseLayoutUseFlag(aLayout, aActiveTab);
       
   502     }
       
   503 
       
   504 
   534 
   505 TBool CAknTabGroupGraphics::TabClickedL( TInt aTabComponent,
   535 TBool CAknTabGroupGraphics::TabClickedL( TInt aTabComponent,
   506                                          const TRect& aTabRect,
   536                                          const TRect& aTabRect,
   507                                          const TPoint& aPoint,
   537                                          const TPoint& aPoint,
   508                                          TBool aIsActiveTab )
   538                                          TBool aIsActiveTab )
   811     aLayout.iFourthTab.iRight  = nullRect;
   841     aLayout.iFourthTab.iRight  = nullRect;
   812 
   842 
   813     return aLayout;
   843     return aLayout;
   814     }
   844     }
   815 
   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 
   816 // ---------------------------------------------------------------------------
   931 // ---------------------------------------------------------------------------
   817 // Extracts tab group background layout from layout data for three tab layout.
   932 // Extracts tab group background layout from layout data for three tab layout.
   818 // ---------------------------------------------------------------------------
   933 // ---------------------------------------------------------------------------
   819 //
   934 //
   820 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeTabBackground(
   935 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeTabBackground(
  1216     aLayout.iFourthTab.iRight = TRect(0,0,0,0);
  1331     aLayout.iFourthTab.iRight = TRect(0,0,0,0);
  1217 
  1332 
  1218     return aLayout;
  1333     return aLayout;
  1219     }
  1334     }
  1220 
  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 
  1221 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::FourTabBackground(
  1669 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::FourTabBackground(
  1222     TInt aActiveTab ) const
  1670     TInt aActiveTab ) const
  1223     {
  1671     {
  1224     SAknTabGroupBackgroundLayout aLayout;
  1672     SAknTabGroupBackgroundLayout aLayout;
  1225 
  1673 
  1690         }
  2138         }
  1691 
  2139 
  1692     return aLayout;
  2140     return aLayout;
  1693     }
  2141     }
  1694 
  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 
  1695 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoLongTabBackground(TInt aActiveTab) const
  2379 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::TwoLongTabBackground(TInt aActiveTab) const
  1696     {
  2380     {
  1697     SAknTabGroupBackgroundLayout aLayout;
  2381     SAknTabGroupBackgroundLayout aLayout;
  1698 
  2382 
  1699     // screen
  2383     // screen
  1900     aLayout.iFourthTab.iLeft   = nullRect;
  2584     aLayout.iFourthTab.iLeft   = nullRect;
  1901     aLayout.iFourthTab.iMiddle = nullRect;
  2585     aLayout.iFourthTab.iMiddle = nullRect;
  1902     aLayout.iFourthTab.iRight  = nullRect;
  2586     aLayout.iFourthTab.iRight  = nullRect;
  1903 
  2587 
  1904     return aLayout;
  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         }
  1905     }
  2673     }
  1906 
  2674 
  1907 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeLongTabBackground(TInt aActiveTab) const
  2675 CAknTabGroupGraphics::SAknTabGroupBackgroundLayout CAknTabGroupGraphics::ThreeLongTabBackground(TInt aActiveTab) const
  1908     {
  2676     {
  1909     SAknTabGroupBackgroundLayout aLayout;
  2677     SAknTabGroupBackgroundLayout aLayout;
  2269     aLayout.iFourthTab.iMiddle = TRect(0,0,0,0);
  3037     aLayout.iFourthTab.iMiddle = TRect(0,0,0,0);
  2270     aLayout.iFourthTab.iRight  = TRect(0,0,0,0);
  3038     aLayout.iFourthTab.iRight  = TRect(0,0,0,0);
  2271 
  3039 
  2272     return aLayout;
  3040     return aLayout;
  2273     }
  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 
  2274 
  3176 
  2275 // ---------------------------------------------------------------------------
  3177 // ---------------------------------------------------------------------------
  2276 // Draws single tab graphics for an active tab.
  3178 // Draws single tab graphics for an active tab.
  2277 // ---------------------------------------------------------------------------
  3179 // ---------------------------------------------------------------------------
  2278 //
  3180 //
  2724         }
  3626         }
  2725 
  3627 
  2726     return iTabGroupBackgroundAvailable; // 3
  3628     return iTabGroupBackgroundAvailable; // 3
  2727     }
  3629     }
  2728 
  3630 
  2729 void CAknTabGroupGraphics::DrawHighlightTabL(TTabDrawMode aDrawMode,
       
  2730         TRect aLeft, TRect aMiddle, TRect aRight, CBitmapContext* aGc) const
       
  2731     {
       
  2732     if ( aDrawMode == CAknTabGroupGraphics::ENoDraw )
       
  2733         {
       
  2734         return;
       
  2735         }
       
  2736 
       
  2737     TRect rect( aLeft );
       
  2738     CFbsBitmap* activeColorBitmap = new (ELeave) CFbsBitmap();
       
  2739     CleanupStack::PushL( activeColorBitmap );
       
  2740 
       
  2741     TDisplayMode screenDisplayMode( iPassiveTabLeft->DisplayMode() );
       
  2742     activeColorBitmap->Create( rect.Size(), screenDisplayMode );
       
  2743 
       
  2744     TRgb color;
       
  2745     AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), color,
       
  2746             KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG25 );
       
  2747 
       
  2748     CFbsBitmapDevice* destinationDevice = CFbsBitmapDevice::NewL( activeColorBitmap );
       
  2749     CleanupStack::PushL( destinationDevice );
       
  2750     CFbsBitGc* destinationGc;
       
  2751     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
  2752     destinationGc->SetPenColor( color );
       
  2753     destinationGc->SetPenStyle( CGraphicsContext::ESolidPen );
       
  2754     destinationGc->SetBrushColor( color );
       
  2755     destinationGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2756     destinationGc->DrawRect( TRect( activeColorBitmap->SizeInPixels() ) );
       
  2757 
       
  2758     delete destinationGc;
       
  2759     CleanupStack::PopAndDestroy( destinationDevice );
       
  2760 
       
  2761     aGc->BitBltMasked( rect.iTl, activeColorBitmap, 
       
  2762             TRect( 0, 0, rect.Width(), rect.Height() ), 
       
  2763             iPassiveTabLeftMask, ETrue );
       
  2764 
       
  2765     CleanupStack::PopAndDestroy( activeColorBitmap );
       
  2766 
       
  2767     /*********************************************************************/
       
  2768 
       
  2769     rect = aMiddle;
       
  2770 
       
  2771     CFbsBitmap* activeColorBitmapM = new (ELeave) CFbsBitmap();
       
  2772     CleanupStack::PushL( activeColorBitmapM );
       
  2773 
       
  2774     activeColorBitmapM->Create( rect.Size(), screenDisplayMode );
       
  2775 
       
  2776     destinationDevice = CFbsBitmapDevice::NewL( activeColorBitmapM );
       
  2777     CleanupStack::PushL( destinationDevice );
       
  2778     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
  2779     destinationGc->SetPenColor( color );
       
  2780     destinationGc->SetPenStyle( CGraphicsContext::ESolidPen );
       
  2781     destinationGc->SetBrushColor( color );
       
  2782     destinationGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2783     destinationGc->DrawRect( TRect( activeColorBitmapM->SizeInPixels() ) );
       
  2784 
       
  2785     delete destinationGc;
       
  2786     CleanupStack::PopAndDestroy( destinationDevice );
       
  2787 
       
  2788     aGc->BitBltMasked(rect.iTl, activeColorBitmapM, 
       
  2789             TRect(0, 0, rect.Width(), rect.Height() ), 
       
  2790             iPassiveTabMiddleMask, ETrue );
       
  2791     CleanupStack::PopAndDestroy( activeColorBitmapM );
       
  2792 
       
  2793     /*********************************************************************/
       
  2794 
       
  2795     rect = aRight;
       
  2796 
       
  2797     CFbsBitmap* activeColorBitmapR = new (ELeave) CFbsBitmap();
       
  2798     CleanupStack::PushL( activeColorBitmapR );
       
  2799 
       
  2800     activeColorBitmapR->Create( rect.Size(), screenDisplayMode );
       
  2801 
       
  2802     destinationDevice = CFbsBitmapDevice::NewL( activeColorBitmapR );
       
  2803     CleanupStack::PushL( destinationDevice );
       
  2804     User::LeaveIfError( destinationDevice->CreateContext( destinationGc ) );
       
  2805     destinationGc->SetPenColor( color );
       
  2806     destinationGc->SetPenStyle( CGraphicsContext::ESolidPen );
       
  2807     destinationGc->SetBrushColor( color );
       
  2808     destinationGc->SetBrushStyle( CGraphicsContext::ESolidBrush );
       
  2809     destinationGc->DrawRect( TRect( activeColorBitmapR->SizeInPixels() ) );
       
  2810 
       
  2811     delete destinationGc;
       
  2812     CleanupStack::PopAndDestroy( destinationDevice );
       
  2813     aGc->BitBltMasked( rect.iTl, activeColorBitmapR, 
       
  2814         TRect(0, 0, rect.Width(), rect.Height() ), 
       
  2815         iPassiveTabRightMask, ETrue );
       
  2816 
       
  2817     CleanupStack::PopAndDestroy( activeColorBitmapM );
       
  2818     }
       
  2819 
       
  2820 void CAknTabGroupGraphics::ReviseLayoutForTabBackground(
       
  2821     SAknTabGroupBackgroundLayout& aLayout,
       
  2822     TInt aNumberOfTabs,
       
  2823     TBool aLongTabs,
       
  2824     TInt aActiveTab,
       
  2825     TBool aIsNarrow,
       
  2826     TTabAnimationType aAnimation) const
       
  2827     {
       
  2828     if (aLayout.iUse)
       
  2829         {
       
  2830         // aLayout has been set, return directly.
       
  2831         return;
       
  2832         }
       
  2833     
       
  2834     if (aIsNarrow)
       
  2835         {
       
  2836         switch (aNumberOfTabs)
       
  2837             {
       
  2838             case 2:
       
  2839                 {
       
  2840                 aLayout = aLongTabs ? TwoLongTabNarrowBackground(aActiveTab) : TwoTabNarrowBackground(aActiveTab);
       
  2841                 break;
       
  2842                 }
       
  2843             case 3:
       
  2844                 {
       
  2845                 aLayout = aLongTabs ? ThreeLongTabNarrowBackground(aActiveTab) : ThreeTabNarrowBackground(aActiveTab);
       
  2846                 break;
       
  2847                 }
       
  2848             case 4:
       
  2849                 {
       
  2850                 aLayout = FourTabNarrowBackground(aActiveTab);
       
  2851                 break;
       
  2852                 }
       
  2853             default:
       
  2854                 {
       
  2855 #ifdef AVKON_RDEBUG_ERROR
       
  2856                 RDebug::Print(_L("CAknTabGroupGraphics: Unknown narrow tab layout !"));
       
  2857 #endif
       
  2858                 }
       
  2859             }
       
  2860         aLayout.iUse = ETrue;
       
  2861         }
       
  2862     else
       
  2863         {
       
  2864         switch (aNumberOfTabs)
       
  2865             {
       
  2866             case 2:
       
  2867                 {
       
  2868                 aLayout = aLongTabs ? TwoLongTabBackground(aActiveTab) : TwoTabBackground(aActiveTab);
       
  2869                 break;
       
  2870                 }
       
  2871             case 3:
       
  2872                 {
       
  2873                 if (aLongTabs)
       
  2874                     {
       
  2875                     aLayout = ThreeLongTabBackground(aActiveTab);
       
  2876                     }
       
  2877                 else
       
  2878                     {
       
  2879                     TInt animActiveTab = aActiveTab;
       
  2880                     if (aAnimation && aActiveTab == 2)
       
  2881                         {
       
  2882                         // Move the tab highlight already during the animation.
       
  2883                         animActiveTab = 
       
  2884                                 aAnimation == ECycleToLeft ? aActiveTab - 1 : aActiveTab + 1;
       
  2885                         }
       
  2886                     aLayout = ThreeTabBackground(animActiveTab);
       
  2887                     }
       
  2888                 break;
       
  2889                 }
       
  2890             case 4:
       
  2891                 {
       
  2892                 aLayout = FourTabBackground(aActiveTab);
       
  2893                 break;
       
  2894                 }
       
  2895             default:
       
  2896                 {
       
  2897 #ifdef AVKON_RDEBUG_ERROR
       
  2898                 RDebug::Print( _L("CAknTabGroupGraphics: Unknown tab layout !") );
       
  2899 #endif
       
  2900                 }
       
  2901             }
       
  2902         }
       
  2903     }
       
  2904 
       
  2905 void CAknTabGroupGraphics::ReviseLayoutUseFlag(
       
  2906     SAknTabGroupBackgroundLayout& aLayout,
       
  2907     TInt aActiveTab) const
       
  2908     {
       
  2909     if (!aLayout.iUse)
       
  2910         {
       
  2911         aLayout.iFirstTab.iActive  = EFalse;
       
  2912         aLayout.iSecondTab.iActive = EFalse;
       
  2913         aLayout.iThirdTab.iActive  = EFalse;
       
  2914         aLayout.iFourthTab.iActive = EFalse;
       
  2915 
       
  2916         if (aActiveTab == 1)
       
  2917             {
       
  2918             aLayout.iFirstTab.iActive = ETrue;
       
  2919             }
       
  2920         else if (aActiveTab == 2)
       
  2921             {
       
  2922             aLayout.iSecondTab.iActive = ETrue;
       
  2923             }
       
  2924         else if (aActiveTab == 3)
       
  2925             {
       
  2926             aLayout.iThirdTab.iActive = ETrue;
       
  2927             }
       
  2928         else if (aActiveTab == 4)
       
  2929             {
       
  2930             aLayout.iFourthTab.iActive = ETrue;
       
  2931             }
       
  2932         }
       
  2933     }
       
  2934 
       
  2935 
       
  2936 #define GET_TABLAYOUT_RECT(idx) do{ \
       
  2937         left = aLayout.idx.iLeft; \
       
  2938         middle = aLayout.idx.iMiddle; \
       
  2939         right = aLayout.idx.iRight; \
       
  2940 }while (0)
       
  2941 
       
  2942 void CAknTabGroupGraphics::ProcessDrawTabInstructions(
       
  2943     TTabInstruction *aInstructions,
       
  2944     TInt aNumOfIns,
       
  2945     TTabDrawMode aTabDrawMode,
       
  2946     SAknTabGroupBackgroundLayout& aLayout,
       
  2947     CBitmapContext* aGc) const
       
  2948     {
       
  2949     if (aInstructions == NULL || aNumOfIns <= 0 || aGc == NULL)
       
  2950         {
       
  2951         return;
       
  2952         }
       
  2953     
       
  2954     for ( TInt i = 0; i < aNumOfIns; i++ )
       
  2955         {
       
  2956         if ( aInstructions[i].iTabStyle == 5 || aInstructions[i].iTabStyle == 6 )
       
  2957             {
       
  2958             // Draw passive tab bit.
       
  2959             DrawPassiveTabBit(aTabDrawMode, 
       
  2960                               aInstructions[i].iTabStyle == 5 ? ELeft : ERight, 
       
  2961                               aInstructions[i].iBitTabRect, 
       
  2962                               aGc);
       
  2963             }
       
  2964         else
       
  2965             {
       
  2966             TBool layoutValid = ETrue;
       
  2967             TRect left, middle, right;
       
  2968             switch (aInstructions[i].iLayoutIdx)
       
  2969                 {
       
  2970                 case 1: 
       
  2971                     {
       
  2972                     GET_TABLAYOUT_RECT(iFirstTab); 
       
  2973                     break;
       
  2974                     }
       
  2975                 case 2: 
       
  2976                     {
       
  2977                     GET_TABLAYOUT_RECT(iSecondTab); 
       
  2978                     break;
       
  2979                     }
       
  2980                 case 3: 
       
  2981                     {
       
  2982                     GET_TABLAYOUT_RECT(iThirdTab); 
       
  2983                     break;
       
  2984                     }
       
  2985                 case 4: 
       
  2986                     {
       
  2987                     GET_TABLAYOUT_RECT(iFourthTab); 
       
  2988                     break;
       
  2989                     }
       
  2990                 case 5: 
       
  2991                     {
       
  2992                     GET_TABLAYOUT_RECT(iHiddenTabLeft); 
       
  2993                     break;
       
  2994                     }
       
  2995                 case 6: 
       
  2996                     {
       
  2997                     GET_TABLAYOUT_RECT(iHiddenTabRight); 
       
  2998                     break;
       
  2999                     }
       
  3000                 default:
       
  3001                     {
       
  3002                     layoutValid = EFalse;
       
  3003                     }
       
  3004                 }
       
  3005             
       
  3006             if (layoutValid)
       
  3007                 {
       
  3008                 if (aInstructions[i].iTabStyle == 1)
       
  3009                     {
       
  3010                     DrawActiveTab(aTabDrawMode, left, middle, right, aGc);
       
  3011                     }
       
  3012                 else if (aInstructions[i].iTabStyle == 2)
       
  3013                     {
       
  3014                     DrawPassiveTab(aTabDrawMode, left, middle, right, aGc, aInstructions[i].iPassiveFade);
       
  3015                     }
       
  3016                 else if (aInstructions[i].iTabStyle == 3)
       
  3017                     {
       
  3018                     TRAP_IGNORE( DrawHighlightTabL(aTabDrawMode, left, middle, right, aGc) );
       
  3019                     }
       
  3020                 }
       
  3021             }
       
  3022         }
       
  3023     }
       
  3024 
       
  3025 // End of file
  3631 // End of file