256 DrawBackground(); |
256 DrawBackground(); |
257 } |
257 } |
258 |
258 |
259 if ( iForgroundBmp ) |
259 if ( iForgroundBmp ) |
260 { |
260 { |
261 if( iForgroundBmp->SizeInPixels() != innerRect.Size() ) |
261 TRect iconRect; |
|
262 iconRect.iTl = TPoint( innerRect.iTl.iX + iIconOffset.iWidth, |
|
263 innerRect.iTl.iY + iIconOffset.iHeight ); |
|
264 iconRect.SetWidth( iIconSize.iWidth ); |
|
265 iconRect.SetHeight( iIconSize.iHeight ); |
|
266 |
|
267 if( iForgroundBmp->SizeInPixels() != iconRect.Size() ) |
262 { |
268 { |
263 AknIconUtils::SetSize( iForgroundBmp, innerRect.Size(), EAspectRatioNotPreserved ); |
269 AknIconUtils::SetSize( iForgroundBmp, iconRect.Size(), EAspectRatioNotPreserved ); |
264 } |
270 } |
265 |
271 |
266 TRect srcRect( TPoint( 0, 0 ), iForgroundBmp->SizeInPixels() ); |
272 TRect srcRect( TPoint( 0, 0 ), iForgroundBmp->SizeInPixels() ); |
267 |
273 |
268 if( iForgroundBmpMask ) |
274 if( iForgroundBmpMask ) |
269 { |
275 { |
270 if( iForgroundBmpMask->SizeInPixels() != innerRect.Size() ) |
276 if( iForgroundBmpMask->SizeInPixels() != iconRect.Size() ) |
271 { |
277 { |
272 AknIconUtils::SetSize( iForgroundBmpMask, innerRect.Size(), EAspectRatioNotPreserved); |
278 AknIconUtils::SetSize( iForgroundBmpMask, iconRect.Size(), EAspectRatioNotPreserved); |
273 } |
279 } |
274 |
280 |
275 |
281 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
276 gc->BitBltMasked( innerRect.iTl, |
282 gc->BitBltMasked( iconRect.iTl, |
277 iForgroundBmp, |
283 iForgroundBmp, |
278 srcRect, |
284 srcRect, |
279 iForgroundBmpMask, |
285 iForgroundBmpMask, |
280 EFalse); |
286 EFalse); |
281 } |
287 } |
282 else |
288 else |
283 { |
289 { |
284 gc->BitBlt( innerRect.iTl, |
290 gc->BitBlt( iconRect.iTl, |
285 iForgroundBmp, |
291 iForgroundBmp, |
286 srcRect ); |
292 srcRect ); |
287 } |
293 } |
288 } |
294 } |
289 |
295 |
290 if ( iText ) |
296 if ( iText && iText->Length() > 0 ) |
291 { |
297 { |
292 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
298 gc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
293 TAknLayoutText textLayout; |
299 TAknLayoutText textLayout; |
294 textLayout.LayoutText(Rect(), iTextFormat); |
300 textLayout.LayoutText(Rect(), iTextFormat); |
295 TRgb color( KRgbBlack ); // sane default for nonskinned case |
301 TRgb color( KRgbBlack ); // sane default for nonskinned case |