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