coreapplicationuis/powersaveutilities/batterypopupcontrol/src/batterypopupcontrol.cpp
branchRCL_3
changeset 18 0818dd463d41
parent 7 fc3225a0ab43
--- a/coreapplicationuis/powersaveutilities/batterypopupcontrol/src/batterypopupcontrol.cpp	Thu Jul 15 18:49:38 2010 +0300
+++ b/coreapplicationuis/powersaveutilities/batterypopupcontrol/src/batterypopupcontrol.cpp	Thu Aug 19 10:05:08 2010 +0300
@@ -341,7 +341,7 @@
          
         TInt textBaseLineOffset = 0;
         textBaseLineOffset = (rect.Height() - font->FontMaxHeight())/2;
-        gc.DrawText( *(iText->Text()), rect, textBaseLineOffset, CGraphicsContext::ELeft );
+        gc.DrawText( *(iText->Text()), rect, textBaseLineOffset, iAlign );
         //gc.Reset();
        
         }
@@ -397,7 +397,7 @@
         baselineOffset = font->AscentInPixels() +
             ( rect.Height() - font->AscentInPixels() ) / 2;
         gc.DrawText( ptr, rect, baselineOffset, 
-            CGraphicsContext::ELeft );
+            iAlign );
         delete visualText; 
         }
     }
@@ -475,12 +475,8 @@
         TAknTextComponentLayout textLayout =
         AknLayoutScalable_Avkon::popup_battery_window_t1( iVariant );
     
-        TAknLayoutText textRect;
-        textRect.LayoutText( rectPopUpWindow, textLayout );
-    
-        iText->SetRect( textRect.TextRect() );    
-        // Set text font
-        iText->SetFont( textRect.Font() );
+        AknLayoutUtils::LayoutLabel(iText, rectPopUpWindow, textLayout);
+
         }
         
     // Set link text rect
@@ -491,6 +487,8 @@
         linkLayoutText.LayoutText( rectPopUpWindow,
             AknLayoutScalable_Avkon::popup_battery_window_t2( EVariantIconTextLink ) );
        
+       iAlign = linkLayoutText.Align();
+       
         iFont = linkLayoutText.Font();
         
         TInt tempWidth = iFont->TextWidthInPixels( *(iLinkText) );
@@ -508,7 +506,17 @@
   
             tempRect = TRect( linkLayout.Rect() );            
             }
-        tempRect.SetWidth( tempWidth );
+
+        if(  iAlign == CGraphicsContext::ERight )
+            {
+            tempRect.iTl.iX = tempWidth - tempRect.iBr.iX; 
+            }
+        else
+            {
+            tempRect.SetWidth( tempWidth );
+            }
+
+
         iLinkRect = tempRect;
         }
     }