25
|
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,
|
|
34 |
const CCoeControl* aParent,
|
|
35 |
TScaleMode aScaleMode
|
|
36 |
)
|
|
37 |
{
|
|
38 |
CMRButton* self = new (ELeave) CMRButton( aScaleMode );
|
|
39 |
CleanupStack::PushL( self );
|
|
40 |
self->ConstructL( aBitmapId, aParent );
|
|
41 |
CleanupStack::Pop( self );
|
|
42 |
return self;
|
|
43 |
}
|
|
44 |
|
|
45 |
// ---------------------------------------------------------------------------
|
|
46 |
// CMRButton::~CMRButton
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
EXPORT_C CMRButton::~CMRButton()
|
|
50 |
{
|
|
51 |
// Do nothing
|
|
52 |
}
|
|
53 |
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
// CMRButton::SizeChanged
|
|
56 |
// ---------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
void CMRButton::SizeChanged()
|
|
59 |
{
|
|
60 |
TSize sz = Rect().Size();
|
|
61 |
const CFbsBitmap* bitmap = GetCurrentIcon()->Bitmap();
|
|
62 |
AknIconUtils::SetSize( const_cast< CFbsBitmap* >( bitmap ), sz, iScaleMode );
|
|
63 |
}
|
|
64 |
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
// CMRButton::CMRButton
|
|
67 |
// ---------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CMRButton::CMRButton( TScaleMode aScaleMode )
|
|
70 |
: CAknButton( KAknButtonNoFrame | KAknButtonPressedDownFrame ),
|
|
71 |
iScaleMode( aScaleMode )
|
|
72 |
{
|
|
73 |
// No implementation
|
|
74 |
}
|
|
75 |
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CMRButton::ConstructL
|
|
78 |
// ---------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
void CMRButton::ConstructL(
|
|
81 |
NMRBitmapManager::TMRBitmapId aBitmapId,
|
|
82 |
const CCoeControl* aParent )
|
|
83 |
{
|
|
84 |
CFbsBitmap* bitMap( NULL );
|
|
85 |
CFbsBitmap* bitMapMask( NULL );
|
|
86 |
TSize sz( Rect().Size() );
|
|
87 |
User::LeaveIfError( NMRBitmapManager::GetSkinBasedBitmap(
|
|
88 |
aBitmapId,
|
|
89 |
bitMap, bitMapMask, sz ) );
|
|
90 |
|
|
91 |
CGulIcon* icon = CGulIcon::NewL( bitMap, bitMapMask );
|
|
92 |
|
|
93 |
CAknButton::ConstructL(
|
|
94 |
icon,
|
|
95 |
NULL,
|
|
96 |
NULL,
|
|
97 |
NULL,
|
|
98 |
KNullDesC(),
|
|
99 |
KNullDesC(),
|
|
100 |
KAknButtonNoFrame | KAknButtonPressedDownFrame );
|
|
101 |
|
|
102 |
if ( aParent )
|
|
103 |
{
|
|
104 |
SetContainerWindowL( *aParent );
|
|
105 |
}
|
|
106 |
}
|
|
107 |
|
|
108 |
// EOF
|