339 |
339 |
340 gc.SetPenColor( textContentColor ); |
340 gc.SetPenColor( textContentColor ); |
341 |
341 |
342 TInt textBaseLineOffset = 0; |
342 TInt textBaseLineOffset = 0; |
343 textBaseLineOffset = (rect.Height() - font->FontMaxHeight())/2; |
343 textBaseLineOffset = (rect.Height() - font->FontMaxHeight())/2; |
344 gc.DrawText( *(iText->Text()), rect, textBaseLineOffset, CGraphicsContext::ELeft ); |
344 gc.DrawText( *(iText->Text()), rect, textBaseLineOffset, iAlign ); |
345 //gc.Reset(); |
345 //gc.Reset(); |
346 |
346 |
347 } |
347 } |
348 |
348 |
349 TRgb textColor; |
349 TRgb textColor; |
395 |
395 |
396 TInt baselineOffset = 0; |
396 TInt baselineOffset = 0; |
397 baselineOffset = font->AscentInPixels() + |
397 baselineOffset = font->AscentInPixels() + |
398 ( rect.Height() - font->AscentInPixels() ) / 2; |
398 ( rect.Height() - font->AscentInPixels() ) / 2; |
399 gc.DrawText( ptr, rect, baselineOffset, |
399 gc.DrawText( ptr, rect, baselineOffset, |
400 CGraphicsContext::ELeft ); |
400 iAlign ); |
401 delete visualText; |
401 delete visualText; |
402 } |
402 } |
403 } |
403 } |
404 |
404 |
405 |
405 |
473 if( iText ) |
473 if( iText ) |
474 { |
474 { |
475 TAknTextComponentLayout textLayout = |
475 TAknTextComponentLayout textLayout = |
476 AknLayoutScalable_Avkon::popup_battery_window_t1( iVariant ); |
476 AknLayoutScalable_Avkon::popup_battery_window_t1( iVariant ); |
477 |
477 |
478 TAknLayoutText textRect; |
478 AknLayoutUtils::LayoutLabel(iText, rectPopUpWindow, textLayout); |
479 textRect.LayoutText( rectPopUpWindow, textLayout ); |
479 |
480 |
|
481 iText->SetRect( textRect.TextRect() ); |
|
482 // Set text font |
|
483 iText->SetFont( textRect.Font() ); |
|
484 } |
480 } |
485 |
481 |
486 // Set link text rect |
482 // Set link text rect |
487 if( iLinkText ) |
483 if( iLinkText ) |
488 { |
484 { |
489 TAknLayoutText linkLayoutText; |
485 TAknLayoutText linkLayoutText; |
490 // popup_battery_window_t2 doesn't have other variants as EVariantIconTextLink |
486 // popup_battery_window_t2 doesn't have other variants as EVariantIconTextLink |
491 linkLayoutText.LayoutText( rectPopUpWindow, |
487 linkLayoutText.LayoutText( rectPopUpWindow, |
492 AknLayoutScalable_Avkon::popup_battery_window_t2( EVariantIconTextLink ) ); |
488 AknLayoutScalable_Avkon::popup_battery_window_t2( EVariantIconTextLink ) ); |
493 |
489 |
|
490 iAlign = linkLayoutText.Align(); |
|
491 |
494 iFont = linkLayoutText.Font(); |
492 iFont = linkLayoutText.Font(); |
495 |
493 |
496 TInt tempWidth = iFont->TextWidthInPixels( *(iLinkText) ); |
494 TInt tempWidth = iFont->TextWidthInPixels( *(iLinkText) ); |
497 TRect tempRect; |
495 TRect tempRect; |
498 |
496 |
506 |
504 |
507 linkLayout.LayoutRect( rectPopUpWindow, paneIconLayout ); |
505 linkLayout.LayoutRect( rectPopUpWindow, paneIconLayout ); |
508 |
506 |
509 tempRect = TRect( linkLayout.Rect() ); |
507 tempRect = TRect( linkLayout.Rect() ); |
510 } |
508 } |
511 tempRect.SetWidth( tempWidth ); |
509 |
|
510 if( iAlign == CGraphicsContext::ERight ) |
|
511 { |
|
512 tempRect.iTl.iX = tempWidth - tempRect.iBr.iX; |
|
513 } |
|
514 else |
|
515 { |
|
516 tempRect.SetWidth( tempWidth ); |
|
517 } |
|
518 |
|
519 |
512 iLinkRect = tempRect; |
520 iLinkRect = tempRect; |
513 } |
521 } |
514 } |
522 } |
515 |
523 |
516 // ----------------------------------------------------------------------------- |
524 // ----------------------------------------------------------------------------- |