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 visualizer for data items with rich text. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
#include "emailtrace.h" |
|
21 |
#include <txtrich.h> |
|
22 |
||
23 |
#include <alf/alfcontrol.h> |
|
24 |
#include <alf/alflayout.h> |
|
25 |
#include <alf/alfflowlayout.h> |
|
26 |
#include <alf/alftextvisual.h> |
|
27 |
#include <alf/alfgradientbrush.h> |
|
28 |
#include <alf/alfanchorlayout.h> |
|
29 |
#include <alf/alfimage.h> |
|
30 |
#include <alf/alfimagevisual.h> |
|
31 |
#include <alf/alfbrusharray.h> |
|
32 |
#include <alf/alfenv.h> |
|
33 |
||
34 |
#include "fstreerichitemvisualizer.h" |
|
35 |
#include "fstreerichitemdata.h" |
|
36 |
#include "fsgenericpanic.h" |
|
37 |
#include "fsrichtext.h" |
|
38 |
#include "fstreelist.h" |
|
39 |
#include "fsscrollbarset.h" |
|
40 |
#include "fsalftextstylemanager.h" |
|
41 |
#include "fslayoutmanager.h" |
|
42 |
||
43 |
// ======== MEMBER FUNCTIONS ======== |
|
44 |
||
45 |
||
46 |
||
47 |
// --------------------------------------------------------------------------- |
|
48 |
// C++ constructor. |
|
49 |
// --------------------------------------------------------------------------- |
|
50 |
// |
|
51 |
CFsTreeRichItemVisualizer::CFsTreeRichItemVisualizer( |
|
52 |
CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager ) |
|
53 |
: CFsTreeItemVisualizerBase(aOwnerControl) |
|
54 |
{ |
|
55 |
FUNC_LOG; |
|
56 |
iTextStyleManager = &aTextStyleManager; |
|
57 |
} |
|
58 |
||
59 |
||
60 |
||
61 |
// --------------------------------------------------------------------------- |
|
62 |
// 2nd phase constructor. |
|
63 |
// --------------------------------------------------------------------------- |
|
64 |
// |
|
65 |
void CFsTreeRichItemVisualizer::ConstructL() |
|
66 |
{ |
|
67 |
FUNC_LOG; |
|
68 |
} |
|
69 |
||
70 |
||
71 |
||
72 |
// --------------------------------------------------------------------------- |
|
73 |
// Two-phase constructor. |
|
74 |
// --------------------------------------------------------------------------- |
|
75 |
// |
|
76 |
EXPORT_C CFsTreeRichItemVisualizer* CFsTreeRichItemVisualizer::NewL( |
|
77 |
CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager ) |
|
78 |
{ |
|
79 |
FUNC_LOG; |
|
80 |
CFsTreeRichItemVisualizer* self = |
|
81 |
new( ELeave ) CFsTreeRichItemVisualizer(aOwnerControl, aTextStyleManager); |
|
82 |
CleanupStack::PushL( self ); |
|
83 |
self->ConstructL(); |
|
84 |
CleanupStack::Pop( self ); |
|
85 |
return self; |
|
86 |
} |
|
87 |
||
88 |
||
89 |
// --------------------------------------------------------------------------- |
|
90 |
// C++ destructor. |
|
91 |
// --------------------------------------------------------------------------- |
|
92 |
// |
|
93 |
CFsTreeRichItemVisualizer::~CFsTreeRichItemVisualizer() |
|
94 |
{ |
|
95 |
FUNC_LOG; |
|
96 |
} |
|
97 |
||
98 |
||
99 |
// --------------------------------------------------------------------------- |
|
100 |
// Returns visualizer's type. |
|
101 |
// --------------------------------------------------------------------------- |
|
102 |
// |
|
103 |
TFsTreeItemVisualizerType CFsTreeRichItemVisualizer::Type() const |
|
104 |
{ |
|
105 |
FUNC_LOG; |
|
106 |
return EFsTreeRichItemVisualizer; |
|
107 |
} |
|
108 |
||
109 |
||
110 |
||
111 |
// --------------------------------------------------------------------------- |
|
112 |
// Create a visual based on the text object. |
|
113 |
// --------------------------------------------------------------------------- |
|
114 |
// |
|
115 |
CAlfFlowLayout* CFsTreeRichItemVisualizer::CreateTextLineL( |
|
116 |
CAlfControl& aOwnerControl, |
|
117 |
CAlfLayout* aParentLayout, |
|
118 |
const CFsTreeRichItemData* aText, |
|
119 |
TSize aSize ) |
|
120 |
{ |
|
121 |
FUNC_LOG; |
|
122 |
CAlfFlowLayout* textLayout( |
|
123 |
CAlfFlowLayout::AddNewL(aOwnerControl, aParentLayout)); |
|
124 |
textLayout->SetFlowDirection(CAlfFlowLayout::EFlowHorizontal); |
|
125 |
textLayout->SetCentering( EFalse ); |
|
126 |
textLayout->EnableBrushesL(); |
|
127 |
textLayout->SetSize( aSize ); |
|
128 |
textLayout->SetClipping(ETrue); |
|
129 |
||
130 |
CAlfTextVisual* textVisual; |
|
131 |
TCharFormat charFormat; |
|
132 |
TPtrC16 text; |
|
133 |
TInt textPos( 0 ); |
|
134 |
TInt xPos( 0 ); |
|
135 |
||
136 |
textLayout->SetFlag(EAlfVisualFlagFreezeLayout); |
|
137 |
||
138 |
while ( aText->Text().DocumentLength() > textPos ) |
|
139 |
{ |
|
140 |
// Need to create a new visual for every text block with different |
|
141 |
// markup. |
|
142 |
aText->Text().GetChars( text, charFormat, textPos ); |
|
143 |
textVisual = CAlfTextVisual::AddNewL( aOwnerControl, textLayout ); |
|
144 |
textVisual->EnableShadow( iFlags & KFsTreeListItemTextShadow ); |
|
145 |
textVisual->EnableBrushesL(); |
|
146 |
textVisual->SetTextL( text ); |
|
147 |
||
148 |
TInt styleId( iTextStyleManager->GetStyleIDL( charFormat ) ); |
|
149 |
textVisual->SetTextStyle( styleId ); |
|
150 |
textVisual->SetColor( charFormat.iFontPresentation.iTextColor ); |
|
151 |
||
152 |
if ( TFontPresentation::EFontHighlightNone |
|
153 |
!= charFormat.iFontPresentation.iHighlightStyle ) |
|
154 |
{ |
|
155 |
CAlfGradientBrush* brush( CAlfGradientBrush::NewLC(textLayout->Env())); |
|
156 |
brush->SetColor( charFormat.iFontPresentation.iHighlightColor ); |
|
157 |
textVisual->Brushes()->AppendL(brush, EAlfHasOwnership); |
|
158 |
CleanupStack::Pop( brush ); |
|
159 |
} |
|
160 |
||
161 |
textVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate ); |
|
162 |
||
163 |
textVisual->SetSize( TSize(textVisual->TextExtents().iWidth, |
|
164 |
iSize.iHeight) ); |
|
165 |
||
166 |
TInt visualWidth( textVisual->Size().Target().iX ); |
|
167 |
if ( xPos + visualWidth >= aSize.iWidth ) |
|
168 |
{ |
|
169 |
// The width limit has been reached and the last item need to be |
|
170 |
// resized. |
|
171 |
TAlfRealSize size; |
|
172 |
size.iWidth = aSize.iWidth - xPos; |
|
173 |
size.iHeight = textVisual->Size().iY.Target(); |
|
174 |
textVisual->SetSize(size, 0); |
|
175 |
break; |
|
176 |
} |
|
177 |
xPos += visualWidth; |
|
178 |
textPos += text.Length(); |
|
179 |
} |
|
180 |
textLayout->SetFlag(EAlfVisualFlagFreezeLayout); |
|
181 |
textLayout->UpdateChildrenLayout(0); |
|
182 |
||
183 |
return textLayout; |
|
184 |
} |
|
185 |
||
186 |
||
187 |
// --------------------------------------------------------------------------- |
|
188 |
// From class MFsTreeItemVisualizer. |
|
189 |
// Sets the size of the item visualization when item is not in expanded |
|
190 |
// state. The value is taken from layout manager. |
|
191 |
// --------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
void CFsTreeRichItemVisualizer::UpdateLayout( |
|
194 |
const CFsTreeRichItemData* aData, |
|
195 |
const TInt aIndentation ) |
|
196 |
{ |
|
197 |
FUNC_LOG; |
|
198 |
TRect rect; |
|
199 |
||
200 |
TAlfTimedPoint tpMainIconTl, tpMainIconBr; |
|
201 |
TAlfTimedPoint tpTextTl, tpTextBr; |
|
202 |
TAlfTimedPoint tpMarkIconTl, tpMarkIconBr; |
|
203 |
TAlfTimedPoint tpMenuIconTl, tpMenuIconBr; |
|
204 |
||
205 |
CFsLayoutManager::TFsLayoutMetrics |
|
206 |
mainIconMetrics = CFsLayoutManager::EFsLmListMediumLineG1, |
|
207 |
markIconMetrics = CFsLayoutManager::EFsLmListMediumLineG3G2, |
|
208 |
menuIconMetrics = CFsLayoutManager::EFsLmListMediumLineG3G3, |
|
209 |
textMetrics = CFsLayoutManager::EFsLmListMediumLineG3T1, |
|
210 |
sizeMetrics = CFsLayoutManager::EFsLmListSingleDycRowPane; |
|
211 |
||
212 |
if (aData->IsIconSet()) |
|
213 |
{ |
|
214 |
if (iFlags & KFsTreeListItemMarked) |
|
215 |
{ |
|
216 |
if (iMenu && (iFlags & KFsTreeListItemFocused)) |
|
217 |
{ |
|
218 |
//mainIcon + markIcon + menuIcon |
|
219 |
//the metrics defined when declared |
|
220 |
} |
|
221 |
else |
|
222 |
{ |
|
223 |
//mainIcon + markIcon |
|
224 |
mainIconMetrics = CFsLayoutManager::EFsLmListMediumLineG2G1; |
|
225 |
markIconMetrics = CFsLayoutManager::EFsLmListMediumLineG2G2; |
|
226 |
textMetrics = CFsLayoutManager::EFsLmListMediumLineG2T1; |
|
227 |
} |
|
228 |
} |
|
229 |
else |
|
230 |
{ |
|
231 |
if ((iFlags & KFsTreeListItemHasMenu) |
|
232 |
&& (iFlags & KFsTreeListItemFocused)) |
|
233 |
{ |
|
234 |
//mainIcon + menuIcon |
|
235 |
mainIconMetrics = CFsLayoutManager::EFsLmListMediumLineG2G1; |
|
236 |
menuIconMetrics = CFsLayoutManager::EFsLmListMediumLineG2G2; |
|
237 |
textMetrics = CFsLayoutManager::EFsLmListMediumLineG2T1; |
|
238 |
} |
|
239 |
else |
|
240 |
{ |
|
241 |
//mainIcon |
|
242 |
mainIconMetrics = CFsLayoutManager::EFsLmListMediumLineG1; |
|
243 |
textMetrics = CFsLayoutManager::EFsLmListMediumLineT1; |
|
244 |
} |
|
245 |
} |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
if (iFlags & KFsTreeListItemMarked) |
|
250 |
{ |
|
251 |
if (iMenu && (iFlags & KFsTreeListItemFocused)) |
|
252 |
{ |
|
253 |
//markIcon + menuIcon |
|
254 |
markIconMetrics = |
|
255 |
CFsLayoutManager::EFsLmListMediumLineRightIconx2G1; |
|
256 |
menuIconMetrics = |
|
257 |
CFsLayoutManager::EFsLmListMediumLineRightIconx2G2; |
|
258 |
textMetrics = |
|
259 |
CFsLayoutManager::EFsLmListMediumLineRightIconx2T1; |
|
260 |
} |
|
261 |
else |
|
262 |
{ |
|
263 |
//markIcon |
|
264 |
markIconMetrics = |
|
265 |
CFsLayoutManager::EFsLmListMediumLineRightIconG1; |
|
266 |
textMetrics = |
|
267 |
CFsLayoutManager::EFsLmListMediumLineRightIconT1; |
|
268 |
} |
|
269 |
} |
|
270 |
else |
|
271 |
{ |
|
272 |
if ((iFlags & KFsTreeListItemHasMenu) |
|
273 |
&& (iFlags & KFsTreeListItemFocused)) |
|
274 |
{ |
|
275 |
//menuIcon |
|
276 |
menuIconMetrics = |
|
277 |
CFsLayoutManager::EFsLmListMediumLineRightIconG1; |
|
278 |
textMetrics = |
|
279 |
CFsLayoutManager::EFsLmListMediumLineRightIconT1; |
|
280 |
} |
|
281 |
else |
|
282 |
{ |
|
283 |
//plain item |
|
284 |
textMetrics = |
|
285 |
CFsLayoutManager::EFsLmListMediumLinePlainT1; |
|
286 |
} |
|
287 |
} |
|
288 |
} |
|
289 |
||
290 |
//layout manager is queried for medium values - LM returnes rects based on phone's global text settings |
|
291 |
||
292 |
TRect parentLayoutRect = TRect(iParentLayout->Size().Target().AsSize()); |
|
293 |
parentLayoutRect.Resize(-(iParentLayout->HorizontalPadding()*2), 0); |
|
294 |
||
295 |
if (iFlags & KFsTreeListItemManagedLayout) |
|
296 |
{ |
|
297 |
CFsLayoutManager::LayoutMetricsSize( |
|
298 |
parentLayoutRect, |
|
299 |
sizeMetrics, |
|
300 |
iSize ); |
|
301 |
} |
|
302 |
||
303 |
TRect currentSize = iSize; |
|
304 |
if (CFsLayoutManager::IsMirrored()) |
|
305 |
{ |
|
306 |
currentSize.iBr = currentSize.iBr - TPoint(aIndentation, 0); |
|
307 |
} |
|
308 |
else |
|
309 |
{ |
|
310 |
currentSize.iTl = currentSize.iTl + TPoint(aIndentation, 0); |
|
311 |
} |
|
312 |
||
313 |
CFsLayoutManager::LayoutMetricsRect( |
|
314 |
currentSize, |
|
315 |
mainIconMetrics, |
|
316 |
rect ); |
|
317 |
tpMainIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
318 |
tpMainIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
319 |
||
320 |
CFsLayoutManager::LayoutMetricsRect( |
|
321 |
currentSize, |
|
322 |
markIconMetrics, |
|
323 |
rect ); |
|
324 |
tpMarkIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
325 |
tpMarkIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
326 |
||
327 |
CFsLayoutManager::LayoutMetricsRect( |
|
328 |
currentSize, |
|
329 |
menuIconMetrics, |
|
330 |
rect ); |
|
331 |
tpMenuIconTl.SetTarget(TAlfRealPoint(rect.iTl)); |
|
332 |
tpMenuIconBr.SetTarget(TAlfRealPoint(rect.iBr)); |
|
333 |
||
334 |
CFsLayoutManager::TFsText textInfo; |
|
335 |
CFsLayoutManager::LayoutMetricsText(currentSize, textMetrics, textInfo); |
|
336 |
||
337 |
tpTextTl.SetTarget(TAlfRealPoint(textInfo.iTextRect.iTl)); |
|
338 |
tpTextBr.SetTarget(TAlfRealPoint(textInfo.iTextRect.iBr)); |
|
339 |
||
340 |
TInt visualIconIndex = iLayout->FindVisual(iIconVisual); |
|
341 |
if ( visualIconIndex != KErrNotFound ) |
|
342 |
{ |
|
343 |
iLayout->SetAnchor( EAlfAnchorTopLeft, |
|
344 |
visualIconIndex, |
|
345 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
346 |
EAlfAnchorMetricAbsolute, |
|
347 |
EAlfAnchorMetricAbsolute, |
|
348 |
tpMainIconTl ); |
|
349 |
iLayout->SetAnchor( EAlfAnchorBottomRight, |
|
350 |
visualIconIndex, |
|
351 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
352 |
EAlfAnchorMetricAbsolute, |
|
353 |
EAlfAnchorMetricAbsolute, |
|
354 |
tpMainIconBr ); |
|
355 |
} |
|
356 |
||
357 |
if ((iFlags & KFsTreeListItemHasMenu) |
|
358 |
&& (iFlags & KFsTreeListItemFocused)) |
|
359 |
{ |
|
360 |
TInt iconMenuVisIndex = iLayout->FindVisual(iIconMenu); |
|
361 |
if ( iconMenuVisIndex != KErrNotFound ) |
|
362 |
{ |
|
363 |
iLayout->SetAnchor(EAlfAnchorTopLeft, |
|
364 |
iconMenuVisIndex, |
|
365 |
EAlfAnchorOriginLeft,EAlfAnchorOriginTop, |
|
366 |
EAlfAnchorMetricAbsolute,EAlfAnchorMetricAbsolute, |
|
367 |
tpMenuIconTl ); |
|
368 |
iLayout->SetAnchor(EAlfAnchorBottomRight, |
|
369 |
iconMenuVisIndex, |
|
370 |
EAlfAnchorOriginLeft,EAlfAnchorOriginTop, |
|
371 |
EAlfAnchorMetricAbsolute,EAlfAnchorMetricAbsolute, |
|
372 |
tpMenuIconBr ); |
|
373 |
||
374 |
TAlfTimedValue opacity; |
|
375 |
opacity.SetValueNow(1.0f); |
|
376 |
iIconMenu->SetOpacity(opacity); |
|
377 |
} |
|
378 |
} |
|
379 |
else |
|
380 |
{ |
|
381 |
TAlfTimedValue opacity; |
|
382 |
opacity.SetValueNow(0.0f); |
|
383 |
iIconMenu->SetOpacity(opacity); |
|
384 |
} |
|
385 |
||
386 |
if (iTextLayout) |
|
387 |
{ |
|
388 |
TInt textVisIndex = iLayout->FindVisual(iTextLayout); |
|
389 |
if ( textVisIndex != KErrNotFound ) |
|
390 |
{ |
|
391 |
iLayout->SetAnchor(EAlfAnchorTopLeft, |
|
392 |
textVisIndex, |
|
393 |
EAlfAnchorOriginLeft,EAlfAnchorOriginTop, |
|
394 |
EAlfAnchorMetricAbsolute, |
|
395 |
EAlfAnchorMetricAbsolute, |
|
396 |
tpTextTl ); |
|
397 |
iLayout->SetAnchor(EAlfAnchorBottomRight, |
|
398 |
textVisIndex, |
|
399 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
400 |
EAlfAnchorMetricAbsolute, |
|
401 |
EAlfAnchorMetricAbsolute, |
|
402 |
tpTextBr ); |
|
403 |
} |
|
404 |
} |
|
405 |
||
406 |
if ( iFlags & KFsTreeListItemMarked ) |
|
407 |
{ |
|
408 |
TInt iconMarkedVisIndex = |
|
409 |
iLayout->FindVisual(iIconMarked); |
|
410 |
if ( iconMarkedVisIndex != KErrNotFound ) |
|
411 |
{ |
|
412 |
iLayout->SetAnchor(EAlfAnchorTopLeft, |
|
413 |
iconMarkedVisIndex, |
|
414 |
EAlfAnchorOriginLeft,EAlfAnchorOriginTop, |
|
415 |
EAlfAnchorMetricAbsolute, |
|
416 |
EAlfAnchorMetricAbsolute, |
|
417 |
tpMarkIconTl ); |
|
418 |
iLayout->SetAnchor(EAlfAnchorBottomRight, |
|
419 |
iconMarkedVisIndex, |
|
420 |
EAlfAnchorOriginLeft, EAlfAnchorOriginTop, |
|
421 |
EAlfAnchorMetricAbsolute, |
|
422 |
EAlfAnchorMetricAbsolute, |
|
423 |
tpMarkIconBr ); |
|
424 |
||
425 |
TAlfTimedValue opacity; |
|
426 |
opacity.SetValueNow(1.0f); |
|
427 |
iIconMarked->SetOpacity(opacity); |
|
428 |
} |
|
429 |
} |
|
430 |
else |
|
431 |
{ |
|
432 |
if (iIconMarked) |
|
433 |
{ |
|
434 |
TAlfTimedValue opacity; |
|
435 |
opacity.SetValueNow(0.0f); |
|
436 |
iIconMarked->SetOpacity(opacity); |
|
437 |
} |
|
438 |
} |
|
439 |
iLayout->UpdateChildrenLayout(); |
|
440 |
} |
|
441 |
||
442 |
||
443 |
// --------------------------------------------------------------------------- |
|
444 |
// From class MFsTreeItemVisualizer. |
|
445 |
// A call to this function means that the item is requested to draw itself |
|
446 |
// within specified parent layout. |
|
447 |
// --------------------------------------------------------------------------- |
|
448 |
// |
|
449 |
void CFsTreeRichItemVisualizer::ShowL( CAlfLayout& aParentLayout, const TUint aTimeout ) |
|
450 |
{ |
|
451 |
FUNC_LOG; |
|
452 |
if ( !iLayout ) |
|
453 |
{ |
|
454 |
iParentLayout = &aParentLayout; |
|
455 |
||
456 |
iLayout = CAlfAnchorLayout::AddNewL(iOwnerControl, iParentLayout); |
|
457 |
iLayout->EnableBrushesL(); |
|
458 |
iLayout->SetClipping(ETrue); |
|
459 |
||
460 |
if ( !iIconVisual ) |
|
461 |
{ |
|
462 |
iIconVisual = |
|
463 |
CAlfImageVisual::AddNewL( iOwnerControl, iLayout ); |
|
464 |
iIconVisual->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
465 |
} |
|
466 |
||
467 |
if ( !iIconMarked ) |
|
468 |
{ |
|
469 |
iIconMarked = |
|
470 |
CAlfImageVisual::AddNewL( iOwnerControl, iLayout ); |
|
471 |
iIconMarked->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
472 |
} |
|
473 |
||
474 |
if ( !iIconMenu ) |
|
475 |
{ |
|
476 |
iIconMenu = |
|
477 |
CAlfImageVisual::AddNewL( iOwnerControl, iLayout ); |
|
478 |
iIconMenu->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
479 |
} |
|
480 |
} |
|
481 |
else |
|
482 |
{ |
|
483 |
//visuals are already created but not attached to the list layout |
|
484 |
if (!iLayout->Layout()) |
|
485 |
{ |
|
486 |
aParentLayout.Append(iLayout, aTimeout); |
|
487 |
iParentLayout = &aParentLayout; |
|
488 |
} |
|
489 |
} |
|
490 |
} |
|
491 |
||
492 |
||
493 |
// --------------------------------------------------------------------------- |
|
494 |
// From class MFsTreeItemVisualizer. |
|
495 |
// A call to this function means that the item is requested to update its |
|
496 |
// visual content. |
|
497 |
// --------------------------------------------------------------------------- |
|
498 |
// |
|
499 |
void CFsTreeRichItemVisualizer::UpdateL( |
|
500 |
const MFsTreeItemData& aData, |
|
501 |
TBool /*aFocused*/, |
|
502 |
const TUint aLevel, |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
503 |
CAlfTexture*& aMarkOnIcon, |
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
504 |
CAlfTexture*& /*aMarkOffIcon*/, |
64 | 505 |
CAlfTexture*& aMenuIcon, |
506 |
const TUint /*aTimeout*/, |
|
507 |
TBool aUpdateData) |
|
508 |
{ |
|
509 |
FUNC_LOG; |
|
510 |
if ( iLayout ) |
|
511 |
{ |
|
512 |
iSize.iWidth = iParentLayout->Size().Target().iX - |
|
513 |
iParentLayout->PaddingInPixels().Width(); |
|
514 |
iExtendedSize.iWidth = iSize.iWidth; |
|
515 |
||
516 |
if ( KFsTreeRichItemDataType == aData.Type() ) |
|
517 |
{ |
|
518 |
const CFsTreeRichItemData* data( |
|
519 |
static_cast<const CFsTreeRichItemData*>(&aData)); |
|
520 |
||
521 |
if (iIconVisual) |
|
522 |
{ |
|
523 |
if ( data->IsIconSet() ) |
|
524 |
{ |
|
525 |
iIconVisual->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
526 |
iIconVisual->SetImage( TAlfImage(data->Icon())); |
|
527 |
} |
|
528 |
} |
|
529 |
||
530 |
if (iFlags & KFsTreeListItemMarked) |
|
531 |
{ |
|
532 |
iIconMarked->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
73
c8382f7b54ef
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
64
diff
changeset
|
533 |
iIconMarked->SetImage(TAlfImage(*aMarkOnIcon)); |
64 | 534 |
} |
535 |
||
536 |
if (iFlags & KFsTreeListItemHasMenu) |
|
537 |
{ |
|
538 |
iIconMenu->SetScaleMode( CAlfImageVisual::EScaleFit ); |
|
539 |
iIconMenu->SetImage(TAlfImage(*aMenuIcon)); |
|
540 |
} |
|
541 |
||
542 |
iLayout->Env().SetRefreshMode(EAlfRefreshModeManual); |
|
543 |
||
544 |
if (iTextLayout) |
|
545 |
{ |
|
546 |
iTextLayout->RemoveAndDestroyAllD(); |
|
547 |
} |
|
548 |
iTextLayout = CAlfFlowLayout::AddNewL(iOwnerControl, iLayout); |
|
549 |
iTextLayout->SetFlowDirection(CAlfFlowLayout::EFlowHorizontal); |
|
550 |
||
551 |
const TInt indent( iTextIndentation * ( aLevel - 1 ) ); |
|
552 |
UpdateLayout(data, indent); |
|
553 |
||
554 |
if (aUpdateData) |
|
555 |
{ |
|
556 |
CreateTextLineL(iOwnerControl, iTextLayout, data, |
|
557 |
iTextLayout->Size().Target().AsSize()); |
|
558 |
} |
|
559 |
||
560 |
iLayout->Env().SetRefreshMode(EAlfRefreshModeAutomatic); |
|
561 |
||
562 |
} |
|
563 |
} |
|
564 |
} |
|
565 |
||
566 |
||
567 |
// --------------------------------------------------------------------------- |
|
568 |
// From class MFsTreeItemVisualizer. |
|
569 |
// A call to this function means that the item goes out of the visible items |
|
570 |
// scope. |
|
571 |
// --------------------------------------------------------------------------- |
|
572 |
// |
|
573 |
void CFsTreeRichItemVisualizer::Hide( const TInt aTimeout ) |
|
574 |
{ |
|
575 |
FUNC_LOG; |
|
576 |
if ( iLayout ) |
|
577 |
{ |
|
578 |
iParentLayout->Remove( iLayout, aTimeout ); |
|
579 |
iLayout->RemoveAndDestroyAllD(); |
|
580 |
iLayout = NULL; |
|
581 |
iParentLayout = NULL; |
|
582 |
iTextLayout = NULL; |
|
583 |
iIconMarked = NULL; |
|
584 |
iIconMenu = NULL; |
|
585 |
iIconVisual = NULL; |
|
586 |
} |
|
587 |
} |
|
588 |
||
589 |
||
590 |
// --------------------------------------------------------------------------- |
|
591 |
// From MFsTreeItemVisualizer. |
|
592 |
// This method marquees the text in tree item if it is too long. |
|
593 |
// --------------------------------------------------------------------------- |
|
594 |
// |
|
595 |
void CFsTreeRichItemVisualizer::MarqueeL(const TFsTextMarqueeType /*aMarqueeType*/, |
|
596 |
const TUint /*aMarqueeSpeed*/, |
|
597 |
const TInt /*aMarqueeStartDelay*/, |
|
598 |
const TInt /*aMarqueeCycleStartDelay*/, |
|
599 |
const TInt /*aMarqueeRepetitions*/) |
|
600 |
{ |
|
601 |
FUNC_LOG; |
|
602 |
} |
|
603 |
||
604 |
// --------------------------------------------------------------------------- |
|
605 |
// From MFsTreeItemVisualizer. |
|
606 |
// This method sets flag disable wrapping the text item. |
|
607 |
// --------------------------------------------------------------------------- |
|
608 |
// |
|
609 |
void CFsTreeRichItemVisualizer::OffWrapping() |
|
610 |
{ |
|
611 |
FUNC_LOG; |
|
612 |
} |