uifw/AvKon/src/akntitle.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 9 aabf2c525e0f
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
     1 /*
     1 /*
     2 * Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2002-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".
   687         gc.SetBrushColor(rgb);
   687         gc.SetBrushColor(rgb);
   688         gc.Clear( aRect );
   688         gc.Clear( aRect );
   689         return;
   689         return;
   690         }
   690         }
   691 
   691 
   692     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   692     // Don't allow normal background drawing if
   693 
   693     // background is already drawn with a background drawer.
   694     TRect rect( Rect() );
   694     const MCoeControlBackground* backgroundDrawer = FindBackground();
   695 
   695     if ( !backgroundDrawer )
   696     CWindowGc& gc=SystemGc();
   696         {
   697 
   697         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
   698     if ( AknStatuspaneUtils::StaconPaneActive() ||
   698 
   699          AknStatuspaneUtils::FlatLayoutActive() )
   699         TRect rect( Rect() );
   700         {
   700 
   701         MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
   701         CWindowGc& gc=SystemGc();
   702 
   702 
   703         if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
   703         if ( AknStatuspaneUtils::StaconPaneActive() ||
   704             {
   704              AknStatuspaneUtils::FlatLayoutActive() )
   705             gc.SetPenStyle( CGraphicsContext::ENullPen );
   705             {
       
   706             MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
   707 
       
   708             if( !AknsDrawUtils::Background( skin, cc, this, gc, rect ) )
       
   709                 {
       
   710                 gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   711                 gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   712                 gc.SetBrushColor(
       
   713                     AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
       
   714                 gc.DrawRect( rect );
       
   715                 }
       
   716             }
       
   717         else
       
   718             {
   706             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   719             gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
   707             gc.SetBrushColor(
   720             gc.SetBrushColor( AKN_LAF_COLOR( KStatusPaneBackgroundColor ) );
   708                 AKN_LAF_COLOR( KStatusPaneBackgroundGraphicsColorUsual ) );
   721             AknsDrawUtils::Background( skin,
   709             gc.DrawRect( rect );
   722                                        AknsDrawUtils::ControlContext( this ),
   710             }
   723                                        this,
   711         }
   724                                        gc,
   712     else
   725                                        rect );
   713         {
   726             }
   714         gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   715         gc.SetBrushColor( AKN_LAF_COLOR( KStatusPaneBackgroundColor ) );
       
   716         AknsDrawUtils::Background( skin,
       
   717                                    AknsDrawUtils::ControlContext( this ),
       
   718                                    this,
       
   719                                    gc,
       
   720                                    rect );
       
   721         }
   727         }
   722     }
   728     }
   723 
   729 
   724 
   730 
   725 // ----------------------------------------------------------------------------
   731 // ----------------------------------------------------------------------------
  1428                         AknLayoutUtils::PenEnabled() );
  1434                         AknLayoutUtils::PenEnabled() );
  1429 
  1435 
  1430         TAknLayoutRect layoutRect;
  1436         TAknLayoutRect layoutRect;
  1431         layoutRect.LayoutRect(
  1437         layoutRect.LayoutRect(
  1432             rect,
  1438             rect,
  1433             AknLayoutScalable_Avkon::title_pane_g2( touchLsc ? 4 : 0 ) );
  1439             AknLayoutScalable_Avkon::title_pane_g2( touchLsc ? 4 : 1 ) );
  1434 
  1440 
  1435         if ( iExtension->iSmallImageAutoscaling &&
  1441         if ( iExtension->iSmallImageAutoscaling &&
  1436              iExtension->iTitleImage->Bitmap() &&
  1442              iExtension->iTitleImage->Bitmap() &&
  1437              iExtension->iTitleImage->Mask() )
  1443              iExtension->iTitleImage->Mask() )
  1438             {
  1444             {
  1459         
  1465         
  1460         if ( iExtension->iTitleImage && iExtension->iSmallImageShown )
  1466         if ( iExtension->iTitleImage && iExtension->iSmallImageShown )
  1461             {
  1467             {
  1462             // if image is shown, use shorter version of text
  1468             // if image is shown, use shorter version of text
  1463             oneLineLayout =
  1469             oneLineLayout =
  1464                 AknLayoutScalable_Avkon::title_pane_t1( touchLsc ? 11 : 3 ).LayoutLine();
  1470                 AknLayoutScalable_Avkon::title_pane_t1( touchLsc ? 11 : 6 ).LayoutLine();
  1465             }
  1471             }
  1466         else
  1472         else
  1467             {
  1473             {
  1468             // if image is not shown, use longer version of text
  1474             // if image is not shown, use longer version of text
  1469             oneLineLayout =
  1475             oneLineLayout =
  1470                 AknLayoutScalable_Avkon::title_pane_t1( touchLsc ? 10 : 2 ).LayoutLine();
  1476                 AknLayoutScalable_Avkon::title_pane_t1( touchLsc ? 10 : 5 ).LayoutLine();
  1471             }
  1477             }
  1472 
  1478 
  1473         TAknLayoutText oneLineLayoutText;
  1479         TAknLayoutText oneLineLayoutText;
  1474         oneLineLayoutText.LayoutText( rect, oneLineLayout );
  1480         oneLineLayoutText.LayoutText( rect, oneLineLayout );
  1475         TRect oneLineLayoutRect( oneLineLayoutText.TextRect() );
  1481         TRect oneLineLayoutRect( oneLineLayoutText.TextRect() );