author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 20:46:07 +0300 | |
branch | RCL_3 |
changeset 57 | 2c87b2808fd7 |
parent 54 | bac7acad7cb3 |
child 67 | 756ad29ed18e |
permissions | -rw-r--r-- |
54 | 1 |
/* |
2 |
* Copyright (c) 2007-2010 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: A drawer class for the capture setup list box items* |
|
15 |
*/ |
|
16 |
||
17 |
||
18 |
||
19 |
// INCLUDE FILES |
|
20 |
#include <eikappui.h> // For CCoeAppUiBase |
|
21 |
#include <eikapp.h> // For CEikApplication |
|
22 |
#include <AknUtils.h> |
|
23 |
#include <AknsSkinInstance.h> |
|
24 |
#include <AknsUtils.h> |
|
25 |
#include <barsread.h> |
|
26 |
#include <AknIconArray.h> |
|
27 |
#include <gulicon.h> |
|
28 |
#include <AknsFrameBackgroundControlContext.h> |
|
29 |
#include <AknsDrawUtils.h> |
|
30 |
#include <aknenv.h> |
|
31 |
#include <aknlayoutscalable_avkon.cdl.h> // list_highlight_pane_g1_cp1 |
|
32 |
||
33 |
#include <cameraapp.mbg> |
|
34 |
#ifndef CAMERAAPP_PLUGIN_BUILD |
|
35 |
#include <cameraapp.rsg> |
|
36 |
#include <vgacamsettings.rsg> |
|
37 |
#else |
|
38 |
#include <gscamerapluginrsc.rsg> |
|
39 |
#endif //CAMERAAPP_PLUGIN_BUILD |
|
40 |
||
41 |
||
42 |
#include "CamCaptureSetupListItemDrawer.h" |
|
43 |
#include "CamCaptureSetupListBoxModel.h" |
|
44 |
#include "CamUtility.h" |
|
45 |
#include "camlogging.h" |
|
46 |
||
47 |
#include <aknlayoutscalable_apps.cdl.h> |
|
48 |
||
49 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
50 |
#include <aknlistloadertfx.h> |
|
51 |
#include <aknlistboxtfxinternal.h> |
|
52 |
#endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
53 |
||
54 |
// CONSTANTS |
|
55 |
static const TInt KRadioButtonSelectedIconIndex = 0; |
|
56 |
static const TInt KRadioButtonUnselectedIconIndex = 1; |
|
57 |
const TUint32 KToolbarExtensionBgColor = 0x00000000; |
|
58 |
const TInt KToolBarExtensionBgAlpha = 0x7F; |
|
59 |
||
60 |
||
61 |
// ================= MEMBER FUNCTIONS ======================= |
|
62 |
||
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// CCamCaptureSetupListItemDrawer::NewL |
|
65 |
// Two-phased constructor. |
|
66 |
// ----------------------------------------------------------------------------- |
|
67 |
// |
|
68 |
CCamCaptureSetupListItemDrawer* |
|
69 |
CCamCaptureSetupListItemDrawer::NewL( MCamListboxModel& aListBoxModel, TBool aFullySkinned ) |
|
70 |
{ |
|
71 |
CCamCaptureSetupListItemDrawer* self = new( ELeave ) |
|
72 |
CCamCaptureSetupListItemDrawer( aListBoxModel, aFullySkinned ); |
|
73 |
CleanupStack::PushL( self ); |
|
74 |
self->ConstructL(); |
|
75 |
CleanupStack::Pop( self ); |
|
76 |
return self; |
|
77 |
} |
|
78 |
||
79 |
// ----------------------------------------------------------------------------- |
|
80 |
// CCamCaptureSetupListItemDrawer Destructor |
|
81 |
// |
|
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// |
|
84 |
CCamCaptureSetupListItemDrawer::~CCamCaptureSetupListItemDrawer() |
|
85 |
{ |
|
86 |
PRINT( _L("Camera => ~CCamCaptureSetupListItemDrawer") ); |
|
87 |
if ( iRadioButtonIconArray ) |
|
88 |
{ |
|
89 |
delete iRadioButtonIconArray; |
|
90 |
iRadioButtonIconArray = NULL; |
|
91 |
} |
|
92 |
PRINT( _L("Camera <= ~CCamCaptureSetupListItemDrawer") ); |
|
93 |
} |
|
94 |
||
95 |
// ----------------------------------------------------------------------------- |
|
96 |
// CCamCaptureSetupListItemDrawer::CCamCaptureSetupListItemDrawer |
|
97 |
// C++ constructor |
|
98 |
// ----------------------------------------------------------------------------- |
|
99 |
// |
|
100 |
CCamCaptureSetupListItemDrawer |
|
101 |
::CCamCaptureSetupListItemDrawer( MCamListboxModel& aListBoxModel, TBool aFullySkinned ) |
|
102 |
: iModel( aListBoxModel ),iFullySkinned( aFullySkinned ) |
|
103 |
{ |
|
104 |
} |
|
105 |
||
106 |
// --------------------------------------------------------------------------- |
|
107 |
// CCamCaptureSetupListItemDrawer::ConstructL |
|
108 |
// 2nd phase construction |
|
109 |
// --------------------------------------------------------------------------- |
|
110 |
// |
|
111 |
void CCamCaptureSetupListItemDrawer::ConstructL() |
|
112 |
{ |
|
113 |
||
114 |
||
115 |
iCaptureSetupItemHeight = iModel.ListItemLayoutData().Rect().Height(); |
|
116 |
||
117 |
||
118 |
const TInt KIconArrayGranularity = 4; |
|
119 |
iRadioButtonIconArray = |
|
120 |
new( ELeave ) CAknIconArray( KIconArrayGranularity ); |
|
121 |
TResourceReader reader; |
|
122 |
||
123 |
CCoeEnv::Static()->CreateResourceReaderLC(reader, R_AVKON_SETTING_PAGE_RADIOBUTTON_ICONS); |
|
124 |
||
125 |
reader.ReadInt16(); //not needed, simple or complex |
|
126 |
||
127 |
HBufC* bmpFile = reader.ReadHBufCL(); |
|
128 |
TInt count = reader.ReadInt16(); // count |
|
129 |
||
130 |
TInt32 bmpSelected = reader.ReadInt32(); |
|
131 |
TInt32 bmpSelectedM = reader.ReadInt32(); |
|
132 |
TInt32 bmp = reader.ReadInt32(); |
|
133 |
TInt32 bmpM = reader.ReadInt32(); |
|
134 |
CleanupStack::PopAndDestroy(); // reader |
|
135 |
||
136 |
CleanupStack::PushL(bmpFile); |
|
137 |
||
138 |
// create normally colored icons |
|
139 |
CreateIconAndAddToArrayL( iRadioButtonIconArray, |
|
140 |
KAknsIIDQgnIndiRadiobuttOn, |
|
141 |
EAknsCIQsnIconColorsCG14, |
|
142 |
*bmpFile, |
|
143 |
bmpSelected, |
|
144 |
bmpSelectedM ); |
|
145 |
||
146 |
CreateIconAndAddToArrayL( iRadioButtonIconArray, |
|
147 |
KAknsIIDQgnIndiRadiobuttOff, |
|
148 |
EAknsCIQsnIconColorsCG14, |
|
149 |
*bmpFile, |
|
150 |
bmp, |
|
151 |
bmpM ); |
|
152 |
||
153 |
// create highlight colored icons |
|
154 |
CreateIconAndAddToArrayL( iRadioButtonIconArray, |
|
155 |
KAknsIIDQgnIndiRadiobuttOn, |
|
156 |
EAknsCIQsnIconColorsCG18, |
|
157 |
*bmpFile, |
|
158 |
bmpSelected, |
|
159 |
bmpSelectedM ); |
|
160 |
||
161 |
CreateIconAndAddToArrayL( iRadioButtonIconArray, |
|
162 |
KAknsIIDQgnIndiRadiobuttOff, |
|
163 |
EAknsCIQsnIconColorsCG18, |
|
164 |
*bmpFile, |
|
165 |
bmp, |
|
166 |
bmpM ); |
|
167 |
||
168 |
const TSize radioButtonRectSize = |
|
169 |
TSize( iModel.RadioButtonLayoutData().Rect().Width(), |
|
170 |
iModel.RadioButtonLayoutData().Rect().Height() ); |
|
171 |
AknIconUtils::SetSize( |
|
172 |
iRadioButtonIconArray->At( KRadioButtonSelectedIconIndex )->Bitmap(), |
|
173 |
radioButtonRectSize ); |
|
174 |
AknIconUtils::SetSize( |
|
175 |
iRadioButtonIconArray->At( KRadioButtonUnselectedIconIndex )->Bitmap(), |
|
176 |
radioButtonRectSize ); |
|
177 |
||
178 |
||
179 |
ReadLayout(); |
|
180 |
||
181 |
CleanupStack::PopAndDestroy(); // bmpfile |
|
182 |
||
183 |
} |
|
184 |
||
185 |
// --------------------------------------------------------------------------- |
|
186 |
// CCamCaptureSetupListItemDrawer::MinimumCellSize |
|
187 |
// Calculate the minimum size of a cell |
|
188 |
// --------------------------------------------------------------------------- |
|
189 |
// |
|
190 |
TSize |
|
191 |
CCamCaptureSetupListItemDrawer::MinimumCellSize() const |
|
192 |
{ |
|
193 |
PRINT( _L("Camera => CCamCaptureSetupListItemDrawer::MinimumCellSize") ); |
|
194 |
||
195 |
TSize cellSize; |
|
196 |
cellSize.iWidth = iModel.ListItemLayoutData().Rect().Width(); |
|
197 |
cellSize.iHeight = iModel.ListItemLayoutData().Rect().Height(); |
|
198 |
||
199 |
||
200 |
PRINT2( _L("Camera => CCamCaptureSetupListItemDrawer::MinimumCellSize, return (%d x %d)"), cellSize.iWidth, cellSize.iHeight ); |
|
201 |
return cellSize; |
|
202 |
} |
|
203 |
||
204 |
// --------------------------------------------------------------------------- |
|
205 |
// CCamCaptureSetupListItemDrawer::DrawActualItem |
|
206 |
// Draw the highlight, bitmap, radio button and item text. |
|
207 |
// --------------------------------------------------------------------------- |
|
208 |
// |
|
209 |
void CCamCaptureSetupListItemDrawer::DrawActualItem( TInt aItemIndex, |
|
210 |
const TRect& aActualItemRect, |
|
211 |
TBool aItemIsCurrent, |
|
212 |
TBool /*aViewIsEmphasized*/, |
|
213 |
TBool /*aViewIsDimmed*/, |
|
214 |
TBool aItemIsSelected ) const |
|
215 |
{ |
|
216 |
||
217 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
218 |
MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( iGc ); |
|
219 |
if ( transApi ) |
|
220 |
{ |
|
221 |
transApi->StartDrawing( MAknListBoxTfxInternal::EListView ); |
|
222 |
} |
|
223 |
#endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
224 |
// Draw unhighlighted rectangle that encapsulates the item text and bitmap. |
|
225 |
PRINT1( _L("Camera <> CCamCaptureSetupListItemDrawer::DrawActualItem iFullySkinned=%d"), iFullySkinned ); |
|
226 |
||
227 |
if( iFullySkinned ) |
|
228 |
{ |
|
229 |
DrawItemRect( aActualItemRect ); |
|
230 |
} |
|
231 |
else |
|
232 |
{ |
|
233 |
DrawTransparentItemRect( aActualItemRect ); |
|
234 |
} |
|
235 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
236 |
if ( transApi ) |
|
237 |
{ |
|
238 |
transApi->StopDrawing(); |
|
239 |
} |
|
240 |
#endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
241 |
// If this item is currently selected, draw highlight |
|
242 |
if ( aItemIsCurrent ) |
|
243 |
{ |
|
244 |
DrawHighlight( aActualItemRect ); |
|
245 |
} |
|
246 |
||
247 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
248 |
if ( transApi ) |
|
249 |
{ |
|
250 |
transApi->StartDrawing( MAknListBoxTfxInternal::EListItem ); |
|
251 |
} |
|
252 |
#endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
253 |
// Determine drawing colour for text and radio buttons, from current skin |
|
254 |
// ...text colour index if this item is not selected. |
|
255 |
TRgb color; |
|
256 |
TAknsQsnTextColorsIndex index = EAknsCIQsnTextColorsCG7; |
|
257 |
// ...text colour index if this item is selected. |
|
258 |
if( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
259 |
{ |
|
260 |
// Single clickable items don't have a highlight |
|
261 |
aItemIsCurrent = EFalse; |
|
262 |
} |
|
263 |
||
264 |
if ( aItemIsCurrent ) |
|
265 |
{ |
|
266 |
index = EAknsCIQsnTextColorsCG10; // highlighted text colour |
|
267 |
} |
|
268 |
||
269 |
// ...get colour from current skin for text colour index |
|
270 |
MAknsSkinInstance *skin = AknsUtils::SkinInstance(); |
|
271 |
AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, index ); |
|
272 |
||
273 |
// ...make sure text/bitmap background colour does not overwrite skin background colour |
|
274 |
iGc->SetBrushStyle( CGraphicsContext::ENullBrush ); |
|
275 |
||
276 |
if ( !iModel.ShootingModeListBox() ) |
|
277 |
{ |
|
278 |
||
279 |
// Draw text |
|
280 |
// ...Create a text layout object for drawing the text |
|
281 |
// ...inside of the list item's rectangle |
|
282 |
TAknLayoutText layoutText; |
|
283 |
layoutText.LayoutText( aActualItemRect, iTxtLayout ); |
|
284 |
// ...Pass the text to be drawn, into the text layout object |
|
285 |
// ...and draw it. |
|
286 |
if( !iFullySkinned && !aItemIsCurrent ) |
|
287 |
{ |
|
288 |
color = KRgbWhite; |
|
289 |
} |
|
290 |
||
291 |
layoutText.DrawText( *iGc, iModel.ItemText( aItemIndex ), |
|
292 |
ETrue, color ); |
|
293 |
// Draw the bitmap. |
|
294 |
// ...Create a rect layout object for drawing the bitmap |
|
295 |
// ...inside of the list item's rectangle. |
|
296 |
TAknLayoutRect layoutRect; |
|
297 |
layoutRect.LayoutRect( aActualItemRect, iBmpLayout ); |
|
298 |
// ...Pass the bitmap to be drawn, into the rect layout object |
|
299 |
// ...and draw it. |
|
300 |
CFbsBitmap* bitmap = iModel.Bitmap( aItemIndex ); |
|
301 |
// if the item has a bitmap |
|
302 |
if ( bitmap ) |
|
303 |
{ |
|
304 |
CFbsBitmap* bitmapMask = iModel.BitmapMask( aItemIndex ); |
|
305 |
layoutRect.DrawImage( *iGc, bitmap, bitmapMask ); |
|
306 |
} |
|
307 |
||
308 |
||
309 |
DrawRadioButton( aActualItemRect, aItemIsSelected, color ); |
|
310 |
} |
|
311 |
else |
|
312 |
{ |
|
313 |
// draw without radiobuttons |
|
314 |
||
315 |
// Draw text |
|
316 |
// ...Create a text layout object for drawing the text |
|
317 |
// ...inside of the list item's rectangle |
|
318 |
TAknLayoutText layoutText; |
|
319 |
layoutText.LayoutText( aActualItemRect, iTxtWithRbLayout ); |
|
320 |
// ...Pass the text to be drawn, into the text layout object |
|
321 |
// ...and draw it. |
|
322 |
if( !iFullySkinned && !aItemIsCurrent ) |
|
323 |
{ |
|
324 |
color = KRgbWhite; |
|
325 |
} |
|
326 |
||
327 |
layoutText.DrawText( *iGc, iModel.ItemText( aItemIndex ), ETrue, color ); |
|
328 |
||
329 |
// Draw the bitmap. |
|
330 |
// ...Create a rect layout object for drawing the bitmap |
|
331 |
// ...inside of the list item's rectangle. |
|
332 |
TAknLayoutRect layoutRect; |
|
333 |
layoutRect.LayoutRect( aActualItemRect, iBmpWithRbLayout ); |
|
334 |
// ...Pass the bitmap to be drawn, into the rect layout object |
|
335 |
// ...and draw it. |
|
336 |
CFbsBitmap* bitmap = iModel.Bitmap( aItemIndex ); |
|
337 |
// if the item has a bitmap |
|
338 |
if ( bitmap ) |
|
339 |
{ |
|
340 |
CFbsBitmap* bitmapMask = iModel.BitmapMask( aItemIndex ); |
|
341 |
layoutRect.DrawImage( *iGc, bitmap, bitmapMask ); |
|
342 |
} |
|
343 |
||
344 |
||
345 |
} |
|
346 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
347 |
if ( transApi ) |
|
348 |
{ |
|
349 |
transApi->StopDrawing(); |
|
350 |
} |
|
351 |
#endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
352 |
} |
|
353 |
||
354 |
// --------------------------------------------------------------------------- |
|
355 |
// CCamCaptureSetupListItemDrawer::DrawHighlight |
|
356 |
// Draw the highlight as a bitmap before any other part of the item |
|
357 |
// --------------------------------------------------------------------------- |
|
358 |
// |
|
359 |
void CCamCaptureSetupListItemDrawer::DrawHighlight( const TRect& aActualItemRect ) const |
|
360 |
{ |
|
361 |
if( Flags() & CListItemDrawer::ESingleClickDisabledHighlight ) |
|
362 |
{ |
|
363 |
return; |
|
364 |
} |
|
365 |
||
366 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
367 |
MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal( iGc ); |
|
368 |
if ( transApi ) |
|
369 |
{ |
|
370 |
transApi->BeginRedraw( MAknListBoxTfxInternal::EListHighlight, aActualItemRect ); |
|
371 |
transApi->StartDrawing( MAknListBoxTfxInternal::EListHighlight ); |
|
372 |
} |
|
373 |
#endif //RD_UI_TRANSITION_EFFECTS_LIST |
|
374 |
TAknLayoutRect highlightRectLayout; |
|
375 |
highlightRectLayout.LayoutRect( aActualItemRect, iHighlightLayout ); |
|
376 |
//highlightRectLayout.DrawOutLineRect(*iGc); |
|
377 |
TRect highlightRect( highlightRectLayout.Rect() ); |
|
378 |
||
379 |
||
380 |
||
381 |
||
382 |
// Draw highlight using the same highlight that is used for the Avkon settings list radio controls. |
|
383 |
MAknsSkinInstance *skin = AknsUtils::SkinInstance(); |
|
384 |
//TBool highlightDrawn = EFalse; |
|
385 |
||
386 |
TAknLayoutRect innerHighlightLayRect; |
|
387 |
innerHighlightLayRect.LayoutRect( highlightRect, |
|
388 |
AknLayoutScalable_Avkon::list_highlight_pane_g1_cp1() ); |
|
389 |
||
390 |
//highlightDrawn = |
|
391 |
if ( Flags()&EPressedDownState ) |
|
392 |
{ |
|
393 |
// This handles the darker pressed down highlights |
|
394 |
AknsDrawUtils::DrawFrame( skin, |
|
395 |
*iGc, |
|
396 |
highlightRect, |
|
397 |
innerHighlightLayRect.Rect(), |
|
398 |
KAknsIIDQsnFrListPressed, |
|
399 |
KAknsIIDQsnFrListCenterPressed ); |
|
400 |
} |
|
401 |
else |
|
402 |
{ |
|
403 |
AknsDrawUtils::DrawFrame( skin, |
|
404 |
*iGc, |
|
405 |
highlightRect, |
|
406 |
innerHighlightLayRect.Rect(), |
|
407 |
KAknsIIDQsnFrList, //KAknsIIDQsnFrSetOptFoc other option? |
|
408 |
KAknsIIDDefault ); |
|
409 |
||
410 |
} |
|
411 |
||
412 |
//(void)highlightDrawn; // avoid compiler warning |
|
413 |
/* |
|
414 |
// if the highlight has not be drawn |
|
415 |
if ( !highlightDrawn ) |
|
416 |
{ |
|
417 |
TAknLayoutRect highlightshadow; |
|
418 |
TAknLayoutRect highlight; |
|
419 |
highlightshadow.LayoutRect( highlightRect, |
|
420 |
AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_1( highlightRect ) ); |
|
421 |
highlight.LayoutRect( highlightRect, |
|
422 |
AKN_LAYOUT_WINDOW_List_pane_highlight_graphics__various__Line_2( highlightRect ) ); |
|
423 |
highlightshadow.DrawRect( *iGc ); |
|
424 |
highlight.DrawRect( *iGc ); |
|
425 |
} |
|
426 |
*/ |
|
427 |
#ifdef RD_UI_TRANSITION_EFFECTS_LIST |
|
428 |
if ( transApi ) |
|
429 |
{ |
|
430 |
transApi->StopDrawing(); |
|
431 |
transApi->EndRedraw( MAknListBoxTfxInternal::EListHighlight ); |
|
432 |
} |
|
433 |
#endif // RD_UI_TRANSITION_EFFECTS_LIST |
|
434 |
} |
|
435 |
||
436 |
// --------------------------------------------------------------------------- |
|
437 |
// CCamCaptureSetupListItemDrawer::DrawRadioButton |
|
438 |
// Draw the radio button |
|
439 |
// --------------------------------------------------------------------------- |
|
440 |
// |
|
441 |
void CCamCaptureSetupListItemDrawer::DrawRadioButton( const TRect& aActualItemRect, |
|
442 |
TBool aItemIsSelected, const TRgb& /*aColor*/ ) const |
|
443 |
{ |
|
444 |
PRINT( _L("Camera => CCamCaptureSetupListItemDrawer::DrawRadioButton")) |
|
445 |
||
446 |
TAknLayoutRect layoutRect; |
|
447 |
layoutRect.LayoutRect( aActualItemRect, AknLayoutScalable_Apps::cset_list_set_pane_g1( 0 ) ); |
|
448 |
||
449 |
// Pass the bitmap to be drawn into the rect layout object, and draw it |
|
450 |
TInt index; |
|
451 |
if (aItemIsSelected) |
|
452 |
{ |
|
453 |
index = KRadioButtonSelectedIconIndex; |
|
454 |
} |
|
455 |
else |
|
456 |
{ |
|
457 |
index = KRadioButtonUnselectedIconIndex; |
|
458 |
} |
|
459 |
||
460 |
layoutRect.DrawImage( *iGc, |
|
461 |
iRadioButtonIconArray->At(index)->Bitmap(), |
|
462 |
iRadioButtonIconArray->At(index)->Mask() ); |
|
463 |
||
464 |
} |
|
465 |
||
466 |
||
467 |
// --------------------------------------------------------- |
|
468 |
// CCamCaptureSetupListItemDrawer::DrawItemRect |
|
469 |
// Draws a rectangle for an item. |
|
470 |
// --------------------------------------------------------- |
|
471 |
// |
|
472 |
void CCamCaptureSetupListItemDrawer::DrawTransparentItemRect( |
|
473 |
const TRect& aActualItemRect ) // the rectangular area to be drawn |
|
474 |
const |
|
475 |
{ |
|
476 |
const CCoeControl* control = iParentControl; |
|
477 |
||
478 |
if ( control ) |
|
479 |
{ |
|
480 |
iGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
481 |
iGc->SetPenColor( TRgb( 0x00ffffff, KToolBarExtensionBgAlpha ) ); |
|
482 |
iGc->SetPenStyle( CGraphicsContext::ENullPen ); |
|
483 |
iGc->SetBrushColor( TRgb( KToolbarExtensionBgColor, KToolBarExtensionBgAlpha ) ); |
|
484 |
iGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
485 |
iGc->DrawRect( aActualItemRect ); |
|
486 |
iGc->SetPenSize( TSize( 1, 3 ) ); |
|
487 |
iGc->SetPenStyle( CGraphicsContext::ESolidPen ); |
|
488 |
iGc->DrawLine( TPoint( aActualItemRect.iTl.iX , |
|
489 |
aActualItemRect.iBr.iY ), aActualItemRect.iBr ); |
|
490 |
} |
|
491 |
} |
|
492 |
// --------------------------------------------------------- |
|
493 |
// CCamCaptureSetupListItemDrawer::DrawItemRect |
|
494 |
// Draws a rectangle for an item. |
|
495 |
// --------------------------------------------------------- |
|
496 |
// |
|
497 |
void CCamCaptureSetupListItemDrawer::DrawItemRect( |
|
498 |
const TRect& aActualItemRect ) // the rectangular area to be drawn |
|
499 |
const |
|
500 |
{ |
|
501 |
||
502 |
/* |
|
503 |
iGc->SetBrushColor( AKN_LAF_COLOR_STATIC(0) ); |
|
504 |
iGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
505 |
iGc->SetPenStyle( CGraphicsContext::ENullPen ); |
|
506 |
iGc->DrawRect( aActualItemRect ); |
|
507 |
||
508 |
*/ |
|
509 |
||
510 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
511 |
const CCoeControl* control = iParentControl; |
|
512 |
MAknsControlContext* cc = AknsDrawUtils::ControlContext( control ); |
|
513 |
||
514 |
TBool bgDrawn( EFalse ); |
|
515 |
if ( control ) |
|
516 |
{ |
|
517 |
bgDrawn = AknsDrawUtils::Background( |
|
518 |
skin, cc, control, *iGc, aActualItemRect, |
|
519 |
KAknsDrawParamNoClearUnderImage | |
|
520 |
KAknsDrawParamBottomLevelRGBOnly ); |
|
521 |
} |
|
522 |
||
523 |
if ( !bgDrawn ) |
|
524 |
{ |
|
525 |
iGc->Clear( aActualItemRect ); |
|
526 |
} |
|
527 |
||
528 |
||
529 |
/* |
|
530 |
// Draw background to be the same colour as that for the Avkon settings list radio controls. |
|
531 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
532 |
// AknsDrawUtils::DrawCachedImage(skin, *iGc, aActualItemRect, KAknsIIDQsnFrSetOpt); |
|
533 |
AknsDrawUtils::DrawCachedImage(skin, *iGc, aActualItemRect, KAknsIIDQsnBgScreenMp); |
|
534 |
*/ |
|
535 |
||
536 |
} |
|
537 |
||
538 |
// --------------------------------------------------------- |
|
539 |
// CCamCaptureSetupListItemDrawer::SetControl |
|
540 |
// Sets the parent control of the listbox |
|
541 |
// --------------------------------------------------------- |
|
542 |
// |
|
543 |
void CCamCaptureSetupListItemDrawer::SetParentControl( |
|
544 |
const CCoeControl* aControl ) |
|
545 |
{ |
|
546 |
iParentControl = aControl; |
|
547 |
} |
|
548 |
||
549 |
// --------------------------------------------------------- |
|
550 |
// CCamCaptureSetupListItemDrawer::ReadLayout |
|
551 |
// --------------------------------------------------------- |
|
552 |
// |
|
553 |
void CCamCaptureSetupListItemDrawer::ReadLayout() |
|
554 |
{ |
|
57
2c87b2808fd7
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
54
diff
changeset
|
555 |
if ( AknLayoutUtils::PenEnabled() ) |
54 | 556 |
{ |
557 |
iTxtLayout = AknLayoutScalable_Apps::cset_list_set_pane_t1( 0 ); |
|
558 |
iBmpLayout = AknLayoutScalable_Apps::cset_list_set_pane_g3( 0 ); |
|
559 |
iTxtWithRbLayout = AknLayoutScalable_Apps::cset_list_set_pane_t1( 1 ); |
|
560 |
iBmpWithRbLayout = AknLayoutScalable_Apps::cset_list_set_pane_g3( 1 ); |
|
561 |
iHighlightLayout = |
|
562 |
AknLayoutScalable_Apps::list_highlight_pane_cp021( 0 ); |
|
563 |
} |
|
564 |
else |
|
565 |
{ |
|
566 |
iTxtLayout = AknLayoutScalable_Apps::cset_list_set_pane_t1_copy1( 0 ); |
|
567 |
iBmpLayout = AknLayoutScalable_Apps::cset_list_set_pane_g3_copy1( 0 ); |
|
568 |
iTxtWithRbLayout = |
|
569 |
AknLayoutScalable_Apps::cset_list_set_pane_t1_copy1( 1 ); |
|
570 |
iBmpWithRbLayout = |
|
571 |
AknLayoutScalable_Apps::cset_list_set_pane_g3_copy1( 1 ); |
|
572 |
iHighlightLayout = |
|
573 |
AknLayoutScalable_Apps::list_highlight_pane_cp021_copy1( 0 ); |
|
574 |
} |
|
575 |
} |
|
576 |
||
577 |
void CCamCaptureSetupListItemDrawer::CreateIconAndAddToArrayL( |
|
578 |
CArrayPtr<CGulIcon>*& aIconArray, |
|
579 |
const TAknsItemID& aId, |
|
580 |
const TInt aColorIndex, |
|
581 |
const TDesC& aBmpFile, |
|
582 |
const TInt32 aBmp, |
|
583 |
const TInt32 aBmpM ) |
|
584 |
{ |
|
585 |
MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
|
586 |
||
587 |
CFbsBitmap* bitmap = 0; |
|
588 |
CFbsBitmap* mask = 0; |
|
589 |
||
590 |
AknsUtils::CreateColorIconLC( skin, |
|
591 |
aId, |
|
592 |
KAknsIIDQsnIconColors, |
|
593 |
aColorIndex, |
|
594 |
bitmap, |
|
595 |
mask, |
|
596 |
aBmpFile, |
|
597 |
aBmp, |
|
598 |
aBmpM, |
|
599 |
KRgbBlack ); |
|
600 |
||
601 |
CGulIcon* gulicon = CGulIcon::NewL( bitmap, mask ); // ownership passed |
|
602 |
CleanupStack::PushL( gulicon ); |
|
603 |
||
604 |
aIconArray->AppendL( gulicon ); |
|
605 |
CleanupStack::Pop( 3 ); // mask, bitmap, gulicon |
|
606 |
} |
|
607 |
||
608 |
//End of file |
|
609 |
||
610 |