uifw/AvKon/src/eikfrlb.cpp
branchRCL_3
changeset 23 3d340a0166ff
parent 18 0aa5fbdfbc30
child 29 a8834a2e9a96
equal deleted inserted replaced
18:0aa5fbdfbc30 23:3d340a0166ff
   160 
   160 
   161         if ( backgroundDrawer )
   161         if ( backgroundDrawer )
   162             {
   162             {
   163             backgroundDrawer->Draw( *iGc, *control, r );
   163             backgroundDrawer->Draw( *iGc, *control, r );
   164             }
   164             }
   165         else if ( CAknEnv::Static()->TransparencyEnabled() )
   165         else
   166             {
   166             {
   167             AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
   167             AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
   168                                    KAknsDrawParamNoClearUnderImage );
   168                                    KAknsDrawParamNoClearUnderImage );
   169             }
       
   170         else
       
   171             {
       
   172             AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
       
   173                                    KAknsDrawParamNoClearUnderImage |
       
   174                                    KAknsDrawParamBottomLevelRGBOnly );
       
   175             }
   169             }
   176         }
   170         }
   177     else
   171     else
   178         {
   172         {
   179         iGc->Clear( r );
   173         iGc->Clear( r );
   217         transApi->StopDrawing();
   211         transApi->StopDrawing();
   218         }
   212         }
   219 #endif //RD_UI_TRANSITION_EFFECTS_LIST
   213 #endif //RD_UI_TRANSITION_EFFECTS_LIST
   220 
   214 
   221     TBool removeicon = (!aItemIsSelected && !ItemMarkReverse()) || (aItemIsSelected && ItemMarkReverse());
   215     TBool removeicon = (!aItemIsSelected && !ItemMarkReverse()) || (aItemIsSelected && ItemMarkReverse());
       
   216     
       
   217     if ( Flags() & CListItemDrawer::EMarkingModeEnabled )
       
   218         {
       
   219         removeicon = EFalse;
       
   220         }
   222 
   221 
   223     CFormattedCellListBoxData::TColors colors;
   222     CFormattedCellListBoxData::TColors colors;
   224     colors.iText=iTextColor;
   223     colors.iText=iTextColor;
   225     colors.iBack=iBackColor;
   224     colors.iBack=iBackColor;
   226     colors.iHighlightedText=iHighlightedTextColor;
   225     colors.iHighlightedText=iHighlightedTextColor;
   400     }
   399     }
   401 
   400 
   402 EXPORT_C void CFormattedCellListBoxItemDrawer::SetTopItemIndex(TInt aTop)
   401 EXPORT_C void CFormattedCellListBoxItemDrawer::SetTopItemIndex(TInt aTop)
   403     {
   402     {
   404     iTopItemIndex = aTop;
   403     iTopItemIndex = aTop;
   405     }
       
   406 
       
   407 void 
       
   408 CFormattedCellListBoxItemDrawer::DrawCurrentItemRect(const TRect& aRect) const
       
   409     {
       
   410     _AKNTRACE_FUNC_ENTER;    
       
   411     iGc->SetClippingRect(iViewRect);
       
   412     iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
       
   413     iGc->SetPenColor(iHighlightedBackColor);
       
   414     iGc->DrawRect(aRect);
       
   415     iGc->CancelClippingRect();
       
   416     _AKNTRACE_FUNC_EXIT;
       
   417     }
   404     }
   418 
   405 
   419 
   406 
   420 //
   407 //
   421 // CEikFormattedCellListBox
   408 // CEikFormattedCellListBox
   810         cc = itemDrawer->FormattedCellData()->SkinBackgroundContext();
   797         cc = itemDrawer->FormattedCellData()->SkinBackgroundContext();
   811         }
   798         }
   812     
   799     
   813     itemDrawer->SetTopItemIndex( iTopItemIndex );
   800     itemDrawer->SetTopItemIndex( iTopItemIndex );
   814 
   801 
   815     TBool transparencyEnabled = CAknEnv::Static()->TransparencyEnabled();
       
   816     TInt numberOfItems = iModel->NumberOfItems();
   802     TInt numberOfItems = iModel->NumberOfItems();
   817     
   803     
   818     if ( numberOfItems > 0 )
   804     if ( numberOfItems > 0 )
   819         {
   805         {
   820 		TBool drawingInitiated = ETrue;
   806 		TBool drawingInitiated = ETrue;
   822 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   808 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   823         MAknListBoxTfxInternal* transApi =
   809         MAknListBoxTfxInternal* transApi =
   824             CAknListLoader::TfxApiInternal( gc );
   810             CAknListLoader::TfxApiInternal( gc );
   825 #endif // RD_UI_TRANSITION_EFFECTS_LIST
   811 #endif // RD_UI_TRANSITION_EFFECTS_LIST
   826 		
   812 		
   827 		if ( transparencyEnabled )
   813         if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
   828 		    {
   814     		{
   829     		if ( iWin && iWin->GetDrawRect() == TRect::EUninitialized )
       
   830 	    		{
       
   831 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   815 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   832                 drawingInitiated = transApi && !transApi->EffectsDisabled();
   816             drawingInitiated = transApi && !transApi->EffectsDisabled();
   833 #else
   817 #else
   834                 drawingInitiated = EFalse;
   818             drawingInitiated = EFalse;
   835 #endif
   819 #endif
   836     			}
   820 			}
   837 
   821 
   838 	    	if ( !drawingInitiated )
   822     	if ( !drawingInitiated )
   839 		    	{
   823 	    	{
   840     			iWin->Invalidate( *aClipRect );
   824 			iWin->Invalidate( *aClipRect );
   841 	    		iWin->BeginRedraw( *aClipRect );
   825     		iWin->BeginRedraw( *aClipRect );
   842 		    	}
   826 	    	}
   843 		    }
       
   844 
   827 
   845         TInt lastPotentialItemIndex =
   828         TInt lastPotentialItemIndex =
   846             Min( numberOfItems,
   829             Min( numberOfItems,
   847                  iTopItemIndex + NumberOfItemsThatFitInRect( iViewRect ) );
   830                  iTopItemIndex + NumberOfItemsThatFitInRect( iViewRect ) );
   848 
   831 
       
   832         gc->SetClippingRect( iViewRect );
       
   833         
   849         while ( i < lastPotentialItemIndex )      
   834         while ( i < lastPotentialItemIndex )      
       
   835             {
       
   836             DrawItem( i++ );
       
   837             }
       
   838 
       
   839         gc->CancelClippingRect();
       
   840 
       
   841         if ( control && !static_cast<CEikListBox*>( control )->
       
   842                 BackgroundDrawingSuppressed() )
   850             {
   843             {
   851 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   844 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   852             if ( transApi )
   845             if ( transApi )
   853                 {
   846                 {
   854                 transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
   847                 transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
   855                 }
   848                 }
   856 #endif // RD_UI_TRANSITION_EFFECTS_LIST
   849 
   857 
   850             if ( i > iBottomItemIndex + 1 )
   858             gc->SetClippingRect( iViewRect );
   851                 {
   859             
   852                 i = iBottomItemIndex + 1;
   860 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
   853                 }
   861             if ( transApi )
   854 
   862                 {
   855             TRect usedPortionOfViewRect(
   863                 transApi->StopDrawing();
   856                 iViewRect.iTl + TSize( 0, iVerticalOffset ),
   864                 }
   857                 TSize( iViewRect.Width(), ( i - iTopItemIndex ) * iItemHeight ) );
   865 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
   866 
       
   867             DrawItem( i++ );
       
   868 
       
   869 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   870             if ( transApi )
       
   871                 {
       
   872                 transApi->StartDrawing( MAknListBoxTfxInternal::EListNotSpecified );
       
   873                 }
       
   874 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
   875 
       
   876             gc->CancelClippingRect();
       
   877             
       
   878 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   879             if ( transApi )
       
   880                 {
       
   881                 transApi->StopDrawing();
       
   882                 }
       
   883 #endif // RD_UI_TRANSITION_EFFECTS_LIST
       
   884             }
       
   885 
       
   886 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
       
   887         if ( transApi )
       
   888             {
       
   889             transApi->StartDrawing( MAknListBoxTfxInternal::EListView );
       
   890             }
       
   891 
       
   892         if ( i > iBottomItemIndex + 1 )
       
   893             {
       
   894             i = iBottomItemIndex + 1;
       
   895             }
       
   896 
       
   897         TRect usedPortionOfViewRect(
       
   898             iViewRect.iTl + TSize( 0, iVerticalOffset ),
       
   899             TSize( iViewRect.Width(), ( i - iTopItemIndex ) * iItemHeight ) );
       
   900 #else
   858 #else
   901         // clear the unused portion of the viewing area
   859             // clear the unused portion of the viewing area
   902         TRect usedPortionOfViewRect( iViewRect.iTl.iX,
   860             TRect usedPortionOfViewRect( iViewRect.iTl.iX,
   903                                      iViewRect.iTl.iY + iVerticalOffset,
   861                                      iViewRect.iTl.iY + iVerticalOffset,
   904                                      iViewRect.Width(),
   862                                      iViewRect.Width(),
   905                                      ItemPos( lastPotentialItemIndex ).iY );
   863                                      ItemPos( lastPotentialItemIndex ).iY );
   906         
   864         
   907         if ( aClipRect )
   865             if ( aClipRect )
   908             {
   866                 {
   909             usedPortionOfViewRect.iBr.iX = aClipRect->iBr.iX;
   867                 usedPortionOfViewRect.iBr.iX = aClipRect->iBr.iX;
   910             }
   868                 }
   911 
       
   912 #endif
   869 #endif
   913 
   870 
   914         // Also draw the area behind scroll bar.
   871             // Also draw the area behind scroll bar.
   915         TRect sbbg( iViewRect ); // whole area behind scroll bar
   872             TRect sbbg( iViewRect ); // whole area behind scroll bar
   916         
   873             
   917         if ( AknLayoutUtils::LayoutMirrored() )
   874             if ( AknLayoutUtils::LayoutMirrored() )
   918             {
   875                 {
   919             _AKNTRACE("CFormattedCellListBoxView::Draw Layout mirrored");
   876                 _AKNTRACE("CFormattedCellListBoxView::Draw Layout mirrored");
   920             sbbg.iBr.iX = iViewRect.iBr.iX - itemDrawer->LafItemSize().iWidth;
   877                 sbbg.iBr.iX = iViewRect.iBr.iX - itemDrawer->LafItemSize().iWidth;
   921             }
   878                 }
   922         else
   879             else
   923             {
   880                 {
   924             sbbg.iTl.iX = iViewRect.iTl.iX + itemDrawer->LafItemSize().iWidth;
   881                 sbbg.iTl.iX = iViewRect.iTl.iX + itemDrawer->LafItemSize().iWidth;
   925             }
   882                 }
   926 
   883     
   927         // Unused portion will be cleared only if listbox background is drawn.
   884             // Unused portion will be cleared only if listbox background is drawn.
   928         if ( itemDrawer->ColumnData()->IsBackgroundDrawingEnabled() ) 
   885             if ( itemDrawer->ColumnData()->IsBackgroundDrawingEnabled() ) 
   929             {
   886                 {
   930             if ( control )
   887                 if ( control )
   931                 {
       
   932                 if ( !control->FindBackground() )
       
   933                     {
   888                     {
   934                     AknsDrawUtils::BackgroundBetweenRects( skin, 
   889                     if ( !control->FindBackground() )
   935                                                            cc, 
       
   936                                                            control, 
       
   937                                                            *gc, 
       
   938                                                            iViewRect, 
       
   939                                                            usedPortionOfViewRect );
       
   940 
       
   941                     if ( !sbbg.IsEmpty() )
       
   942                         {
   890                         {
   943                         AknsDrawUtils::Background( skin,
   891                         AknsDrawUtils::BackgroundBetweenRects( skin, 
   944                                                    cc,
   892                                                                cc, 
   945                                                    control,
   893                                                                control, 
   946                                                    *gc,
   894                                                                *gc, 
   947                                                    sbbg );
   895                                                                iViewRect, 
       
   896                                                                usedPortionOfViewRect );
       
   897     
       
   898                         if ( !sbbg.IsEmpty() )
       
   899                             {
       
   900                             AknsDrawUtils::Background( skin,
       
   901                                                        cc,
       
   902                                                        control,
       
   903                                                        *gc,
       
   904                                                        sbbg );
       
   905                             }
   948                         }
   906                         }
   949                     }
   907                     }
   950                 }
   908                 else
   951             else
   909                     {
   952                 {
   910                     gc->SetBrushColor( BackColor() );
   953                 gc->SetBrushColor( BackColor() );
   911                     DrawUtils::ClearBetweenRects( *gc,
   954                 DrawUtils::ClearBetweenRects( *gc,
   912                                                   iViewRect,
   955                                               iViewRect,
   913                                                   usedPortionOfViewRect );
   956                                               usedPortionOfViewRect );
   914                     gc->Clear( sbbg );
   957                 gc->Clear( sbbg );
   915                     }
   958                 }
   916                 }
   959             }
       
   960 
   917 
   961 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
   918 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
   962     if ( transApi )
   919             if ( transApi )
   963         {
   920                 {
   964         transApi->StopDrawing();
   921                 transApi->StopDrawing();
   965         }
   922                 }
   966 #endif //RD_UI_TRANSITION_EFFECTS_LIST      
   923 #endif //RD_UI_TRANSITION_EFFECTS_LIST      
   967 
   924 
   968 
   925             }
   969 		if ( transparencyEnabled && !drawingInitiated )
   926 
       
   927 		if ( !drawingInitiated )
   970 			{
   928 			{
   971 			iWin->EndRedraw();
   929 			iWin->EndRedraw();
   972 			}
   930 			}
   973         }
   931         }
   974     _AKNTRACE_FUNC_EXIT;
   932     _AKNTRACE_FUNC_EXIT;
  1341     }
  1299     }
  1342 
  1300 
  1343 void CFormattedCellListBoxItemDrawer::DrawBackgroundAndSeparatorLines( 
  1301 void CFormattedCellListBoxItemDrawer::DrawBackgroundAndSeparatorLines( 
  1344         const TRect& aItemTextRect, TBool aDrawSeparator ) const
  1302         const TRect& aItemTextRect, TBool aDrawSeparator ) const
  1345     {
  1303     {
       
  1304     // If we get here background is drawn via avkon implementation -> raise the
       
  1305     // corresponding flag in item drawer.
       
  1306     const_cast<CFormattedCellListBoxItemDrawer*>( this )->SetFlags( ENativeImplementation );
       
  1307 
  1346     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
  1308     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
  1347     CCoeControl* control = FormattedCellData()->Control();
  1309     CCoeControl* control = FormattedCellData()->Control();
  1348     MAknsControlContext *cc = AknsDrawUtils::ControlContext( control );
  1310     MAknsControlContext *cc = AknsDrawUtils::ControlContext( control );
       
  1311     CEikListBox* listbox = static_cast<CEikListBox*>( control );
  1349 
  1312 
  1350     if ( !cc )
  1313     if ( !cc )
  1351         {
  1314         {
  1352         cc = FormattedCellData()->SkinBackgroundContext();
  1315         cc = FormattedCellData()->SkinBackgroundContext();
  1353         }
  1316         }
  1365             }
  1328             }
  1366         }
  1329         }
  1367 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1330 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1368 
  1331 
  1369     // background
  1332     // background
  1370     if ( FormattedCellData()->IsBackgroundDrawingEnabled() )
  1333     if ( FormattedCellData()->IsBackgroundDrawingEnabled() && listbox
       
  1334             && !listbox->BackgroundDrawingSuppressed() )
  1371         {
  1335         {
  1372 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1336 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
  1373         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
  1337         MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc );
  1374         if ( transApi )
  1338         if ( transApi )
  1375             {
  1339             {
  1385             if ( backgroundDrawer )
  1349             if ( backgroundDrawer )
  1386                 {
  1350                 {
  1387                 backgroundDrawer->Draw( *iGc, *control, aItemTextRect );
  1351                 backgroundDrawer->Draw( *iGc, *control, aItemTextRect );
  1388                 bgDrawn = ETrue;
  1352                 bgDrawn = ETrue;
  1389                 }
  1353                 }
  1390             else if ( CAknEnv::Static()->TransparencyEnabled() )
  1354             else
  1391                 {
  1355                 {
  1392                 bgDrawn = AknsDrawUtils::Background(
  1356                 bgDrawn = AknsDrawUtils::Background(
  1393                     skin, cc, control, *iGc, aItemTextRect,
  1357                     skin, cc, control, *iGc, aItemTextRect,
  1394                     KAknsDrawParamNoClearUnderImage );
  1358                     KAknsDrawParamNoClearUnderImage );
  1395                 }
  1359                 }
  1396             else
       
  1397                 {
       
  1398                 bgDrawn = AknsDrawUtils::Background(
       
  1399                     skin, cc, control, *iGc, aItemTextRect,
       
  1400                     KAknsDrawParamNoClearUnderImage | 
       
  1401                     KAknsDrawParamBottomLevelRGBOnly );
       
  1402                 }
       
  1403             }
  1360             }
  1404         if ( !bgDrawn )
  1361         if ( !bgDrawn )
  1405             {
  1362             {
  1406             iGc->Clear( aItemTextRect );
  1363             iGc->Clear( aItemTextRect );
  1407             }
  1364             }
  1409         if ( transApi )
  1366         if ( transApi )
  1410             {
  1367             {
  1411             transApi->StopDrawing();
  1368             transApi->StopDrawing();
  1412             }
  1369             }
  1413 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1370 #endif // RD_UI_TRANSITION_EFFECTS_LIST
  1414 
  1371         }
  1415         if ( aDrawSeparator && control && 
  1372 
  1416             static_cast<CEikListBox*>( control )->ItemsInSingleLine() == 1 )
  1373     if ( aDrawSeparator && listbox && 
  1417             {
  1374         listbox->ItemsInSingleLine() == 1 )
  1418             AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor, skin );
  1375         {
  1419             }
  1376         AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor, skin );
  1420         }
  1377         }
  1421     }
  1378     }
  1422 
  1379 
  1423 // End of File
  1380 // End of File