diff -r a3a1ae9acec6 -r da5135c61bad meetingrequest/mrguicommon/src/cmrbutton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/meetingrequest/mrguicommon/src/cmrbutton.cpp Wed Mar 31 21:08:33 2010 +0300 @@ -0,0 +1,98 @@ +/* +* Copyright (c) 2007-2009 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: +* +*/ + +#include "cmrbutton.h" +#include "esmrhelper.h" + +#include +#include +#include + + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// CMRButton::~CMRButton +// --------------------------------------------------------------------------- +// +EXPORT_C CMRButton* CMRButton::NewL( + NMRBitmapManager::TMRBitmapId aBitmapId, TScaleMode aScaleMode ) + { + CMRButton* self = new (ELeave) CMRButton( aScaleMode ); + CleanupStack::PushL( self ); + self->ConstructL( aBitmapId ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// CMRButton::~CMRButton +// --------------------------------------------------------------------------- +// +EXPORT_C CMRButton::~CMRButton() + { + // Do nothing + } + +// --------------------------------------------------------------------------- +// CMRButton::SizeChanged +// --------------------------------------------------------------------------- +// +void CMRButton::SizeChanged() + { + TSize sz = Rect().Size(); + const CFbsBitmap* bitmap = GetCurrentIcon()->Bitmap(); + AknIconUtils::SetSize( const_cast< CFbsBitmap* >( bitmap ), sz, iScaleMode ); + } + +// --------------------------------------------------------------------------- +// CMRButton::CMRButton +// --------------------------------------------------------------------------- +// +CMRButton::CMRButton( TScaleMode aScaleMode ) + : CAknButton( KAknButtonNoFrame | KAknButtonPressedDownFrame ), + iScaleMode( aScaleMode ) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// CMRButton::ConstructL +// --------------------------------------------------------------------------- +// +void CMRButton::ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId ) + { + CFbsBitmap* bitMap( NULL ); + CFbsBitmap* bitMapMask( NULL ); + TSize sz( Rect().Size() ); + User::LeaveIfError( NMRBitmapManager::GetSkinBasedBitmap( + aBitmapId, + bitMap, bitMapMask, sz ) ); + + CGulIcon* icon = CGulIcon::NewL( bitMap, bitMapMask ); + + CAknButton::ConstructL( + icon, + NULL, + NULL, + NULL, + KNullDesC(), + KNullDesC(), + KAknButtonNoFrame | KAknButtonPressedDownFrame ); + } + +// EOF