messagingappbase/msgeditor/viewsrc/MsgDummyHeaderCleaner.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  MsgDummyHeaderCleaner implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // ========== INCLUDE FILES ================================
       
    21 
       
    22 #include <eikenv.h>                        // for CEikonEnv
       
    23 #include <AknUtils.h>                      // for AknUtils
       
    24 #include <aknenv.h>                        // for CAknEnv
       
    25 #include <AknDef.h>
       
    26   
       
    27 #include <applayout.cdl.h> // LAF
       
    28 #include <aknlayoutscalable_apps.cdl.h>
       
    29 #include <aknlayoutscalable_avkon.cdl.h>
       
    30 
       
    31 #include <AknsDrawUtils.h>                 // for Skinned drawing
       
    32 #include <AknsBasicBackgroundControlContext.h>					
       
    33 
       
    34 #include "MsgEditorCommon.h"
       
    35 #include "MsgBaseControl.h"
       
    36 #include "MsgHeader.h"
       
    37 #include "MsgDummyHeaderCleaner.h"
       
    38 
       
    39 // ---------------------------------------------------------
       
    40 // CMsgDummyHeaderCleaner::CMsgDummyHeaderCleaner
       
    41 // ---------------------------------------------------------
       
    42 CMsgDummyHeaderCleaner::CMsgDummyHeaderCleaner( const CMsgHeader* aParent )
       
    43     : iParent( aParent )
       
    44     {
       
    45     }
       
    46 
       
    47 // ---------------------------------------------------------
       
    48 // CMsgDummyHeaderCleaner::ConstructL
       
    49 // ---------------------------------------------------------
       
    50 void CMsgDummyHeaderCleaner::ConstructL( )
       
    51     {
       
    52     SetContainerWindowL( *iParent );
       
    53 
       
    54     // Lets check the position of the dashed bar
       
    55     TRect dataPane = MsgEditorCommons::MsgDataPane();
       
    56     iDashBar.LayoutRect(
       
    57         dataPane,
       
    58         AknLayoutScalable_Avkon::bg_list_pane_g4( 2 ).LayoutLine() );
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------
       
    62 // CMsgDummyHeaderCleaner::Draw
       
    63 // ---------------------------------------------------------
       
    64 void CMsgDummyHeaderCleaner::Draw(const TRect& /*aRect*/) const
       
    65     {
       
    66     CWindowGc& gc = SystemGc();
       
    67 
       
    68     TRect rect( iParent->Rect() );
       
    69 
       
    70     // The rect clearing will be divided into two parts:
       
    71     // First one is the rect on the left side of the dashed bar in the header
       
    72     // ie. the area on top of the label (eg. To)
       
    73     // The second one is the rect on right side of the dashed bar
       
    74     // ie. on top of the field itself (eg. To )
       
    75     TRect rectLabel(
       
    76         0,
       
    77         0,
       
    78         iDashBar.Rect( ).iTl.iX-1,
       
    79         MsgEditorCommons::MsgBaseLineOffset( ) );
       
    80 
       
    81     TRect rectField(
       
    82         iDashBar.Rect( ).iBr.iX+1,
       
    83         0,
       
    84         rect.iBr.iX,
       
    85         MsgEditorCommons::MsgBaseLineOffset( ) );
       
    86 
       
    87     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
       
    88     MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
       
    89 
       
    90     // Either draw the skin context or just clear it
       
    91     if ( !AknsDrawUtils::Background( skin, cc, this, gc, rectLabel ) )
       
    92         {
       
    93         gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
       
    94 		gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
    95 		gc.SetPenStyle( CGraphicsContext::ENullPen );
       
    96 		gc.DrawRect( rectLabel );
       
    97         }
       
    98         
       
    99     if ( !AknsDrawUtils::Background( skin, cc, this, gc, rectField ) )
       
   100         {
       
   101         gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
       
   102 		gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
       
   103 		gc.SetPenStyle( CGraphicsContext::ENullPen );
       
   104 		gc.DrawRect( rectField );
       
   105 		}
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------
       
   109 // CMsgDummyHeaderCleaner::HandleResourceChange
       
   110 // ---------------------------------------------------------
       
   111 void CMsgDummyHeaderCleaner::HandleResourceChange( TInt aType )
       
   112     {
       
   113     CCoeControl::HandleResourceChange( aType );
       
   114 	if ( aType == KEikDynamicLayoutVariantSwitch )
       
   115         {
       
   116         TRect dataPane = MsgEditorCommons::MsgDataPane();
       
   117         iDashBar.LayoutRect(
       
   118             dataPane,
       
   119             AknLayoutScalable_Avkon::bg_list_pane_g4( 2 ).LayoutLine() );
       
   120         }
       
   121     }
       
   122 
       
   123 //  End of File