coreapplicationuis/powersaveutilities/batterypopupcontrol/src/batterypopupcontrol.cpp
branchRCL_3
changeset 4 d440d4c7e9b4
parent 2 7645e9ce10dc
child 7 fc3225a0ab43
equal deleted inserted replaced
3:096dad6e50a9 4:d440d4c7e9b4
     1 /*
     1 /*
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
   285 // CBatteryPopupControl::Draw
   285 // CBatteryPopupControl::Draw
   286 // -----------------------------------------------------------------------------
   286 // -----------------------------------------------------------------------------
   287 //
   287 //
   288 void CBatteryPopupControl::Draw( const TRect& /*aRect*/ ) const
   288 void CBatteryPopupControl::Draw( const TRect& /*aRect*/ ) const
   289     {
   289     {
   290     FUNC_LOG
   290    FUNC_LOG
   291       	
   291       	
   292     CWindowGc& gc = SystemGc();
   292     CWindowGc& gc = SystemGc();
   293     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   293     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   294     
   294 
   295     if( iIcon )
   295     if( iIcon )
   296         {
   296         {
   297         CFbsBitmap* bmp = NULL;
       
   298         TRgb color( KRgbWhite ); // Default never used
   297         TRgb color( KRgbWhite ); // Default never used
   299         bmp = AknsUtils::GetCachedBitmap( skin, KAknsIIDQsnComponentColorBmpCG2 );
   298         
   300         AknsUtils::GetCachedColor( skin, color, 
   299         AknsUtils::GetCachedColor( skin, color, 
   301             KAknsIIDQsnComponentColors, EAknsCIQsnComponentColorsCG2 );
   300                 KAknsIIDQsnIconColors, EAknsCIQsnIconColorsCG6  );
   302 
   301         
   303         AknIconUtils::SetSize( iIcon->Mask(), iBitmapLayout.Rect().Size() );
   302         if (AknIconUtils::IsMifIcon(iIcon->Bitmap()))
   304         if ( bmp )
   303             {
   305             {
   304             AknIconUtils::SetIconColor( iIcon->Bitmap(), color );
   306             iBitmapLayout.DrawImage( gc, bmp, iIcon->Mask() );
   305             }
   307             }
   306 
   308         else
   307         AknIconUtils::SetSize( iIcon->Bitmap(), iBitmapLayout.Rect().Size() );
   309             {
   308         iBitmapLayout.DrawImage( gc, iIcon->Bitmap(), iIcon->Mask() );
   310             AknIconUtils::SetSize( iIcon->Bitmap(), iBitmapLayout.Rect().Size() );     
   309 
   311             bmp = iIcon->Bitmap();
   310         gc.Reset();
   312             iBitmapLayout.DrawImage( gc, bmp, iIcon->Mask() );
   311         }
   313             }
   312     
   314         gc.Reset(); 
   313     gc.SetPenStyle( CGraphicsContext::ESolidPen );
   315         }
   314     const CFont* font = iFont;
       
   315     if ( !font )
       
   316         {
       
   317         font = iCoeEnv->NormalFont();
       
   318         }
       
   319     gc.UseFont( font );
       
   320         
       
   321     if(iText)
       
   322         {
       
   323         TRect rect( iLinkRect );
       
   324         TRgb textContentColor;
       
   325         TInt err = AknsUtils::GetCachedColor( skin, textContentColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG6 );
       
   326         
       
   327         if (!err)
       
   328             {
       
   329             TRAP_IGNORE( AknLayoutUtils::OverrideControlColorL( *iText,
       
   330                     EColorLabelText, textContentColor ) );
       
   331             }
       
   332         
       
   333         gc.SetPenColor( textContentColor );
       
   334          
       
   335         TInt textBaseLineOffset = 0;
       
   336         textBaseLineOffset = (rect.Height() - font->FontMaxHeight())/2;
       
   337         gc.DrawText( *(iText->Text()), rect, textBaseLineOffset, CGraphicsContext::ELeft );
       
   338         //gc.Reset();
       
   339        
       
   340         }
       
   341     
   316     TRgb textColor;
   342     TRgb textColor;
   317     AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnHighlightColors,
   343     AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnHighlightColors,
   318                                EAknsCIQsnHighlightColorsCG3 );
   344                                EAknsCIQsnHighlightColorsCG3 );
   319 
   345 
   320     gc.SetPenStyle( CGraphicsContext::ESolidPen ); 
       
   321     gc.SetPenColor( textColor );
   346     gc.SetPenColor( textColor );
   322 
       
   323     const CFont* font = iFont;
       
   324     if ( !font )
       
   325         {
       
   326         font = iCoeEnv->NormalFont();
       
   327         }
       
   328     gc.UseFont( font );
       
   329 
       
   330     gc.SetUnderlineStyle( EUnderlineOn );
   347     gc.SetUnderlineStyle( EUnderlineOn );
   331     if(iLinkText)
   348     if(iLinkText)
   332         {
   349         {
   333         TRect rect( iLinkRect );
   350         TRect rect( iLinkRect );
   334         if ( Background() )
   351         if ( Background() )