|
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: Definition of CMRImage class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "cmrimage.h" |
|
19 |
|
20 #include <AknsUtils.h> |
|
21 #include <esmrgui.mbg> |
|
22 #include <data_caging_path_literals.hrh> |
|
23 |
|
24 #include "esmrhelper.h" |
|
25 #include "cesmrlayoutmgr.h" |
|
26 |
|
27 |
|
28 |
|
29 // ======== MEMBER FUNCTIONS ======== |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // CMRImage::NewL |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 EXPORT_C CMRImage* CMRImage::NewL( |
|
36 const TAknsItemID& aIconId, TScaleMode aScaleMode ) |
|
37 { |
|
38 CMRImage* self = new (ELeave) CMRImage( aScaleMode ); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL( aIconId ); |
|
41 CleanupStack::Pop( self ); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CMRImage::~CMRImage |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 EXPORT_C CMRImage* CMRImage::NewL( |
|
50 NMRBitmapManager::TMRBitmapId aBitmapId, TScaleMode aScaleMode ) |
|
51 { |
|
52 CMRImage* self = new (ELeave) CMRImage( aScaleMode ); |
|
53 CleanupStack::PushL( self ); |
|
54 self->ConstructL( aBitmapId ); |
|
55 CleanupStack::Pop( self ); |
|
56 return self; |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 // CMRImage::~CMRImage |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C CMRImage::~CMRImage() |
|
64 { |
|
65 // Do nothing |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CMRImage::SizeChanged |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void CMRImage::SizeChanged() |
|
73 { |
|
74 TSize sz = Rect().Size(); |
|
75 const CFbsBitmap* bitmap = Bitmap(); |
|
76 AknIconUtils::SetSize( const_cast< CFbsBitmap* >( bitmap ), sz, iScaleMode ); |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // CMRImage::CMRImage |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 CMRImage::CMRImage( TScaleMode aScaleMode ) |
|
84 : iScaleMode( aScaleMode ) |
|
85 { |
|
86 // Do nothing |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // CMRImage::ConstructL |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 void CMRImage::ConstructL( const TAknsItemID& aIconId ) |
|
94 { |
|
95 CreateIconL( aIconId ); |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // CMRImage::ConstructL |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CMRImage::ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId ) |
|
103 { |
|
104 CreateIconL( aBitmapId ); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CMRImage::CreateIconL |
|
109 // --------------------------------------------------------------------------- |
|
110 // |
|
111 void CMRImage::CreateIconL( const TAknsItemID& aIconId ) |
|
112 { |
|
113 TInt fileIndex(-1); |
|
114 TInt fileMaskIndex(-1); |
|
115 |
|
116 SetBitmapFallback( aIconId, fileIndex, fileMaskIndex ); |
|
117 |
|
118 TFileName bitmapFilePath; |
|
119 ESMRHelper::LocateResourceFile( |
|
120 KESMRMifFile, |
|
121 KDC_APP_BITMAP_DIR, |
|
122 bitmapFilePath ); |
|
123 |
|
124 CFbsBitmap* bitMap; |
|
125 CFbsBitmap* bitMapMask; |
|
126 |
|
127 AknsUtils::CreateIconL( AknsUtils::SkinInstance(), |
|
128 aIconId, |
|
129 bitMap, |
|
130 bitMapMask, |
|
131 bitmapFilePath, |
|
132 fileIndex, |
|
133 fileMaskIndex |
|
134 ); |
|
135 |
|
136 if( bitMap && bitMapMask ) |
|
137 { |
|
138 SetPictureOwnedExternally( EFalse ); |
|
139 SetBrushStyle( CWindowGc::ENullBrush ); |
|
140 SetPicture( bitMap, bitMapMask ); |
|
141 } |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // CMRImage::CreateIconL |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CMRImage::CreateIconL( NMRBitmapManager::TMRBitmapId aBitmapId ) |
|
149 { |
|
150 CFbsBitmap* bitMap( NULL ); |
|
151 CFbsBitmap* bitMapMask( NULL ); |
|
152 TSize sz( Rect().Size() ); |
|
153 User::LeaveIfError( |
|
154 NMRBitmapManager::GetSkinBasedBitmap( |
|
155 aBitmapId, |
|
156 bitMap, bitMapMask, sz ) ); |
|
157 |
|
158 if( bitMap && bitMapMask ) |
|
159 { |
|
160 SetPictureOwnedExternally( EFalse ); |
|
161 SetBrushStyle( CWindowGc::ENullBrush ); |
|
162 SetPicture( bitMap, bitMapMask ); |
|
163 } |
|
164 } |
|
165 |
|
166 // --------------------------------------------------------------------------- |
|
167 // CMRImage::SetBitmapFallback |
|
168 // --------------------------------------------------------------------------- |
|
169 // |
|
170 void CMRImage::SetBitmapFallback( |
|
171 const TAknsItemID& aIconId, |
|
172 TInt& aFileIndex, |
|
173 TInt& aFileMaskIndex ) |
|
174 { |
|
175 // <cmail> icons changed |
|
176 switch ( aIconId.iMinor ) |
|
177 { |
|
178 case EAknsMinorGenericQgnFscalIndiPriorityHigh: |
|
179 case EAknsMinorGenericQgnFsIndiPriorityHigh: |
|
180 { |
|
181 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_high; |
|
182 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_high_mask; |
|
183 break; |
|
184 } |
|
185 case EAknsMinorGenericQgnFscalIndiPriorityNormal: |
|
186 case EAknsMinorGenericQgnFsIndiPriorityNormal: |
|
187 { |
|
188 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_normal; |
|
189 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_normal_mask; |
|
190 break; |
|
191 } |
|
192 case EAknsMinorGenericQgnFscalIndiPriorityLow: |
|
193 case EAknsMinorGenericQgnFsIndiPriorityLow: |
|
194 { |
|
195 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_low; |
|
196 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_priority_low_mask; |
|
197 break; |
|
198 } |
|
199 case EAknsMinorGenericQgnFscalIndiAlarmDay: |
|
200 { |
|
201 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_day; |
|
202 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_day_mask; |
|
203 break; |
|
204 } |
|
205 case EAknsMinorGenericQgnFscalIndiAlarmTime: |
|
206 { |
|
207 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm; |
|
208 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_alarm_mask; |
|
209 break; |
|
210 } |
|
211 case EAknsMinorGenericQgnFscalIndiSubject: |
|
212 { |
|
213 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_subject; |
|
214 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_subject_mask; |
|
215 break; |
|
216 } |
|
217 case EAknsMinorGenericQgnFscalIndiRecurrence: |
|
218 { |
|
219 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_recurrence; |
|
220 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_recurrence_mask; |
|
221 break; |
|
222 } |
|
223 case EAknsMinorGenericQgnMeetReqIndiAlarm: |
|
224 { |
|
225 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_alarm; |
|
226 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_alarm_mask; |
|
227 break; |
|
228 } |
|
229 case EAknsMinorGenericQgnMeetReqIndiCheckboxMark: |
|
230 { |
|
231 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_on; |
|
232 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_on_mask; |
|
233 break; |
|
234 } |
|
235 case EAknsMinorGenericQgnMeetReqIndiCheckboxUnmark: |
|
236 { |
|
237 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_off; |
|
238 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_checkbox_off_mask; |
|
239 break; |
|
240 } |
|
241 case EAknsMinorGenericQgnMeetReqIndiClock: |
|
242 { |
|
243 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_clock; |
|
244 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_clock_mask; |
|
245 break; |
|
246 } |
|
247 case EAknsMinorGenericQgnMeetReqIndiDateEnd: |
|
248 { |
|
249 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_end; |
|
250 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_end_mask; |
|
251 break; |
|
252 } |
|
253 case EAknsMinorGenericQgnMeetReqIndiDateStart: |
|
254 { |
|
255 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_start; |
|
256 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_date_start_mask; |
|
257 break; |
|
258 } |
|
259 case EAknsMinorGenericQgnMeetReqIndiLocation: |
|
260 { |
|
261 aFileIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_location; |
|
262 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_meet_req_location_mask; |
|
263 break; |
|
264 } |
|
265 case EAknsMinorGenericQgnFscalIndiSynchronisation: |
|
266 { |
|
267 aFileIndex = EMbmEsmrguiQgn_indi_cmail_synchronisation; |
|
268 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_synchronisation_mask; |
|
269 break; |
|
270 } |
|
271 case EAknsMinorGenericQgnFscalIndiOccasion: |
|
272 { |
|
273 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_occasion; |
|
274 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_occasion_mask; |
|
275 break; |
|
276 } |
|
277 |
|
278 case EAknsMinorGenericQgnFsIndiCaleTrackingTentative: |
|
279 { |
|
280 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_tentative; |
|
281 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_tentative_mask; |
|
282 break; |
|
283 } |
|
284 case EAknsMinorGenericQgnFsIndiCaleTrackingAccept: |
|
285 { |
|
286 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_accept; |
|
287 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_accept_mask; |
|
288 break; |
|
289 } |
|
290 case EAknsMinorGenericQgnFsIndiCaleTrackingNone: |
|
291 { |
|
292 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_none; |
|
293 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_none_mask; |
|
294 break; |
|
295 } |
|
296 case EAknsMinorGenericQgnFsIndiCaleTrackingReject: |
|
297 { |
|
298 aFileIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_reject; |
|
299 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_calendar_tracking_reject_mask; |
|
300 break; |
|
301 } |
|
302 case EAknsMinorGenericQgnFseMailAttachment: |
|
303 { |
|
304 aFileIndex = EMbmEsmrguiQgn_indi_cmail_attachment; |
|
305 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_attachment_mask; |
|
306 break; |
|
307 } |
|
308 case EAknsMinorGenericQgnFsGrafEmailCtrlbar: |
|
309 { |
|
310 aFileIndex = EMbmEsmrguiQgn_graf_cmail_email_ctrlbar; |
|
311 aFileMaskIndex = EMbmEsmrguiQgn_graf_cmail_email_ctrlbar_mask; |
|
312 break; |
|
313 } |
|
314 case EAknsMinorQgnPropCheckboxOn: |
|
315 aFileIndex = EMbmEsmrguiQgn_prop_checkbox_on; |
|
316 aFileMaskIndex = EMbmEsmrguiQgn_prop_checkbox_on_mask; |
|
317 break; |
|
318 case EAknsMinorQgnPropCheckboxOff: |
|
319 aFileIndex = EMbmEsmrguiQgn_prop_checkbox_off; |
|
320 aFileMaskIndex = EMbmEsmrguiQgn_prop_checkbox_off_mask; |
|
321 break; |
|
322 case EAknsMinorQgnFsListCenter: |
|
323 { |
|
324 aFileIndex = EMbmEsmrguiQsn_fr_list_center; |
|
325 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_center_mask; |
|
326 break; |
|
327 } |
|
328 case EAknsMinorQgnFsListSideT: |
|
329 { |
|
330 aFileIndex = EMbmEsmrguiQsn_fr_list_side_t; |
|
331 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_t_mask; |
|
332 break; |
|
333 } |
|
334 case EAknsMinorQgnFsListSideL: |
|
335 { |
|
336 aFileIndex = EMbmEsmrguiQsn_fr_list_side_l; |
|
337 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_l_mask; |
|
338 break; |
|
339 } |
|
340 case EAknsMinorQgnFsListSideR: |
|
341 { |
|
342 aFileIndex = EMbmEsmrguiQsn_fr_list_side_r; |
|
343 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_r_mask; |
|
344 break; |
|
345 } |
|
346 case EAknsMinorQgnFsListSideB: |
|
347 { |
|
348 aFileIndex = EMbmEsmrguiQsn_fr_list_side_b; |
|
349 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_side_b_mask; |
|
350 break; |
|
351 } |
|
352 case EAknsMinorQgnFsListCornerTl: |
|
353 { |
|
354 aFileIndex = EMbmEsmrguiQsn_fr_list_corner_tl; |
|
355 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_tl_mask; |
|
356 break; |
|
357 } |
|
358 case EAknsMinorQgnFsListCornerTr: |
|
359 { |
|
360 aFileIndex = EMbmEsmrguiQsn_fr_list_corner_tr; |
|
361 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_tr_mask; |
|
362 break; |
|
363 } |
|
364 case EAknsMinorQgnFsListCornerBl: |
|
365 { |
|
366 aFileIndex = EMbmEsmrguiQsn_fr_list_corner_bl; |
|
367 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_bl_mask; |
|
368 break; |
|
369 } |
|
370 case EAknsMinorQgnFsListCornerBr: |
|
371 { |
|
372 aFileIndex = EMbmEsmrguiQsn_fr_list_corner_br; |
|
373 aFileMaskIndex = EMbmEsmrguiQsn_fr_list_corner_br_mask; |
|
374 break; |
|
375 } |
|
376 case EAknsMinorGenericQgnFsHscrActionArrowLeft: |
|
377 { |
|
378 aFileIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right; |
|
379 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right_mask; |
|
380 break; |
|
381 } |
|
382 // <cmail> removed when icons changed to common ones |
|
383 /* |
|
384 case EAknsMinorGenericQgnFsHscrActionArrowRight: |
|
385 { |
|
386 aFileIndex = EMbmEsmrguiQgn_indi_action_menu; |
|
387 aFileMaskIndex = EMbmEsmrguiQgn_indi_action_menu_mask; |
|
388 break; |
|
389 } |
|
390 */ |
|
391 // </cmail> |
|
392 // <cmail> Commented to enable compilation in wk04 |
|
393 /*case EAknsMinorGenericQgnFseActionMenuOpenInWebIcon: |
|
394 { |
|
395 aFileIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_web_icon; |
|
396 aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_web_icon; |
|
397 break; |
|
398 } |
|
399 case EAknsMinorGenericQgnFseActionMenuOpenInIntranetIcon: |
|
400 { |
|
401 aFileIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_intranet_icon; |
|
402 aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_open_in_intranet_icon_mask; |
|
403 break; |
|
404 } |
|
405 case EAknsMinorGenericQgnFseActionMenuBookmarkIcon: |
|
406 { |
|
407 aFileIndex = EMbmEsmrguiQgn_fse_action_menu_bookmark_icon; |
|
408 aFileMaskIndex = EMbmEsmrguiQgn_fse_action_menu_bookmark_icon_mask; |
|
409 break; |
|
410 }*/ |
|
411 // </cmail> |
|
412 // <cmail> removed when icons changed to common ones |
|
413 /* |
|
414 case EAknsMinorGenericQgnPropBlidWaypoint: |
|
415 { |
|
416 aFileIndex = EMbmEsmrguiQgn_fs_action_show_on_maps; |
|
417 aFileMaskIndex = EMbmEsmrguiQgn_fs_action_show_on_maps_mask; |
|
418 break; |
|
419 } |
|
420 */ |
|
421 // </cmail> |
|
422 default: |
|
423 { |
|
424 // <cmail> icons changed |
|
425 aFileIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right; |
|
426 aFileMaskIndex = EMbmEsmrguiQgn_indi_cmail_arrow_right_mask; |
|
427 break; |
|
428 // </cmail> |
|
429 } |
|
430 // </cmail> |
|
431 } |
|
432 } |
|
433 |
|
434 // EOF |