author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 11:52:37 +0300 | |
branch | RCL_3 |
changeset 73 | c8382f7b54ef |
parent 64 | 3533d4323edc |
child 80 | 726fba06891a |
permissions | -rw-r--r-- |
64 | 1 |
/* |
2 |
* Copyright (c) 2007 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 visualier class for the MultiLine item. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
//////SYSTEM INCLUDES |
|
20 |
||
21 |
//////TOOLKIT INCLUDES |
|
22 |
#include "emailtrace.h" |
|
23 |
#include <alf/alfenv.h> |
|
24 |
#include <alf/alflayout.h> |
|
25 |
#include <alf/alfanchorlayout.h> |
|
26 |
#include <alf/alftextvisual.h> |
|
27 |
#include <alf/alfimagevisual.h> |
|
28 |
#include <alf/alftexture.h> |
|
29 |
#include <alf/alfcontrol.h> |
|
30 |
#include <alf/alfimage.h> |
|
31 |
||
32 |
//////PROJECT INCLUDES |
|
33 |
#include "fsmultilineitemvisualizer.h" |
|
34 |
#include "fsmultilineitemdata.h" |
|
35 |
#include "fslayoutmanager.h" |
|
36 |
||
37 |
||
38 |
//CONSTANTS |
|
39 |
const TInt KZero = 0; |
|
40 |
const TInt KOne = 1; |
|
41 |
const TInt KTwo = 2; |
|
42 |
const TInt KThree = 3; |
|
43 |
const TInt KFour = 4; |
|
44 |
const TInt KFive = 5; |
|
45 |
const TInt KSix = 6; |
|
46 |
const TInt KSeven = 7; |
|
47 |
const TInt KEight = 8; |
|
48 |
||
49 |
// --------------------------------------------------------------------------- |
|
50 |
// Two-phased constructor. |
|
51 |
// --------------------------------------------------------------------------- |
|
52 |
// |
|
53 |
EXPORT_C CFsMultiLineItemVisualizer* CFsMultiLineItemVisualizer::NewL( CAlfControl& aOwnerControl ) |
|
54 |
{ |
|
55 |
FUNC_LOG; |
|
56 |
CFsMultiLineItemVisualizer* self = new( ELeave ) CFsMultiLineItemVisualizer( aOwnerControl ); |
|
57 |
CleanupStack::PushL( self ); |
|
58 |
self->ConstructL( ); |
|
59 |
CleanupStack::Pop( self ); |
|
60 |
return self; |
|
61 |
} |
|
62 |
||
63 |
||
64 |
// --------------------------------------------------------------------------- |
|
65 |
// C++ destructor |
|
66 |
// --------------------------------------------------------------------------- |
|
67 |
// |
|
68 |
CFsMultiLineItemVisualizer::~CFsMultiLineItemVisualizer() |
|
69 |
{ |
|
70 |
FUNC_LOG; |
|
71 |
||
72 |
} |
|
73 |
||
74 |
||
75 |
//item visualizer's interface |
|
76 |
||
77 |
// --------------------------------------------------------------------------- |
|
78 |
// The function sets how many lines the multiline item has when it's not extended. |
|
79 |
// --------------------------------------------------------------------------- |
|
80 |
// |
|
81 |
void CFsMultiLineItemVisualizer::SetNumberOfLinesWhenNotExtended( TInt aNumberOfLines ) |
|
82 |
{ |
|
83 |
FUNC_LOG; |
|
84 |
if ( 1 <= aNumberOfLines && aNumberOfLines <= 4 && aNumberOfLines <= iNumLinesExtended ) |
|
85 |
{ |
|
86 |
iNumLinesNotExtended = aNumberOfLines; |
|
87 |
} |
|
88 |
} |
|
89 |
||
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// The function returns how many lines the item has when it's not extended. |
|
93 |
// --------------------------------------------------------------------------- |
|
94 |
// |
|
95 |
TInt CFsMultiLineItemVisualizer::NumberOfLinesWhenNotExtended( ) const |
|
96 |
{ |
|
97 |
FUNC_LOG; |
|
98 |
return iNumLinesNotExtended; |
|
99 |
} |
|
100 |
||
101 |
||
102 |
// --------------------------------------------------------------------------- |
|
103 |
// The function sets how many lines the multiline item has when it's extended. |
|
104 |
// --------------------------------------------------------------------------- |
|
105 |
// |
|
106 |
void CFsMultiLineItemVisualizer::SetNumberOfLinesWhenExtended( TInt aNumberOfLines ) |
|
107 |
{ |
|
108 |
FUNC_LOG; |
|
109 |
if ( aNumberOfLines >= 1 && aNumberOfLines <= 4 && aNumberOfLines >= iNumLinesNotExtended ) |
|
110 |
{ |
|
111 |
iNumLinesExtended = aNumberOfLines; |
|
112 |
} |
|
113 |
} |
|
114 |
||
115 |
||
116 |
// --------------------------------------------------------------------------- |
|
117 |
// The function returns how many lines the item has when it's extended. |
|
118 |
// --------------------------------------------------------------------------- |
|
119 |
// |
|
120 |
TInt CFsMultiLineItemVisualizer::NumberOfLinesWhenExtended( ) const |
|
121 |
{ |
|
122 |
FUNC_LOG; |
|
123 |
return iNumLinesExtended; |
|
124 |
} |
|
125 |
||
126 |
||
127 |
// --------------------------------------------------------------------------- |
|
128 |
// The function sets state of the item's checkbox. |
|
129 |
// --------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
void CFsMultiLineItemVisualizer::SetCheckboxState( TBool aChecked ) |
|
132 |
{ |
|
133 |
FUNC_LOG; |
|
134 |
iCheckState = aChecked; |
|
135 |
} |
|
136 |
||
137 |
||
138 |
// --------------------------------------------------------------------------- |
|
139 |
// The function returns state of the item's checkbox. |
|
140 |
// --------------------------------------------------------------------------- |
|
141 |
// |
|
142 |
TBool CFsMultiLineItemVisualizer::CheckboxState () const |
|
143 |
{ |
|
144 |
FUNC_LOG; |
|
145 |
return iCheckState; |
|
146 |
} |
|
147 |
||
148 |
||
149 |
// --------------------------------------------------------------------------- |
|
150 |
// The function sets whether place holders should be kept when icons in the |
|
151 |
// first column are not present. |
|
152 |
// --------------------------------------------------------------------------- |
|
153 |
// |
|
154 |
void CFsMultiLineItemVisualizer::SetKeepEmptyIconsPlaceHolders( TBool aKeep ) |
|
155 |
{ |
|
156 |
FUNC_LOG; |
|
157 |
iKeepPlaceHolders = aKeep; |
|
158 |
} |
|
159 |
||
160 |
// --------------------------------------------------------------------------- |
|
161 |
// The function returnes whether place holders are kept in case icons are |
|
162 |
// not set. |
|
163 |
// --------------------------------------------------------------------------- |
|
164 |
// |
|
165 |
TBool CFsMultiLineItemVisualizer::IsKeepEmptyIconsPlaceHolders( ) const |
|
166 |
{ |
|
167 |
FUNC_LOG; |
|
168 |
return iKeepPlaceHolders; |
|
169 |
} |
|
170 |
||
171 |
||
172 |
// from base class MFsTreeItemVisualizer |
|
173 |
||
174 |
// --------------------------------------------------------------------------- |
|
175 |
// From MFsTreeItemVisualizer. |
|
176 |
// Returns the type of the item's visualizer. |
|
177 |
// --------------------------------------------------------------------------- |
|
178 |
// |
|
179 |
TFsTreeItemVisualizerType CFsMultiLineItemVisualizer::Type() const |
|
180 |
{ |
|
181 |
FUNC_LOG; |
|
182 |
return EFsMultiLineItemVisualizer; |
|
183 |
} |
|
184 |
||
185 |
||
186 |
// --------------------------------------------------------------------------- |
|
187 |
// From MFsTreeItemVisualizer. |
|
188 |
// Returns the size of an item in a normal (not extended) state. |
|
189 |
// --------------------------------------------------------------------------- |
|
190 |
// |
|
191 |
TSize CFsMultiLineItemVisualizer::Size() const |
|
192 |
{ |
|
193 |
FUNC_LOG; |
|
194 |
if ( IsAlwaysExtended() ) |
|
195 |
{ |
|
196 |
return ExtendedSize(); |
|
197 |
} |
|
198 |
else |
|
199 |
{ |
|
200 |
if ( iFlags & KFsTreeListItemManagedLayout ) |
|
201 |
{ |
|
202 |
return SizeWithNumberOfLines( iNumLinesNotExtended ); |
|
203 |
} |
|
204 |
else |
|
205 |
{ |
|
206 |
return iSize; |
|
207 |
} |
|
208 |
} |
|
209 |
} |
|
210 |
||
211 |
||
212 |
// --------------------------------------------------------------------------- |
|
213 |
// From MFsTreeItemVisualizer. |
|
214 |
// Returns the size of an item in expanded state. |
|
215 |
// --------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
TSize CFsMultiLineItemVisualizer::ExtendedSize() const |
|
218 |
{ |
|
219 |
FUNC_LOG; |
|
220 |
if ( iFlags & KFsTreeListItemManagedLayout ) |
|
221 |
{ |
|
222 |
return SizeWithNumberOfLines( iNumLinesExtended ); |
|
223 |
} |
|
224 |
else |
|
225 |
{ |
|
226 |
return iExtendedSize; |
|
227 |
} |
|
228 |
} |
|
229 |
||
230 |
||
231 |
// --------------------------------------------------------------------------- |
|
232 |
// From MFsTreeItemVisualizer. |
|
233 |
// A call to this function means that the item is requested to draw itself |
|
234 |
// within specified parent layout. |
|
235 |
// --------------------------------------------------------------------------- |
|
236 |
// |
|
237 |
void CFsMultiLineItemVisualizer::ShowL( CAlfLayout& aParentLayout, const TUint aTimeout ) |
|
238 |
{ |
|
239 |
FUNC_LOG; |
|
240 |
||
241 |
if (!iLayout) |
|
242 |
{ |
|
243 |
iParentLayout = &aParentLayout; |
|
244 |
iLayout = CAlfAnchorLayout::AddNewL(iOwnerControl,iParentLayout); |
|
245 |
iLayout->EnableBrushesL(); |
|
246 |
iLayout->SetClipping(ETrue); |
|
247 |
///////////////////////////first line/////////////////////////// |
|
248 |
//text |
|
249 |
if (!iFirstLineTextVis) |
|
250 |
{ |
|
251 |
iFirstLineTextVis = CAlfTextVisual::AddNewL(iOwnerControl, iLayout ); |
|
252 |
} |
|
253 |
//icons |
|
254 |
if (!iFirstLineIconVis) //optional priority icon in first line |
|
255 |
{ |
|
256 |
iFirstLineIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
257 |
iFirstLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
258 |
} |
|
259 |
||
260 |
if (!iCheckBoxIconVis) |
|
261 |
{ |
|
262 |
iCheckBoxIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
263 |
iCheckBoxIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
264 |
} |
|
265 |
||
266 |
if (!iMarkIconVis) |
|
267 |
{ |
|
268 |
iMarkIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
269 |
iMarkIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
270 |
} |
|
271 |
||
272 |
if(!iMenuIconVis) |
|
273 |
{ |
|
274 |
iMenuIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
275 |
iMenuIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
276 |
} |
|
277 |
||
278 |
///////////////////////////second line/////////////////////////// |
|
279 |
//text |
|
280 |
if (!iSecondLineTextVis) |
|
281 |
{ |
|
282 |
iSecondLineTextVis = CAlfTextVisual::AddNewL(iOwnerControl, iLayout ); |
|
283 |
} |
|
284 |
//icon |
|
285 |
if (!iSecondLineIconVis) |
|
286 |
{ |
|
287 |
iSecondLineIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
288 |
iSecondLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
289 |
} |
|
290 |
||
291 |
///////////////////////////third line/////////////////////////// |
|
292 |
//text |
|
293 |
if (!iThirdLineTextVis) |
|
294 |
{ |
|
295 |
iThirdLineTextVis = CAlfTextVisual::AddNewL(iOwnerControl, iLayout ); |
|
296 |
} |
|
297 |
//icon |
|
298 |
if (!iThirdLineIconVis) |
|
299 |
{ |
|
300 |
iThirdLineIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
301 |
iThirdLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
302 |
} |
|
303 |
||
304 |
///////////////////////////fourth line/////////////////////////// |
|
305 |
//text |
|
306 |
if (!iFourthLineTextVis) |
|
307 |
{ |
|
308 |
iFourthLineTextVis = CAlfTextVisual::AddNewL(iOwnerControl, iLayout ); |
|
309 |
} |
|
310 |
//icon |
|
311 |
if (!iFourthLineIconVis) |
|
312 |
{ |
|
313 |
iFourthLineIconVis = CAlfImageVisual::AddNewL(iOwnerControl, iLayout); |
|
314 |
iFourthLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
315 |
} |
|
316 |
||
317 |
} |
|
318 |
else |
|
319 |
{ |
|
320 |
//visuals are already created but not attached to the list layout |
|
321 |
if (!iLayout->Layout()) |
|
322 |
{ |
|
323 |
aParentLayout.Append(iLayout, aTimeout); |
|
324 |
iParentLayout = &aParentLayout; |
|
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
||
329 |
||
330 |
// --------------------------------------------------------------------------- |
|
331 |
// From MFsTreeItemVisualizer. |
|
332 |
// A call to this function means that the item is requested to update its |
|
333 |
// visual content. |
|
334 |
// --------------------------------------------------------------------------- |
|
335 |
// |
|
336 |
void CFsMultiLineItemVisualizer::UpdateL( const MFsTreeItemData& aData, |
|
337 |
TBool aFocused, |
|
338 |
const TUint aLevel, |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
339 |
CAlfTexture*& aMarkOnIcon, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
340 |
CAlfTexture*& /*aMarkOffIcon*/, |
64 | 341 |
CAlfTexture*& aMenuIcon, |
342 |
const TUint /*aTimeout*/, |
|
343 |
TBool aUpdateData) |
|
344 |
{ |
|
345 |
FUNC_LOG; |
|
346 |
||
347 |
if (!iLayout) |
|
348 |
{ |
|
349 |
return; |
|
350 |
} |
|
351 |
||
352 |
//text color |
|
353 |
TRgb textColor; |
|
354 |
if ( aFocused ) |
|
355 |
{ |
|
356 |
if (!iIsCustomTextFocusedColor) |
|
357 |
{//custom color not set, use color from skin - load it in case theme has changed |
|
358 |
iFocusedTextColor = FocusedStateTextSkinColor(); |
|
359 |
} |
|
360 |
textColor = iFocusedTextColor; |
|
361 |
iFlags |= KFsTreeListItemFocused; |
|
362 |
} |
|
363 |
else |
|
364 |
{ |
|
365 |
if (!iIsCustomTextNormalColor) |
|
366 |
{//custom color not set, use color from skin - load it in case theme has changed |
|
367 |
iNormalTextColor = NormalStateTextSkinColor( ); |
|
368 |
} |
|
369 |
textColor = iNormalTextColor; |
|
370 |
iFlags &= ~KFsTreeListItemFocused; |
|
371 |
} |
|
372 |
||
373 |
//text aignment in visuals |
|
374 |
TAlfAlignHorizontal currTextAlignment( EAlfAlignHLeft ); |
|
375 |
currTextAlignment = CurrentTextAlignmentL( iTextAlign, NULL, NULL ); //Western/AH layout |
|
376 |
||
377 |
//text's shadow |
|
378 |
TBool enableShadow(EFalse); |
|
379 |
enableShadow = iFlags & KFsTreeListItemTextShadow; |
|
380 |
||
381 |
TInt styleId = ModifiedStyleIdL( ); |
|
382 |
||
383 |
//set data to the proper visuals |
|
384 |
if ( aData.Type() == KFsMultiLineItemDataType ) |
|
385 |
{ |
|
386 |
const CFsMultiLineItemData* data = static_cast<const CFsMultiLineItemData*>(&aData); |
|
387 |
||
388 |
//set icons and texts to their visuals |
|
389 |
||
390 |
///////////////////////////first line/////////////////////////////////////////// |
|
391 |
//text |
|
392 |
if (iFirstLineTextVis && aUpdateData) |
|
393 |
{ |
|
394 |
iFirstLineTextVis->Env().CancelCommands( iFirstLineTextVis ); |
|
395 |
||
396 |
iFirstLineTextVis->EnableShadow( enableShadow ); |
|
397 |
iFirstLineTextVis->SetWrapping(CAlfTextVisual::ELineWrapTruncate); |
|
398 |
iFirstLineTextVis->SetAlign( currTextAlignment, EAlfAlignVCenter ); |
|
399 |
iFirstLineTextVis->SetTextStyle( styleId ); |
|
400 |
iFirstLineTextVis->SetColor( textColor ); |
|
401 |
||
402 |
iFirstLineTextVis->SetTextL( data->LineText( 0 )); |
|
403 |
} |
|
404 |
||
405 |
//icon |
|
406 |
if (iCheckBoxIconVis) |
|
407 |
{ |
|
408 |
if ( CheckboxState() ) |
|
409 |
{ |
|
410 |
if ( data->CheckBoxCheckedIcon() ) |
|
411 |
{ |
|
412 |
iCheckBoxIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
413 |
iCheckBoxIconVis->SetImage( TAlfImage( *data->CheckBoxCheckedIcon() ) ); |
|
414 |
} |
|
415 |
else |
|
416 |
{ |
|
417 |
//zero visual's opacity |
|
418 |
} |
|
419 |
} |
|
420 |
else |
|
421 |
{ |
|
422 |
if ( data->CheckBoxUncheckedIcon() ) |
|
423 |
{ |
|
424 |
iCheckBoxIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
425 |
iCheckBoxIconVis->SetImage( TAlfImage( *data->CheckBoxUncheckedIcon() ) ); |
|
426 |
} |
|
427 |
else |
|
428 |
{ |
|
429 |
//zero visual's opacity |
|
430 |
} |
|
431 |
} |
|
432 |
} |
|
433 |
//icon |
|
434 |
if ( iFirstLineIconVis && data->LineIcon( 0 ) ) |
|
435 |
{ |
|
436 |
iFirstLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
437 |
iFirstLineIconVis->SetImage( TAlfImage( *data->LineIcon( 0 ) ) ); |
|
438 |
} |
|
439 |
//mark icon |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
440 |
if ( iMarkIconVis && IsMarked() && aMarkOnIcon ) |
64 | 441 |
{ |
442 |
iMarkIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
443 |
iMarkIconVis->SetImage( *aMarkOnIcon ); |
64 | 444 |
} |
445 |
//menu icon |
|
446 |
if ( iMenuIconVis && (iFlags & KFsTreeListItemHasMenu) && aMenuIcon ) |
|
447 |
{ |
|
448 |
iMenuIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
449 |
iMenuIconVis->SetImage( *aMenuIcon ); |
|
450 |
} |
|
451 |
///////////////////////////second line////////////////////////////////////////// |
|
452 |
//text |
|
453 |
if ( iSecondLineTextVis && aUpdateData) |
|
454 |
{ |
|
455 |
iSecondLineTextVis->Env().CancelCommands( iSecondLineTextVis ); |
|
456 |
||
457 |
iSecondLineTextVis->SetWrapping(CAlfTextVisual::ELineWrapTruncate); |
|
458 |
iSecondLineTextVis->SetAlign( currTextAlignment, EAlfAlignVCenter ); |
|
459 |
iSecondLineTextVis->EnableShadow( enableShadow ); |
|
460 |
iSecondLineTextVis->SetTextStyle( styleId ); |
|
461 |
iSecondLineTextVis->SetColor( textColor ); |
|
462 |
||
463 |
iSecondLineTextVis->SetTextL( data->LineText( 1 )); |
|
464 |
} |
|
465 |
||
466 |
//icon |
|
467 |
if ( iSecondLineIconVis && data->LineIcon( 1 ) ) |
|
468 |
{ |
|
469 |
iSecondLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
470 |
iSecondLineIconVis->SetImage( TAlfImage( *data->LineIcon( 1 ) ) ); |
|
471 |
} |
|
472 |
||
473 |
///////////////////////////third line/////////////////////////////////////////// |
|
474 |
//text |
|
475 |
if ( iThirdLineTextVis && aUpdateData ) |
|
476 |
{ |
|
477 |
iThirdLineTextVis->Env().CancelCommands( iThirdLineTextVis ); |
|
478 |
||
479 |
iThirdLineTextVis->SetWrapping(CAlfTextVisual::ELineWrapTruncate); |
|
480 |
iThirdLineTextVis->SetAlign( currTextAlignment, EAlfAlignVCenter ); |
|
481 |
iThirdLineTextVis->EnableShadow( enableShadow ); |
|
482 |
iThirdLineTextVis->SetTextStyle( styleId ); |
|
483 |
iThirdLineTextVis->SetColor( textColor ); |
|
484 |
||
485 |
iThirdLineTextVis->SetTextL( data->LineText( 2 ) ); |
|
486 |
} |
|
487 |
||
488 |
//icon |
|
489 |
if ( iThirdLineIconVis && data->LineIcon( 2 ) ) |
|
490 |
{ |
|
491 |
iThirdLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
492 |
iThirdLineIconVis->SetImage( TAlfImage( *data->LineIcon( 2 ) ) ); |
|
493 |
} |
|
494 |
||
495 |
///////////////////////////fourth line////////////////////////////////////////// |
|
496 |
//text |
|
497 |
if ( iFourthLineTextVis && aUpdateData) |
|
498 |
{ |
|
499 |
iFourthLineTextVis->Env().CancelCommands( iFourthLineTextVis ); |
|
500 |
||
501 |
iFourthLineTextVis->SetWrapping(CAlfTextVisual::ELineWrapTruncate); |
|
502 |
iFourthLineTextVis->SetAlign( currTextAlignment, EAlfAlignVCenter ); |
|
503 |
iFourthLineTextVis->EnableShadow( enableShadow ); |
|
504 |
iFourthLineTextVis->SetTextStyle( styleId ); |
|
505 |
iFourthLineTextVis->SetColor( textColor ); |
|
506 |
||
507 |
iFourthLineTextVis->SetTextL( data->LineText( 3 ) ); |
|
508 |
} |
|
509 |
||
510 |
//icon |
|
511 |
if ( iFourthLineIconVis && data->LineIcon( 3 ) ) |
|
512 |
{ |
|
513 |
iFourthLineIconVis->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
514 |
iFourthLineIconVis->SetImage( TAlfImage( *data->LineIcon( 3 ) ) ); |
|
515 |
} |
|
516 |
||
517 |
const TInt indent( iTextIndentation * ( aLevel - 1 ) ); |
|
518 |
UpdateLayout(data, indent); |
|
519 |
iLayout->UpdateChildrenLayout(); |
|
520 |
} |
|
521 |
} |
|
522 |
||
523 |
||
524 |
// --------------------------------------------------------------------------- |
|
525 |
// From MFsTreeItemVisualizer. |
|
526 |
// A call to this function means that the item goes out of the visible |
|
527 |
// items scope. The visualizer should destroy all its visuals to save |
|
528 |
// memory. |
|
529 |
// --------------------------------------------------------------------------- |
|
530 |
// |
|
531 |
void CFsMultiLineItemVisualizer::Hide( const TInt aTimeout ) |
|
532 |
{ |
|
533 |
FUNC_LOG; |
|
534 |
if ( iLayout ) |
|
535 |
{ |
|
536 |
iParentLayout->Remove(iLayout, aTimeout); |
|
537 |
iLayout->RemoveAndDestroyAllD(); |
|
538 |
iLayout = NULL; |
|
539 |
iParentLayout = NULL; |
|
540 |
///////////////////////////first line/////////////////////////// |
|
541 |
iFirstLineTextVis = NULL; |
|
542 |
iFirstLineIconVis = NULL; |
|
543 |
iCheckBoxIconVis = NULL; |
|
544 |
iMarkIconVis = NULL; |
|
545 |
iMenuIconVis = NULL; |
|
546 |
///////////////////////////second line/////////////////////////// |
|
547 |
iSecondLineTextVis = NULL; |
|
548 |
iSecondLineIconVis = NULL; |
|
549 |
///////////////////////////third line/////////////////////////// |
|
550 |
iThirdLineTextVis = NULL; |
|
551 |
iThirdLineIconVis = NULL; |
|
552 |
///////////////////////////fourth line/////////////////////////// |
|
553 |
iFourthLineTextVis = NULL; |
|
554 |
iFourthLineIconVis = NULL; |
|
555 |
} |
|
556 |
} |
|
557 |
||
558 |
||
559 |
// --------------------------------------------------------------------------- |
|
560 |
// C++ constructor |
|
561 |
// --------------------------------------------------------------------------- |
|
562 |
// |
|
563 |
CFsMultiLineItemVisualizer::CFsMultiLineItemVisualizer( CAlfControl& aOwnerControl ) |
|
564 |
: CFsTreeItemVisualizerBase( aOwnerControl ), |
|
565 |
iCheckState(EFalse), |
|
566 |
iKeepPlaceHolders(EFalse), |
|
567 |
iNumLinesNotExtended(KOne), |
|
568 |
iNumLinesExtended(KFour) |
|
569 |
{ |
|
570 |
FUNC_LOG; |
|
571 |
||
572 |
} |
|
573 |
||
574 |
||
575 |
// --------------------------------------------------------------------------- |
|
576 |
// Second phase constructor |
|
577 |
// --------------------------------------------------------------------------- |
|
578 |
// |
|
579 |
void CFsMultiLineItemVisualizer::ConstructL( ) |
|
580 |
{ |
|
581 |
FUNC_LOG; |
|
582 |
CFsTreeItemVisualizerBase::ConstructL( ); //set text colors |
|
583 |
} |
|
584 |
||
585 |
||
586 |
// --------------------------------------------------------------------------- |
|
587 |
// Updates anchor for visuals according to the current item's setup. |
|
588 |
// --------------------------------------------------------------------------- |
|
589 |
// |
|
590 |
void CFsMultiLineItemVisualizer::UpdateLayout(const CFsMultiLineItemData* aData, const TInt aIndentation ) |
|
591 |
{ |
|
592 |
FUNC_LOG; |
|
593 |
||
594 |
///////////////////////////first line/////////////////////////// |
|
595 |
//icon |
|
596 |
TAlfTimedPoint tpFirstLineCheckBoxIconTl(0.0,0.0); |
|
597 |
TAlfTimedPoint tpFirstLineCheckBoxIconBr(0.0,0.0); |
|
598 |
//priority icon |
|
599 |
TAlfTimedPoint tpFirstLineIconTl(0.0,0.0); |
|
600 |
TAlfTimedPoint tpFirstLineIconBr(0.0,0.0); |
|
601 |
//text |
|
602 |
TAlfTimedPoint tpFirstLineTextTl(0.0,0.0); |
|
603 |
TAlfTimedPoint tpFirstLineTextBr(0.0,0.0); |
|
604 |
//mark icon |
|
605 |
TAlfTimedPoint tpFirstLineMarkIconTl(0.0,0.0); |
|
606 |
TAlfTimedPoint tpFirstLineMarkIconBr(0.0,0.0); |
|
607 |
//menu icon |
|
608 |
TAlfTimedPoint tpFirstMenuIconTl(0.0,0.0); |
|
609 |
TAlfTimedPoint tpFirstMenuIconBr(0.0,0.0); |
|
610 |
||
611 |
//LM metrics |
|
612 |
CFsLayoutManager::TFsLayoutMetrics firstLineIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG1), |
|
613 |
firstLinePrioIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG2), |
|
614 |
firstLineTextMetrics(CFsLayoutManager::EFsLmListSingleDycRowTextPane), |
|
615 |
firstLineMenuIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG3), |
|
616 |
firstLineMarkIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG4); |
|
617 |
TInt firstLineIconVariety(KZero), |
|
618 |
firstLinePrioIconVariety(KZero), |
|
619 |
firstLineTextVariety(KZero), |
|
620 |
firstLineMenuIconVariety(KZero), |
|
621 |
firstLineMarkIconVariety(KZero); |
|
622 |
||
623 |
///////////////////////////second line/////////////////////////// |
|
624 |
//icon |
|
625 |
TAlfTimedPoint tpSecondLineIconTl(0.0,0.0); |
|
626 |
TAlfTimedPoint tpSecondLineIconBr(0.0,0.0); |
|
627 |
//text |
|
628 |
TAlfTimedPoint tpSecondLineTextTl(0.0,0.0); |
|
629 |
TAlfTimedPoint tpSecondLineTextBr(0.0,0.0); |
|
630 |
//LM metrics |
|
631 |
CFsLayoutManager::TFsLayoutMetrics secondLineIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG1), |
|
632 |
secondLineTextMetrics(CFsLayoutManager::EFsLmListSingleDycRowTextPane); |
|
633 |
TInt secondLineTextVariety(KZero); |
|
634 |
///////////////////////////third line/////////////////////////// |
|
635 |
//icon |
|
636 |
TAlfTimedPoint tpThirdLineIconTl(0.0,0.0); |
|
637 |
TAlfTimedPoint tpThirdLineIconBr(0.0,0.0); |
|
638 |
//text |
|
639 |
TAlfTimedPoint tpThirdLineTextTl(0.0,0.0); |
|
640 |
TAlfTimedPoint tpThirdLineTextBr(0.0,0.0); |
|
641 |
//LM metrics |
|
642 |
CFsLayoutManager::TFsLayoutMetrics thirdLineIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG1), |
|
643 |
thirdLineTextMetrics(CFsLayoutManager::EFsLmListSingleDycRowTextPane); |
|
644 |
TInt thirdLineTextVariety(KZero); |
|
645 |
///////////////////////////fourth line/////////////////////////// |
|
646 |
//icon |
|
647 |
TAlfTimedPoint tpFourthLineIconTl(0.0,0.0); |
|
648 |
TAlfTimedPoint tpFourthLineIconBr(0.0,0.0); |
|
649 |
//text |
|
650 |
TAlfTimedPoint tpFourthLineTextTl(0.0,0.0); |
|
651 |
TAlfTimedPoint tpFourthLineTextBr(0.0,0.0); |
|
652 |
CFsLayoutManager::TFsLayoutMetrics fourthLineIconMetrics(CFsLayoutManager::EFsLmListSingleDycRowPaneG1), |
|
653 |
fourthLineTextMetrics(CFsLayoutManager::EFsLmListSingleDycRowTextPane); |
|
654 |
TInt fourthLineTextVariety(KZero); |
|
655 |
///////////////////////////////////////////////////////////////// |
|
656 |
||
657 |
||
658 |
TBool itemFocused(EFalse); |
|
659 |
itemFocused = iFlags & KFsTreeListItemFocused; |
|
660 |
||
661 |
TAlfTimedValue opacity; |
|
662 |
||
663 |
TInt linesVisible(1); |
|
664 |
||
665 |
if ( (itemFocused || IsAlwaysExtended()) && IsExtendable() ) // the item has focus or is always extended |
|
666 |
{ |
|
667 |
linesVisible = NumberOfLinesWhenExtended(); |
|
668 |
} |
|
669 |
else |
|
670 |
{ |
|
671 |
linesVisible = NumberOfLinesWhenNotExtended(); |
|
672 |
} |
|
673 |
||
674 |
||
675 |
//0. set opacities for visuals |
|
676 |
///////////////////////////first line/////////////////////////// |
|
677 |
||
678 |
opacity.SetValueNow( 1.0 ); |
|
679 |
||
680 |
if ( iFirstLineTextVis ) |
|
681 |
{ |
|
682 |
iFirstLineTextVis->SetOpacity(opacity); |
|
683 |
} |
|
684 |
||
685 |
//set opacities to visuals in lines 2-4 |
|
686 |
||
687 |
///////////////////////////second line/////////////////////////// |
|
688 |
if ( linesVisible >= 2 ) // line visible? |
|
689 |
{ |
|
690 |
opacity.SetValueNow( 1.0 ); |
|
691 |
} |
|
692 |
else |
|
693 |
{ |
|
694 |
opacity.SetValueNow( 0.0 ); |
|
695 |
} |
|
696 |
||
697 |
if ( iSecondLineIconVis ) |
|
698 |
{ |
|
699 |
iSecondLineIconVis->SetOpacity(opacity); |
|
700 |
} |
|
701 |
if ( iSecondLineTextVis ) |
|
702 |
{ |
|
703 |
iSecondLineTextVis->SetOpacity(opacity); |
|
704 |
} |
|
705 |
///////////////////////////third line/////////////////////////// |
|
706 |
if ( linesVisible >= 3 ) // line visible? |
|
707 |
{ |
|
708 |
opacity.SetValueNow( 1.0 ); |
|
709 |
} |
|
710 |
else |
|
711 |
{ |
|
712 |
opacity.SetValueNow( 0.0 ); |
|
713 |
} |
|
714 |
||
715 |
if ( iThirdLineIconVis ) |
|
716 |
{ |
|
717 |
iThirdLineIconVis->SetOpacity(opacity); |
|
718 |
} |
|
719 |
if ( iThirdLineTextVis ) |
|
720 |
{ |
|
721 |
iThirdLineTextVis->SetOpacity(opacity); |
|
722 |
} |
|
723 |
///////////////////////////fourth line/////////////////////////// |
|
724 |
if ( linesVisible == 4 ) // line visible? |
|
725 |
{ |
|
726 |
opacity.SetValueNow( 1.0 ); |
|
727 |
} |
|
728 |
else |
|
729 |
{ |
|
730 |
opacity.SetValueNow( 0.0 ); |
|
731 |
} |
|
732 |
if ( iFourthLineIconVis ) |
|
733 |
{ |
|
734 |
iFourthLineIconVis->SetOpacity(opacity); |
|
735 |
} |
|
736 |
if ( iFourthLineTextVis ) |
|
737 |
{ |
|
738 |
iFourthLineTextVis->SetOpacity(opacity); |
|
739 |
} |
|
740 |
||
741 |
//1. set anchor values for visuals |
|
742 |
///////////////////////////first line/////////////////////////// |
|
743 |
//no icons, only text |
|
744 |
firstLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
745 |
firstLineTextVariety = KEight; |
|
746 |
||
747 |
TBool isCheckboxPres(EFalse),isMarkPres(EFalse); |
|
748 |
||
749 |
if ( CheckboxState() && aData->CheckBoxCheckedIcon() || |
|
750 |
!CheckboxState() && aData->CheckBoxUncheckedIcon() ) |
|
751 |
{ |
|
752 |
isCheckboxPres = ETrue; |
|
753 |
firstLineIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG1; |
|
754 |
firstLineIconVariety = KZero; |
|
755 |
||
756 |
firstLineTextVariety = KFive; |
|
757 |
||
758 |
opacity.SetValueNow( 1.0 ); |
|
759 |
iCheckBoxIconVis->SetOpacity(opacity); |
|
760 |
} |
|
761 |
else |
|
762 |
{ |
|
763 |
isCheckboxPres = EFalse; |
|
764 |
//zero image visual's opacity |
|
765 |
opacity.SetValueNow( 0.0 ); |
|
766 |
iCheckBoxIconVis->SetOpacity(opacity); |
|
767 |
} |
|
768 |
||
769 |
if ( aData->LineIcon( KZero ) ) |
|
770 |
{ |
|
771 |
if ( isCheckboxPres ) |
|
772 |
{ |
|
773 |
firstLinePrioIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG2; |
|
774 |
firstLinePrioIconVariety = KZero; |
|
775 |
firstLineTextVariety = KTwo; |
|
776 |
} |
|
777 |
else |
|
778 |
{ |
|
779 |
firstLinePrioIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG1; |
|
780 |
firstLinePrioIconVariety = KZero; |
|
781 |
firstLineTextVariety = KFive; |
|
782 |
} |
|
783 |
opacity.SetValueNow( 1.0 ); |
|
784 |
iFirstLineIconVis->SetOpacity(opacity); |
|
785 |
} |
|
786 |
else |
|
787 |
{ |
|
788 |
if ( !isCheckboxPres && IsKeepEmptyIconsPlaceHolders() ) |
|
789 |
{ |
|
790 |
firstLineTextVariety = KFive; |
|
791 |
} |
|
792 |
||
793 |
//zero image visual's opacity |
|
794 |
opacity.SetValueNow( 0.0 ); |
|
795 |
iFirstLineIconVis->SetOpacity(opacity); |
|
796 |
} |
|
797 |
||
798 |
||
799 |
if ( IsMarked() ) |
|
800 |
{ |
|
801 |
isMarkPres = ETrue; |
|
802 |
firstLineMarkIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG4; |
|
803 |
firstLineMarkIconVariety = KZero; |
|
804 |
||
805 |
if ( firstLineTextVariety == KTwo ) |
|
806 |
{ |
|
807 |
firstLineTextVariety = KOne; |
|
808 |
} |
|
809 |
else if ( firstLineTextVariety == KFive ) |
|
810 |
{ |
|
811 |
firstLineTextVariety = KFour; |
|
812 |
} |
|
813 |
else //KEight |
|
814 |
{ |
|
815 |
firstLineTextVariety = KSeven; |
|
816 |
} |
|
817 |
||
818 |
opacity.SetValueNow( 1.0 ); |
|
819 |
iMarkIconVis->SetOpacity(opacity); |
|
820 |
} |
|
821 |
else |
|
822 |
{ |
|
823 |
isMarkPres = EFalse; |
|
824 |
//zero image visual's opacity |
|
825 |
opacity.SetValueNow( 0.0 ); |
|
826 |
iMarkIconVis->SetOpacity(opacity); |
|
827 |
} |
|
828 |
||
829 |
if ( itemFocused && ( iFlags & KFsTreeListItemHasMenu ) ) |
|
830 |
{ |
|
831 |
if ( isMarkPres ) |
|
832 |
{ |
|
833 |
firstLineMenuIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG3; |
|
834 |
firstLineMenuIconVariety = KZero; |
|
835 |
if ( firstLineTextVariety == KOne ) |
|
836 |
{ |
|
837 |
firstLineTextVariety = KZero; |
|
838 |
} |
|
839 |
else if ( firstLineTextVariety == KFour ) |
|
840 |
{ |
|
841 |
firstLineTextVariety = KThree; |
|
842 |
} |
|
843 |
else //KSeven |
|
844 |
{ |
|
845 |
firstLineTextVariety = KSix; |
|
846 |
} |
|
847 |
} |
|
848 |
else |
|
849 |
{ |
|
850 |
firstLineMenuIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG4; |
|
851 |
firstLineMenuIconVariety = KZero; |
|
852 |
||
853 |
if ( firstLineTextVariety == KTwo ) |
|
854 |
{ |
|
855 |
firstLineTextVariety = KOne; |
|
856 |
} |
|
857 |
else if ( firstLineTextVariety == KFive ) |
|
858 |
{ |
|
859 |
firstLineTextVariety = KFour; |
|
860 |
} |
|
861 |
else //KEight |
|
862 |
{ |
|
863 |
firstLineTextVariety = KSeven; |
|
864 |
} |
|
865 |
} |
|
866 |
opacity.SetValueNow( 1.0 ); |
|
867 |
iMenuIconVis->SetOpacity(opacity); |
|
868 |
} |
|
869 |
else |
|
870 |
{ |
|
871 |
//zero image visual's opacity |
|
872 |
opacity.SetValueNow( 0.0 ); |
|
873 |
iMenuIconVis->SetOpacity(opacity); |
|
874 |
} |
|
875 |
||
876 |
///////////////////////////second line/////////////////////////// |
|
877 |
if ( aData->LineIcon( KOne ) ) |
|
878 |
{ |
|
879 |
secondLineIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG1; |
|
880 |
secondLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
881 |
||
882 |
secondLineTextVariety = KFive; |
|
883 |
} |
|
884 |
else |
|
885 |
{ |
|
886 |
if ( IsKeepEmptyIconsPlaceHolders() ) |
|
887 |
{ |
|
888 |
secondLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
889 |
secondLineTextVariety = KFive; |
|
890 |
} |
|
891 |
else |
|
892 |
{ |
|
893 |
secondLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
894 |
secondLineTextVariety = KEight; |
|
895 |
} |
|
896 |
||
897 |
opacity.SetValueNow( 0.0 ); |
|
898 |
iSecondLineIconVis->SetOpacity(opacity); |
|
899 |
} |
|
900 |
||
901 |
///////////////////////////third line/////////////////////////// |
|
902 |
if ( aData->LineIcon( KTwo ) ) |
|
903 |
{ |
|
904 |
thirdLineIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG1; |
|
905 |
thirdLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
906 |
thirdLineTextVariety = KFive; |
|
907 |
} |
|
908 |
else |
|
909 |
{ |
|
910 |
if ( IsKeepEmptyIconsPlaceHolders() ) |
|
911 |
{ |
|
912 |
thirdLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
913 |
thirdLineTextVariety = KFive; |
|
914 |
} |
|
915 |
else |
|
916 |
{ |
|
917 |
thirdLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
918 |
thirdLineTextVariety = KEight; |
|
919 |
} |
|
920 |
||
921 |
opacity.SetValueNow( 0.0 ); |
|
922 |
iThirdLineIconVis->SetOpacity(opacity); |
|
923 |
} |
|
924 |
||
925 |
///////////////////////////fourth line/////////////////////////// |
|
926 |
if ( aData->LineIcon( KThree ) ) |
|
927 |
{ |
|
928 |
fourthLineIconMetrics = CFsLayoutManager::EFsLmListSingleDycRowPaneG1; |
|
929 |
fourthLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
930 |
fourthLineTextVariety = KFive; |
|
931 |
} |
|
932 |
else |
|
933 |
{ |
|
934 |
if ( IsKeepEmptyIconsPlaceHolders() ) |
|
935 |
{ |
|
936 |
fourthLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
937 |
fourthLineTextVariety = KFive; |
|
938 |
} |
|
939 |
else |
|
940 |
{ |
|
941 |
fourthLineTextMetrics = CFsLayoutManager::EFsLmListSingleDycRowTextPane; |
|
942 |
fourthLineTextVariety = KEight; |
|
943 |
} |
|
944 |
||
945 |
opacity.SetValueNow( 0.0 ); |
|
946 |
iFourthLineIconVis->SetOpacity(opacity); |
|
947 |
} |
|
948 |
||
949 |
//3. get correct metrics based on text's size range |
|
950 |
//not needed anymore |
|
951 |
//layout manager is queried for medium values - LM returnes rects based on phone's global text settings |
|
952 |
//4. get item size from Layout Manager - this will be used as parent in icons'/texts' size queries to LM |
|
953 |
||
954 |
//use full 4-line item size |
|
955 |
TRect rect; |
|
956 |
TInt rowVariety (KThree);//four lines |
|
957 |
TRect itemRect; |
|
958 |
||
959 |
itemRect = SizeWithNumberOfLines( KThree ); |
|
960 |
||
961 |
//modify item size with list's indentation |
|
962 |
if ( CFsLayoutManager::IsMirrored() ) |
|
963 |
{ |
|
964 |
itemRect.iBr = itemRect.iBr - TPoint(aIndentation, 0); |
|
965 |
} |
|
966 |
else |
|
967 |
{ |
|
968 |
itemRect.iTl = itemRect.iTl + TPoint(aIndentation, 0); |
|
969 |
} |
|
970 |
||
971 |
//. Set visuals' anchors |
|
972 |
||
973 |
TInt iconVisualIndex(KErrNotFound), textVisualIndex(KErrNotFound); |
|
974 |
///////////////////////////first line/////////////////////////// |
|
975 |
TRect rowRect; |
|
976 |
TInt rowNumber(KZero); |
|
977 |
rowVariety = KThree; |
|
978 |
rowNumber = KZero; |
|
979 |
||
980 |
CFsLayoutManager::LayoutMetricsRect( itemRect, CFsLayoutManager::EFsLmListSingleDycRowPane, rowRect, rowVariety, rowNumber ); |
|
981 |
||
982 |
||
983 |
CFsLayoutManager::LayoutMetricsRect( |
|
984 |
rowRect, |
|
985 |
firstLineIconMetrics, |
|
986 |
rect, |
|
987 |
firstLineIconVariety ); |
|
988 |
||
989 |
tpFirstLineCheckBoxIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
990 |
tpFirstLineCheckBoxIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
991 |
||
992 |
iconVisualIndex = iLayout->FindVisual( iCheckBoxIconVis ); |
|
993 |
if ( iconVisualIndex != KErrNotFound ) |
|
994 |
{ |
|
995 |
tpFirstLineCheckBoxIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
996 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
997 |
iconVisualIndex, |
|
998 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
999 |
EAlfAnchorMetricAbsolute, |
|
1000 |
EAlfAnchorMetricAbsolute, |
|
1001 |
tpFirstLineCheckBoxIconTl ); |
|
1002 |
||
1003 |
tpFirstLineCheckBoxIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1004 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1005 |
iconVisualIndex, |
|
1006 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1007 |
EAlfAnchorMetricAbsolute, |
|
1008 |
EAlfAnchorMetricAbsolute, |
|
1009 |
tpFirstLineCheckBoxIconBr ); |
|
1010 |
} |
|
1011 |
//priority icon |
|
1012 |
CFsLayoutManager::LayoutMetricsRect( |
|
1013 |
rowRect, |
|
1014 |
firstLinePrioIconMetrics, |
|
1015 |
rect, |
|
1016 |
firstLinePrioIconVariety ); |
|
1017 |
||
1018 |
tpFirstLineIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1019 |
tpFirstLineIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1020 |
||
1021 |
iconVisualIndex = iLayout->FindVisual( iFirstLineIconVis ); |
|
1022 |
if ( iconVisualIndex != KErrNotFound ) |
|
1023 |
{ |
|
1024 |
tpFirstLineIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1025 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1026 |
iconVisualIndex, |
|
1027 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1028 |
EAlfAnchorMetricAbsolute, |
|
1029 |
EAlfAnchorMetricAbsolute, |
|
1030 |
tpFirstLineIconTl ); |
|
1031 |
||
1032 |
tpFirstLineIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1033 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1034 |
iconVisualIndex, |
|
1035 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1036 |
EAlfAnchorMetricAbsolute, |
|
1037 |
EAlfAnchorMetricAbsolute, |
|
1038 |
tpFirstLineIconBr ); |
|
1039 |
} |
|
1040 |
||
1041 |
//text |
|
1042 |
CFsLayoutManager::LayoutMetricsRect( |
|
1043 |
rowRect, |
|
1044 |
firstLineTextMetrics, |
|
1045 |
rect, |
|
1046 |
firstLineTextVariety ); |
|
1047 |
||
1048 |
tpFirstLineTextTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1049 |
tpFirstLineTextBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1050 |
||
1051 |
textVisualIndex = iLayout->FindVisual( iFirstLineTextVis ); |
|
1052 |
if ( textVisualIndex != KErrNotFound ) |
|
1053 |
{ |
|
1054 |
tpFirstLineTextTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1055 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1056 |
textVisualIndex, |
|
1057 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1058 |
EAlfAnchorMetricAbsolute, |
|
1059 |
EAlfAnchorMetricAbsolute, |
|
1060 |
tpFirstLineTextTl ); |
|
1061 |
||
1062 |
tpFirstLineTextBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1063 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1064 |
textVisualIndex, |
|
1065 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1066 |
EAlfAnchorMetricAbsolute, |
|
1067 |
EAlfAnchorMetricAbsolute, |
|
1068 |
tpFirstLineTextBr ); |
|
1069 |
} |
|
1070 |
||
1071 |
//mark icon |
|
1072 |
TInt markVisualIndex(KErrNotFound), menuVisualIndex(KErrNotFound); |
|
1073 |
CFsLayoutManager::LayoutMetricsRect( |
|
1074 |
rowRect, |
|
1075 |
firstLineMarkIconMetrics, |
|
1076 |
rect, |
|
1077 |
firstLineMarkIconVariety ); |
|
1078 |
||
1079 |
tpFirstLineMarkIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1080 |
tpFirstLineMarkIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1081 |
||
1082 |
markVisualIndex = iLayout->FindVisual( iMarkIconVis ); |
|
1083 |
if ( markVisualIndex != KErrNotFound ) |
|
1084 |
{ |
|
1085 |
tpFirstLineMarkIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1086 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1087 |
markVisualIndex, |
|
1088 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1089 |
EAlfAnchorMetricAbsolute, |
|
1090 |
EAlfAnchorMetricAbsolute, |
|
1091 |
tpFirstLineMarkIconTl ); |
|
1092 |
||
1093 |
tpFirstLineMarkIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1094 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1095 |
markVisualIndex, |
|
1096 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1097 |
EAlfAnchorMetricAbsolute, |
|
1098 |
EAlfAnchorMetricAbsolute, |
|
1099 |
tpFirstLineMarkIconBr ); |
|
1100 |
} |
|
1101 |
//menu icon |
|
1102 |
CFsLayoutManager::LayoutMetricsRect( |
|
1103 |
rowRect, |
|
1104 |
firstLineMenuIconMetrics, |
|
1105 |
rect, |
|
1106 |
firstLineMenuIconVariety ); |
|
1107 |
||
1108 |
tpFirstMenuIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1109 |
tpFirstMenuIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1110 |
||
1111 |
menuVisualIndex = iLayout->FindVisual( iMenuIconVis ); |
|
1112 |
if ( menuVisualIndex != KErrNotFound ) |
|
1113 |
{ |
|
1114 |
tpFirstMenuIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1115 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1116 |
menuVisualIndex, |
|
1117 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1118 |
EAlfAnchorMetricAbsolute, |
|
1119 |
EAlfAnchorMetricAbsolute, |
|
1120 |
tpFirstMenuIconTl ); |
|
1121 |
||
1122 |
tpFirstMenuIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1123 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1124 |
menuVisualIndex, |
|
1125 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1126 |
EAlfAnchorMetricAbsolute, |
|
1127 |
EAlfAnchorMetricAbsolute, |
|
1128 |
tpFirstMenuIconBr ); |
|
1129 |
} |
|
1130 |
||
1131 |
CFsLayoutManager::TFsText textInfo; |
|
1132 |
///////////////////////////second line/////////////////////////// |
|
1133 |
rowNumber = KOne; |
|
1134 |
||
1135 |
CFsLayoutManager::LayoutMetricsRect( itemRect, CFsLayoutManager::EFsLmListSingleDycRowPane, rowRect, rowVariety, rowNumber ); |
|
1136 |
||
1137 |
CFsLayoutManager::LayoutMetricsRect( |
|
1138 |
rowRect, |
|
1139 |
secondLineIconMetrics, |
|
1140 |
rect, |
|
1141 |
KZero ); |
|
1142 |
tpSecondLineIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1143 |
tpSecondLineIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1144 |
||
1145 |
iconVisualIndex = iLayout->FindVisual( iSecondLineIconVis ); |
|
1146 |
if ( iconVisualIndex != KErrNotFound ) |
|
1147 |
{ |
|
1148 |
tpSecondLineIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1149 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1150 |
iconVisualIndex, |
|
1151 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1152 |
EAlfAnchorMetricAbsolute, |
|
1153 |
EAlfAnchorMetricAbsolute, |
|
1154 |
tpSecondLineIconTl ); |
|
1155 |
||
1156 |
tpSecondLineIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1157 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1158 |
iconVisualIndex, |
|
1159 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1160 |
EAlfAnchorMetricAbsolute, |
|
1161 |
EAlfAnchorMetricAbsolute, |
|
1162 |
tpSecondLineIconBr ); |
|
1163 |
} |
|
1164 |
||
1165 |
CFsLayoutManager::LayoutMetricsRect( |
|
1166 |
rowRect, |
|
1167 |
secondLineTextMetrics, |
|
1168 |
rect, |
|
1169 |
secondLineTextVariety ); |
|
1170 |
||
1171 |
tpSecondLineTextTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1172 |
tpSecondLineTextBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1173 |
||
1174 |
textVisualIndex = iLayout->FindVisual( iSecondLineTextVis ); |
|
1175 |
if ( textVisualIndex != KErrNotFound ) |
|
1176 |
{ |
|
1177 |
tpSecondLineTextTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1178 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1179 |
textVisualIndex, |
|
1180 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1181 |
EAlfAnchorMetricAbsolute, |
|
1182 |
EAlfAnchorMetricAbsolute, |
|
1183 |
tpSecondLineTextTl ); |
|
1184 |
||
1185 |
tpSecondLineTextBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1186 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1187 |
textVisualIndex, |
|
1188 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1189 |
EAlfAnchorMetricAbsolute, |
|
1190 |
EAlfAnchorMetricAbsolute, |
|
1191 |
tpSecondLineTextBr ); |
|
1192 |
} |
|
1193 |
///////////////////////////third line/////////////////////////// |
|
1194 |
rowNumber = KTwo; |
|
1195 |
||
1196 |
CFsLayoutManager::LayoutMetricsRect( itemRect, CFsLayoutManager::EFsLmListSingleDycRowPane, rowRect, rowVariety, rowNumber ); |
|
1197 |
||
1198 |
CFsLayoutManager::LayoutMetricsRect( |
|
1199 |
rowRect, |
|
1200 |
thirdLineIconMetrics, |
|
1201 |
rect ); |
|
1202 |
tpThirdLineIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1203 |
tpThirdLineIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1204 |
||
1205 |
iconVisualIndex = iLayout->FindVisual( iThirdLineIconVis ); |
|
1206 |
if ( iconVisualIndex != KErrNotFound ) |
|
1207 |
{ |
|
1208 |
tpThirdLineIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1209 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1210 |
iconVisualIndex, |
|
1211 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1212 |
EAlfAnchorMetricAbsolute, |
|
1213 |
EAlfAnchorMetricAbsolute, |
|
1214 |
tpThirdLineIconTl ); |
|
1215 |
||
1216 |
tpThirdLineIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1217 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1218 |
iconVisualIndex, |
|
1219 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1220 |
EAlfAnchorMetricAbsolute, |
|
1221 |
EAlfAnchorMetricAbsolute, |
|
1222 |
tpThirdLineIconBr ); |
|
1223 |
} |
|
1224 |
||
1225 |
CFsLayoutManager::LayoutMetricsRect( |
|
1226 |
rowRect, |
|
1227 |
thirdLineTextMetrics, |
|
1228 |
rect, |
|
1229 |
thirdLineTextVariety ); |
|
1230 |
||
1231 |
tpThirdLineTextTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1232 |
tpThirdLineTextBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1233 |
||
1234 |
textVisualIndex = iLayout->FindVisual( iThirdLineTextVis ); |
|
1235 |
if ( textVisualIndex != KErrNotFound ) |
|
1236 |
{ |
|
1237 |
tpThirdLineTextTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1238 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1239 |
textVisualIndex, |
|
1240 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1241 |
EAlfAnchorMetricAbsolute, |
|
1242 |
EAlfAnchorMetricAbsolute, |
|
1243 |
tpThirdLineTextTl ); |
|
1244 |
||
1245 |
tpThirdLineTextBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1246 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1247 |
textVisualIndex, |
|
1248 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1249 |
EAlfAnchorMetricAbsolute, |
|
1250 |
EAlfAnchorMetricAbsolute, |
|
1251 |
tpThirdLineTextBr ); |
|
1252 |
} |
|
1253 |
||
1254 |
///////////////////////////fourth line/////////////////////////// |
|
1255 |
rowNumber = KThree; |
|
1256 |
||
1257 |
CFsLayoutManager::LayoutMetricsRect( itemRect, CFsLayoutManager::EFsLmListSingleDycRowPane, rowRect, rowVariety, rowNumber ); |
|
1258 |
||
1259 |
CFsLayoutManager::LayoutMetricsRect( |
|
1260 |
rowRect, |
|
1261 |
fourthLineIconMetrics, |
|
1262 |
rect ); |
|
1263 |
tpFourthLineIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1264 |
tpFourthLineIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1265 |
||
1266 |
iconVisualIndex = iLayout->FindVisual( iFourthLineIconVis ); |
|
1267 |
if ( iconVisualIndex != KErrNotFound ) |
|
1268 |
{ |
|
1269 |
tpFourthLineIconTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1270 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1271 |
iconVisualIndex, |
|
1272 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1273 |
EAlfAnchorMetricAbsolute, |
|
1274 |
EAlfAnchorMetricAbsolute, |
|
1275 |
tpFourthLineIconTl ); |
|
1276 |
||
1277 |
tpFourthLineIconBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1278 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1279 |
iconVisualIndex, |
|
1280 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1281 |
EAlfAnchorMetricAbsolute, |
|
1282 |
EAlfAnchorMetricAbsolute, |
|
1283 |
tpFourthLineIconBr ); |
|
1284 |
} |
|
1285 |
||
1286 |
CFsLayoutManager::LayoutMetricsRect( |
|
1287 |
rowRect, |
|
1288 |
fourthLineTextMetrics, |
|
1289 |
rect, |
|
1290 |
fourthLineTextVariety ); |
|
1291 |
||
1292 |
tpFourthLineTextTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
1293 |
tpFourthLineTextBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
1294 |
||
1295 |
textVisualIndex = iLayout->FindVisual( iFourthLineTextVis ); |
|
1296 |
if ( textVisualIndex != KErrNotFound ) |
|
1297 |
{ |
|
1298 |
tpFourthLineTextTl.SetStyle(EAlfTimedValueStyleLinear); |
|
1299 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
1300 |
textVisualIndex, |
|
1301 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1302 |
EAlfAnchorMetricAbsolute, |
|
1303 |
EAlfAnchorMetricAbsolute, |
|
1304 |
tpFourthLineTextTl ); |
|
1305 |
||
1306 |
tpFourthLineTextBr.SetStyle(EAlfTimedValueStyleLinear); |
|
1307 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
1308 |
textVisualIndex, |
|
1309 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
1310 |
EAlfAnchorMetricAbsolute, |
|
1311 |
EAlfAnchorMetricAbsolute, |
|
1312 |
tpFourthLineTextBr ); |
|
1313 |
} |
|
1314 |
} |
|
1315 |
||
1316 |
||
1317 |
// --------------------------------------------------------------------------- |
|
1318 |
// Returns item's size in state with given number of lines. |
|
1319 |
// --------------------------------------------------------------------------- |
|
1320 |
// |
|
1321 |
TSize CFsMultiLineItemVisualizer::SizeWithNumberOfLines( const TInt aNumberLines ) const |
|
1322 |
{ |
|
1323 |
FUNC_LOG; |
|
1324 |
TSize size; |
|
1325 |
if ( aNumberLines < KOne || aNumberLines > KFour ) |
|
1326 |
{ |
|
1327 |
size.iWidth = 0; |
|
1328 |
size.iHeight = 0; |
|
1329 |
} |
|
1330 |
else |
|
1331 |
{ |
|
1332 |
/* family |
|
1333 |
Screen ->EFsLmScreen |
|
1334 |
application_window ->EFsLmApplicationWindow |
|
1335 |
main_pane ->EFsLmMainPane |
|
1336 |
main_sp_fs_listscroll_pane_te ->EFsLmMainSpFsListscrollPaneTe |
|
1337 |
main_sp_fs_list_pane ->EFsLmMainSpFsListPane |
|
1338 |
list_single_fs_dyc_pane ->EFsLmListSingleFsDycPane |
|
1339 |
list_single_dyc_row_pane ->EFsLmListSingleDycRowPane |
|
1340 |
*/ |
|
1341 |
TRect rect, rect2; |
|
1342 |
CFsLayoutManager::LayoutMetricsRect( rect, CFsLayoutManager::EFsLmScreen, rect2 ); |
|
1343 |
CFsLayoutManager::LayoutMetricsRect( rect2, CFsLayoutManager::EFsLmApplicationWindow, rect ); |
|
1344 |
CFsLayoutManager::LayoutMetricsRect( rect, CFsLayoutManager::EFsLmMainPane, rect2 ); |
|
1345 |
CFsLayoutManager::LayoutMetricsRect( rect2, CFsLayoutManager::EFsLmMainSpFsListscrollPaneTe, rect ); |
|
1346 |
CFsLayoutManager::LayoutMetricsRect( rect, CFsLayoutManager::EFsLmMainSpFsListPane, rect2 ); |
|
1347 |
||
1348 |
TInt rowVariety (KThree);//four lines |
|
1349 |
TRect itemRect; |
|
1350 |
||
1351 |
switch ( aNumberLines ) |
|
1352 |
{ |
|
1353 |
case KOne: |
|
1354 |
{ |
|
1355 |
rowVariety = KZero; |
|
1356 |
break; |
|
1357 |
} |
|
1358 |
case KTwo: |
|
1359 |
{ |
|
1360 |
rowVariety = KOne; |
|
1361 |
break; |
|
1362 |
} |
|
1363 |
case KThree: |
|
1364 |
{ |
|
1365 |
rowVariety = KTwo; |
|
1366 |
break; |
|
1367 |
} |
|
1368 |
case KFour: |
|
1369 |
default: |
|
1370 |
{ |
|
1371 |
rowVariety = KThree; |
|
1372 |
break; |
|
1373 |
} |
|
1374 |
} |
|
1375 |
||
1376 |
CFsLayoutManager::LayoutMetricsRect( rect2, CFsLayoutManager::EFsLmListSingleFsDycPane, itemRect, rowVariety ); |
|
1377 |
||
1378 |
size = itemRect.Size(); |
|
1379 |
} |
|
1380 |
||
1381 |
return size; |
|
1382 |
} |
|
1383 |
||
1384 |
// --------------------------------------------------------------------------- |
|
1385 |
// From MFsTreeItemVisualizer. |
|
1386 |
// This method sets flag disable wrapping the text item. |
|
1387 |
// --------------------------------------------------------------------------- |
|
1388 |
// |
|
1389 |
void CFsMultiLineItemVisualizer::OffWrapping() |
|
1390 |
{ |
|
1391 |
FUNC_LOG; |
|
1392 |
} |
|
1393 |
||
1394 |
//End of file |
|
1395 |