wvuing/wvuiave/AppSrc/CCACustomDraw.cpp
branchRCL_3
changeset 13 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
12:6ca72c0fe49a 13:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Utility class for drawing skins
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include    "CCACustomDraw.h"
       
    22 
       
    23 #include 	<aknsskininstance.h>
       
    24 #include 	<AknsUtils.h>
       
    25 #include 	<AknsDrawUtils.h>
       
    26 #include 	<eikenv.h>
       
    27 #include 	<eikappui.h>
       
    28 
       
    29 #include	<aknsdrawutils.h>
       
    30 #include	<AknsBasicBackgroundControlContext.h>
       
    31 #include	<BidiText.h>	// A/H
       
    32 #include	<AknBidiTextUtils.h>
       
    33 #include	<AknLayout.cdl.h> //cdl 
       
    34 #include	<AppLayout.cdl.h> //cdl 
       
    35 #include    <aknutils.h>
       
    36 
       
    37 
       
    38 // ============================ MEMBER FUNCTIONS ===============================
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CCACustomDraw::CCACustomDraw
       
    42 // C++ default constructor can NOT contain any code, that
       
    43 // might leave.
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CCACustomDraw::CCACustomDraw( TRect aViewRect )
       
    47         : iViewRect( aViewRect )
       
    48     {
       
    49     }
       
    50 
       
    51 // Destructor
       
    52 CCACustomDraw::~CCACustomDraw()
       
    53     {
       
    54 
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCACustomDraw::SetRect
       
    59 // (other items were commented in a header).
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 void CCACustomDraw::SetRect( const TRect& aRect )
       
    63     {
       
    64     iViewRect = aRect;
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CCACustomDraw::DrawBackground
       
    69 // (other items were commented in a header).
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CCACustomDraw::DrawBackground( const TParam& aParam,
       
    73                                     const TRgb& aBackground,
       
    74                                     TRect& aDrawn ) const
       
    75     {
       
    76     if ( aBackground != KRgbWhite || !iBgContext )
       
    77         {
       
    78         // draw background with color
       
    79         aParam.iGc.SetPenStyle( CGraphicsContext::ENullPen );
       
    80         aParam.iGc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
    81         aParam.iGc.SetBrushColor( aBackground );
       
    82         aParam.iGc.DrawRect( aParam.iDrawRect );
       
    83         }
       
    84     // if background is white -> we draw the skinned background
       
    85     else
       
    86         {
       
    87         //Draw the skin background
       
    88         MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
    89         AknsDrawUtils::Background( skin,
       
    90                                    iBgContext,
       
    91                                    iParent,
       
    92                                    static_cast<CWindowGc&>( aParam.iGc ),
       
    93                                    aParam.iDrawRect );
       
    94 
       
    95         }
       
    96     aDrawn = aParam.iDrawRect;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CCACustomDraw::SetBackgroundContext
       
   101 // (other items were commented in a header).
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 void CCACustomDraw::SetBackgroundContext( CAknsBasicBackgroundControlContext* aBgContext,
       
   105                                           CCoeControl* aParent )
       
   106     {
       
   107     iBgContext = aBgContext;
       
   108     iParent = aParent;
       
   109     }
       
   110 
       
   111 //  End of File