|
1 /* |
|
2 * Copyright (c) 2006 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 * MsgEditor bitmap container control. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "MsgBitmapControl.h" |
|
23 |
|
24 #include <AknsDrawUtils.h> // AknsDrawUtils |
|
25 #include <aknenv.h> |
|
26 |
|
27 #include <MIHLBitmap.h> // MIHLBitmap |
|
28 |
|
29 // ========================================================== |
|
30 |
|
31 // EXTERNAL DATA STRUCTURES |
|
32 |
|
33 // EXTERNAL FUNCTION PROTOTYPES |
|
34 |
|
35 // CONSTANTS |
|
36 |
|
37 // MACROS |
|
38 |
|
39 // LOCAL CONSTANTS AND MACROS |
|
40 |
|
41 // MODULE DATA STRUCTURES |
|
42 |
|
43 // LOCAL FUNCTION PROTOTYPES |
|
44 |
|
45 // ================= MEMBER FUNCTIONS ======================= |
|
46 |
|
47 // --------------------------------------------------------- |
|
48 // CMsgBitmapControl::CMsgBitmapControl |
|
49 // |
|
50 // Constructor. |
|
51 // --------------------------------------------------------- |
|
52 // |
|
53 CMsgBitmapControl::CMsgBitmapControl() |
|
54 { |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------- |
|
58 // CMsgBitmapControl::~CMsgBitmapControl |
|
59 // |
|
60 // Destructor |
|
61 // --------------------------------------------------------- |
|
62 // |
|
63 CMsgBitmapControl::~CMsgBitmapControl() |
|
64 { |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------- |
|
68 // CMsgBitmapControl::SetBitmap |
|
69 // |
|
70 // Starts the image loading. |
|
71 // --------------------------------------------------------- |
|
72 // |
|
73 void CMsgBitmapControl::SetBitmap( MIHLBitmap* aBitmap ) |
|
74 { |
|
75 iBitmap = aBitmap; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // CMsgBitmapControl::Draw |
|
80 // Draws the bitmap. |
|
81 // --------------------------------------------------------- |
|
82 // |
|
83 void CMsgBitmapControl::Draw( const TRect& aRect ) const |
|
84 { |
|
85 CWindowGc& gc = SystemGc(); |
|
86 |
|
87 // Draw the bitmap background either bitmap is not set or it has mask present. |
|
88 if ( !iBitmap || iBitmap->HasMask() ) |
|
89 { |
|
90 if ( !AknsDrawUtils::Background( AknsUtils::SkinInstance(), |
|
91 AknsDrawUtils::ControlContext( this ), |
|
92 this, |
|
93 gc, |
|
94 aRect, |
|
95 KAknsDrawParamNoClearUnderImage ) ) |
|
96 { |
|
97 gc.SetBrushColor( AKN_LAF_COLOR( 0 ) ); |
|
98 gc.SetPenStyle( CGraphicsContext::ENullPen ); |
|
99 gc.SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
100 gc.DrawRect( aRect ); |
|
101 } |
|
102 } |
|
103 |
|
104 if ( iBitmap ) |
|
105 { |
|
106 iBitmap->Draw( gc, Position(), Size() ); |
|
107 } |
|
108 } |
|
109 |
|
110 // End of File |