92 |
92 |
93 // KMatchingTextMarginInPixels the absolute pixel width of highlight margin. Highlight margin |
93 // KMatchingTextMarginInPixels the absolute pixel width of highlight margin. Highlight margin |
94 // is an extra space in highlight boundary to make the text look less crowded. |
94 // is an extra space in highlight boundary to make the text look less crowded. |
95 const TInt KMatchingTextMarginInPixels = 3; |
95 const TInt KMatchingTextMarginInPixels = 3; |
96 |
96 |
|
97 // KFavoriteIconSizePercent is size of favorite icon relative to text height. |
|
98 const TInt KFavoriteIconSizePercent = 65; |
|
99 |
97 // KMatchingTextMarginInPixels is the absolute pixel value for rounding used in highlight |
100 // KMatchingTextMarginInPixels is the absolute pixel value for rounding used in highlight |
98 // rectangle. |
101 // rectangle. |
99 const TInt KHighligthRectangleRoundingYInPixels = 4; |
102 const TInt KHighligthRectangleRoundingYInPixels = 4; |
100 |
103 |
101 // KThumbnailAspectRatio is the aspect ratio of contact thumbnail in percents. 133 for instance |
104 // KThumbnailAspectRatio is the aspect ratio of contact thumbnail in percents. 133 for instance |
133 static TRect CompanyNameBoundingBox( |
136 static TRect CompanyNameBoundingBox( |
134 const TRect& aItemRect, |
137 const TRect& aItemRect, |
135 const CFont* aCompanyNameFont, |
138 const CFont* aCompanyNameFont, |
136 TBool aIsCurrentItem, |
139 TBool aIsCurrentItem, |
137 TBool aThumbnailsShown ); |
140 TBool aThumbnailsShown ); |
138 static TRect FavouriteIconBoundingBox( const TRect& aContactNameBoundingBox, TInt aTextWidth ); |
141 static TRect FavouriteIconBoundingBox( const TRect& aContactNameBoundingBox ); |
139 static TRect MirrorLayoutBoundingBox(const TRect& aSourceRect, TRect& aBoundingBoxRect); |
142 static TRect MirrorLayoutBoundingBox(const TRect& aSourceRect, TRect& aBoundingBoxRect); |
140 static TInt BaseLineOffset( const TRect& aTextBoundingBox, const CFont* aFont ); |
143 static TInt BaseLineOffset( const TRect& aTextBoundingBox, const CFont* aFont ); |
141 static TBool ContainsRightToLeftText( const TDesC& aDesc ); |
144 static TBool ContainsRightToLeftText( const TDesC& aDesc ); |
142 static TInt HighlightSeparatorCount( const TDesC& aText ); |
145 static TInt HighlightSeparatorCount( const TDesC& aText ); |
143 static HBufC* ConvertToVisualAndClipLC( const TDesC& aText, const CFont& aFont, const TRect& aBoundingBox ); |
146 static HBufC* ConvertToVisualAndClipLC( const TDesC& aText, const CFont& aFont, const TRect& aBoundingBox ); |
554 // Draws the Favourite Icon |
557 // Draws the Favourite Icon |
555 // ----------------------------------------------------------------------------- |
558 // ----------------------------------------------------------------------------- |
556 void CEasyDialingListBoxData::DrawFavouriteIcon( |
559 void CEasyDialingListBoxData::DrawFavouriteIcon( |
557 CWindowGc& aGc, |
560 CWindowGc& aGc, |
558 TRect aNameRectUnMirrored, |
561 TRect aNameRectUnMirrored, |
559 TInt aTextWidth, |
|
560 TRect aEffectiveRect) const |
562 TRect aEffectiveRect) const |
561 { |
563 { |
562 CFbsBitmap* favouriteIcon; |
564 CFbsBitmap* favouriteIcon; |
563 CFbsBitmap* favouriteIconMask; |
565 CFbsBitmap* favouriteIconMask; |
564 TRect favouriteIconBoundingBox; |
566 TRect favouriteIconBoundingBox; |
565 |
567 |
566 favouriteIconBoundingBox = FavouriteIconBoundingBox( aNameRectUnMirrored, aTextWidth ); |
568 favouriteIconBoundingBox = FavouriteIconBoundingBox( aNameRectUnMirrored ); |
567 |
569 |
568 if ( AknLayoutUtils::LayoutMirrored() ) |
570 if ( AknLayoutUtils::LayoutMirrored() ) |
569 { |
571 { |
570 favouriteIconBoundingBox = MirrorLayoutBoundingBox(aEffectiveRect, favouriteIconBoundingBox); |
572 favouriteIconBoundingBox = MirrorLayoutBoundingBox(aEffectiveRect, favouriteIconBoundingBox); |
571 } |
573 } |
853 |
855 |
854 |
856 |
855 // ----------------------------------------------------------------------------- |
857 // ----------------------------------------------------------------------------- |
856 // FavouriteIconBoundingBox |
858 // FavouriteIconBoundingBox |
857 // Calculates the area to which the favourite icon is drawn. |
859 // Calculates the area to which the favourite icon is drawn. |
858 // Because favourite icon is drawn in the same line with contact name, |
860 // Favourite icon is drawn right beside contact name bounding box. |
859 // this function takes contact name bounding box as the parameter, not |
861 // ----------------------------------------------------------------------------- |
860 // the whole item rect. |
862 // |
861 // ----------------------------------------------------------------------------- |
863 static TRect FavouriteIconBoundingBox( const TRect& aContactNameBoundingBox ) |
862 // |
864 { |
863 static TRect FavouriteIconBoundingBox( const TRect& aContactNameBoundingBox, TInt aTextWidth ) |
865 // Favourite icons place is right beside contact name bounding box. |
864 { |
866 // Contact name bounding box is calculated so that there is room for the icon. |
865 return TRect( |
867 TInt shrinkMargin = ( KCent - KFavoriteIconSizePercent ) * aContactNameBoundingBox.Height() / ( 2 * KCent ); |
866 aContactNameBoundingBox.iTl.iX + aTextWidth, |
868 TRect rect( |
|
869 aContactNameBoundingBox.iBr.iX, |
867 aContactNameBoundingBox.iTl.iY, |
870 aContactNameBoundingBox.iTl.iY, |
868 aContactNameBoundingBox.iTl.iX + aTextWidth + aContactNameBoundingBox.Height(), |
871 aContactNameBoundingBox.iBr.iX + aContactNameBoundingBox.Height(), |
869 aContactNameBoundingBox.iBr.iY); |
872 aContactNameBoundingBox.iBr.iY); |
|
873 rect.Shrink( shrinkMargin, shrinkMargin ); |
|
874 return rect; |
870 } |
875 } |
871 |
876 |
872 |
877 |
873 |
878 |
874 // ----------------------------------------------------------------------------- |
879 // ----------------------------------------------------------------------------- |