meetingrequest/mrguicommon/src/cmrbutton.cpp
branchRCL_3
changeset 12 4ce476e64c59
child 22 d620048b4810
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
       
     1 /*
       
     2 * Copyright (c) 2007-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cmrbutton.h"
       
    19 #include "esmrhelper.h"
       
    20 
       
    21 #include <gulicon.h>
       
    22 #include <esmrgui.mbg>
       
    23 #include <data_caging_path_literals.hrh>
       
    24 
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CMRButton::~CMRButton
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 EXPORT_C  CMRButton* CMRButton::NewL(
       
    33              NMRBitmapManager::TMRBitmapId aBitmapId, TScaleMode aScaleMode )
       
    34     {
       
    35     CMRButton* self = new (ELeave) CMRButton( aScaleMode );
       
    36     CleanupStack::PushL( self );
       
    37     self->ConstructL( aBitmapId );
       
    38     CleanupStack::Pop( self );
       
    39     return self;
       
    40     }
       
    41     
       
    42 // ---------------------------------------------------------------------------
       
    43 // CMRButton::~CMRButton
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 EXPORT_C CMRButton::~CMRButton()
       
    47     {
       
    48     // Do nothing
       
    49     }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CMRButton::SizeChanged
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CMRButton::SizeChanged()
       
    56     {
       
    57     TSize sz = Rect().Size();
       
    58     const CFbsBitmap* bitmap = GetCurrentIcon()->Bitmap();
       
    59     AknIconUtils::SetSize( const_cast< CFbsBitmap* >( bitmap ), sz, iScaleMode );
       
    60     }
       
    61 
       
    62 // ---------------------------------------------------------------------------
       
    63 // CMRButton::CMRButton
       
    64 // ---------------------------------------------------------------------------
       
    65 //
       
    66 CMRButton::CMRButton( TScaleMode aScaleMode )
       
    67     : CAknButton( KAknButtonNoFrame | KAknButtonPressedDownFrame ),
       
    68       iScaleMode( aScaleMode )
       
    69     {
       
    70     // No implementation
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // CMRButton::ConstructL
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CMRButton::ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId )
       
    78     {
       
    79     CFbsBitmap* bitMap( NULL );
       
    80     CFbsBitmap* bitMapMask( NULL );
       
    81     TSize sz( Rect().Size() );
       
    82     User::LeaveIfError( NMRBitmapManager::GetSkinBasedBitmap( 
       
    83                                 aBitmapId, 
       
    84                                 bitMap, bitMapMask, sz ) ); 
       
    85     
       
    86     CGulIcon* icon = CGulIcon::NewL( bitMap, bitMapMask );
       
    87     
       
    88     CAknButton::ConstructL( 
       
    89             icon, 
       
    90             NULL, 
       
    91             NULL, 
       
    92             NULL, 
       
    93             KNullDesC(), 
       
    94             KNullDesC(), 
       
    95             KAknButtonNoFrame | KAknButtonPressedDownFrame );
       
    96     }
       
    97 
       
    98 // EOF