diff -r ebe688cedc25 -r 7fdbb852d323 messagingappbase/msgeditor/mediacontrolsrc/MsgBitmapControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingappbase/msgeditor/mediacontrolsrc/MsgBitmapControl.cpp Wed Sep 01 12:31:54 2010 +0100 @@ -0,0 +1,110 @@ +/* +* 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 +#include + +#include // 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