uifw/AvKon/src/eikfrlbd.cpp
branchRCL_3
changeset 25 941195f2d488
parent 23 3d340a0166ff
child 29 a8834a2e9a96
equal deleted inserted replaced
23:3d340a0166ff 25:941195f2d488
    57 const TInt KMaxSubCellIndex = 16 + 1;
    57 const TInt KMaxSubCellIndex = 16 + 1;
    58 
    58 
    59 // colored tick marks support
    59 // colored tick marks support
    60 const TInt KColorIconFlag = -1;
    60 const TInt KColorIconFlag = -1;
    61 const TInt KColorIconIdx  =  0;
    61 const TInt KColorIconIdx  =  0;
       
    62 
       
    63 // Number of icons in marking mode icon array
       
    64 const TInt KMarkingModeIconArraySize = 2;
       
    65 
    62 // smiley text place holder
    66 // smiley text place holder
    63 _LIT( KPlaceHolder, "\xFFF0i" );
    67 _LIT( KPlaceHolder, "\xFFF0i" );
    64 
    68 
    65 /**
    69 /**
    66 * This class needs to be in .cpp file so that we do not accidentally make it
    70 * This class needs to be in .cpp file so that we do not accidentally make it
  1327 //
  1331 //
  1328 void CFormattedCellListBoxDataExtension::LoadMarkingIconsL()
  1332 void CFormattedCellListBoxDataExtension::LoadMarkingIconsL()
  1329     {
  1333     {
  1330     if ( !iMarkingIconArray )
  1334     if ( !iMarkingIconArray )
  1331         {
  1335         {
  1332         iMarkingIconArray = new ( ELeave ) CAknIconArray( 2 );
  1336         iMarkingIconArray = new ( ELeave ) CAknIconArray( 
       
  1337                 KMarkingModeIconArraySize );
  1333         }
  1338         }
  1334     else
  1339     else
  1335         {
  1340         {
  1336         iMarkingIconArray->ResetAndDestroy();
  1341         iMarkingIconArray->ResetAndDestroy();
  1337         }
  1342         }
  2475             aItemRect.iBr.iY);
  2480             aItemRect.iBr.iY);
  2476     
  2481     
  2477     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  2482     __ASSERT_DEBUG( iExtension, Panic( EAknPanicNullPointer ));
  2478     
  2483     
  2479     TRect textRect(aItemRect);
  2484     TRect textRect(aItemRect);
  2480     
  2485     DrawMarkingModeIcons( aProperties, aGc, textRect );
  2481     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
       
  2482     
       
  2483     if ( listbox->View()->ItemDrawer()->Flags() 
       
  2484             & CListItemDrawer::EMarkingModeEnabled 
       
  2485             && iExtension->iMarkingIconArray
       
  2486             &&  iExtension->iMarkingIconArray->Count() == 2 )
       
  2487         {
       
  2488         textRect.iTl.iX += 
       
  2489                 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( 0 ).LayoutLine().il;
       
  2490 
       
  2491         TAknLayoutRect layoutRect;
       
  2492         layoutRect.LayoutRect( aItemRect, 
       
  2493                 AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) );
       
  2494         
       
  2495         CGulIcon* icon = (*iExtension->iMarkingIconArray)[1]; // unchecked
       
  2496 
       
  2497         if ( listbox->View()->ItemIsSelected( 
       
  2498                 iExtension->iCurrentlyDrawnItemIndex ) )
       
  2499             {
       
  2500             icon = (*iExtension->iMarkingIconArray)[0];
       
  2501             }
       
  2502         
       
  2503         CFbsBitmap* bitmap = icon->Bitmap();
       
  2504 
       
  2505         if ( bitmap )
       
  2506             {
       
  2507             TSize size( bitmap->SizeInPixels() ); // set size if not already
       
  2508             TSize targetSize( layoutRect.Rect().Size() );
       
  2509             
       
  2510             if ( size.iWidth != targetSize.iWidth && size.iHeight != targetSize.iHeight )
       
  2511                 {
       
  2512                 AknIconUtils::SetSize( bitmap, targetSize,
       
  2513                         EAspectRatioPreservedAndUnusedSpaceRemoved ); 
       
  2514                 }
       
  2515 
       
  2516             aGc.BitBltMasked( layoutRect.Rect().iTl, bitmap, TRect( layoutRect.Rect().Size() ), icon->Mask(), EFalse );
       
  2517             }
       
  2518         }
       
  2519     
  2486     
  2520     const TColors *subcellColors = &aColors;
  2487     const TColors *subcellColors = &aColors;
  2521 
  2488 
  2522     TInt lastSubCell = Min( LastSubCell(), KMaxSubCellIndex );
  2489     TInt lastSubCell = Min( LastSubCell(), KMaxSubCellIndex );
  2523 
  2490 
  2876     const_cast<CFormattedCellListBoxData*>( this )->
  2843     const_cast<CFormattedCellListBoxData*>( this )->
  2877         SetWordWrappedSubcellIndices( -1, -1 );
  2844         SetWordWrappedSubcellIndices( -1, -1 );
  2878     _AKNTRACE_FUNC_EXIT;
  2845     _AKNTRACE_FUNC_EXIT;
  2879     }
  2846     }
  2880 
  2847 
       
  2848 // -----------------------------------------------------------------------------
       
  2849 // CFormattedCellListBoxData::DrawMarkingModeIcons
       
  2850 // -----------------------------------------------------------------------------
       
  2851 //
       
  2852 void CFormattedCellListBoxData::DrawMarkingModeIcons( 
       
  2853                                             TListItemProperties& aProperties,
       
  2854                                             CWindowGc& aGc,
       
  2855                                             TRect& aItemRect ) const
       
  2856     {
       
  2857     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
       
  2858     TRect textRect( aItemRect );
       
  2859     
       
  2860     if ( listbox->View()->ItemDrawer()->Flags() 
       
  2861             & CListItemDrawer::EMarkingModeEnabled 
       
  2862             && !aProperties.IsSelectionHidden()            
       
  2863             && iExtension->iMarkingIconArray
       
  2864 #ifdef RD_TOUCH2_MARKING
       
  2865             &&  iExtension->iMarkingIconArray->Count() 
       
  2866                 == KMarkingModeIconArraySize )         
       
  2867 #else            
       
  2868             &&  iExtension->iMarkingIconArray->Count() == 2 )
       
  2869 #endif // RD_TOUCH2_MARKING        
       
  2870         {
       
  2871         textRect.iTl.iX += 
       
  2872                 AknLayoutScalable_Avkon::list_double_graphic_pane_t1( 
       
  2873                         0 ).LayoutLine().il;
       
  2874 
       
  2875         TAknLayoutRect layoutRect;
       
  2876         layoutRect.LayoutRect( aItemRect, 
       
  2877                 AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) );
       
  2878 
       
  2879         // unchecked icon
       
  2880         CGulIcon* icon = ( *iExtension->iMarkingIconArray )[1];        
       
  2881         
       
  2882         if ( listbox->View()->ItemIsSelected( 
       
  2883                 iExtension->iCurrentlyDrawnItemIndex ) )
       
  2884             {
       
  2885             icon = ( *iExtension->iMarkingIconArray )[0];        
       
  2886             }
       
  2887         
       
  2888         CFbsBitmap* bitmap = icon->Bitmap();
       
  2889 
       
  2890         if ( bitmap )
       
  2891             {
       
  2892             TSize size( bitmap->SizeInPixels() ); // set size if not already
       
  2893             TSize targetSize( layoutRect.Rect().Size() );
       
  2894             
       
  2895             if ( size.iWidth != targetSize.iWidth && 
       
  2896                  size.iHeight != targetSize.iHeight )
       
  2897                 {
       
  2898                 AknIconUtils::SetSize( bitmap, targetSize,
       
  2899                         EAspectRatioPreservedAndUnusedSpaceRemoved ); 
       
  2900                 }
       
  2901             aGc.BitBltMasked( layoutRect.Rect().iTl, 
       
  2902                               bitmap, 
       
  2903                               TRect( layoutRect.Rect().Size() ),
       
  2904                               icon->Mask(), EFalse );
       
  2905             }
       
  2906         aItemRect = textRect;
       
  2907         }    
       
  2908     }
  2881 
  2909 
  2882 EXPORT_C 
  2910 EXPORT_C 
  2883 CFormattedCellListBoxData::CFormattedCellListBoxData()
  2911 CFormattedCellListBoxData::CFormattedCellListBoxData()
  2884     : CListBoxData()
  2912     : CListBoxData()
  2885     {
  2913     {
  4196         return;
  4224         return;
  4197         }
  4225         }
  4198     
  4226     
  4199     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
  4227     CEikListBox* listbox = static_cast<CEikListBox*>( Control() ); 
  4200     
  4228     
  4201     if ( listbox->View()->ItemDrawer()->Flags()
  4229     DrawMarkingModeIcons( aProperties, aGc, itemRect );
  4202             & CListItemDrawer::EMarkingModeEnabled &&
       
  4203          iExtension->iMarkingIconArray && 
       
  4204          iExtension->iMarkingIconArray->Count() == 2 )
       
  4205         {
       
  4206         itemRect.iTl.iX +=
       
  4207             AknLayoutScalable_Avkon::list_double_graphic_pane_t1( 0 ).LayoutLine().il;
       
  4208 
       
  4209         TAknLayoutRect layoutRect;
       
  4210         layoutRect.LayoutRect(
       
  4211             aItemRect, 
       
  4212             AknLayoutScalable_Avkon::list_double_graphic_pane_g1( 0 ) );
       
  4213         TRect iconRect( layoutRect.Rect() );
       
  4214         
       
  4215         CGulIcon* icon = (*iExtension->iMarkingIconArray)[1]; // unchecked
       
  4216 
       
  4217         if ( listbox->View()->ItemIsSelected( 
       
  4218                 iExtension->iCurrentlyDrawnItemIndex ) )
       
  4219             {
       
  4220             icon = (*iExtension->iMarkingIconArray)[0];
       
  4221             }
       
  4222         
       
  4223         CFbsBitmap* bitmap = icon->Bitmap();
       
  4224 
       
  4225         if ( bitmap )
       
  4226             {
       
  4227             TSize size( bitmap->SizeInPixels() ); // set size if not already
       
  4228             TSize targetSize( layoutRect.Rect().Size() );
       
  4229             
       
  4230             if ( size.iWidth != targetSize.iWidth &&
       
  4231                  size.iHeight != targetSize.iHeight )
       
  4232                 {
       
  4233                 AknIconUtils::SetSize( bitmap, targetSize,
       
  4234                         EAspectRatioPreservedAndUnusedSpaceRemoved ); 
       
  4235                 }
       
  4236 
       
  4237             aGc.BitBltMasked( iconRect.iTl,
       
  4238                               bitmap,
       
  4239                               TRect( iconRect.Size() ),
       
  4240                               icon->Mask(),
       
  4241                               EFalse );
       
  4242             }
       
  4243         }
       
  4244     
  4230     
  4245     const TColors* subcellColors = &aColors;
  4231     const TColors* subcellColors = &aColors;
  4246     
  4232     
  4247     const CFont* font=SubCellFont(0);
  4233     const CFont* font=SubCellFont(0);
  4248     if (font==NULL)
  4234     if (font==NULL)