58 |
58 |
59 // KContactNameFontHeightPercent is contact name font height relative to list item height. |
59 // KContactNameFontHeightPercent is contact name font height relative to list item height. |
60 const TInt KContactNameFontHeightPercent = 35; |
60 const TInt KContactNameFontHeightPercent = 35; |
61 |
61 |
62 // KCompanyNameFontHeightPercent is company name font height relative to list item height. |
62 // KCompanyNameFontHeightPercent is company name font height relative to list item height. |
63 const TInt KCompanyNameFontHeightPercent = 30; |
63 const TInt KCompanyNameFontHeightPercent = 28; |
64 |
64 |
65 // KTextBoundingBoxHeightPercent gives the text bounding box height in percentages |
65 // KTextBoundingBoxHeightPercent gives the text bounding box height in percents |
66 // relative to font height. This must be over 100, or part of the text cuts off. |
66 // relative to font height. This must be over 100, or part of the text cuts off. |
67 const TInt KTextBoundingBoxHeightPercent = 120; |
67 const TInt KTextBoundingBoxHeightPercent = 120; |
68 |
68 |
69 // KTextPlacementPercent controls how text is placed vertically within its bounding box. |
69 // KTextPlacementPercent controls how text is placed vertically within its bounding box. |
70 // The value is between 0 and 100. 0 means in top part, 50 mean in the middle, 100 means in the |
70 // The value is between 0 and 100. 0 means in top part, 50 means in the middle, 100 means in the |
71 // bottom. |
71 // bottom. |
72 const TInt KTextPlacementPercent = 70; |
72 const TInt KTextPlacementPercent = 70; |
73 |
73 |
74 // KMarginXPercent defines a width of horizontal margin used in many places. In relation to |
74 // KMarginXPercent defines a width of horizontal margin used in many places. In relation to |
75 // the width of the item rectangle. |
75 // the width of the item rectangle. |
226 // ----------------------------------------------------------------------------- |
226 // ----------------------------------------------------------------------------- |
227 // CEasyDialingListBoxData |
227 // CEasyDialingListBoxData |
228 // |
228 // |
229 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
230 // |
230 // |
231 CEasyDialingListBoxData::CEasyDialingListBoxData() : |
231 CEasyDialingListBoxData::CEasyDialingListBoxData( CCoeEnv& aCoeEnv ) : |
232 CFormattedCellListBoxData() |
232 CFormattedCellListBoxData(), iCoeEnv( aCoeEnv ) |
233 { |
233 { |
234 } |
234 } |
235 |
235 |
236 // ----------------------------------------------------------------------------- |
236 // ----------------------------------------------------------------------------- |
237 // Destructor |
237 // Destructor |
240 // |
240 // |
241 CEasyDialingListBoxData::~CEasyDialingListBoxData() |
241 CEasyDialingListBoxData::~CEasyDialingListBoxData() |
242 { |
242 { |
243 // Release fonts. ReleaseFont function can cope with null pointer |
243 // Release fonts. ReleaseFont function can cope with null pointer |
244 // so we don't need to null check them. |
244 // so we don't need to null check them. |
245 CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); |
245 CWsScreenDevice& screenDev = *( iCoeEnv.ScreenDevice() ); |
246 screenDev.ReleaseFont( iContactNameFont ); |
246 screenDev.ReleaseFont( iContactNameFont ); |
247 screenDev.ReleaseFont( iCompanyNameFont ); |
247 screenDev.ReleaseFont( iCompanyNameFont ); |
248 |
248 |
249 delete iArrowPointingRight; |
249 delete iArrowPointingRight; |
250 delete iArrowPointingLeft; |
250 delete iArrowPointingLeft; |
258 // ----------------------------------------------------------------------------- |
258 // ----------------------------------------------------------------------------- |
259 // NewL |
259 // NewL |
260 // |
260 // |
261 // ----------------------------------------------------------------------------- |
261 // ----------------------------------------------------------------------------- |
262 // |
262 // |
263 CEasyDialingListBoxData* CEasyDialingListBoxData::NewL() |
263 CEasyDialingListBoxData* CEasyDialingListBoxData::NewL( CCoeEnv& aCoeEnv ) |
264 { |
264 { |
265 CEasyDialingListBoxData* self = new (ELeave) CEasyDialingListBoxData(); |
265 CEasyDialingListBoxData* self = new (ELeave) CEasyDialingListBoxData( aCoeEnv ); |
266 |
266 |
267 CleanupStack::PushL( self ); |
267 CleanupStack::PushL( self ); |
268 self->ConstructLD(); |
268 self->ConstructLD(); |
269 CleanupStack::Pop( self ); |
269 CleanupStack::Pop( self ); |
270 |
270 |
560 // Draws the Favourite Icon |
560 // Draws the Favourite Icon |
561 // ----------------------------------------------------------------------------- |
561 // ----------------------------------------------------------------------------- |
562 // |
562 // |
563 void CEasyDialingListBoxData::DrawFavouriteIcon( |
563 void CEasyDialingListBoxData::DrawFavouriteIcon( |
564 CWindowGc& aGc, |
564 CWindowGc& aGc, |
565 TRect aNameRectUnMirrored, |
565 TRect aNameRectUnMirrored, |
566 TRect aEffectiveRect) const |
566 TRect aEffectiveRect ) const |
567 { |
567 { |
568 TRect favouriteIconBoundingBox; |
568 TRect favouriteIconBoundingBox; |
569 |
569 |
570 favouriteIconBoundingBox = FavouriteIconBoundingBox( aNameRectUnMirrored ); |
570 favouriteIconBoundingBox = FavouriteIconBoundingBox( aNameRectUnMirrored ); |
571 |
571 |
575 } |
575 } |
576 |
576 |
577 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
577 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
578 TRect sourceRect( TPoint(0,0), favouriteIconBoundingBox.Size() ); |
578 TRect sourceRect( TPoint(0,0), favouriteIconBoundingBox.Size() ); |
579 |
579 |
580 if( AknsUtils::SkinInstance()->GetCachedItemData(KAknsIIDQgnFsContactsFavorite) ) |
580 if ( AknsUtils::SkinInstance()->GetCachedItemData(KAknsIIDQgnFsContactsFavorite) ) |
581 { |
581 { |
582 AknsDrawUtils::DrawCachedImage( AknsUtils::SkinInstance(), aGc, sourceRect, |
582 AknsDrawUtils::DrawCachedImage( AknsUtils::SkinInstance(), aGc, sourceRect, |
583 KAknsIIDQgnFsContactsFavorite ); |
583 KAknsIIDQgnFsContactsFavorite ); |
584 } |
584 } |
585 else |
585 else |
586 { |
586 { |
587 // Set size for the bitmap and mask |
587 // Set size for the bitmap and mask |
588 AknIconUtils::SetSize( iFavouriteIcon->Bitmap(), favouriteIconBoundingBox.Size() ); |
588 AknIconUtils::SetSize( iFavouriteIcon->Bitmap(), favouriteIconBoundingBox.Size() ); |
589 AknIconUtils::SetSize( iFavouriteIcon->Mask(), favouriteIconBoundingBox.Size() ); |
589 AknIconUtils::SetSize( iFavouriteIcon->Mask(), favouriteIconBoundingBox.Size() ); |
590 aGc.BitBltMasked( favouriteIconBoundingBox.iTl , iFavouriteIcon->Bitmap(), |
590 aGc.BitBltMasked( favouriteIconBoundingBox.iTl, iFavouriteIcon->Bitmap(), |
591 sourceRect, iFavouriteIcon->Mask(), ETrue); |
591 sourceRect, iFavouriteIcon->Mask(), ETrue ); |
592 } |
592 } |
593 } |
593 } |
594 // ----------------------------------------------------------------------------- |
594 // ----------------------------------------------------------------------------- |
595 // SetContactDataManager |
595 // SetContactDataManager |
596 // |
596 // |
623 // |
623 // |
624 // ----------------------------------------------------------------------------- |
624 // ----------------------------------------------------------------------------- |
625 // |
625 // |
626 void CEasyDialingListBoxData::ObtainFonts( TInt aItemHeight ) |
626 void CEasyDialingListBoxData::ObtainFonts( TInt aItemHeight ) |
627 { |
627 { |
628 CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); |
628 CWsScreenDevice& screenDev = *( iCoeEnv.ScreenDevice() ); |
629 |
629 |
630 // Release previous fonts. ReleaseFont function can cope with null pointers |
630 // Release previous fonts. ReleaseFont function can cope with null pointers |
631 // so we don't need to null check them. |
631 // so we don't need to null check them. |
632 screenDev.ReleaseFont( iContactNameFont ); |
632 screenDev.ReleaseFont( iContactNameFont ); |
633 screenDev.ReleaseFont( iCompanyNameFont ); |
633 screenDev.ReleaseFont( iCompanyNameFont ); |
1076 TBool match = EFalse; |
1076 TBool match = EFalse; |
1077 |
1077 |
1078 aGc.UseFont( aFont ); |
1078 aGc.UseFont( aFont ); |
1079 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
1079 aGc.SetBrushStyle( CGraphicsContext::ENullBrush ); |
1080 |
1080 |
1081 while ( TextUtils::ColumnText( textPiece , textPieceIndex, visualBuf, KHighlightSeparatorChar) == KErrNone ) |
1081 while ( TextUtils::ColumnText( textPiece, textPieceIndex, visualBuf, KHighlightSeparatorChar) == KErrNone ) |
1082 { |
1082 { |
1083 if (! DrawPieceOfText( aBoundingBox, xOffset, aGc, textPiece, match, aFont, aColors, aHighLight )) |
1083 if (! DrawPieceOfText( aBoundingBox, xOffset, aGc, textPiece, match, aFont, aColors, aHighLight )) |
1084 { |
1084 { |
1085 // If there was not enough space for this piece of text, exit the loop stop drawing further pieces. |
1085 // If there was not enough space for this piece of text, exit the loop stop drawing further pieces. |
1086 break; |
1086 break; |