128 |
128 |
129 // LOCAL FUNCTION PROTOTYPES |
129 // LOCAL FUNCTION PROTOTYPES |
130 static TRect ContactNameBoundingBox( |
130 static TRect ContactNameBoundingBox( |
131 const TRect& aItemRect, |
131 const TRect& aItemRect, |
132 const CFont* aContactNameFont, |
132 const CFont* aContactNameFont, |
133 TBool aIsCurrentItem, |
133 TBool aArrowIconShown, |
134 TBool aIsFavourite, |
134 TBool aIsFavourite, |
135 TBool aThumbnailsShown ); |
135 TBool aThumbnailsShown ); |
136 static TRect CompanyNameBoundingBox( |
136 static TRect CompanyNameBoundingBox( |
137 const TRect& aItemRect, |
137 const TRect& aItemRect, |
138 const CFont* aCompanyNameFont, |
138 const CFont* aCompanyNameFont, |
221 |
225 |
222 // ----------------------------------------------------------------------------- |
226 // ----------------------------------------------------------------------------- |
223 // CEasyDialingListBoxData |
227 // CEasyDialingListBoxData |
224 // |
228 // |
225 // ----------------------------------------------------------------------------- |
229 // ----------------------------------------------------------------------------- |
226 // |
230 // |
227 CEasyDialingListBoxData::CEasyDialingListBoxData() : |
231 CEasyDialingListBoxData::CEasyDialingListBoxData() : |
228 CFormattedCellListBoxData() |
232 CFormattedCellListBoxData() |
229 { |
233 { |
230 } |
234 } |
231 |
235 |
232 // ----------------------------------------------------------------------------- |
236 // ----------------------------------------------------------------------------- |
233 // Destructor |
237 // Destructor |
234 // |
238 // |
235 // ----------------------------------------------------------------------------- |
239 // ----------------------------------------------------------------------------- |
236 // |
240 // |
237 CEasyDialingListBoxData::~CEasyDialingListBoxData() |
241 CEasyDialingListBoxData::~CEasyDialingListBoxData() |
238 { |
242 { |
239 // Release fonts. ReleaseFont function can cope with null pointer |
243 // Release fonts. ReleaseFont function can cope with null pointer |
240 // so we don't need to null check them. |
244 // so we don't need to null check them. |
241 CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); |
245 CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() ); |
309 Dll::FileName( dllFileName ); |
313 Dll::FileName( dllFileName ); |
310 |
314 |
311 TParse parse; |
315 TParse parse; |
312 User::LeaveIfError(parse.Set(KEasyDialingBitmapFile, &dllFileName, NULL)); |
316 User::LeaveIfError(parse.Set(KEasyDialingBitmapFile, &dllFileName, NULL)); |
313 TFileName bitmapFileName(parse.FullName()); |
317 TFileName bitmapFileName(parse.FullName()); |
314 |
318 |
315 CFbsBitmap* bm; |
319 // Icon displayed for the selected item in normal layout |
316 CFbsBitmap* mask; |
320 iArrowPointingRight = CreateIconL( bitmapFileName, EMbmEasydialingQgn_indi_org_arrow_right, |
317 |
321 EMbmEasydialingQgn_indi_org_arrow_right_mask ); |
318 // iArrowPointingLeft is the icon displayed for the selected item in EasyDialingListBox |
322 |
319 AknIconUtils::CreateIconL( bm, mask, bitmapFileName, EMbmEasydialingQgn_indi_org_arrow_left, |
323 // Icon displayed for the selected item in mirrored layout |
|
324 iArrowPointingLeft = CreateIconL( bitmapFileName, EMbmEasydialingQgn_indi_org_arrow_left, |
320 EMbmEasydialingQgn_indi_org_arrow_left_mask ); |
325 EMbmEasydialingQgn_indi_org_arrow_left_mask ); |
321 |
326 |
322 iArrowPointingLeft = CGulIcon::NewL( bm, mask ); |
327 // Only mask for the arrow icons are used. iColorBitmap is used for making the icon |
323 |
|
324 AknIconUtils::CreateIconL( bm, mask, bitmapFileName, EMbmEasydialingQgn_indi_org_arrow_right, |
|
325 EMbmEasydialingQgn_indi_org_arrow_right_mask ); |
|
326 |
|
327 iArrowPointingRight = CGulIcon::NewL( bm, mask ); |
|
328 |
|
329 // Only mask for the icons are used. iColorBitmap is used for making the icon |
|
330 // to follow text color changes according to skin. |
328 // to follow text color changes according to skin. |
331 iColorBitmap = new (ELeave) CFbsBitmap; |
329 iColorBitmap = new (ELeave) CFbsBitmap; |
332 |
330 |
333 // Contact default thumbnail is not available in themes. It is read from phonebook resource. |
331 // Contact default thumbnail is not available in themes. It is read from phonebook resource. |
334 AknIconUtils::CreateIconL( bm, mask, KPhonebook2EceBitmapFile, |
332 iDummyThumbnail = CreateIconL( KPhonebook2EceBitmapFile, |
335 EMbmPhonebook2eceQgn_prop_pb_thumb_unknown, EMbmPhonebook2eceQgn_prop_pb_thumb_unknown_mask ); |
333 EMbmPhonebook2eceQgn_prop_pb_thumb_unknown, EMbmPhonebook2eceQgn_prop_pb_thumb_unknown_mask ); |
336 iDummyThumbnail = CGulIcon::NewL( bm, mask ); |
|
337 |
334 |
338 // Create the favourite icon bitmap and mask |
335 // Create the favourite icon bitmap and mask |
339 AknIconUtils::CreateIconL( bm, mask, KFavouriteIconBitmapFile, |
336 iFavouriteIcon = CreateIconL( KFavouriteIconBitmapFile, |
340 EMbmPhonebook2Qgn_prop_pb_topc, EMbmPhonebook2Qgn_prop_pb_topc_mask ); |
337 EMbmPhonebook2Qgn_prop_pb_topc, EMbmPhonebook2Qgn_prop_pb_topc_mask ); |
341 |
|
342 iFavouriteIcon = CGulIcon::NewL( bm, mask ); |
|
343 } |
338 } |
344 |
339 |
345 |
340 |
346 // ----------------------------------------------------------------------------- |
341 // ----------------------------------------------------------------------------- |
347 // DrawHighlight |
342 // DrawHighlight |
348 // |
343 // |
349 // ----------------------------------------------------------------------------- |
344 // ----------------------------------------------------------------------------- |
350 // |
345 // |
351 void CEasyDialingListBoxData::DrawHighlight( CWindowGc &aGc, const TRect &aItemRect ) const |
346 void CEasyDialingListBoxData::DrawHighlight( CWindowGc &aGc, const TRect &aItemRect ) const |
352 { |
347 { |
353 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &aGc ); |
348 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &aGc ); |
354 if ( transApi ) |
349 if ( transApi ) |
355 { |
350 { |
415 TInt error = TextUtils::ColumnText( cellText , 0, aText ); |
410 TInt error = TextUtils::ColumnText( cellText , 0, aText ); |
416 __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) ); |
411 __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) ); |
417 __ASSERT_DEBUG( iContactNameFont, EasyDialingPanic( EEasyDialingNoFontFound ) ); |
412 __ASSERT_DEBUG( iContactNameFont, EasyDialingPanic( EEasyDialingNoFontFound ) ); |
418 __ASSERT_DEBUG( iCompanyNameFont, EasyDialingPanic( EEasyDialingNoFontFound ) ); |
413 __ASSERT_DEBUG( iCompanyNameFont, EasyDialingPanic( EEasyDialingNoFontFound ) ); |
419 |
414 |
420 MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc ); |
415 MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( &aGc ); |
421 if ( transApi ) |
416 if ( transApi ) |
422 { |
417 { |
423 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
418 transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
424 if ( transApi->EffectsDisabled() ) |
419 if ( transApi->EffectsDisabled() ) |
425 { |
420 { |
431 if ( AknLayoutUtils::LayoutMirrored() ) |
426 if ( AknLayoutUtils::LayoutMirrored() ) |
432 { |
427 { |
433 boundingBox = MirrorLayoutBoundingBox( aItemRect, boundingBox ); |
428 boundingBox = MirrorLayoutBoundingBox( aItemRect, boundingBox ); |
434 } |
429 } |
435 |
430 |
436 //Draws the Contact Thumbnail Icon if exists else draws the dummy contact thumbnail |
431 // Arrow icon is drawn if the item is in focus and listbox has focus |
437 TBool fav = ContactThumbnailDrawing( aGc, boundingBox, cellText ); |
432 // (and not only the temporary visual focus caused by touching a list item). |
|
433 TBool showArrowIcon = aHighlight && iControl->IsFocused(); |
|
434 if ( showArrowIcon ) |
|
435 { |
|
436 TRect arrowRect = ArrowIconBoundingBox( aItemRect ); |
|
437 if ( AknLayoutUtils::LayoutMirrored() ) |
|
438 { |
|
439 arrowRect = MirrorLayoutBoundingBox( aItemRect, arrowRect ); |
|
440 } |
|
441 DrawArrowIcon( aGc, arrowRect ); |
|
442 } |
|
443 |
|
444 //Draws the Contact Thumbnail Icon if exists, else draws the dummy contact thumbnail |
|
445 TBool fav = DrawContactThumbnail( aGc, boundingBox, cellText ); |
438 |
446 |
439 error = TextUtils::ColumnText( cellText , 1, aText ); |
447 error = TextUtils::ColumnText( cellText , 1, aText ); |
440 __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) ); |
448 __ASSERT_DEBUG( error == KErrNone, EasyDialingPanic( EEasyDialingPanicInvalidListBoxModelString ) ); |
441 |
449 |
442 boundingBox = ContactNameBoundingBox( aItemRect, |
450 boundingBox = ContactNameBoundingBox( aItemRect, |
443 iContactNameFont, |
451 iContactNameFont, |
444 aHighlight, |
452 showArrowIcon, |
445 fav, |
453 fav, |
446 iContactDataManager->GetContactThumbnailSetting() ); |
454 iContactDataManager->GetContactThumbnailSetting() ); |
447 TRect nameRectUnMirrored = boundingBox; // used for favourite star drawing |
455 TRect nameRectUnMirrored = boundingBox; // used for favourite star drawing |
448 |
456 |
449 if ( AknLayoutUtils::LayoutMirrored() ) |
457 if ( AknLayoutUtils::LayoutMirrored() ) |
452 } |
460 } |
453 |
461 |
454 // favourite icon size is set the same as contact name bounding box height. |
462 // favourite icon size is set the same as contact name bounding box height. |
455 TInt favouriteIconSize = boundingBox.Height(); |
463 TInt favouriteIconSize = boundingBox.Height(); |
456 |
464 |
457 TRect arrowRect = ArrowIconBoundingBox( aItemRect ); |
|
458 if ( AknLayoutUtils::LayoutMirrored() ) |
|
459 { |
|
460 arrowRect = MirrorLayoutBoundingBox( aItemRect, arrowRect ); |
|
461 } |
|
462 |
|
463 // Draw arrow icon if the item is in focus. |
|
464 if ( aHighlight ) |
|
465 { |
|
466 DrawArrowIcon( aGc, arrowRect ); |
|
467 } |
|
468 |
|
469 TInt err( KErrNone ); |
465 TInt err( KErrNone ); |
470 TRAP( err, DrawTextWithMatchHighlightL( |
466 TRAP( err, DrawTextWithMatchHighlightL( |
471 boundingBox, aGc, cellText, iContactNameFont, aColors, aHighlight ) ); |
467 boundingBox, aGc, cellText, iContactNameFont, aColors, aHighlight ) ); |
472 |
468 |
473 if ( !err && TextUtils::ColumnText( cellText , 2, aText ) == KErrNone ) |
469 if ( !err && TextUtils::ColumnText( cellText , 2, aText ) == KErrNone ) |
494 transApi->StopDrawing(); |
490 transApi->StopDrawing(); |
495 } |
491 } |
496 } |
492 } |
497 |
493 |
498 // ----------------------------------------------------------------------------- |
494 // ----------------------------------------------------------------------------- |
499 // ContactThumbnailDrawing |
495 // DrawContactThumbnail |
500 // |
496 // |
501 // Draws the Contact Thumbnail Icon if any else draws the dummy contact thumbnail |
497 // Draws the Contact Thumbnail Icon if any, else draws the dummy contact thumbnail |
502 // ----------------------------------------------------------------------------- |
498 // Also check if this is a favorite contact and return true if this is. |
503 |
499 // ----------------------------------------------------------------------------- |
504 TBool CEasyDialingListBoxData::ContactThumbnailDrawing(CWindowGc& aGc, TRect aBoundingBox, TPtrC aCellText) const |
500 // |
|
501 TBool CEasyDialingListBoxData::DrawContactThumbnail(CWindowGc& aGc, TRect aBoundingBox, TPtrC aCellText) const |
505 { |
502 { |
506 TBool fav(EFalse); |
503 TBool fav(EFalse); |
507 CFbsBitmap* thumbnail(NULL); |
504 CFbsBitmap* thumbnail(NULL); |
508 TBool isLoaded = iContactDataManager->GetThumbnailAndFav(aCellText, thumbnail, fav); |
505 TBool isLoaded = iContactDataManager->GetThumbnailAndFav(aCellText, thumbnail, fav); |
509 if ( isLoaded && thumbnail ) |
506 if ( isLoaded && thumbnail ) |
532 |
529 |
533 // ----------------------------------------------------------------------------- |
530 // ----------------------------------------------------------------------------- |
534 // DrawArrowIcon |
531 // DrawArrowIcon |
535 // Draws the Action Menu |
532 // Draws the Action Menu |
536 // ----------------------------------------------------------------------------- |
533 // ----------------------------------------------------------------------------- |
|
534 // |
537 void CEasyDialingListBoxData::DrawArrowIcon( |
535 void CEasyDialingListBoxData::DrawArrowIcon( |
538 CWindowGc& aGc, TRect aArrowRect) const |
536 CWindowGc& aGc, TRect aArrowRect) const |
539 { |
537 { |
540 // Action Menu Arrow for opening the Action Menu |
538 // Action Menu Arrow for opening the Action Menu |
541 if ( AknLayoutUtils::LayoutMirrored() ) |
539 if ( AknLayoutUtils::LayoutMirrored() ) |
666 |
665 |
667 // ----------------------------------------------------------------------------- |
666 // ----------------------------------------------------------------------------- |
668 // UpdateColorBitmapL |
667 // UpdateColorBitmapL |
669 // ColorBitmap is redrawn when UI layout or text color (Theme) changes |
668 // ColorBitmap is redrawn when UI layout or text color (Theme) changes |
670 // ----------------------------------------------------------------------------- |
669 // ----------------------------------------------------------------------------- |
671 // |
670 // |
672 void CEasyDialingListBoxData::UpdateColorBitmapL( const TSize& aSize ) |
671 void CEasyDialingListBoxData::UpdateColorBitmapL( const TSize& aSize ) |
673 { |
672 { |
674 TRgb color; |
673 TRgb color; |
675 // Get the HighLighted text color in ListBox from the Theme |
674 // Get the HighLighted text color in ListBox from the Theme |
676 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), color, |
675 AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), color, |
726 // ----------------------------------------------------------------------------- |
725 // ----------------------------------------------------------------------------- |
727 // ContactImageBoundingBox |
726 // ContactImageBoundingBox |
728 // Calculates the area where contact thumbnail is confined |
727 // Calculates the area where contact thumbnail is confined |
729 // ----------------------------------------------------------------------------- |
728 // ----------------------------------------------------------------------------- |
730 // |
729 // |
731 TRect ContactImageBoundingBox(const TRect& aItemRect) |
730 TRect ContactImageBoundingBox( const TRect& aItemRect ) |
732 { |
731 { |
733 TInt leftMargin = aItemRect.Width() * KMarginXPercent / KCent; |
732 TInt leftMargin = aItemRect.Width() * KMarginXPercent / KCent; |
734 TInt topMargin = KMarginYPercent * aItemRect.Height() / KCent; |
733 TInt topMargin = KMarginYPercent * aItemRect.Height() / KCent; |
735 TInt bottomMargin = topMargin; |
734 TInt bottomMargin = topMargin; |
736 TInt width = ((aItemRect.Height() - topMargin - bottomMargin) * KThumbnailAspectRatio) / KCent; |
735 TInt width = ((aItemRect.Height() - topMargin - bottomMargin) * KThumbnailAspectRatio) / KCent; |
744 |
743 |
745 // ----------------------------------------------------------------------------- |
744 // ----------------------------------------------------------------------------- |
746 // ContactNameBoundingBox |
745 // ContactNameBoundingBox |
747 // Calculates the area to which the contact name and possible match highlights |
746 // Calculates the area to which the contact name and possible match highlights |
748 // are confined. |
747 // are confined. |
749 // |
|
750 // ----------------------------------------------------------------------------- |
748 // ----------------------------------------------------------------------------- |
751 // |
749 // |
752 static TRect ContactNameBoundingBox( |
750 static TRect ContactNameBoundingBox( |
753 const TRect& aItemRect, |
751 const TRect& aItemRect, |
754 const CFont* aContactNameFont, |
752 const CFont* aContactNameFont, |
755 TBool aIsCurrentItem, |
753 TBool aArrowIconShown, |
756 TBool aIsFavourite, |
754 TBool aIsFavourite, |
757 TBool aThumbnailsShown ) |
755 TBool aThumbnailsShown ) |
758 { |
756 { |
759 // Position X will contain the starting position of text from left side of item rect. |
757 // Position X will contain the starting position of text from left side of item rect. |
760 TInt positionX = aItemRect.Width() * KMarginXPercent / KCent; |
758 TInt positionX = aItemRect.Width() * KMarginXPercent / KCent; |
769 |
767 |
770 TInt topMargin = KContactNameYOffsetPercent * aItemRect.Height() / KCent; |
768 TInt topMargin = KContactNameYOffsetPercent * aItemRect.Height() / KCent; |
771 TInt height = KTextBoundingBoxHeightPercent * aContactNameFont->FontMaxHeight() / KCent; |
769 TInt height = KTextBoundingBoxHeightPercent * aContactNameFont->FontMaxHeight() / KCent; |
772 TInt rightMargin = KMarginXPercent * aItemRect.Width() / KCent; |
770 TInt rightMargin = KMarginXPercent * aItemRect.Width() / KCent; |
773 |
771 |
774 // Reserve space for communication launcher icon. |
772 // Reserve space for communication launcher icon if it's shown on this item |
775 // Communication launcher icon is shown only id item is highlighted. |
773 if ( aArrowIconShown ) |
776 if ( aIsCurrentItem ) |
|
777 { |
774 { |
778 rightMargin += KArrowIconSizePercent * aItemRect.Height() / KCent; |
775 rightMargin += KArrowIconSizePercent * aItemRect.Height() / KCent; |
779 } |
776 } |
780 |
777 |
781 // If item is favourite, reserve space for favourite icon. Icon dimensions are the same as bounding box height. |
778 // If item is favourite, reserve space for favourite icon. Icon dimensions are the same as bounding box height. |
837 // ----------------------------------------------------------------------------- |
834 // ----------------------------------------------------------------------------- |
838 // ArrowIconBoundingBox |
835 // ArrowIconBoundingBox |
839 // Calculates the area to which the action menu icon is drawn. |
836 // Calculates the area to which the action menu icon is drawn. |
840 // ----------------------------------------------------------------------------- |
837 // ----------------------------------------------------------------------------- |
841 // |
838 // |
842 TRect ArrowIconBoundingBox(const TRect& aItemRect) |
839 TRect ArrowIconBoundingBox( const TRect& aItemRect ) |
843 { |
840 { |
844 TInt iconSize = KArrowIconSizePercent * aItemRect.Height() / KCent; |
841 TInt iconSize = KArrowIconSizePercent * aItemRect.Height() / KCent; |
845 TInt rightMargin = KMarginXPercent * aItemRect.Width() / KCent; |
842 TInt rightMargin = KMarginXPercent * aItemRect.Width() / KCent; |
846 TInt positionX = aItemRect.iBr.iX - rightMargin - iconSize; |
843 TInt positionX = aItemRect.iBr.iX - rightMargin - iconSize; |
847 TInt topMargin = ( aItemRect.Height() - iconSize ) / 2; // Icon is vertically centered. |
844 TInt topMargin = ( aItemRect.Height() - iconSize ) / 2; // Icon is vertically centered. |
892 // ----------------------------------------------------------------------------- |
889 // ----------------------------------------------------------------------------- |
893 // MirrorLayoutBoundingBox |
890 // MirrorLayoutBoundingBox |
894 // |
891 // |
895 // ----------------------------------------------------------------------------- |
892 // ----------------------------------------------------------------------------- |
896 // |
893 // |
897 static TRect MirrorLayoutBoundingBox(const TRect& aSourceRect, TRect& aBoundingBoxRect) |
894 static TRect MirrorLayoutBoundingBox( const TRect& aSourceRect, TRect& aBoundingBoxRect ) |
898 { |
895 { |
899 return TRect( |
896 return TRect( |
900 aSourceRect.iTl.iX + aSourceRect.iBr.iX - aBoundingBoxRect.iBr.iX, |
897 aSourceRect.iTl.iX + aSourceRect.iBr.iX - aBoundingBoxRect.iBr.iX, |
901 aBoundingBoxRect.iTl.iY, |
898 aBoundingBoxRect.iTl.iY, |
902 aSourceRect.iTl.iX + aSourceRect.iBr.iX - aBoundingBoxRect.iTl.iX, |
899 aSourceRect.iTl.iX + aSourceRect.iBr.iX - aBoundingBoxRect.iTl.iX, |
912 // width for matching highlight. |
909 // width for matching highlight. |
913 // NOTE 2: This function cannot handle right-to-left or bidirectional text currently. |
910 // NOTE 2: This function cannot handle right-to-left or bidirectional text currently. |
914 // These cases must be handled elsewhere. |
911 // These cases must be handled elsewhere. |
915 // ----------------------------------------------------------------------------- |
912 // ----------------------------------------------------------------------------- |
916 // |
913 // |
917 |
|
918 _LIT( KThreeDots, "..." ); |
|
919 |
|
920 static void ClipTextToWidth( |
914 static void ClipTextToWidth( |
921 TDes& aText, |
915 TDes& aText, |
922 const CFont& aFont, |
916 const CFont& aFont, |
923 TInt aMaxWidthInPixels, |
917 TInt aMaxWidthInPixels, |
924 TBool& aMatch) |
918 TBool& aMatch) |
925 { |
919 { |
|
920 _LIT( KThreeDots, "..." ); |
926 TInt minimumWidth = aFont.TextWidthInPixels( KThreeDots ); |
921 TInt minimumWidth = aFont.TextWidthInPixels( KThreeDots ); |
927 |
922 |
928 // If this is a matching piece of text, also match text marginals need to be counted. |
923 // If this is a matching piece of text, also match text marginals need to be counted. |
929 if ( aMatch ) |
924 if ( aMatch ) |
930 { |
925 { |
945 aMaxWidthInPixels -= 2 * KMatchingTextMarginInPixels; |
940 aMaxWidthInPixels -= 2 * KMatchingTextMarginInPixels; |
946 } |
941 } |
947 |
942 |
948 AknTextUtils::ClipToFit( aText, aFont, aMaxWidthInPixels ); |
943 AknTextUtils::ClipToFit( aText, aFont, aMaxWidthInPixels ); |
949 } |
944 } |
950 |
|
951 |
945 |
952 // ----------------------------------------------------------------------------- |
946 // ----------------------------------------------------------------------------- |
953 // DrawPieceOfText |
947 // DrawPieceOfText |
954 // Draws a piece of text of contact, either matching or not matching. |
948 // Draws a piece of text of contact, either matching or not matching. |
955 // Updates aXOffset argument by adding drawn text width. |
949 // Updates aXOffset argument by adding drawn text width. |
1109 // ----------------------------------------------------------------------------- |
1102 // ----------------------------------------------------------------------------- |
1110 // CalculateTextWidth |
1103 // CalculateTextWidth |
1111 // Calculates the width of the text and returns it |
1104 // Calculates the width of the text and returns it |
1112 // ----------------------------------------------------------------------------- |
1105 // ----------------------------------------------------------------------------- |
1113 // |
1106 // |
1114 static TInt CalculateTextWidth(const TRect& aBoundingBox, const TDesC& aText, const CFont* aFont ) |
1107 static TInt CalculateTextWidth( const TRect& aBoundingBox, |
1115 { |
1108 const TDesC& aText, |
1116 |
1109 const CFont* aFont ) |
|
1110 { |
1117 TInt xOffset = 0; |
1111 TInt xOffset = 0; |
1118 TPtrC textPiece; |
1112 TPtrC textPiece; |
1119 TInt textPieceIndex = 0; |
1113 TInt textPieceIndex = 0; |
1120 TBool match = EFalse; |
1114 TBool match = EFalse; |
1121 |
1115 |
1252 // NOTE2: It's assumed that there can be highlights only in pure LTR and RTL |
1246 // NOTE2: It's assumed that there can be highlights only in pure LTR and RTL |
1253 // texts. Highlights for mixed LTR-RTL text cannot be handled properly. |
1247 // texts. Highlights for mixed LTR-RTL text cannot be handled properly. |
1254 // ----------------------------------------------------------------------------- |
1248 // ----------------------------------------------------------------------------- |
1255 // |
1249 // |
1256 static HBufC* ConvertToVisualAndClipLC( const TDesC& aText, |
1250 static HBufC* ConvertToVisualAndClipLC( const TDesC& aText, |
1257 const CFont& aFont, |
1251 const CFont& aFont, |
1258 const TRect& aBoundingBox ) |
1252 const TRect& aBoundingBox ) |
1259 { |
1253 { |
1260 HBufC* buf = HBufC::NewLC( aText.Length() + KAknBidiExtraSpacePerLine ); |
1254 HBufC* buf = HBufC::NewLC( aText.Length() + KAknBidiExtraSpacePerLine ); |
1261 TPtr ptr = buf->Des(); |
1255 TPtr ptr = buf->Des(); |
1262 ptr.Copy( aText ); |
1256 ptr.Copy( aText ); |
1263 |
1257 |