messagingappbase/msgeditor/mediacontrolsrc/MsgBitmapControl.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 00:08:43 +0200
changeset 10 da93fe14e0e3
parent 0 72b543305e3a
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  
*       MsgEditor bitmap container control.
*
*/



// INCLUDE FILES
#include "MsgBitmapControl.h"

#include <AknsDrawUtils.h>          // AknsDrawUtils
#include <aknenv.h>

#include <MIHLBitmap.h>             // MIHLBitmap

// ==========================================================

// EXTERNAL DATA STRUCTURES

// EXTERNAL FUNCTION PROTOTYPES

// CONSTANTS

// MACROS

// LOCAL CONSTANTS AND MACROS

// MODULE DATA STRUCTURES

// LOCAL FUNCTION PROTOTYPES

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CMsgBitmapControl::CMsgBitmapControl
//
// Constructor.
// ---------------------------------------------------------
//
CMsgBitmapControl::CMsgBitmapControl() 
    {
    }

// ---------------------------------------------------------
// CMsgBitmapControl::~CMsgBitmapControl
//
// Destructor
// ---------------------------------------------------------
//
CMsgBitmapControl::~CMsgBitmapControl()
    {
    }

// ---------------------------------------------------------
// CMsgBitmapControl::SetBitmap
//
// Starts the image loading.
// ---------------------------------------------------------
//
void CMsgBitmapControl::SetBitmap( MIHLBitmap* aBitmap )
    {
    iBitmap = aBitmap;
    }

// ---------------------------------------------------------
// CMsgBitmapControl::Draw
// Draws the bitmap.
// ---------------------------------------------------------
//
void CMsgBitmapControl::Draw( const TRect& aRect ) const
    {   
    CWindowGc& gc = SystemGc();
    
    // Draw the bitmap background either bitmap is not set or it has mask present.
    if ( !iBitmap || iBitmap->HasMask() )
        {   
        if ( !AknsDrawUtils::Background( AknsUtils::SkinInstance(), 
                                   AknsDrawUtils::ControlContext( this ), 
                                   this, 
                                   gc, 
                                   aRect, 
                                   KAknsDrawParamNoClearUnderImage ) )
            {
            gc.SetBrushColor( AKN_LAF_COLOR( 0 ) );
            gc.SetPenStyle( CGraphicsContext::ENullPen );
		    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    	    gc.DrawRect( aRect );
            }
        }
        
    if ( iBitmap )
        {
        iBitmap->Draw( gc, Position(), Size() );
        }
    }

//  End of File