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 : Freestyle tree list visualizer implementation |
|
15 |
* |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
//////SYSTEM INCLUDES |
|
20 |
#include "emailtrace.h" |
|
21 |
#include <AknUtils.h> |
|
22 |
#include <StringLoader.h> |
|
23 |
#include <avkon.rsg> // R_AVKON_EMPTY_POPUP_LIST_TEXT |
|
24 |
#include <centralrepository.h> |
|
25 |
||
26 |
//////TOOLKIT INCLUDES |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
27 |
// <cmail> SF |
64 | 28 |
#include <alf/alfstatic.h> |
29 |
#include <alf/alfownership.h> |
|
30 |
#include <alf/alfevent.h> |
|
31 |
#include <alf/alfimage.h> |
|
32 |
#include <alf/alfenv.h> |
|
33 |
#include <alf/alfcontrolgroup.h> |
|
34 |
//layouts |
|
35 |
#include <alf/alfflowlayout.h> |
|
36 |
#include <alf/alfdecklayout.h> |
|
37 |
#include <alf/alfgridlayout.h> |
|
38 |
#include <alf/alfanchorlayout.h> |
|
39 |
//brushes |
|
40 |
#include <alf/alfbrusharray.h> |
|
41 |
#include <alf/alfbrush.h> |
|
42 |
#include <alf/alfborderbrush.h> |
|
43 |
#include <alf/alfimagebrush.h> |
|
44 |
#include <alf/alfgradientbrush.h> |
|
45 |
#include <alf/alfframebrush.h> |
|
46 |
#include <alf/alfshadowborderbrush.h> |
|
47 |
//metrics |
|
48 |
#include <alf/alfmetric.h> |
|
49 |
#include <alf/alftimedvalue.h> |
|
50 |
//visuals |
|
51 |
#include <alf/alfvisual.h> |
|
52 |
#include <alf/alfimagevisual.h> |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
53 |
// </cmail> |
64 | 54 |
|
55 |
||
56 |
//////PROJECT INCLUDES |
|
57 |
#include "fstreevisualizerbase.h" |
|
58 |
#include "fstreeplainrootvisualizer.h" |
|
59 |
#include "fstree.h" |
|
60 |
#include "fstreeiterator.h" |
|
61 |
#include "fsgenericpanic.h" |
|
62 |
#include "fsfadeeffect.h" |
|
63 |
#include "fstreeplainonelineitemdata.h" |
|
64 |
#include "fsslideeffect.h" |
|
65 |
#include "fstreeplainonelineitemvisualizer.h" |
|
66 |
#include "fstreelist.h" |
|
67 |
#include "fstreevisualizerobserver.h" |
|
68 |
#include "fscenrepkeys.h" |
|
69 |
#include "fswatermark.h" |
|
70 |
#include "fslayoutmanager.h" |
|
71 |
#include "fsseparatordata.h" |
|
72 |
////alf specific |
|
73 |
#include "fsalfscrollbarlayout.h" |
|
74 |
#include "fsalftextstylemanager.h" |
|
75 |
#include "fsinteractioninterval.h" |
|
76 |
#include "muicscrollbar.h" |
|
77 |
#include "cuicaknscrollbaradapter.h" |
|
78 |
#include "cuicscrollbar.h" |
|
79 |
||
80 |
#include <aknphysics.h> |
|
81 |
#include <touchfeedback.h> // for MTouchFeedback |
|
82 |
||
83 |
||
84 |
//CONSTANTS |
|
85 |
const TInt KDefaultShadowWidth = 4; |
|
86 |
const TInt KFSListDefaultSelectorBorderWidth = 0; |
|
87 |
const TInt KZero = 0; |
|
88 |
_LIT8( KPropertyItemId, "PropItemID" ); |
|
89 |
||
90 |
// check from aknphysicsconstants.h |
|
91 |
const TInt KFlickMaxDuration( 500000 ); |
|
92 |
//const TInt KDefaultFriction( 25 ); // avkon default is 10 |
|
93 |
const TInt KDefaultFriction( 5 ); // avkon default is 10 |
|
94 |
||
95 |
// ======== LOCAL FUNCTIONS ======== |
|
96 |
||
97 |
// --------------------------------------------------------------------------- |
|
98 |
// Deletes and sets pointer to NULL. |
|
99 |
// --------------------------------------------------------------------------- |
|
100 |
template<class T> void SafeDelete(T*& aPtr) |
|
101 |
{ |
|
102 |
delete aPtr; |
|
103 |
aPtr = NULL; |
|
104 |
} |
|
105 |
||
106 |
// ======== MEMBER FUNCTIONS ======== |
|
107 |
||
108 |
// TWorld::TItem |
|
109 |
||
110 |
// --------------------------------------------------------------------------- |
|
111 |
// TWorld::TItem::TItem |
|
112 |
// --------------------------------------------------------------------------- |
|
113 |
TWorld::TItem::TItem(const TFsTreeItemId aId, const TRect& aRect) : |
|
114 |
iId(aId) |
|
115 |
{ |
|
116 |
SetRect(aRect); |
|
117 |
} |
|
118 |
||
119 |
// --------------------------------------------------------------------------- |
|
120 |
// TWorld::TItem::Rect |
|
121 |
// --------------------------------------------------------------------------- |
|
122 |
TRect TWorld::TItem::Rect() const |
|
123 |
{ |
|
124 |
return TRect(TPoint(0, iY), TPoint(0, iY + iHeight)); |
|
125 |
} |
|
126 |
||
127 |
// --------------------------------------------------------------------------- |
|
128 |
// TWorld::TItem::SetRect |
|
129 |
// --------------------------------------------------------------------------- |
|
130 |
void TWorld::TItem::SetRect(const TRect& aRect) |
|
131 |
{ |
|
132 |
iY = aRect.iTl.iY; |
|
133 |
iHeight = aRect.Height(); |
|
134 |
} |
|
135 |
||
136 |
// --------------------------------------------------------------------------- |
|
137 |
// TWorld::TItem::Move |
|
138 |
// --------------------------------------------------------------------------- |
|
139 |
void TWorld::TItem::Move(TInt aDy) |
|
140 |
{ |
|
141 |
iY += aDy; |
|
142 |
} |
|
143 |
||
144 |
// --------------------------------------------------------------------------- |
|
145 |
// TWorld::TItem::Top |
|
146 |
// --------------------------------------------------------------------------- |
|
147 |
TInt TWorld::TItem::Top() const |
|
148 |
{ |
|
149 |
return iY; |
|
150 |
} |
|
151 |
||
152 |
// --------------------------------------------------------------------------- |
|
153 |
// TWorld::TItem::TopLeft |
|
154 |
// --------------------------------------------------------------------------- |
|
155 |
TPoint TWorld::TItem::TopLeft() const |
|
156 |
{ |
|
157 |
return TPoint(0, iY); |
|
158 |
} |
|
159 |
||
160 |
// --------------------------------------------------------------------------- |
|
161 |
// TWorld::TItem::Height |
|
162 |
// --------------------------------------------------------------------------- |
|
163 |
TInt TWorld::TItem::Height() const |
|
164 |
{ |
|
165 |
return iHeight; |
|
166 |
} |
|
167 |
||
168 |
// --------------------------------------------------------------------------- |
|
169 |
// TWorld::TItem::Bottom |
|
170 |
// --------------------------------------------------------------------------- |
|
171 |
TInt TWorld::TItem::Bottom() const |
|
172 |
{ |
|
173 |
return iY + iHeight; |
|
174 |
} |
|
175 |
||
176 |
// --------------------------------------------------------------------------- |
|
177 |
// TWorld::TItem::Bottom |
|
178 |
// --------------------------------------------------------------------------- |
|
179 |
TPoint TWorld::TItem::BottomRight() const |
|
180 |
{ |
|
181 |
return TPoint(0, iY + iHeight); |
|
182 |
} |
|
183 |
||
184 |
// TWorld |
|
185 |
||
186 |
// --------------------------------------------------------------------------- |
|
187 |
// TWorld::TWorld |
|
188 |
// --------------------------------------------------------------------------- |
|
189 |
TWorld::TWorld() : |
|
190 |
iBatchUpdateOngoing(EFalse) |
|
191 |
{ |
|
192 |
} |
|
193 |
||
194 |
// --------------------------------------------------------------------------- |
|
195 |
// TWorld::~TWorld |
|
196 |
// --------------------------------------------------------------------------- |
|
197 |
TWorld::~TWorld() |
|
198 |
{ |
|
199 |
iItems.Reset(); |
|
200 |
iObservers.Reset(); |
|
201 |
} |
|
202 |
||
203 |
// --------------------------------------------------------------------------- |
|
204 |
// TWorld::AddObserverL |
|
205 |
// --------------------------------------------------------------------------- |
|
206 |
void TWorld::AddObserverL(MObserver& aObserver) |
|
207 |
{ |
|
208 |
iObservers.AppendL(&aObserver); |
|
209 |
} |
|
210 |
||
211 |
// --------------------------------------------------------------------------- |
|
212 |
// TWorld::RemoveObserver |
|
213 |
// --------------------------------------------------------------------------- |
|
214 |
void TWorld::RemoveObserver(MObserver& aObserver) |
|
215 |
{ |
|
216 |
const TInt index(iObservers.Find(&aObserver)); |
|
217 |
if (index != KErrNotFound) |
|
218 |
{ |
|
219 |
iObservers.Remove(index); |
|
220 |
} |
|
221 |
} |
|
222 |
||
223 |
// --------------------------------------------------------------------------- |
|
224 |
// TWorld::AppendL |
|
225 |
// --------------------------------------------------------------------------- |
|
226 |
void TWorld::AppendL(const TFsTreeItemId aId, const TSize& aSize) |
|
227 |
{ |
|
228 |
const TInt count(iItems.Count()); |
|
229 |
TPoint tl; |
|
230 |
if (count > 0) |
|
231 |
{ |
|
232 |
tl.iY = iItems[count - 1].Bottom(); |
|
233 |
} |
|
234 |
const TRect modifiedRect(TRect(tl, aSize)); |
|
235 |
iItems.AppendL(TItem(aId, modifiedRect)); |
|
236 |
iHeight += aSize.iHeight; |
|
237 |
UpdatedL(); |
|
238 |
} |
|
239 |
||
240 |
// --------------------------------------------------------------------------- |
|
241 |
// TWorld::InsertL |
|
242 |
// --------------------------------------------------------------------------- |
|
243 |
void TWorld::InsertL(const TFsTreeItemId aId, const TSize& aSize, |
|
244 |
const TInt aSlot) |
|
245 |
{ |
|
246 |
if (aSlot >= iItems.Count()) |
|
247 |
{ |
|
248 |
AppendL(aId, aSize); |
|
249 |
} |
|
250 |
else |
|
251 |
{ |
|
252 |
const TPoint topLeft(iItems[aSlot].TopLeft()); |
|
253 |
iItems.InsertL(TItem(aId, TRect(topLeft, aSize)), aSlot); |
|
254 |
MoveBy(aSlot + 1, aSize.iHeight); |
|
255 |
iHeight += aSize.iHeight; |
|
256 |
UpdatedL(); |
|
257 |
} |
|
258 |
} |
|
259 |
||
260 |
// --------------------------------------------------------------------------- |
|
261 |
// TWorld::RemoveL |
|
262 |
// --------------------------------------------------------------------------- |
|
263 |
void TWorld::RemoveL(const TFsTreeItemId aId) |
|
264 |
{ |
|
265 |
for (TInt i = iItems.Count() - 1; i >= 0; i--) |
|
266 |
{ |
|
267 |
const TFsTreeItemId itemId(iItems[i].iId); |
|
268 |
if (itemId == aId) |
|
269 |
{ |
|
270 |
const TItem item(iItems[i]); |
|
271 |
iItems.Remove(i); |
|
272 |
const TInt delta(-item.Height()); |
|
273 |
MoveBy(i, delta); |
|
274 |
iHeight += delta; |
|
275 |
UpdatedL(); |
|
276 |
break; |
|
277 |
} |
|
278 |
} |
|
279 |
} |
|
280 |
||
281 |
// --------------------------------------------------------------------------- |
|
282 |
// TWorld::RemoveAllL |
|
283 |
// --------------------------------------------------------------------------- |
|
284 |
void TWorld::RemoveAllL() |
|
285 |
{ |
|
286 |
iHeight = 0; |
|
287 |
iItems.Reset(); |
|
288 |
UpdatedL(); |
|
289 |
} |
|
290 |
||
291 |
// --------------------------------------------------------------------------- |
|
292 |
// TWorld::Height |
|
293 |
// --------------------------------------------------------------------------- |
|
294 |
TInt TWorld::Height() const |
|
295 |
{ |
|
296 |
return iHeight; |
|
297 |
} |
|
298 |
||
299 |
// --------------------------------------------------------------------------- |
|
300 |
// TWorld::ItemCount |
|
301 |
// --------------------------------------------------------------------------- |
|
302 |
TInt TWorld::ItemCount() const |
|
303 |
{ |
|
304 |
return iItems.Count(); |
|
305 |
} |
|
306 |
||
307 |
// --------------------------------------------------------------------------- |
|
308 |
// TWorld::Item |
|
309 |
// --------------------------------------------------------------------------- |
|
310 |
TFsTreeItemId TWorld::Item(TInt aIndex) const |
|
311 |
{ |
|
312 |
return iItems[aIndex].iId; |
|
313 |
} |
|
314 |
||
315 |
// --------------------------------------------------------------------------- |
|
316 |
// TWorld::IndexOfItem |
|
317 |
// --------------------------------------------------------------------------- |
|
318 |
TInt TWorld::IndexOfItem(TFsTreeItemId aItem) const |
|
319 |
{ |
|
320 |
for (TInt i = 0; i < iItems.Count(); i++) |
|
321 |
{ |
|
322 |
if (iItems[i].iId == aItem) |
|
323 |
{ |
|
324 |
return i; |
|
325 |
} |
|
326 |
} |
|
327 |
return KErrNotFound; |
|
328 |
} |
|
329 |
||
330 |
// --------------------------------------------------------------------------- |
|
331 |
// TWorld::MoveBy |
|
332 |
// --------------------------------------------------------------------------- |
|
333 |
void TWorld::MoveBy(const TInt aSlot, const TInt aDelta) |
|
334 |
{ |
|
335 |
const TInt count(iItems.Count()); |
|
336 |
for (TInt i = aSlot; i < count; i++) |
|
337 |
{ |
|
338 |
iItems[i].Move(aDelta); |
|
339 |
} |
|
340 |
} |
|
341 |
||
342 |
// --------------------------------------------------------------------------- |
|
343 |
// TWorld::UpdatedL |
|
344 |
// --------------------------------------------------------------------------- |
|
345 |
void TWorld::UpdatedL() |
|
346 |
{ |
|
347 |
if (!iBatchUpdateOngoing) |
|
348 |
{ |
|
349 |
for (TInt i = iObservers.Count() - 1; i >= 0; i--) |
|
350 |
{ |
|
351 |
iObservers[i]->WorldUpdatedL(*this); |
|
352 |
} |
|
353 |
} |
|
354 |
} |
|
355 |
||
356 |
// --------------------------------------------------------------------------- |
|
357 |
// TWorld::GetItemsL |
|
358 |
// Uses binary search. |
|
359 |
// --------------------------------------------------------------------------- |
|
360 |
void TWorld::GetItemsL(RArray<TFsTreeItemId>& aItems, TInt aY, TInt aHeight, |
|
361 |
TInt& aOffset, TInt& aBeginIndex) |
|
362 |
{ |
|
363 |
// First find first visible item using binary search algorithm |
|
364 |
aItems.Reset(); |
|
365 |
TInt i(0); |
|
366 |
aOffset = 0; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
367 |
aBeginIndex = KErrNotFound; |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
368 |
|
64 | 369 |
if (aY > Height()) |
370 |
{ |
|
371 |
aHeight = -1; |
|
372 |
} |
|
373 |
else if (aY > 0) |
|
374 |
{ |
|
375 |
TInt min(0); |
|
376 |
TInt max(iItems.Count() - 1); |
|
377 |
while (min <= max) |
|
378 |
{ |
|
379 |
const TInt middle(min + (max - min) / 2); |
|
380 |
if (aY < iItems[middle].Top()) |
|
381 |
{ |
|
382 |
max = middle - 1; |
|
383 |
} |
|
384 |
else if (aY > iItems[middle].Bottom()) |
|
385 |
{ |
|
386 |
min = middle + 1; |
|
387 |
} |
|
388 |
else |
|
389 |
{ |
|
390 |
aOffset = aY - iItems[middle].Top(); |
|
391 |
aHeight += aOffset; |
|
392 |
aBeginIndex = i = middle; |
|
393 |
break; |
|
394 |
} |
|
395 |
} |
|
396 |
} |
|
397 |
else |
|
398 |
{ |
|
399 |
aOffset = aY; |
|
400 |
aHeight += aY; |
|
401 |
} |
|
402 |
||
403 |
// If item was found, collect enough items to fill the view |
|
404 |
while (aHeight >= 0 && i < iItems.Count()) |
|
405 |
{ |
|
406 |
aItems.AppendL(iItems[i].iId); |
|
407 |
aHeight -= iItems[i++].Height(); |
|
408 |
} |
|
409 |
} |
|
410 |
||
411 |
// --------------------------------------------------------------------------- |
|
412 |
// TWorld::BeginUpdate |
|
413 |
// --------------------------------------------------------------------------- |
|
414 |
void TWorld::BeginUpdate() |
|
415 |
{ |
|
416 |
iBatchUpdateOngoing = ETrue; |
|
417 |
} |
|
418 |
||
419 |
// --------------------------------------------------------------------------- |
|
420 |
// TWorld::EndUpdateL |
|
421 |
// --------------------------------------------------------------------------- |
|
422 |
void TWorld::EndUpdateL() |
|
423 |
{ |
|
424 |
if (iBatchUpdateOngoing) |
|
425 |
{ |
|
426 |
iBatchUpdateOngoing = EFalse; |
|
427 |
UpdatedL(); |
|
428 |
} |
|
429 |
} |
|
430 |
||
431 |
// --------------------------------------------------------------------------- |
|
432 |
// TWorld::IsUpdating |
|
433 |
// --------------------------------------------------------------------------- |
|
434 |
TBool TWorld::IsUpdating() const |
|
435 |
{ |
|
436 |
return iBatchUpdateOngoing; |
|
437 |
} |
|
438 |
||
439 |
// --------------------------------------------------------------------------- |
|
440 |
// TWorld::Recalculate |
|
441 |
// --------------------------------------------------------------------------- |
|
442 |
void TWorld::Recalculate(const CFsTree& aTree) |
|
443 |
{ |
|
444 |
TPoint tl; |
|
445 |
iHeight = 0; |
|
446 |
for (TInt i = 0; i < iItems.Count(); i++) |
|
447 |
{ |
|
448 |
TItem& item(iItems[i]); |
|
449 |
MFsTreeItemVisualizer* visualizer(aTree.ItemVisualizer(item.iId)); |
|
450 |
TSize size(visualizer->Size()); |
|
451 |
item.SetRect(TRect(tl, size)); |
|
452 |
tl.iY += size.iHeight; |
|
453 |
iHeight += size.iHeight; |
|
454 |
} |
|
455 |
} |
|
456 |
||
457 |
// --------------------------------------------------------------------------- |
|
458 |
// TWorld::GetItemRect |
|
459 |
// --------------------------------------------------------------------------- |
|
460 |
TInt TWorld::GetItemRect(const TFsTreeItemId aItemId, TRect& aRect) const |
|
461 |
{ |
|
462 |
return GetItemRect(aItemId, aRect, 0); |
|
463 |
} |
|
464 |
||
465 |
// --------------------------------------------------------------------------- |
|
466 |
// TWorld::GetItemRect |
|
467 |
// --------------------------------------------------------------------------- |
|
468 |
TInt TWorld::GetItemRect(const TFsTreeItemId aItemId, TRect& aRect, |
|
469 |
const TInt aStartIndex ) const |
|
470 |
{ |
|
471 |
TInt result(KErrNotFound); |
|
472 |
const TInt itemCount(iItems.Count()); |
|
473 |
for (TInt i = aStartIndex; i < itemCount; i++) |
|
474 |
{ |
|
475 |
if (iItems[i].iId == aItemId) |
|
476 |
{ |
|
477 |
result = i; |
|
478 |
aRect = iItems[i].Rect(); |
|
479 |
break; |
|
480 |
} |
|
481 |
} |
|
482 |
return result; |
|
483 |
} |
|
484 |
||
485 |
// --------------------------------------------------------------------------- |
|
486 |
// TWorld::GetItemRectByIndex |
|
487 |
// --------------------------------------------------------------------------- |
|
488 |
TInt TWorld::GetItemRectByIndex(const TInt aIndex, TRect& aRect) const |
|
489 |
{ |
|
490 |
TInt result(KErrNotFound); |
|
491 |
if (aIndex < iItems.Count() && aIndex >= 0) |
|
492 |
{ |
|
493 |
aRect = iItems[aIndex].Rect(); |
|
494 |
result = KErrNone; |
|
495 |
} |
|
496 |
return result; |
|
497 |
} |
|
498 |
||
499 |
// --------------------------------------------------------------------------- |
|
500 |
// TWorld::CheckIntegrity |
|
501 |
// --------------------------------------------------------------------------- |
|
502 |
TBool TWorld::CheckIntegrity() const |
|
503 |
{ |
|
504 |
TBool result(ETrue); |
|
505 |
if (iItems.Count() > 1) |
|
506 |
{ |
|
507 |
TRect prev(iItems[0].Rect()); |
|
508 |
for (TInt i = 1; i < iItems.Count() - 1; i++) |
|
509 |
{ |
|
510 |
const TRect& curr(iItems[i].Rect()); |
|
511 |
if (prev.Intersects(curr)) |
|
512 |
{ |
|
513 |
result = EFalse; |
|
514 |
break; |
|
515 |
} |
|
516 |
prev.iBr.iY += curr.Height(); |
|
517 |
} |
|
518 |
} |
|
519 |
return result; |
|
520 |
} |
|
521 |
||
522 |
// TViewPort |
|
523 |
||
524 |
// --------------------------------------------------------------------------- |
|
525 |
// TViewPort::TViewPort |
|
526 |
// --------------------------------------------------------------------------- |
|
527 |
TViewPort::TViewPort(MObserver& aObserver, TWorld& aWorld) : |
|
528 |
iObserver(aObserver), iWorld(aWorld), iWorldIndex(KErrNotFound) |
|
529 |
{ |
|
530 |
} |
|
531 |
||
532 |
// --------------------------------------------------------------------------- |
|
533 |
// TViewPort::SetPositionL |
|
534 |
// --------------------------------------------------------------------------- |
|
535 |
void TViewPort::SetPositionL(const TPoint& aPosition, TBool aInformUpdate) |
|
536 |
{ |
|
537 |
iPosition = aPosition; |
|
538 |
// Do validation! |
|
539 |
if (aInformUpdate) |
|
540 |
{ |
|
541 |
UpdatedL(); |
|
542 |
} |
|
543 |
} |
|
544 |
||
545 |
// --------------------------------------------------------------------------- |
|
546 |
// TViewPort::SetCenterPositionL |
|
547 |
// --------------------------------------------------------------------------- |
|
548 |
void TViewPort::SetCenterPositionL(const TPoint& aPosition, |
|
549 |
TBool aInformUpdate, TUpdatedByPhysic aUpdateByPhysic) |
|
550 |
{ |
|
551 |
iPosition = TPoint(aPosition.iX - iSize.iWidth / 2, aPosition.iY |
|
552 |
- iSize.iHeight / 2); |
|
553 |
// Do validation! |
|
554 |
if (aInformUpdate) |
|
555 |
{ |
|
556 |
UpdatedL(aUpdateByPhysic); |
|
557 |
} |
|
558 |
} |
|
559 |
||
560 |
// --------------------------------------------------------------------------- |
|
561 |
// TViewPort::Position |
|
562 |
// --------------------------------------------------------------------------- |
|
563 |
const TPoint& TViewPort::Position() const |
|
564 |
{ |
|
565 |
return iPosition; |
|
566 |
} |
|
567 |
||
568 |
// --------------------------------------------------------------------------- |
|
569 |
// TViewPort::CenterPosition |
|
570 |
// --------------------------------------------------------------------------- |
|
571 |
TPoint TViewPort::CenterPosition() const |
|
572 |
{ |
|
573 |
TPoint result(iPosition.iX + iSize.iWidth / 2, iPosition.iY |
|
574 |
+ iSize.iHeight / 2); |
|
575 |
return result; |
|
576 |
} |
|
577 |
||
578 |
// --------------------------------------------------------------------------- |
|
579 |
// TViewPort::SetSizeL |
|
580 |
// --------------------------------------------------------------------------- |
|
581 |
void TViewPort::SetSizeL(const TSize& aSize) |
|
582 |
{ |
|
583 |
iSize = aSize; |
|
584 |
// Do validation! |
|
585 |
if (!iWorld.IsUpdating()) |
|
586 |
{ |
|
587 |
UpdatedL(); |
|
588 |
} |
|
589 |
} |
|
590 |
||
591 |
// --------------------------------------------------------------------------- |
|
592 |
// TViewPort::Size |
|
593 |
// --------------------------------------------------------------------------- |
|
594 |
const TSize& TViewPort::Size() const |
|
595 |
{ |
|
596 |
return iSize; |
|
597 |
} |
|
598 |
||
599 |
// --------------------------------------------------------------------------- |
|
600 |
// TViewPort::GetVisibleItemsL |
|
601 |
// --------------------------------------------------------------------------- |
|
602 |
void TViewPort::GetVisibleItemsL(RArray<TFsTreeItemId>& aItemsToBeRemoved, |
|
603 |
RArray<TFsTreeItemId>& aItemsToBeAdded, TInt& aOffset, |
|
604 |
TBool& aFullUpdate) |
|
605 |
{ |
|
606 |
RArray<TFsTreeItemId> tempItems; |
|
607 |
CleanupClosePushL(tempItems); |
|
608 |
iWorld.GetItemsL(tempItems, iPosition.iY, iSize.iHeight, aOffset, iWorldIndex); |
|
609 |
iCache.UpdateL(tempItems, aItemsToBeRemoved, aItemsToBeAdded, aFullUpdate); |
|
610 |
CleanupStack::PopAndDestroy(); // tempItems |
|
611 |
} |
|
612 |
||
613 |
// --------------------------------------------------------------------------- |
|
614 |
// TViewPort::GetVisibleItemsL |
|
615 |
// --------------------------------------------------------------------------- |
|
616 |
void TViewPort::GetVisibleItemsL(RArray<TFsTreeItemId>& aVisible, TInt& aOffset) |
|
617 |
{ |
|
618 |
iWorld.GetItemsL(aVisible, iPosition.iY, iSize.iHeight, aOffset, iWorldIndex); |
|
619 |
} |
|
620 |
||
621 |
// --------------------------------------------------------------------------- |
|
622 |
// TViewPort::IsScrollBarNeeded |
|
623 |
// --------------------------------------------------------------------------- |
|
624 |
TBool TViewPort::IsScrollBarNeeded() const |
|
625 |
{ |
|
626 |
return iWorld.Height() > iSize.iHeight; |
|
627 |
} |
|
628 |
||
629 |
// --------------------------------------------------------------------------- |
|
630 |
// TViewPort::UpdatedL |
|
631 |
// --------------------------------------------------------------------------- |
|
632 |
void TViewPort::UpdatedL(TUpdatedByPhysic aUpdateByPhysic) |
|
633 |
{ |
|
634 |
iObserver.ViewPortUpdatedL(*this, aUpdateByPhysic); |
|
635 |
} |
|
636 |
||
637 |
// --------------------------------------------------------------------------- |
|
638 |
// TViewPort::WorldUpdatedL |
|
639 |
// --------------------------------------------------------------------------- |
|
640 |
void TViewPort::WorldUpdatedL(const TWorld& aWorld) |
|
641 |
{ |
|
642 |
// recreate viewable set if needed |
|
643 |
if (iPosition.iY > aWorld.Height() || (iPosition.iY + iSize.iHeight |
|
644 |
> aWorld.Height() && iSize.iHeight <= aWorld.Height())) |
|
645 |
{ |
|
646 |
iPosition.iY = Max(0, aWorld.Height() - iSize.iHeight); |
|
647 |
} |
|
648 |
else if (iSize.iHeight > aWorld.Height() && iPosition.iY > 0) |
|
649 |
{ |
|
650 |
iPosition.iY = 0; |
|
651 |
} |
|
652 |
iObserver.ViewPortUpdatedL(*this); |
|
653 |
} |
|
654 |
||
655 |
// --------------------------------------------------------------------------- |
|
656 |
// TViewPort::ScrollToItemL |
|
657 |
// --------------------------------------------------------------------------- |
|
658 |
void TViewPort::ScrollToItemL(const TFsTreeItemId aItemId, |
|
659 |
TBool aInformUpdate) |
|
660 |
{ |
|
661 |
TRect itemRect; |
|
662 |
if (iWorld.GetItemRect(aItemId, itemRect) != KErrNotFound) |
|
663 |
{ |
|
664 |
SetPositionL(itemRect.iTl, aInformUpdate); |
|
665 |
} |
|
666 |
} |
|
667 |
||
668 |
// --------------------------------------------------------------------------- |
|
669 |
// TViewPort::CenterToItemL |
|
670 |
// --------------------------------------------------------------------------- |
|
671 |
void TViewPort::CenterToItemL(const TFsTreeItemId aItemId, |
|
672 |
TBool aInformUpdate) |
|
673 |
{ |
|
674 |
TRect itemRect; |
|
675 |
if (iWorld.GetItemRect(aItemId, itemRect) != KErrNotFound) |
|
676 |
{ |
|
677 |
TInt top(itemRect.iTl.iY); |
|
678 |
top -= (iSize.iHeight - itemRect.Height()) / 2; |
|
679 |
LimitTop(top); |
|
680 |
SetPositionL(TPoint(iPosition.iX, top), aInformUpdate); |
|
681 |
} |
|
682 |
} |
|
683 |
||
684 |
// --------------------------------------------------------------------------- |
|
685 |
// TViewPort::ItemToPositionL |
|
686 |
// Tries to scroll view so that given item is in given position aPosition. |
|
687 |
// --------------------------------------------------------------------------- |
|
688 |
void TViewPort::ItemToPositionL(const TFsTreeItemId aItemId, |
|
689 |
const TPoint& aPosition, const TBool aInformUpdate, |
|
690 |
const TPositionHint aHint) |
|
691 |
{ |
|
692 |
TRect itemRect; |
|
693 |
if (iWorld.GetItemRect(aItemId, itemRect) != KErrNotFound) |
|
694 |
{ |
|
695 |
TInt top(itemRect.iTl.iY); |
|
696 |
top -= aPosition.iY; |
|
697 |
LimitTop(top); |
|
698 |
if (aHint == EPositionAfterExpand) |
|
699 |
{ |
|
700 |
const TInt error( iWorld.GetItemRectByIndex( |
|
701 |
iWorld.IndexOfItem(aItemId) + 1, itemRect) ); |
|
702 |
if (!error) |
|
703 |
{ |
|
704 |
if (itemRect.iBr.iY - top > iSize.iHeight) |
|
705 |
{ |
|
706 |
top += itemRect.iBr.iY - top - iSize.iHeight; |
|
707 |
LimitTop(top); |
|
708 |
} |
|
709 |
} |
|
710 |
} |
|
711 |
SetPositionL(TPoint(iPosition.iX, top), aInformUpdate); |
|
712 |
} |
|
713 |
} |
|
714 |
||
715 |
// --------------------------------------------------------------------------- |
|
716 |
// TViewPort::ScrollItemToViewL |
|
717 |
// Scrolls item to view. Item is set as top most item, if it is above the current |
|
718 |
// display area or bottom most item if it is below the current display area. |
|
719 |
// --------------------------------------------------------------------------- |
|
720 |
void TViewPort::ScrollItemToViewL(const TFsTreeItemId aItemId, |
|
721 |
TBool aInformUpdate) |
|
722 |
{ |
|
723 |
TRect itemRect; |
|
724 |
if (iWorld.GetItemRect(aItemId, itemRect) != KErrNotFound) |
|
725 |
{ |
|
726 |
if (itemRect.iTl.iY < iPosition.iY) |
|
727 |
{ |
|
728 |
SetPositionL(itemRect.iTl, aInformUpdate); |
|
729 |
} |
|
730 |
if (itemRect.iBr.iY > iPosition.iY + iSize.iHeight) |
|
731 |
{ |
|
732 |
SetPositionL( |
|
733 |
TPoint(iPosition.iX, itemRect.iBr.iY - iSize.iHeight), |
|
734 |
aInformUpdate); |
|
735 |
} |
|
736 |
} |
|
737 |
} |
|
738 |
||
739 |
// --------------------------------------------------------------------------- |
|
740 |
// TViewPort::MakeViewFullyOccupiedL |
|
741 |
// --------------------------------------------------------------------------- |
|
742 |
void TViewPort::MakeViewFullyOccupiedL(TBool aInformUpdate) |
|
743 |
{ |
|
744 |
TInt top(iPosition.iY); |
|
745 |
LimitTop(top); |
|
746 |
SetPositionL(TPoint(iPosition.iX, top), aInformUpdate); |
|
747 |
} |
|
748 |
||
749 |
// --------------------------------------------------------------------------- |
|
750 |
// TViewPort::TopItem |
|
751 |
// --------------------------------------------------------------------------- |
|
752 |
TFsTreeItemId TViewPort::TopItem() const |
|
753 |
{ |
|
754 |
return iCache.TopItem(); |
|
755 |
} |
|
756 |
||
757 |
// --------------------------------------------------------------------------- |
|
758 |
// TViewPort::ClearCache |
|
759 |
// --------------------------------------------------------------------------- |
|
760 |
void TViewPort::ClearCache() |
|
761 |
{ |
|
762 |
iWorldIndex = KErrNotFound; |
|
763 |
iCache.Clear(); |
|
764 |
} |
|
765 |
||
766 |
// --------------------------------------------------------------------------- |
|
767 |
// TViewPort::ItemRect |
|
768 |
// --------------------------------------------------------------------------- |
|
769 |
TRect TViewPort::ItemRect(const TFsTreeItemId aItemId) const |
|
770 |
{ |
|
771 |
TRect itemRect; |
|
772 |
if (!iCache.IsClear() && iCache.ContainsItem(aItemId)) |
|
773 |
{ |
|
774 |
const TInt beginIndex(iWorldIndex == KErrNotFound ? 0 : iWorldIndex); |
|
775 |
if (iWorld.GetItemRect(aItemId, itemRect, beginIndex) != KErrNotFound) |
|
776 |
{ |
|
777 |
itemRect.Move(0, -iPosition.iY); |
|
778 |
} |
|
779 |
} |
|
780 |
return itemRect; |
|
781 |
} |
|
782 |
||
783 |
// --------------------------------------------------------------------------- |
|
784 |
// TViewPort::ItemFullyVisible |
|
785 |
// --------------------------------------------------------------------------- |
|
786 |
TBool TViewPort::ItemFullyVisible(const TFsTreeItemId aItemId) const |
|
787 |
{ |
|
788 |
TBool result(EFalse); |
|
789 |
if (!iCache.IsClear() && iCache.ContainsItem(aItemId)) |
|
790 |
{ |
|
791 |
TRect itemRect; |
|
792 |
if (iWorld.GetItemRect(aItemId, itemRect) != KErrNotFound) |
|
793 |
{ |
|
794 |
if (itemRect.Height()) |
|
795 |
{ |
|
796 |
const TRect viewRect(iPosition, iSize); |
|
797 |
result = viewRect.Contains(itemRect.iTl) |
|
798 |
&& viewRect.Contains(itemRect.iBr); |
|
799 |
} |
|
800 |
} |
|
801 |
} |
|
802 |
return result; |
|
803 |
} |
|
804 |
||
805 |
// --------------------------------------------------------------------------- |
|
806 |
// TViewPort::ItemRect |
|
807 |
// --------------------------------------------------------------------------- |
|
808 |
void TViewPort::LimitTop(TInt& aTop) const |
|
809 |
{ |
|
810 |
aTop = Min(iWorld.Height() - iSize.iHeight, aTop); |
|
811 |
aTop = Max(0, aTop); |
|
812 |
} |
|
813 |
||
814 |
// --------------------------------------------------------------------------- |
|
815 |
// TViewPort::TCache::TCache |
|
816 |
// --------------------------------------------------------------------------- |
|
817 |
TViewPort::TCache::TCache() : |
|
818 |
iClear(ETrue) |
|
819 |
{ |
|
820 |
} |
|
821 |
||
822 |
// --------------------------------------------------------------------------- |
|
823 |
// TViewPort::TCache::~TCache |
|
824 |
// --------------------------------------------------------------------------- |
|
825 |
TViewPort::TCache::~TCache() |
|
826 |
{ |
|
827 |
iCachedItems.Reset(); |
|
828 |
} |
|
829 |
||
830 |
// --------------------------------------------------------------------------- |
|
831 |
// TViewPort::TCache::Clear |
|
832 |
// --------------------------------------------------------------------------- |
|
833 |
void TViewPort::TCache::Clear() |
|
834 |
{ |
|
835 |
iClear = ETrue; |
|
836 |
iCachedItems.Reset(); |
|
837 |
} |
|
838 |
||
839 |
// --------------------------------------------------------------------------- |
|
840 |
// TViewPort::TCache::IsClear |
|
841 |
// --------------------------------------------------------------------------- |
|
842 |
TBool TViewPort::TCache::IsClear() const |
|
843 |
{ |
|
844 |
return iClear; |
|
845 |
} |
|
846 |
||
847 |
// --------------------------------------------------------------------------- |
|
848 |
// TViewPort::TCache::ContainsItem |
|
849 |
// --------------------------------------------------------------------------- |
|
850 |
TBool TViewPort::TCache::ContainsItem(const TFsTreeItemId aItemId) const |
|
851 |
{ |
|
852 |
return iCachedItems.Find(aItemId) != KErrNotFound; |
|
853 |
} |
|
854 |
||
855 |
// --------------------------------------------------------------------------- |
|
856 |
// TViewPort::TCache::UpdateL |
|
857 |
// --------------------------------------------------------------------------- |
|
858 |
void TViewPort::TCache::UpdateL(const RArray<TFsTreeItemId>& aItems, RArray< |
|
859 |
TFsTreeItemId>& aItemsToBeRemoved, |
|
860 |
RArray<TFsTreeItemId>& aItemsToBeAdded, TBool& aFullUpdate) |
|
861 |
{ |
|
862 |
aFullUpdate = iClear; |
|
863 |
if (!iClear) |
|
864 |
{ |
|
865 |
// find items in cache, missing in new set => items to be removed |
|
866 |
aItemsToBeRemoved.Reset(); |
|
867 |
for (TInt i = 0; i < iCachedItems.Count(); i++) |
|
868 |
{ |
|
869 |
if (aItems.Find(iCachedItems[i]) == KErrNotFound) |
|
870 |
{ |
|
871 |
aItemsToBeRemoved.AppendL(iCachedItems[i]); |
|
872 |
} |
|
873 |
} |
|
874 |
||
875 |
// find items in new set, missing in cache => items to be added |
|
876 |
aItemsToBeAdded.Reset(); |
|
877 |
for (TInt i = 0; i < aItems.Count(); i++) |
|
878 |
{ |
|
879 |
if (iCachedItems.Find(aItems[i]) == KErrNotFound) |
|
880 |
{ |
|
881 |
aItemsToBeAdded.AppendL(aItems[i]); |
|
882 |
} |
|
883 |
else |
|
884 |
{ |
|
885 |
aItemsToBeAdded.AppendL(KFsTreeNoneID); |
|
886 |
} |
|
887 |
} |
|
888 |
} |
|
889 |
else |
|
890 |
{ |
|
891 |
// find items in new set, missing in cache => items to be added |
|
892 |
aItemsToBeAdded.Reset(); |
|
893 |
for (TInt i = 0; i < aItems.Count(); i++) |
|
894 |
{ |
|
895 |
aItemsToBeAdded.AppendL(aItems[i]); |
|
896 |
} |
|
897 |
} |
|
898 |
// finally update cache |
|
899 |
iCachedItems.Reset(); |
|
900 |
for (TInt i = 0; i < aItems.Count(); i++) |
|
901 |
{ |
|
902 |
iCachedItems.AppendL(aItems[i]); |
|
903 |
} |
|
904 |
iClear = EFalse; |
|
905 |
} |
|
906 |
||
907 |
// --------------------------------------------------------------------------- |
|
908 |
// TViewPort::TCache::TopItem |
|
909 |
// --------------------------------------------------------------------------- |
|
910 |
TFsTreeItemId TViewPort::TCache::TopItem() const |
|
911 |
{ |
|
912 |
if (iClear || !iCachedItems.Count()) |
|
913 |
{ |
|
914 |
return KFsTreeNoneID; |
|
915 |
} |
|
916 |
return iCachedItems[0]; |
|
917 |
} |
|
918 |
||
919 |
// --------------------------------------------------------------------------- |
|
920 |
// Two-phased constructor. |
|
921 |
// --------------------------------------------------------------------------- |
|
922 |
// |
|
923 |
EXPORT_C CFsTreeVisualizerBase* CFsTreeVisualizerBase::NewL( |
|
924 |
CAlfControl* aOwnerControl, CAlfLayout& aParent, |
|
925 |
const TBool aPopUpMode) |
|
926 |
{ |
|
927 |
FUNC_LOG; |
|
928 |
CFsTreeVisualizerBase* self = new (ELeave) CFsTreeVisualizerBase( |
|
929 |
aOwnerControl, aParent, aPopUpMode); |
|
930 |
CleanupStack::PushL(self); |
|
931 |
self->ConstructL(); |
|
932 |
CleanupStack::Pop(self); |
|
933 |
return self; |
|
934 |
} |
|
935 |
||
936 |
// --------------------------------------------------------------------------- |
|
937 |
// C++ destructor. |
|
938 |
// --------------------------------------------------------------------------- |
|
939 |
// |
|
940 |
CFsTreeVisualizerBase::~CFsTreeVisualizerBase() |
|
941 |
{ |
|
942 |
FUNC_LOG; |
|
943 |
delete iDragHandler; |
|
944 |
delete iPhysics; |
|
945 |
if (iOwnerControl) |
|
946 |
{ |
|
947 |
iOwnerControl->Env().RemoveActionObserver(this); |
|
948 |
} |
|
949 |
delete iBorderBrush; |
|
950 |
iVisibleItems.Close(); |
|
951 |
iVisibleItemsBackground.Close(); |
|
952 |
iCustomPageUpKeys.Close(); |
|
953 |
iCustomPageDownKeys.Close(); |
|
954 |
delete iFadeEffect; |
|
955 |
delete iSlideEffect; |
|
956 |
delete iWatermark; |
|
957 |
delete iTextStyleManager; |
|
958 |
delete iIntx; |
|
959 |
if ( iScrollBar ) |
|
960 |
{ |
|
961 |
iScrollBar->Destroy(); |
|
962 |
} |
|
963 |
} |
|
964 |
||
965 |
// --------------------------------------------------------------------------- |
|
966 |
//Sets data model for the visualizer. |
|
967 |
// --------------------------------------------------------------------------- |
|
968 |
// |
|
969 |
void CFsTreeVisualizerBase::SetTreeData(CFsTree& aTreeData) |
|
970 |
{ |
|
971 |
FUNC_LOG; |
|
972 |
iTreeData = &aTreeData; |
|
973 |
} |
|
974 |
||
975 |
// --------------------------------------------------------------------------- |
|
976 |
// Adds custom key which triggers page-up event. |
|
977 |
// --------------------------------------------------------------------------- |
|
978 |
// |
|
979 |
void CFsTreeVisualizerBase::AddCustomPageUpKey(TInt aKeyCode) |
|
980 |
{ |
|
981 |
FUNC_LOG; |
|
982 |
iCustomPageUpKeys.InsertInOrder(aKeyCode); |
|
983 |
} |
|
984 |
||
985 |
// --------------------------------------------------------------------------- |
|
986 |
// Removes given key code from custom page-up event key codes. |
|
987 |
// --------------------------------------------------------------------------- |
|
988 |
// |
|
989 |
TBool CFsTreeVisualizerBase::RemoveCustomPageUpKey(TInt aKeyCode) |
|
990 |
{ |
|
991 |
FUNC_LOG; |
|
992 |
TBool keyRemoved = EFalse; |
|
993 |
||
994 |
TInt index = iCustomPageUpKeys.FindInOrder(aKeyCode); |
|
995 |
if (index != KErrNotFound) |
|
996 |
{ |
|
997 |
iCustomPageUpKeys.Remove(index); |
|
998 |
keyRemoved = ETrue; |
|
999 |
} |
|
1000 |
||
1001 |
return keyRemoved; |
|
1002 |
} |
|
1003 |
||
1004 |
// --------------------------------------------------------------------------- |
|
1005 |
// Checks whether given key is a custom key for page-up event. |
|
1006 |
// --------------------------------------------------------------------------- |
|
1007 |
// |
|
1008 |
TBool CFsTreeVisualizerBase::IsCustomPageUpKey(TInt aKeyCode) |
|
1009 |
{ |
|
1010 |
FUNC_LOG; |
|
1011 |
TBool keyExists = EFalse; |
|
1012 |
TInt index = iCustomPageUpKeys.FindInOrder(aKeyCode); |
|
1013 |
if (index != KErrNotFound) |
|
1014 |
{ |
|
1015 |
keyExists = ETrue; |
|
1016 |
} |
|
1017 |
return keyExists; |
|
1018 |
} |
|
1019 |
||
1020 |
// --------------------------------------------------------------------------- |
|
1021 |
// Adds custom key which triggers page-down event. |
|
1022 |
// --------------------------------------------------------------------------- |
|
1023 |
// |
|
1024 |
void CFsTreeVisualizerBase::AddCustomPageDownKey(TInt aKeyCode) |
|
1025 |
{ |
|
1026 |
FUNC_LOG; |
|
1027 |
iCustomPageDownKeys.InsertInOrder(aKeyCode); |
|
1028 |
} |
|
1029 |
||
1030 |
// --------------------------------------------------------------------------- |
|
1031 |
// Removes given key code from custom page-down event key codes. |
|
1032 |
// --------------------------------------------------------------------------- |
|
1033 |
// |
|
1034 |
TBool CFsTreeVisualizerBase::RemoveCustomPageDownKey(TInt aKeyCode) |
|
1035 |
{ |
|
1036 |
FUNC_LOG; |
|
1037 |
TBool keyRemoved = EFalse; |
|
1038 |
||
1039 |
TInt index = iCustomPageDownKeys.FindInOrder(aKeyCode); |
|
1040 |
if (index != KErrNotFound) |
|
1041 |
{ |
|
1042 |
iCustomPageDownKeys.Remove(index); |
|
1043 |
keyRemoved = ETrue; |
|
1044 |
} |
|
1045 |
||
1046 |
return keyRemoved; |
|
1047 |
} |
|
1048 |
||
1049 |
// --------------------------------------------------------------------------- |
|
1050 |
// Checks whether given key is a custom key for page-down event. |
|
1051 |
// --------------------------------------------------------------------------- |
|
1052 |
// |
|
1053 |
TBool CFsTreeVisualizerBase::IsCustomPageDownKey(TInt aKeyCode) |
|
1054 |
{ |
|
1055 |
FUNC_LOG; |
|
1056 |
TBool keyExists = EFalse; |
|
1057 |
TInt index = iCustomPageDownKeys.FindInOrder(aKeyCode); |
|
1058 |
if (index != KErrNotFound) |
|
1059 |
{ |
|
1060 |
keyExists = ETrue; |
|
1061 |
} |
|
1062 |
return keyExists; |
|
1063 |
} |
|
1064 |
||
1065 |
// --------------------------------------------------------------------------- |
|
1066 |
// Sets icon for a mark sign. |
|
1067 |
// --------------------------------------------------------------------------- |
|
1068 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1069 |
void CFsTreeVisualizerBase::SetMarkIcon(CAlfTexture& aMarkIcon) |
64 | 1070 |
{ |
1071 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1072 |
iMarkIcon = &aMarkIcon; |
64 | 1073 |
} |
1074 |
||
1075 |
// --------------------------------------------------------------------------- |
|
1076 |
// Returns icon used to mark items. |
|
1077 |
// --------------------------------------------------------------------------- |
|
1078 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1079 |
CAlfTexture* CFsTreeVisualizerBase::MarkIcon() |
64 | 1080 |
{ |
1081 |
FUNC_LOG; |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1082 |
return iMarkIcon; |
64 | 1083 |
} |
1084 |
||
1085 |
// --------------------------------------------------------------------------- |
|
1086 |
// |
|
1087 |
// --------------------------------------------------------------------------- |
|
1088 |
// |
|
1089 |
TBool CFsTreeVisualizerBase::IsMarked(const TFsTreeItemId aItemId) const |
|
1090 |
{ |
|
1091 |
FUNC_LOG; |
|
1092 |
MFsTreeItemVisualizer* vis = NULL; |
|
1093 |
vis = iTreeData->ItemVisualizer(aItemId); |
|
1094 |
return vis->IsMarked(); |
|
1095 |
} |
|
1096 |
||
1097 |
// --------------------------------------------------------------------------- |
|
1098 |
// |
|
1099 |
// --------------------------------------------------------------------------- |
|
1100 |
// |
|
1101 |
void CFsTreeVisualizerBase::MarkItemL(const TFsTreeItemId aItemId, |
|
1102 |
TBool aMarked) |
|
1103 |
{ |
|
1104 |
FUNC_LOG; |
|
1105 |
MFsTreeItemVisualizer* vis = NULL; |
|
1106 |
vis = iTreeData->ItemVisualizer(aItemId); |
|
1107 |
vis->SetMarked(aMarked); |
|
1108 |
if (iVisibleItems.Find(aItemId) != KErrNotFound) |
|
1109 |
{ |
|
1110 |
MFsTreeItemData* data = NULL; |
|
1111 |
data = &(iTreeData->ItemData(aItemId)); |
|
1112 |
||
1113 |
vis->UpdateL(*data, IsItemFocused(aItemId) && IsFocusShown(), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1114 |
iTreeData->Level(aItemId), iMarkIcon, iMenuIcon); |
64 | 1115 |
} |
1116 |
} |
|
1117 |
||
1118 |
// --------------------------------------------------------------------------- |
|
1119 |
// |
|
1120 |
// --------------------------------------------------------------------------- |
|
1121 |
// |
|
1122 |
void CFsTreeVisualizerBase::GetMarkedItemsL(RFsTreeItemIdList& aMarkedItems) const |
|
1123 |
{ |
|
1124 |
FUNC_LOG; |
|
1125 |
TFsTreeIterator treeIter = iTreeData->Iterator(KFsTreeRootID, |
|
1126 |
KFsTreeRootID); |
|
1127 |
TFsTreeItemId itemId; |
|
1128 |
MFsTreeItemVisualizer* vis = NULL; |
|
1129 |
while (treeIter.HasNext()) |
|
1130 |
{ |
|
1131 |
itemId = treeIter.Next(); |
|
1132 |
vis = iTreeData->ItemVisualizer(itemId); |
|
1133 |
if (vis->IsMarked()) |
|
1134 |
{ |
|
1135 |
aMarkedItems.AppendL(itemId); |
|
1136 |
} |
|
1137 |
} |
|
1138 |
} |
|
1139 |
||
1140 |
// --------------------------------------------------------------------------- |
|
1141 |
// Function marks/unmarks all items in the list. |
|
1142 |
// --------------------------------------------------------------------------- |
|
1143 |
// |
|
1144 |
void CFsTreeVisualizerBase::MarkAllItemsL(TBool aMarkAll) |
|
1145 |
{ |
|
1146 |
FUNC_LOG; |
|
1147 |
TFsTreeIterator treeIter = iTreeData->Iterator(KFsTreeRootID, |
|
1148 |
KFsTreeRootID); |
|
1149 |
TFsTreeItemId itemId; |
|
1150 |
MFsTreeItemVisualizer* vis = NULL; |
|
1151 |
while (treeIter.HasNext()) |
|
1152 |
{ |
|
1153 |
itemId = treeIter.Next(); |
|
1154 |
vis = iTreeData->ItemVisualizer(itemId); |
|
1155 |
vis->SetMarked(aMarkAll); |
|
1156 |
} |
|
1157 |
RefreshListViewL(); |
|
1158 |
} |
|
1159 |
||
1160 |
// --------------------------------------------------------------------------- |
|
1161 |
// Sets item indentation per hierarchy level. |
|
1162 |
// --------------------------------------------------------------------------- |
|
1163 |
void CFsTreeVisualizerBase::SetIndentationL(TInt aIndentation) |
|
1164 |
{ |
|
1165 |
FUNC_LOG; |
|
1166 |
iLevelIndentation = aIndentation; |
|
1167 |
||
1168 |
MFsTreeItemVisualizer* vis = NULL; |
|
1169 |
TFsTreeItemId itemId = KFsTreeNoneID; |
|
1170 |
//loop through the list and set items to always-extended state. |
|
1171 |
TFsTreeIterator iter = iTreeData->Iterator(KFsTreeRootID, KFsTreeRootID); |
|
1172 |
while (iter.HasNext()) |
|
1173 |
{ |
|
1174 |
itemId = iter.Next(); |
|
1175 |
//get item's visualizer |
|
1176 |
vis = iTreeData->ItemVisualizer(itemId); |
|
1177 |
//set indentation in pixels |
|
1178 |
vis->SetIndentation(iLevelIndentation); |
|
1179 |
} |
|
1180 |
||
1181 |
//refresh the list view |
|
1182 |
RefreshListViewL(); |
|
1183 |
} |
|
1184 |
||
1185 |
// --------------------------------------------------------------------------- |
|
1186 |
// Returns indentation per hierarchy level in pixels. |
|
1187 |
// --------------------------------------------------------------------------- |
|
1188 |
// |
|
1189 |
TInt CFsTreeVisualizerBase::Indentation() const |
|
1190 |
{ |
|
1191 |
FUNC_LOG; |
|
1192 |
return iLevelIndentation; |
|
1193 |
} |
|
1194 |
||
1195 |
// --------------------------------------------------------------------------- |
|
1196 |
// Sets icon for a menu sign. |
|
1197 |
// --------------------------------------------------------------------------- |
|
1198 |
void CFsTreeVisualizerBase::SetMenuIcon(CAlfTexture& aMenuIcon) |
|
1199 |
{ |
|
1200 |
FUNC_LOG; |
|
1201 |
iMenuIcon = &aMenuIcon; |
|
1202 |
} |
|
1203 |
||
1204 |
// --------------------------------------------------------------------------- |
|
1205 |
// Returns menu icon. |
|
1206 |
// --------------------------------------------------------------------------- |
|
1207 |
CAlfTexture* CFsTreeVisualizerBase::MenuIcon() const |
|
1208 |
{ |
|
1209 |
FUNC_LOG; |
|
1210 |
return iMenuIcon; |
|
1211 |
} |
|
1212 |
||
1213 |
// --------------------------------------------------------------------------- |
|
1214 |
// Used internally by the list. To make the list focused/not focused use |
|
1215 |
// CFsTreeList::SetFocusedL() instead. |
|
1216 |
// --------------------------------------------------------------------------- |
|
1217 |
// |
|
1218 |
void CFsTreeVisualizerBase::SetFocusedL(const TBool aFocused) |
|
1219 |
{ |
|
1220 |
FUNC_LOG; |
|
1221 |
if (iDragHandler && !aFocused) |
|
1222 |
{ |
|
1223 |
iDragHandler->Reset(); |
|
1224 |
} |
|
1225 |
if (iFlags.IsSet(EListFocused) != aFocused) |
|
1226 |
{ |
|
1227 |
iFlags.Assign(EListFocused, aFocused); |
|
1228 |
if (iTreeData->Count()) |
|
1229 |
{ |
|
1230 |
if (iFlags.IsSet(EListFocused)) |
|
1231 |
{ |
|
1232 |
//list will receive focus |
|
1233 |
if (iFocusedItem == KFsTreeNoneID) |
|
1234 |
{ |
|
1235 |
TFsTreeIterator treeIter = iTreeData->Iterator( |
|
1236 |
KFsTreeRootID, KFsTreeRootID, |
|
1237 |
KFsTreeIteratorSkipCollapsedFlag |
|
1238 |
| KFsTreeIteratorSkipHiddenFlag); |
|
1239 |
||
1240 |
TFsTreeItemId id(KFsTreeNoneID); |
|
1241 |
MFsTreeItemVisualizer* visualizer(NULL); |
|
1242 |
id = treeIter.First(); |
|
1243 |
visualizer = iTreeData->ItemVisualizer(id); |
|
1244 |
if (visualizer) |
|
1245 |
{ |
|
1246 |
if (visualizer->IsFocusable()) |
|
1247 |
{ |
|
1248 |
iFocusedItem = id; |
|
1249 |
} |
|
1250 |
} |
|
1251 |
} |
|
1252 |
// a workaround to make SetFocusedItemL work with timeout |
|
1253 |
SetFocusedItemL(iFocusedItem); |
|
1254 |
MakeSelectorVisibleL(ETrue); |
|
1255 |
} |
|
1256 |
else |
|
1257 |
{ |
|
1258 |
if (iFocusedItem != KFsTreeNoneID) |
|
1259 |
{ |
|
1260 |
//list will loose focus |
|
1261 |
MFsTreeItemVisualizer* visualizer = |
|
1262 |
iTreeData->ItemVisualizer(iFocusedItem); |
|
1263 |
if (visualizer) |
|
1264 |
{ |
|
1265 |
TInt index(iListLayout->FindVisual( |
|
1266 |
&visualizer->Layout())); |
|
1267 |
if (index != KErrNotFound) |
|
1268 |
{ |
|
1269 |
MFsTreeItemData* data = &iTreeData->ItemData( |
|
1270 |
iFocusedItem); |
|
1271 |
MakeSelectorVisibleL(EFalse); |
|
1272 |
visualizer->UpdateL(*data, EFalse, |
|
1273 |
iTreeData->Level(iFocusedItem), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1274 |
iMarkIcon, iMenuIcon, iCurrentScrollSpeed); |
64 | 1275 |
} |
1276 |
} |
|
1277 |
} |
|
1278 |
} |
|
1279 |
iListLayout->UpdateChildrenLayout(); |
|
1280 |
} |
|
1281 |
} |
|
1282 |
} |
|
1283 |
||
1284 |
// --------------------------------------------------------------------------- |
|
1285 |
// The function sets some properties of the selector like bitmap, type |
|
1286 |
// of movement. |
|
1287 |
// --------------------------------------------------------------------------- |
|
1288 |
// |
|
1289 |
void CFsTreeVisualizerBase::SetSelectorPropertiesL(CAlfTexture* aTexture, |
|
1290 |
TFsSelectorMovement aMovementType, TInt aLeftBorderWidth, |
|
1291 |
TInt aRightBorderWidth, TInt aTopBorderHeight, |
|
1292 |
TInt aBottomBorderHeight) |
|
1293 |
{ |
|
1294 |
FUNC_LOG; |
|
1295 |
iSelectorTexture = aTexture; |
|
1296 |
iSelectorBrush = NULL; |
|
1297 |
iSelectorMovementType = aMovementType; |
|
1298 |
iSelectorOpacity = 1.0; |
|
1299 |
||
1300 |
iLeftSelectorBorderWidth = aLeftBorderWidth; |
|
1301 |
iRightSelectorBorderWidth = aRightBorderWidth; |
|
1302 |
iTopSelectorBorderHeight = aTopBorderHeight; |
|
1303 |
iBottomSelectorBorderHeight = aBottomBorderHeight; |
|
1304 |
||
1305 |
DestroySelectorVisualL(); |
|
1306 |
MakeSelectorVisibleL(ETrue); |
|
1307 |
} |
|
1308 |
||
1309 |
// --------------------------------------------------------------------------- |
|
1310 |
// The function sets some properties of the selector. |
|
1311 |
// --------------------------------------------------------------------------- |
|
1312 |
// |
|
1313 |
void CFsTreeVisualizerBase::SetSelectorPropertiesL(CAlfBrush* aSelectorBrush, |
|
1314 |
TReal32 aOpacity, TFsSelectorMovement aMovementType) |
|
1315 |
{ |
|
1316 |
FUNC_LOG; |
|
1317 |
iSelectorTexture = NULL; |
|
1318 |
iSelectorBrush = aSelectorBrush; |
|
1319 |
iSelectorMovementType = aMovementType; |
|
1320 |
//check value, selector cannot be fully transparent ( <= 0.0 ) |
|
1321 |
if (aOpacity <= 0.0 || aOpacity > 1.0) |
|
1322 |
{ |
|
1323 |
iSelectorOpacity = 1.0; |
|
1324 |
} |
|
1325 |
else |
|
1326 |
{ |
|
1327 |
iSelectorOpacity = aOpacity; |
|
1328 |
} |
|
1329 |
||
1330 |
iLeftSelectorBorderWidth = 0; |
|
1331 |
iRightSelectorBorderWidth = 0; |
|
1332 |
iTopSelectorBorderHeight = 0; |
|
1333 |
iBottomSelectorBorderHeight = 0; |
|
1334 |
||
1335 |
DestroySelectorVisualL(); |
|
1336 |
MakeSelectorVisibleL(ETrue); |
|
1337 |
} |
|
1338 |
||
1339 |
// --------------------------------------------------------------------------- |
|
1340 |
// The function returnes selector's properties. |
|
1341 |
// --------------------------------------------------------------------------- |
|
1342 |
// |
|
1343 |
void CFsTreeVisualizerBase::GetSelectorProperties(CAlfTexture*& aTexture, |
|
1344 |
TFsSelectorMovement& aMovementType, TInt& aLeftBorderWidth, |
|
1345 |
TInt& aRightBorderWidth, TInt& aTopBorderHeight, |
|
1346 |
TInt& aBottomBorderHeight) |
|
1347 |
{ |
|
1348 |
FUNC_LOG; |
|
1349 |
aTexture = iSelectorTexture; |
|
1350 |
aMovementType = iSelectorMovementType; |
|
1351 |
||
1352 |
aLeftBorderWidth = iLeftSelectorBorderWidth; |
|
1353 |
aRightBorderWidth = iRightSelectorBorderWidth; |
|
1354 |
aTopBorderHeight = iTopSelectorBorderHeight; |
|
1355 |
aBottomBorderHeight = iBottomSelectorBorderHeight; |
|
1356 |
} |
|
1357 |
||
1358 |
// --------------------------------------------------------------------------- |
|
1359 |
// The function sets a text for empty list's view. |
|
1360 |
// --------------------------------------------------------------------------- |
|
1361 |
// |
|
1362 |
void CFsTreeVisualizerBase::SetEmptyListTextL(const TDesC& aText) |
|
1363 |
{ |
|
1364 |
FUNC_LOG; |
|
1365 |
if (iRootData) |
|
1366 |
{ |
|
1367 |
iRootData->SetDataL(aText); |
|
1368 |
} |
|
1369 |
} |
|
1370 |
||
1371 |
// --------------------------------------------------------------------------- |
|
1372 |
// The function returns a text for empty list's view. |
|
1373 |
// --------------------------------------------------------------------------- |
|
1374 |
// |
|
1375 |
TDesC& CFsTreeVisualizerBase::GetEmptyListText() const |
|
1376 |
{ |
|
1377 |
FUNC_LOG; |
|
1378 |
return iRootData->Data(); |
|
1379 |
} |
|
1380 |
||
1381 |
// --------------------------------------------------------------------------- |
|
1382 |
// Handles key event forwarded by the controller. |
|
1383 |
// --------------------------------------------------------------------------- |
|
1384 |
// |
|
1385 |
TBool CFsTreeVisualizerBase::HandleKeyEventL(const TAlfEvent& aEvent) |
|
1386 |
{ |
|
1387 |
//ignore KeyUp events |
|
1388 |
TBool eventHandled = aEvent.Code() == EEventKeyUp; |
|
1389 |
||
1390 |
if (iTreeData->Count() && (!eventHandled)) |
|
1391 |
{ |
|
1392 |
TInt nowOffset = iListLayout->ScrollOffset().iY.ValueNow(); |
|
1393 |
TInt targetOffset = iListLayout->ScrollOffset().iY.Target(); |
|
1394 |
||
1395 |
if (!(iFlags.IsSet(EIsPageUpDownActive) |
|
1396 |
&& (nowOffset != targetOffset))) |
|
1397 |
{ |
|
1398 |
iFlags.Clear(EIsPageUpDownActive); |
|
1399 |
||
1400 |
switch (aEvent.KeyEvent().iScanCode) |
|
1401 |
{ |
|
1402 |
case EStdKeyUpArrow: |
|
1403 |
{ |
|
1404 |
if (iFocusedItem != KFsTreeNoneID) |
|
1405 |
{ |
|
1406 |
SetCurrentScrollSpeed(aEvent.KeyEvent().iRepeats); |
|
1407 |
MoveSelectionL(EFsTreeVisualizerMoveLineUp); |
|
1408 |
//iCurrentScrollSpeed = iScrollSpeed; |
|
1409 |
} |
|
1410 |
eventHandled = ETrue; |
|
1411 |
break; |
|
1412 |
} |
|
1413 |
case EStdKeyDownArrow: |
|
1414 |
{ |
|
1415 |
if (iFocusedItem != KFsTreeNoneID) |
|
1416 |
{ |
|
1417 |
SetCurrentScrollSpeed(aEvent.KeyEvent().iRepeats); |
|
1418 |
MoveSelectionL(EFsTreeVisualizerMoveLineDown); |
|
1419 |
//iCurrentScrollSpeed = iScrollSpeed; |
|
1420 |
} |
|
1421 |
eventHandled = ETrue; |
|
1422 |
break; |
|
1423 |
} |
|
1424 |
case EStdKeyLeftArrow: |
|
1425 |
{ |
|
1426 |
if (iVisualizerObserver) |
|
1427 |
{ |
|
1428 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1429 |
MFsTreeVisualizerObserver::EFsTreeKeyLeftArrow, |
|
1430 |
iFocusedItem); |
|
1431 |
} |
|
1432 |
eventHandled = ETrue; |
|
1433 |
break; |
|
1434 |
} |
|
1435 |
case EStdKeyRightArrow: |
|
1436 |
{ |
|
1437 |
if (iVisualizerObserver) |
|
1438 |
{ |
|
1439 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1440 |
MFsTreeVisualizerObserver::EFsTreeKeyRightArrow, |
|
1441 |
iFocusedItem); |
|
1442 |
} |
|
1443 |
eventHandled = ETrue; |
|
1444 |
break; |
|
1445 |
} |
|
1446 |
case EStdKeyDevice3: |
|
1447 |
{ |
|
1448 |
if (iTreeData->IsNode(iFocusedItem)) |
|
1449 |
{ |
|
1450 |
if (iTreeData->NodeVisualizer(iFocusedItem)->IsExpanded()) |
|
1451 |
{ |
|
1452 |
CollapseNodeL(iFocusedItem); |
|
1453 |
} |
|
1454 |
else |
|
1455 |
{ |
|
1456 |
ExpandNodeL(iFocusedItem); |
|
1457 |
} |
|
1458 |
} |
|
1459 |
else |
|
1460 |
{ |
|
1461 |
if (iVisualizerObserver) |
|
1462 |
{ |
|
1463 |
if (iTreeData->ItemVisualizer(iFocusedItem)->Menu()) |
|
1464 |
{ |
|
1465 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1466 |
MFsTreeVisualizerObserver::EFsTreeItemWithMenuSelected, |
|
1467 |
iFocusedItem); |
|
1468 |
} |
|
1469 |
else |
|
1470 |
{ |
|
1471 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1472 |
MFsTreeVisualizerObserver::EFsTreeItemSelected, |
|
1473 |
iFocusedItem); |
|
1474 |
} |
|
1475 |
} |
|
1476 |
} |
|
1477 |
eventHandled = ETrue; |
|
1478 |
break; |
|
1479 |
} |
|
1480 |
default: |
|
1481 |
{ |
|
1482 |
// the visualizer ignores all other events |
|
1483 |
break; |
|
1484 |
} |
|
1485 |
} |
|
1486 |
//page up/down |
|
1487 |
if (!eventHandled) |
|
1488 |
{ |
|
1489 |
if (IsCustomPageUpKey(aEvent.KeyEvent().iScanCode)) |
|
1490 |
{ |
|
1491 |
SetCurrentScrollSpeed(aEvent.KeyEvent().iRepeats); |
|
1492 |
MoveSelectionL(EFsTreeVisualizerMovePageUp); |
|
1493 |
iFlags.Set(EIsPageUpDownActive); |
|
1494 |
eventHandled = ETrue; |
|
1495 |
//iCurrentScrollSpeed = iScrollSpeed; |
|
1496 |
} |
|
1497 |
else if (IsCustomPageDownKey(aEvent.KeyEvent().iScanCode)) |
|
1498 |
{ |
|
1499 |
SetCurrentScrollSpeed(aEvent.KeyEvent().iRepeats); |
|
1500 |
MoveSelectionL(EFsTreeVisualizerMovePageDown); |
|
1501 |
iFlags.Set(EIsPageUpDownActive); |
|
1502 |
eventHandled = ETrue; |
|
1503 |
//iCurrentScrollSpeed = iScrollSpeed; |
|
1504 |
} |
|
1505 |
} |
|
1506 |
} |
|
1507 |
else |
|
1508 |
{ |
|
1509 |
eventHandled = EFalse; |
|
1510 |
} |
|
1511 |
} |
|
1512 |
else |
|
1513 |
{ |
|
1514 |
eventHandled = EFalse; |
|
1515 |
} |
|
1516 |
||
1517 |
return eventHandled; |
|
1518 |
} |
|
1519 |
||
1520 |
// --------------------------------------------------------------------------- |
|
1521 |
// CFsTreeVisualizerBase::SetFlipState |
|
1522 |
// --------------------------------------------------------------------------- |
|
1523 |
// |
|
1524 |
void CFsTreeVisualizerBase::SetFlipState( TBool aOpen ) |
|
1525 |
{ |
|
1526 |
iFlipOpen = aOpen; |
|
1527 |
} |
|
1528 |
||
1529 |
// --------------------------------------------------------------------------- |
|
1530 |
// CFsTreeVisualizerBase::SetFocusVisibility |
|
1531 |
// --------------------------------------------------------------------------- |
|
1532 |
// |
|
1533 |
void CFsTreeVisualizerBase::SetFocusVisibility( TBool aShow ) |
|
1534 |
{ |
|
1535 |
if ( ( iFocusVisible && !aShow ) || ( !iFocusVisible && aShow ) ) |
|
1536 |
{ |
|
1537 |
iFocusVisible = aShow; |
|
1538 |
TRAP_IGNORE( |
|
1539 |
MakeSelectorVisibleL( aShow ); |
|
1540 |
UpdateItemL( iFocusedItem ); ); |
|
1541 |
} |
|
1542 |
} |
|
1543 |
||
1544 |
// --------------------------------------------------------------------------- |
|
1545 |
// CFsTreeVisualizerBase::HandlePointerEventL |
|
1546 |
// --------------------------------------------------------------------------- |
|
1547 |
// |
|
1548 |
TBool CFsTreeVisualizerBase::HandlePointerEventL(const TAlfEvent& aEvent) |
|
1549 |
{ |
|
1550 |
TBool eventHandled(EFalse); |
|
1551 |
if (iDragHandler && iOwnerControl->ControlGroup()->AcceptInput()) |
|
1552 |
{ |
|
1553 |
TPointerEvent::TType type = aEvent.PointerEvent().iType; |
|
1554 |
const TFsTreeItemId id(EventItemId(aEvent)); |
|
1555 |
INFO_1("visual: $%x", aEvent.Visual()); |
|
1556 |
if ( KFsTreeNoneID != id || type == TPointerEvent::EDrag || |
|
1557 |
type == TPointerEvent::EButtonRepeat || |
|
1558 |
type == TPointerEvent::EButton1Up || |
|
1559 |
type == TPointerEvent::EButton1Down) |
|
1560 |
{ |
|
1561 |
switch (type) |
|
1562 |
{ |
|
1563 |
case TPointerEvent::EButton1Down: |
|
1564 |
{ |
|
1565 |
eventHandled = ETrue; |
|
1566 |
iTouchPressed = ETrue; |
|
1567 |
const TPoint& pos(aEvent.PointerEvent().iParentPosition); |
|
1568 |
INFO_2("EButton1Down (%d, %d)", pos.iX, pos.iY); |
|
1569 |
//if (!iFlags.IsSet(EPhysicsOn)) |
|
1570 |
// Keep this last! |
|
1571 |
if (iFlags.IsSet(EPhysicsOn)) |
|
1572 |
{ |
|
1573 |
iPhysics->StopPhysics(); |
|
1574 |
//iPhysics->ResetFriction(); |
|
1575 |
UpdatePhysicsL(); |
|
1576 |
iFlags.Set(EIgnorePointerUpAction); |
|
1577 |
} |
|
1578 |
else |
|
1579 |
{ |
|
1580 |
iFlags.Clear(EIgnorePointerUpAction); |
|
1581 |
} |
|
1582 |
iDragHandler->PointerDown(aEvent.PointerEvent(), id); |
|
1583 |
break; |
|
1584 |
} |
|
1585 |
case TPointerEvent::EButton1Up: |
|
1586 |
{ |
|
1587 |
const TPoint& pos(aEvent.PointerEvent().iParentPosition); |
|
1588 |
if( iTouchPressed ) |
|
1589 |
{ |
|
1590 |
eventHandled = ETrue; |
|
1591 |
iTouchPressed = EFalse; |
|
1592 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1593 |
MFsTreeVisualizerObserver::EFsChangeFocusVisibility ); |
|
1594 |
INFO_2( "EButton1Up (%d, %d)", pos.iX, pos.iY ); |
|
1595 |
} |
|
1596 |
/*if( !iDragHandler->IsFlicking() ) |
|
1597 |
{ |
|
1598 |
iPhysics->StopPhysics(); |
|
1599 |
}*/ |
|
1600 |
iDragHandler->PointerUp( aEvent.PointerEvent(), id ); |
|
1601 |
iFlags.Clear(EIgnorePointerUpAction); |
|
1602 |
iFlags.Clear( EListPanning ); |
|
1603 |
break; |
|
1604 |
} |
|
1605 |
case TPointerEvent::EDrag: |
|
1606 |
{ |
|
1607 |
eventHandled = ETrue; |
|
1608 |
const TPoint& pos(aEvent.PointerEvent().iPosition); |
|
1609 |
INFO_2("EDrag (%d, %d)", pos.iX, pos.iY); |
|
1610 |
if (iDragHandler->IsFlicking() |
|
1611 |
|| iDragHandler->DragDelta(aEvent.PointerEvent()) |
|
1612 |
>= iPhysics->DragThreshold()) |
|
1613 |
{ |
|
1614 |
iFlags.Set(EIgnorePointerUpAction); |
|
1615 |
iDragHandler->PointerDrag(aEvent.PointerEvent(), id); |
|
1616 |
iDragHandler->EnableFlicking(); |
|
1617 |
} |
|
1618 |
break; |
|
1619 |
} |
|
1620 |
||
1621 |
case TPointerEvent::EButtonRepeat: |
|
1622 |
{ |
|
1623 |
eventHandled = ETrue; |
|
1624 |
const TPoint& pos(aEvent.PointerEvent().iParentPosition); |
|
1625 |
INFO_2("EButtonRepeat (%d, %d)", pos.iX, pos.iY); |
|
1626 |
iDragHandler->PointerRepeat(aEvent.PointerEvent()); |
|
1627 |
iFlags.Clear(EIgnorePointerUpAction); |
|
1628 |
break; |
|
1629 |
} |
|
1630 |
||
1631 |
default: |
|
1632 |
{ |
|
1633 |
//Unknown event, ignore. |
|
1634 |
break; |
|
1635 |
} |
|
1636 |
} |
|
1637 |
} |
|
1638 |
else |
|
1639 |
{ |
|
1640 |
iVisualizerObserver->TreeVisualizerEventL( |
|
1641 |
MFsTreeVisualizerObserver::EFsChangeFocusVisibility ); |
|
1642 |
} |
|
1643 |
} |
|
1644 |
return eventHandled; |
|
1645 |
} |
|
1646 |
// --------------------------------------------------------------------------- |
|
1647 |
// CFsTreeVisualizerBase::EventItemId |
|
1648 |
// --------------------------------------------------------------------------- |
|
1649 |
// |
|
1650 |
TFsTreeItemId CFsTreeVisualizerBase::EventItemId(const TAlfEvent& aEvent) const |
|
1651 |
{ |
|
1652 |
FUNC_LOG; |
|
1653 |
if (aEvent.Type() == TPointerEvent::EDrag) |
|
1654 |
{ |
|
1655 |
return VisualItemId(FindVisualUnderDrag( |
|
1656 |
aEvent.PointerEvent().iPosition)); |
|
1657 |
} |
|
1658 |
else |
|
1659 |
{ |
|
1660 |
return VisualItemId(aEvent.Visual()); |
|
1661 |
} |
|
1662 |
} |
|
1663 |
||
1664 |
// --------------------------------------------------------------------------- |
|
1665 |
// CFsTreeVisualizerBase::FindVisualUnderDrag |
|
1666 |
// --------------------------------------------------------------------------- |
|
1667 |
// |
|
1668 |
const CAlfVisual* CFsTreeVisualizerBase::FindVisualUnderDrag( |
|
1669 |
const TPoint& aPosition) const |
|
1670 |
{ |
|
1671 |
FUNC_LOG; |
|
1672 |
for (TInt i = 0; i < iListLayout->Count(); i++) |
|
1673 |
{ |
|
1674 |
const TRect displayRect(iListLayout->Visual(i).DisplayRectTarget()); |
|
1675 |
if (displayRect.Contains(aPosition)) |
|
1676 |
{ |
|
1677 |
return &iListLayout->Visual(i); |
|
1678 |
} |
|
1679 |
} |
|
1680 |
return NULL; |
|
1681 |
} |
|
1682 |
||
1683 |
// --------------------------------------------------------------------------- |
|
1684 |
// CFsTreeVisualizerBase::VisualItemId |
|
1685 |
// --------------------------------------------------------------------------- |
|
1686 |
// |
|
1687 |
TFsTreeItemId CFsTreeVisualizerBase::VisualItemId(const CAlfVisual* aVisual) const |
|
1688 |
{ |
|
1689 |
FUNC_LOG; |
|
1690 |
TFsTreeItemId itemId( KFsTreeNoneID ); |
|
1691 |
if (aVisual) |
|
1692 |
{ |
|
1693 |
aVisual->PropertyFindInteger(KPropertyItemId(), &itemId); |
|
1694 |
} |
|
1695 |
return itemId; |
|
1696 |
} |
|
1697 |
||
1698 |
// --------------------------------------------------------------------------- |
|
1699 |
// Sets the specified item as focused. |
|
1700 |
// --------------------------------------------------------------------------- |
|
1701 |
// |
|
1702 |
void CFsTreeVisualizerBase::SetFocusedItemL( const TFsTreeItemId aItemId, |
|
1703 |
TBool /*aCheckFocus*/ ) |
|
1704 |
{ |
|
1705 |
FUNC_LOG; |
|
1706 |
MFsTreeItemVisualizer* visualizer = NULL; |
|
1707 |
||
1708 |
if ( aItemId != iFocusedItem ) |
|
1709 |
{ |
|
1710 |
visualizer = iTreeData->ItemVisualizer( iFocusedItem ); |
|
1711 |
||
1712 |
if ( visualizer ) |
|
1713 |
{ |
|
1714 |
visualizer->UpdateL( iTreeData->ItemData( iFocusedItem ), EFalse, |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1715 |
iTreeData->Level( iFocusedItem ), iMarkIcon, iMenuIcon, 0 ); |
64 | 1716 |
} |
1717 |
||
1718 |
iFocusedItem = aItemId; |
|
1719 |
} |
|
1720 |
||
1721 |
visualizer = iTreeData->ItemVisualizer( iFocusedItem ); |
|
1722 |
||
1723 |
if ( visualizer ) |
|
1724 |
{ |
|
1725 |
visualizer->UpdateL( iTreeData->ItemData( iFocusedItem ), IsFocusShown(), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1726 |
iTreeData->Level( iFocusedItem ), iMarkIcon, iMenuIcon, 0 ); |
64 | 1727 |
} |
1728 |
||
1729 |
if ( iFocusedItem != KFsTreeNoneID ) |
|
1730 |
{ |
|
1731 |
UpdateSelectorVisualL(); |
|
1732 |
||
1733 |
if ( !iViewPort.ItemFullyVisible( iFocusedItem ) ) |
|
1734 |
{ |
|
1735 |
iViewPort.ScrollItemToViewL( iFocusedItem ); |
|
1736 |
} |
|
1737 |
} |
|
1738 |
} |
|
1739 |
||
1740 |
// --------------------------------------------------------------------------- |
|
1741 |
// Gets item vertical position in the list |
|
1742 |
// --------------------------------------------------------------------------- |
|
1743 |
// |
|
1744 |
TInt CFsTreeVisualizerBase::GetItemWorldPosition( const TInt aIdx ) |
|
1745 |
{ |
|
1746 |
TRect rect; |
|
1747 |
iWorld.GetItemRectByIndex( aIdx, rect); |
|
1748 |
return rect.iTl.iY; |
|
1749 |
} |
|
1750 |
||
1751 |
// --------------------------------------------------------------------------- |
|
1752 |
// Checks if the specified item is focused. |
|
1753 |
// --------------------------------------------------------------------------- |
|
1754 |
// |
|
1755 |
TFsTreeItemId CFsTreeVisualizerBase::FocusedItem() const |
|
1756 |
{ |
|
1757 |
FUNC_LOG; |
|
1758 |
return iFocusedItem; |
|
1759 |
} |
|
1760 |
||
1761 |
// --------------------------------------------------------------------------- |
|
1762 |
// Checks if the specified item is focused. |
|
1763 |
// --------------------------------------------------------------------------- |
|
1764 |
// |
|
1765 |
TBool CFsTreeVisualizerBase::IsFocused(const TFsTreeItemId aItemId) const |
|
1766 |
{ |
|
1767 |
FUNC_LOG; |
|
1768 |
return iFocusedItem == aItemId ? ETrue : EFalse; |
|
1769 |
} |
|
1770 |
||
1771 |
// --------------------------------------------------------------------------- |
|
1772 |
// Sets an item as first visible one in the list. |
|
1773 |
// --------------------------------------------------------------------------- |
|
1774 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1775 |
// <cmail> |
64 | 1776 |
void CFsTreeVisualizerBase::SetFirstVisibleItemL(const TFsTreeItemId /*aItemId*/) |
1777 |
{ |
|
1778 |
FUNC_LOG; |
|
1779 |
} |
|
1780 |
||
1781 |
// --------------------------------------------------------------------------- |
|
1782 |
// Get an id of the first visible item. |
|
1783 |
// --------------------------------------------------------------------------- |
|
1784 |
// |
|
1785 |
TFsTreeItemId CFsTreeVisualizerBase::FirstVisibleItem() |
|
1786 |
{ |
|
1787 |
FUNC_LOG; |
|
1788 |
TFsTreeItemId retId = KFsTreeNoneID; |
|
1789 |
if (iVisibleItems.Count()) |
|
1790 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1791 |
// <cmail> |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1792 |
// TRAP_IGNORE( ClearVisibleItemsListL(EFalse) ); |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1793 |
// </cmail> |
64 | 1794 |
retId = iVisibleItems[0]; |
1795 |
} |
|
1796 |
else |
|
1797 |
{ |
|
1798 |
retId = KFsTreeNoneID; |
|
1799 |
} |
|
1800 |
return retId; |
|
1801 |
} |
|
1802 |
||
1803 |
// --------------------------------------------------------------------------- |
|
1804 |
// Gets a pointer to the root's item data object. |
|
1805 |
// --------------------------------------------------------------------------- |
|
1806 |
// |
|
1807 |
MFsTreeItemData* CFsTreeVisualizerBase::RootItemData() |
|
1808 |
{ |
|
1809 |
FUNC_LOG; |
|
1810 |
return iRootData; |
|
1811 |
} |
|
1812 |
||
1813 |
// --------------------------------------------------------------------------- |
|
1814 |
// Gets a pointer to the root's item visualizer object. |
|
1815 |
// --------------------------------------------------------------------------- |
|
1816 |
// |
|
1817 |
MFsTreeNodeVisualizer* CFsTreeVisualizerBase::RootNodeVisualizer() |
|
1818 |
{ |
|
1819 |
FUNC_LOG; |
|
1820 |
return iRootVisualizer; |
|
1821 |
} |
|
1822 |
||
1823 |
// --------------------------------------------------------------------------- |
|
1824 |
// Displays the list. |
|
1825 |
// --------------------------------------------------------------------------- |
|
1826 |
// |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1827 |
// <cmail> |
64 | 1828 |
void CFsTreeVisualizerBase::ShowListL(const TBool aFadeIn, |
1829 |
const TBool aSlideIn) |
|
1830 |
{ |
|
1831 |
FUNC_LOG; |
|
1832 |
iVisualizationState = EFsTreeVisible; |
|
1833 |
if (iTreeData->Count() == 0) |
|
1834 |
{ |
|
1835 |
iRootVisualizer->ShowL(*iRootLayout); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1836 |
iRootVisualizer->UpdateL(*iRootData, EFalse, 0, iMarkIcon, iMenuIcon); |
64 | 1837 |
} |
1838 |
else |
|
1839 |
{ |
|
1840 |
const TBool showFocus = IsFocusShown(); |
|
1841 |
for (TUint i = 0; i < iVisibleItems.Count(); ++i) |
|
1842 |
{ |
|
1843 |
TFsTreeItemId itemId(iVisibleItems[i]); |
|
1844 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer( |
|
1845 |
itemId); |
|
1846 |
||
1847 |
TBool itemFocused( showFocus && IsItemFocused(itemId) ); |
|
1848 |
if ( visualizer ) |
|
1849 |
{ |
|
1850 |
visualizer->UpdateL(iTreeData->ItemData(itemId), itemFocused, |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1851 |
iTreeData->Level(itemId), iMarkIcon, iMenuIcon, |
64 | 1852 |
0); |
1853 |
} |
|
1854 |
} |
|
1855 |
} |
|
1856 |
UpdateViewPortL(); |
|
1857 |
||
1858 |
TInt fadeInTime(KZero), slideInTime(KZero); |
|
1859 |
CFsSlideEffect::TSlideEffectDirection slideInDir( |
|
1860 |
CFsSlideEffect::ESlideNone); |
|
1861 |
||
1862 |
||
1863 |
if (aFadeIn) |
|
1864 |
{ |
|
1865 |
fadeInTime = iFadeInEffectTime; |
|
1866 |
if (aSlideIn) |
|
1867 |
{ |
|
1868 |
iVisualizationState = EFsTreeFadingInSlidingIn; |
|
1869 |
} |
|
1870 |
else |
|
1871 |
{ |
|
1872 |
iVisualizationState = EFsTreeFadingIn; |
|
1873 |
} |
|
1874 |
} |
|
1875 |
else |
|
1876 |
{ |
|
1877 |
fadeInTime = KZero; |
|
1878 |
} |
|
1879 |
||
1880 |
if (aSlideIn) |
|
1881 |
{ |
|
1882 |
slideInTime = iSlideInDuration; |
|
1883 |
switch (iSlideInDirection) |
|
1884 |
{ |
|
1885 |
case MFsTreeVisualizer::ESlideFromTop: |
|
1886 |
{ |
|
1887 |
slideInDir = CFsSlideEffect::ESlideFromTop; |
|
1888 |
break; |
|
1889 |
} |
|
1890 |
case MFsTreeVisualizer::ESlideFromBottom: |
|
1891 |
{ |
|
1892 |
slideInDir = CFsSlideEffect::ESlideFromBottom; |
|
1893 |
break; |
|
1894 |
} |
|
1895 |
case MFsTreeVisualizer::ESlideFromLeft: |
|
1896 |
{ |
|
1897 |
slideInDir = CFsSlideEffect::ESlideFromLeft; |
|
1898 |
break; |
|
1899 |
} |
|
1900 |
case MFsTreeVisualizer::ESlideFromRight: |
|
1901 |
{ |
|
1902 |
slideInDir = CFsSlideEffect::ESlideFromRight; |
|
1903 |
break; |
|
1904 |
} |
|
1905 |
case MFsTreeVisualizer::ESlideNone: |
|
1906 |
default: |
|
1907 |
{ |
|
1908 |
slideInDir = CFsSlideEffect::ESlideNone; |
|
1909 |
break; |
|
1910 |
} |
|
1911 |
} |
|
1912 |
iVisualizationState = EFsTreeFadingInSlidingIn; |
|
1913 |
} |
|
1914 |
else |
|
1915 |
{ |
|
1916 |
slideInTime = KZero; |
|
1917 |
slideInDir = CFsSlideEffect::ESlideNone; |
|
1918 |
} |
|
1919 |
||
1920 |
iFadeEffect->SetTime(fadeInTime); |
|
1921 |
iSlideEffect->SetTime(slideInTime); |
|
1922 |
||
1923 |
iFadeEffect->FadeIn(); |
|
1924 |
iSlideEffect->SlideIn(slideInDir); |
|
1925 |
||
1926 |
UpdateScrollBarL(); |
|
1927 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
1928 |
// </cmail> |
64 | 1929 |
|
1930 |
// --------------------------------------------------------------------------- |
|
1931 |
// The function assures that the list view is correct. |
|
1932 |
// --------------------------------------------------------------------------- |
|
1933 |
// |
|
1934 |
void CFsTreeVisualizerBase::ValidateListLayoutL(TInt /*aTime*/) |
|
1935 |
{ |
|
1936 |
FUNC_LOG; |
|
1937 |
} |
|
1938 |
||
1939 |
// --------------------------------------------------------------------------- |
|
1940 |
// Hides the list. |
|
1941 |
// --------------------------------------------------------------------------- |
|
1942 |
// |
|
1943 |
void CFsTreeVisualizerBase::HideList(const TBool aFadeOut, |
|
1944 |
const TBool aSlideOut) |
|
1945 |
{ |
|
1946 |
FUNC_LOG; |
|
1947 |
iScrollBar->Show( EFalse ); |
|
1948 |
if (iDragHandler) |
|
1949 |
{ |
|
1950 |
iDragHandler->Reset(); |
|
1951 |
} |
|
1952 |
||
1953 |
if (aFadeOut) |
|
1954 |
{ |
|
1955 |
iFadeEffect->SetTime(iFadeOutEffectTime); |
|
1956 |
iVisualizationState = EFsTreeFadingOut; |
|
1957 |
iFadeEffect->FadeOut(); |
|
1958 |
} |
|
1959 |
||
1960 |
if (aSlideOut) |
|
1961 |
{ |
|
1962 |
iSlideEffect->SetTime(iSlideOutDuration); |
|
1963 |
if (iVisualizationState == EFsTreeFadingOut) |
|
1964 |
{ |
|
1965 |
iVisualizationState = EFsTreeFadingOutSlidingOut; |
|
1966 |
} |
|
1967 |
else |
|
1968 |
{ |
|
1969 |
iVisualizationState = EFsTreeSlidingOut; |
|
1970 |
} |
|
1971 |
switch (iSlideOutDirection) |
|
1972 |
{ |
|
1973 |
case MFsTreeVisualizer::ESlideFromTop: |
|
1974 |
{ |
|
1975 |
iSlideEffect->SlideOut(CFsSlideEffect::ESlideFromTop); |
|
1976 |
break; |
|
1977 |
} |
|
1978 |
case MFsTreeVisualizer::ESlideFromBottom: |
|
1979 |
{ |
|
1980 |
iSlideEffect->SlideOut(CFsSlideEffect::ESlideFromBottom); |
|
1981 |
break; |
|
1982 |
} |
|
1983 |
case MFsTreeVisualizer::ESlideFromLeft: |
|
1984 |
{ |
|
1985 |
iSlideEffect->SlideOut(CFsSlideEffect::ESlideFromLeft); |
|
1986 |
break; |
|
1987 |
} |
|
1988 |
case MFsTreeVisualizer::ESlideFromRight: |
|
1989 |
{ |
|
1990 |
iSlideEffect->SlideOut(CFsSlideEffect::ESlideFromRight); |
|
1991 |
break; |
|
1992 |
} |
|
1993 |
case MFsTreeVisualizer::ESlideNone: |
|
1994 |
default: |
|
1995 |
{ |
|
1996 |
iSlideEffect->SlideOut(CFsSlideEffect::ESlideNone); |
|
1997 |
break; |
|
1998 |
} |
|
1999 |
} |
|
2000 |
} |
|
2001 |
||
2002 |
if (!aFadeOut && !aSlideOut) |
|
2003 |
{ |
|
2004 |
iVisualizationState = EFsTreeFadingOut; |
|
2005 |
iFadeEffect->SetTime(KZero); |
|
2006 |
iFadeEffect->FadeOut(); |
|
2007 |
} |
|
2008 |
} |
|
2009 |
||
2010 |
// --------------------------------------------------------------------------- |
|
2011 |
// The function sets duration of the slide-in effect. |
|
2012 |
// --------------------------------------------------------------------------- |
|
2013 |
// |
|
2014 |
void CFsTreeVisualizerBase::SetSlideInDuration(TInt aTimeMiliseconds) |
|
2015 |
{ |
|
2016 |
FUNC_LOG; |
|
2017 |
iSlideInDuration = aTimeMiliseconds; |
|
2018 |
if (iSlideInDuration < KZero) |
|
2019 |
{ |
|
2020 |
iSlideInDuration = KZero; |
|
2021 |
} |
|
2022 |
} |
|
2023 |
||
2024 |
// --------------------------------------------------------------------------- |
|
2025 |
// The function returns slide in effect's duration. |
|
2026 |
// --------------------------------------------------------------------------- |
|
2027 |
// |
|
2028 |
TInt CFsTreeVisualizerBase::SlideInDuration() const |
|
2029 |
{ |
|
2030 |
FUNC_LOG; |
|
2031 |
return iSlideInDuration; |
|
2032 |
} |
|
2033 |
||
2034 |
// --------------------------------------------------------------------------- |
|
2035 |
// The function sets direction of the slide in effect. |
|
2036 |
// --------------------------------------------------------------------------- |
|
2037 |
// |
|
2038 |
void CFsTreeVisualizerBase::SetSlideInDirection(TFsSlideEffect aDirection) |
|
2039 |
{ |
|
2040 |
FUNC_LOG; |
|
2041 |
iSlideInDirection = aDirection; |
|
2042 |
} |
|
2043 |
||
2044 |
// --------------------------------------------------------------------------- |
|
2045 |
// The function returns direction of the slide in effect. |
|
2046 |
// --------------------------------------------------------------------------- |
|
2047 |
// |
|
2048 |
MFsTreeVisualizer::TFsSlideEffect CFsTreeVisualizerBase::SlideInDirection() const |
|
2049 |
{ |
|
2050 |
FUNC_LOG; |
|
2051 |
return iSlideInDirection; |
|
2052 |
} |
|
2053 |
||
2054 |
// --------------------------------------------------------------------------- |
|
2055 |
// The function sets duration of the slide-out effect. |
|
2056 |
// --------------------------------------------------------------------------- |
|
2057 |
// |
|
2058 |
void CFsTreeVisualizerBase::SetSlideOutDuration(TInt aTimeMiliseconds) |
|
2059 |
{ |
|
2060 |
FUNC_LOG; |
|
2061 |
iSlideOutDuration = aTimeMiliseconds; |
|
2062 |
if (iSlideOutDuration < 0) |
|
2063 |
{ |
|
2064 |
iSlideOutDuration = 0; |
|
2065 |
} |
|
2066 |
} |
|
2067 |
||
2068 |
// --------------------------------------------------------------------------- |
|
2069 |
// The function returns slide out effect's duration. |
|
2070 |
// --------------------------------------------------------------------------- |
|
2071 |
// |
|
2072 |
TInt CFsTreeVisualizerBase::SlideOutDuration() const |
|
2073 |
{ |
|
2074 |
FUNC_LOG; |
|
2075 |
return iSlideOutDuration; |
|
2076 |
} |
|
2077 |
||
2078 |
// --------------------------------------------------------------------------- |
|
2079 |
// The function sets direction of the slide out effect. |
|
2080 |
// --------------------------------------------------------------------------- |
|
2081 |
// |
|
2082 |
void CFsTreeVisualizerBase::SetSlideOutDirection(TFsSlideEffect aDirection) |
|
2083 |
{ |
|
2084 |
FUNC_LOG; |
|
2085 |
iSlideOutDirection = aDirection; |
|
2086 |
} |
|
2087 |
||
2088 |
// --------------------------------------------------------------------------- |
|
2089 |
// The function returns direction of the slide out effect. |
|
2090 |
// --------------------------------------------------------------------------- |
|
2091 |
// |
|
2092 |
MFsTreeVisualizer::TFsSlideEffect CFsTreeVisualizerBase::SlideOutDirection() const |
|
2093 |
{ |
|
2094 |
return iSlideOutDirection; |
|
2095 |
} |
|
2096 |
||
2097 |
// --------------------------------------------------------------------------- |
|
2098 |
// Returns information about looping type of the list. |
|
2099 |
// --------------------------------------------------------------------------- |
|
2100 |
// |
|
2101 |
TFsTreeListLoopingType CFsTreeVisualizerBase::LoopingType() const |
|
2102 |
{ |
|
2103 |
FUNC_LOG; |
|
2104 |
return iLooping; |
|
2105 |
} |
|
2106 |
||
2107 |
// --------------------------------------------------------------------------- |
|
2108 |
// Sets type of list's looping. |
|
2109 |
// --------------------------------------------------------------------------- |
|
2110 |
// |
|
2111 |
void CFsTreeVisualizerBase::SetLoopingType( |
|
2112 |
const TFsTreeListLoopingType aLoopingType) |
|
2113 |
{ |
|
2114 |
FUNC_LOG; |
|
2115 |
iLooping = aLoopingType; |
|
2116 |
} |
|
2117 |
||
2118 |
// --------------------------------------------------------------------------- |
|
2119 |
// Sets item expansion delay. |
|
2120 |
// --------------------------------------------------------------------------- |
|
2121 |
// |
|
2122 |
void CFsTreeVisualizerBase::SetItemExpansionDelay(const TInt aDelay) |
|
2123 |
{ |
|
2124 |
FUNC_LOG; |
|
2125 |
iScrollSpeed = aDelay; |
|
2126 |
if (iScrollSpeed < 0) |
|
2127 |
{ |
|
2128 |
iScrollSpeed = 0; |
|
2129 |
} |
|
2130 |
||
2131 |
iCurrentScrollSpeed = iScrollSpeed; |
|
2132 |
iScrollAccelerationRate = 0.5; |
|
2133 |
} |
|
2134 |
||
2135 |
// --------------------------------------------------------------------------- |
|
2136 |
// Sets an item separator color. |
|
2137 |
// --------------------------------------------------------------------------- |
|
2138 |
// |
|
2139 |
void CFsTreeVisualizerBase::SetItemSeparatorColor(const TRgb& aColor) |
|
2140 |
{ |
|
2141 |
FUNC_LOG; |
|
2142 |
static_cast<CAlfBorderBrush*> (iBorderBrush)->SetColor(aColor); |
|
2143 |
} |
|
2144 |
||
2145 |
// --------------------------------------------------------------------------- |
|
2146 |
// Sets an item separator size. |
|
2147 |
// --------------------------------------------------------------------------- |
|
2148 |
// |
|
2149 |
void CFsTreeVisualizerBase::SetItemSeparatorSize(const TSize aSize) |
|
2150 |
{ |
|
2151 |
FUNC_LOG; |
|
2152 |
static_cast<CAlfBorderBrush*> (iBorderBrush)->SetThickness( |
|
2153 |
TAlfTimedPoint(aSize.iWidth, aSize.iHeight)); |
|
2154 |
} |
|
2155 |
||
2156 |
// --------------------------------------------------------------------------- |
|
2157 |
// Sets an item separator size. |
|
2158 |
// --------------------------------------------------------------------------- |
|
2159 |
// |
|
2160 |
void CFsTreeVisualizerBase::SetItemSeparatorSize( |
|
2161 |
const TAlfTimedPoint& aThickness) |
|
2162 |
{ |
|
2163 |
FUNC_LOG; |
|
2164 |
static_cast<CAlfBorderBrush*> (iBorderBrush)->SetThickness(aThickness); |
|
2165 |
} |
|
2166 |
||
2167 |
// --------------------------------------------------------------------------- |
|
2168 |
// The functions sets fade-in's effect duration. |
|
2169 |
// --------------------------------------------------------------------------- |
|
2170 |
// |
|
2171 |
void CFsTreeVisualizerBase::SetFadeInEffectTime(TInt aFadeTime) |
|
2172 |
{ |
|
2173 |
FUNC_LOG; |
|
2174 |
if (aFadeTime < 0) |
|
2175 |
{ |
|
2176 |
iFadeInEffectTime = 0; |
|
2177 |
} |
|
2178 |
else |
|
2179 |
{ |
|
2180 |
iFadeInEffectTime = aFadeTime; |
|
2181 |
} |
|
2182 |
} |
|
2183 |
||
2184 |
// --------------------------------------------------------------------------- |
|
2185 |
// The functions returns fade-in's effect duration. |
|
2186 |
// --------------------------------------------------------------------------- |
|
2187 |
// |
|
2188 |
TInt CFsTreeVisualizerBase::FadeInEffectTime() |
|
2189 |
{ |
|
2190 |
FUNC_LOG; |
|
2191 |
return iFadeInEffectTime; |
|
2192 |
} |
|
2193 |
||
2194 |
// --------------------------------------------------------------------------- |
|
2195 |
// The functions sets fade-out's effect duration. |
|
2196 |
// --------------------------------------------------------------------------- |
|
2197 |
// |
|
2198 |
void CFsTreeVisualizerBase::SetFadeOutEffectTime(TInt aFadeTime) |
|
2199 |
{ |
|
2200 |
FUNC_LOG; |
|
2201 |
if (aFadeTime < 0) |
|
2202 |
{ |
|
2203 |
iFadeOutEffectTime = 0; |
|
2204 |
} |
|
2205 |
else |
|
2206 |
{ |
|
2207 |
iFadeOutEffectTime = aFadeTime; |
|
2208 |
} |
|
2209 |
} |
|
2210 |
||
2211 |
// --------------------------------------------------------------------------- |
|
2212 |
// The functions returns fade-out's effect duration. |
|
2213 |
// --------------------------------------------------------------------------- |
|
2214 |
// |
|
2215 |
TInt CFsTreeVisualizerBase::FadeOutEffectTime() |
|
2216 |
{ |
|
2217 |
FUNC_LOG; |
|
2218 |
return iFadeOutEffectTime; |
|
2219 |
} |
|
2220 |
||
2221 |
// --------------------------------------------------------------------------- |
|
2222 |
// Function sets the time of list scroll per item and the scroll |
|
2223 |
// acceleration rate. |
|
2224 |
// --------------------------------------------------------------------------- |
|
2225 |
// |
|
2226 |
void CFsTreeVisualizerBase::SetScrollTime(TInt aScrollTime, |
|
2227 |
TReal aScrollAcceleration) |
|
2228 |
{ |
|
2229 |
FUNC_LOG; |
|
2230 |
iScrollSpeed = aScrollTime; |
|
2231 |
if (iScrollSpeed < 0) |
|
2232 |
{ |
|
2233 |
iScrollSpeed = 0; |
|
2234 |
} |
|
2235 |
||
2236 |
iCurrentScrollSpeed = iScrollSpeed; |
|
2237 |
iScrollAccelerationRate = aScrollAcceleration; |
|
2238 |
if (iScrollAccelerationRate < 0.0) |
|
2239 |
{ |
|
2240 |
iScrollAccelerationRate = 0.0; |
|
2241 |
} |
|
2242 |
else if (iScrollAccelerationRate > 1.0) |
|
2243 |
{ |
|
2244 |
iScrollAccelerationRate = 1.0; |
|
2245 |
} |
|
2246 |
} |
|
2247 |
||
2248 |
// --------------------------------------------------------------------------- |
|
2249 |
// Gets the item expansion delay. |
|
2250 |
// --------------------------------------------------------------------------- |
|
2251 |
// |
|
2252 |
TInt CFsTreeVisualizerBase::ItemExpansionDelay() const |
|
2253 |
{ |
|
2254 |
FUNC_LOG; |
|
2255 |
return iScrollSpeed; |
|
2256 |
} |
|
2257 |
||
2258 |
// --------------------------------------------------------------------------- |
|
2259 |
// Function gets the values of scroll speed and its acceleration rate. |
|
2260 |
// --------------------------------------------------------------------------- |
|
2261 |
// |
|
2262 |
void CFsTreeVisualizerBase::GetScrollTime(TInt& aScrollTime, |
|
2263 |
TReal& aScrollAcceleration) |
|
2264 |
{ |
|
2265 |
FUNC_LOG; |
|
2266 |
aScrollTime = iScrollSpeed; |
|
2267 |
aScrollAcceleration = iScrollAccelerationRate; |
|
2268 |
} |
|
2269 |
||
2270 |
// --------------------------------------------------------------------------- |
|
2271 |
// Expand the node. |
|
2272 |
// --------------------------------------------------------------------------- |
|
2273 |
// |
|
2274 |
void CFsTreeVisualizerBase::ExpandNodeL(const TFsTreeItemId aNodeId) |
|
2275 |
{ |
|
2276 |
FUNC_LOG; |
|
2277 |
MFsTreeNodeVisualizer* nodeVisualizer = |
|
2278 |
iTreeData->NodeVisualizer(aNodeId); |
|
2279 |
TRect rc; |
|
2280 |
TInt index = iWorld.GetItemRect(aNodeId, rc); |
|
2281 |
if (!nodeVisualizer->IsExpanded() && index != KErrNotFound ) |
|
2282 |
{ |
|
2283 |
nodeVisualizer->SetExpanded(ETrue, &iTreeData->ItemData(aNodeId)); |
|
2284 |
||
2285 |
TFsTreeIterator treeIter = iTreeData->Iterator(aNodeId, aNodeId, |
|
2286 |
KFsTreeIteratorSkipHiddenFlag); |
|
2287 |
if (treeIter.HasNext()) |
|
2288 |
{ |
|
2289 |
TPoint position; |
|
2290 |
if (iFocusedItem != KFsTreeNoneID) |
|
2291 |
{ |
|
2292 |
position = iViewPort.ItemRect(iFocusedItem).iTl; |
|
2293 |
} |
|
2294 |
iWorld.BeginUpdate(); |
|
2295 |
TFsTreeItemId itemId; |
|
2296 |
TSize size; |
|
2297 |
do |
|
2298 |
{ |
|
2299 |
itemId = treeIter.Next(); |
|
2300 |
++index; |
|
2301 |
MFsTreeItemVisualizer* itemviz = |
|
2302 |
iTreeData->ItemVisualizer(itemId); |
|
2303 |
ApplyListSpecificValuesToItem(itemviz); |
|
2304 |
size = itemviz->Size(); |
|
2305 |
iWorld.InsertL(itemId, size, index); |
|
2306 |
} while (treeIter.HasNext()); |
|
2307 |
if (iFocusedItem != KFsTreeNoneID) |
|
2308 |
{ |
|
2309 |
iViewPort.ItemToPositionL(iFocusedItem, position, EFalse, |
|
2310 |
TViewPort::EPositionAfterExpand); |
|
2311 |
} |
|
2312 |
iWorld.EndUpdateL(); |
|
2313 |
||
2314 |
if ( iVisualizerObserver ) |
|
2315 |
{ |
|
2316 |
iVisualizerObserver->TreeVisualizerEventL( |
|
2317 |
MFsTreeVisualizerObserver::EFsTreeListItemExpanded, |
|
2318 |
aNodeId ); |
|
2319 |
} |
|
2320 |
} |
|
2321 |
} |
|
2322 |
} |
|
2323 |
||
2324 |
// --------------------------------------------------------------------------- |
|
2325 |
// Collapse the node. |
|
2326 |
// --------------------------------------------------------------------------- |
|
2327 |
// |
|
2328 |
void CFsTreeVisualizerBase::CollapseNodeL(const TFsTreeItemId aNodeId) |
|
2329 |
{ |
|
2330 |
FUNC_LOG; |
|
2331 |
MFsTreeNodeVisualizer* nodeVisualizer = |
|
2332 |
iTreeData->NodeVisualizer(aNodeId); |
|
2333 |
if (nodeVisualizer->IsExpanded()) |
|
2334 |
{ |
|
2335 |
TFsTreeIterator treeIter = iTreeData->Iterator(aNodeId, aNodeId, |
|
2336 |
KFsTreeIteratorSkipHiddenFlag); |
|
2337 |
nodeVisualizer->SetExpanded(EFalse, &iTreeData->ItemData(aNodeId)); |
|
2338 |
if (treeIter.HasNext()) |
|
2339 |
{ |
|
2340 |
iWorld.BeginUpdate(); |
|
2341 |
TFsTreeItemId itemId; |
|
2342 |
TSize size; |
|
2343 |
do |
|
2344 |
{ |
|
2345 |
itemId = treeIter.Next(); |
|
2346 |
if (itemId != KFsTreeNoneID) |
|
2347 |
{ |
|
2348 |
iWorld.RemoveL(itemId); |
|
2349 |
} |
|
2350 |
} while (treeIter.HasNext()); |
|
2351 |
iWorld.EndUpdateL(); |
|
2352 |
||
2353 |
if ( iVisualizerObserver ) |
|
2354 |
{ |
|
2355 |
iVisualizerObserver->TreeVisualizerEventL( |
|
2356 |
MFsTreeVisualizerObserver::EFsTreeListItemCollapsed, |
|
2357 |
aNodeId ); |
|
2358 |
} |
|
2359 |
} |
|
2360 |
} |
|
2361 |
} |
|
2362 |
||
2363 |
// --------------------------------------------------------------------------- |
|
2364 |
// Expand all nodes in the tree. |
|
2365 |
// --------------------------------------------------------------------------- |
|
2366 |
// |
|
2367 |
void CFsTreeVisualizerBase::ExpandAllL() |
|
2368 |
{ |
|
2369 |
FUNC_LOG; |
|
2370 |
iWorld.BeginUpdate(); |
|
2371 |
TPoint position; |
|
2372 |
||
2373 |
if( iFocusedItem != KFsTreeNoneID ) |
|
2374 |
{ |
|
2375 |
position = iViewPort.ItemRect(iFocusedItem).iTl; |
|
2376 |
} |
|
2377 |
iWorld.RemoveAllL(); |
|
2378 |
TFsTreeIterator treeIter = iTreeData->Iterator( |
|
2379 |
KFsTreeRootID, KFsTreeRootID ); |
|
2380 |
TFsTreeItemId itemId = KFsTreeNoneID; |
|
2381 |
TSize size; |
|
2382 |
while( treeIter.HasNext() ) |
|
2383 |
{ |
|
2384 |
itemId = treeIter.Next(); |
|
2385 |
if( itemId != KFsTreeNoneID ) |
|
2386 |
{ |
|
2387 |
if( iTreeData->IsNode( itemId ) ) |
|
2388 |
{ |
|
2389 |
MFsTreeNodeVisualizer* nodeviz = iTreeData->NodeVisualizer( |
|
2390 |
itemId); |
|
2391 |
nodeviz->SetExpanded( ETrue, &iTreeData->ItemData( itemId ) ); |
|
2392 |
size = nodeviz->Size(); |
|
2393 |
} |
|
2394 |
else |
|
2395 |
{ |
|
2396 |
MFsTreeItemVisualizer* itemviz = |
|
2397 |
iTreeData->ItemVisualizer( itemId ); |
|
2398 |
size = itemviz->Size(); |
|
2399 |
} |
|
2400 |
iWorld.AppendL( itemId, size ); |
|
2401 |
} |
|
2402 |
} |
|
2403 |
||
2404 |
if( iFocusedItem != KFsTreeNoneID ) |
|
2405 |
{ |
|
2406 |
iViewPort.ItemToPositionL(iFocusedItem, position, EFalse, |
|
2407 |
TViewPort::EPositionAfterExpand ); |
|
2408 |
} |
|
2409 |
iWorld.EndUpdateL(); |
|
2410 |
||
2411 |
if ( iVisualizerObserver ) |
|
2412 |
{ |
|
2413 |
iVisualizerObserver->TreeVisualizerEventL( |
|
2414 |
MFsTreeVisualizerObserver::EFsTreeListExpandedAll ); |
|
2415 |
} |
|
2416 |
} |
|
2417 |
||
2418 |
// --------------------------------------------------------------------------- |
|
2419 |
// Collapse all nodes in the tree. |
|
2420 |
// --------------------------------------------------------------------------- |
|
2421 |
// |
|
2422 |
void CFsTreeVisualizerBase::CollapseAllL() |
|
2423 |
{ |
|
2424 |
FUNC_LOG; |
|
2425 |
iWorld.BeginUpdate(); |
|
2426 |
TPoint position; |
|
2427 |
||
2428 |
if( iFocusedItem != KFsTreeNoneID ) |
|
2429 |
{ |
|
2430 |
position = iViewPort.ItemRect( iFocusedItem ).iTl; |
|
2431 |
} |
|
2432 |
iWorld.RemoveAllL(); |
|
2433 |
if( iTreeData->Count() > 0 ) |
|
2434 |
{ |
|
2435 |
const TUint childcount = iTreeData->CountChildren( KFsTreeRootID ); |
|
2436 |
for( TUint i( 0 ); i < childcount; ++i ) |
|
2437 |
{ |
|
2438 |
TFsTreeItemId itemId = iTreeData->Child( KFsTreeRootID, i ); |
|
2439 |
TSize itemSize; |
|
2440 |
if( iTreeData->IsNode( itemId ) ) |
|
2441 |
{ |
|
2442 |
MFsTreeNodeVisualizer* nodeVis = |
|
2443 |
iTreeData->NodeVisualizer( itemId ); |
|
2444 |
nodeVis->SetExpanded( EFalse, &iTreeData->ItemData( itemId ) ); |
|
2445 |
itemSize = nodeVis->Size(); |
|
2446 |
} |
|
2447 |
else |
|
2448 |
{ |
|
2449 |
itemSize = iTreeData->ItemVisualizer( itemId )->Size(); |
|
2450 |
} |
|
2451 |
iWorld.AppendL(itemId, itemSize); |
|
2452 |
} |
|
2453 |
} |
|
2454 |
||
2455 |
if( iFocusedItem != KFsTreeNoneID ) |
|
2456 |
{ |
|
2457 |
// If item, which was selected, wasn't node, then make its parent node |
|
2458 |
// focused, if it doesn't have parent node or its parent is not a node |
|
2459 |
// then leave focus as it was. |
|
2460 |
if( !iTreeData->IsNode( iFocusedItem ) ) |
|
2461 |
{ |
|
2462 |
TFsTreeItemId parentId = iTreeData->Parent( iFocusedItem ); |
|
2463 |
if( iTreeData->IsNode( parentId ) ) |
|
2464 |
{ |
|
2465 |
SetFocusedItemL( parentId ); |
|
2466 |
position = iViewPort.ItemRect( iFocusedItem ).iTl; |
|
2467 |
} |
|
2468 |
} |
|
2469 |
iViewPort.ItemToPositionL( iFocusedItem, position, EFalse ); |
|
2470 |
} |
|
2471 |
||
2472 |
iWorld.EndUpdateL(); |
|
2473 |
||
2474 |
if ( iVisualizerObserver ) |
|
2475 |
{ |
|
2476 |
iVisualizerObserver->TreeVisualizerEventL( |
|
2477 |
MFsTreeVisualizerObserver::EFsTreeListCollapsedAll ); |
|
2478 |
} |
|
2479 |
} |
|
2480 |
||
2481 |
// --------------------------------------------------------------------------- |
|
2482 |
// |
|
2483 |
// |
|
2484 |
// --------------------------------------------------------------------------- |
|
2485 |
// |
|
2486 |
TBool CFsTreeVisualizerBase::AllNodesCollapsed() const |
|
2487 |
{ |
|
2488 |
FUNC_LOG; |
|
2489 |
TFsTreeIterator treeIter = iTreeData->Iterator(KFsTreeRootID, |
|
2490 |
KFsTreeRootID, KFsTreeIteratorSkipCollapsedFlag |
|
2491 |
| KFsTreeIteratorSkipHiddenFlag); |
|
2492 |
TFsTreeItemId itemId = KFsTreeNoneID; |
|
2493 |
while (treeIter.HasNext()) |
|
2494 |
{ |
|
2495 |
itemId = treeIter.Next(); |
|
2496 |
if (!iTreeData->IsNode(itemId)) |
|
2497 |
{ |
|
2498 |
return EFalse; |
|
2499 |
} |
|
2500 |
} |
|
2501 |
return ETrue; |
|
2502 |
} |
|
2503 |
||
2504 |
// --------------------------------------------------------------------------- |
|
2505 |
// |
|
2506 |
// |
|
2507 |
// --------------------------------------------------------------------------- |
|
2508 |
// |
|
2509 |
TBool CFsTreeVisualizerBase::AllNodesExpanded() const |
|
2510 |
{ |
|
2511 |
FUNC_LOG; |
|
2512 |
return iWorld.ItemCount() == iTreeData->Count(); |
|
2513 |
} |
|
2514 |
||
2515 |
// --------------------------------------------------------------------------- |
|
2516 |
// Update visual of the item given by id. |
|
2517 |
// --------------------------------------------------------------------------- |
|
2518 |
// |
|
2519 |
void CFsTreeVisualizerBase::UpdateItemL(const TFsTreeItemId aItemId) |
|
2520 |
{ |
|
2521 |
FUNC_LOG; |
|
2522 |
TInt i = iVisibleItems.Find(aItemId); |
|
2523 |
if (i != KErrNotFound) |
|
2524 |
{ |
|
2525 |
MFsTreeItemVisualizer* vis = iTreeData->ItemVisualizer(aItemId); |
|
2526 |
if (vis) |
|
2527 |
{ |
|
2528 |
vis->UpdateL(iTreeData->ItemData(aItemId), |
|
2529 |
IsItemFocused(aItemId) && IsFocusShown(), |
|
2530 |
iTreeData->Level(aItemId), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2531 |
iMarkIcon, iMenuIcon, 0); |
64 | 2532 |
} |
2533 |
} |
|
2534 |
} |
|
2535 |
||
2536 |
// --------------------------------------------------------------------------- |
|
2537 |
// The functions sets wether all item in the list should be always in |
|
2538 |
// extended state or in normal state. |
|
2539 |
// --------------------------------------------------------------------------- |
|
2540 |
// |
|
2541 |
void CFsTreeVisualizerBase::SetItemsAlwaysExtendedL(TBool aAlwaysExtended) |
|
2542 |
{ |
|
2543 |
FUNC_LOG; |
|
2544 |
// Do not change this to: IsItemsAlwaysExtended() != aAlwaysExtended, because |
|
2545 |
// it will not work. TBool is defined as TInt and thus this comparison |
|
2546 |
// comes out as TInt != TInt, which always evaluates true in this case. |
|
2547 |
if ( ( IsItemsAlwaysExtended() && !aAlwaysExtended ) || |
|
2548 |
( !IsItemsAlwaysExtended() && aAlwaysExtended ) ) |
|
2549 |
{ |
|
2550 |
iFlags.Assign(EItemsAlwaysExtended, aAlwaysExtended); |
|
2551 |
TFsTreeIterator treeIter( |
|
2552 |
iTreeData->Iterator(KFsTreeRootID, KFsTreeRootID)); |
|
2553 |
while (treeIter.HasNext()) |
|
2554 |
{ |
|
2555 |
TFsTreeItemId itemId(treeIter.Next()); |
|
2556 |
if (itemId != KFsTreeNoneID && !iTreeData->IsNode(itemId)) |
|
2557 |
{ |
|
2558 |
MFsTreeItemVisualizer* itemviz(iTreeData->ItemVisualizer(itemId)); |
|
2559 |
ApplyListSpecificValuesToItem(itemviz); |
|
2560 |
} |
|
2561 |
} |
|
2562 |
const TBool isUpdating(iWorld.IsUpdating()); |
|
2563 |
if (!isUpdating) |
|
2564 |
{ |
|
2565 |
iWorld.BeginUpdate(); |
|
2566 |
} |
|
2567 |
iWorld.RemoveAllL(); |
|
2568 |
treeIter = iTreeData->Iterator(KFsTreeRootID, KFsTreeRootID, |
|
2569 |
KFsTreeIteratorSkipCollapsedFlag); |
|
2570 |
while (treeIter.HasNext()) |
|
2571 |
{ |
|
2572 |
TFsTreeItemId itemId(treeIter.Next()); |
|
2573 |
if (itemId != KFsTreeNoneID) |
|
2574 |
{ |
|
2575 |
MFsTreeItemVisualizer* itemviz(iTreeData->ItemVisualizer(itemId)); |
|
2576 |
iWorld.AppendL(itemId, itemviz->Size()); |
|
2577 |
} |
|
2578 |
} |
|
2579 |
// Below line commetned out. ViewPort is now not moved to the top of mail list |
|
2580 |
//iViewPort.SetPositionL(TPoint(), EFalse); |
|
2581 |
iViewPort.ClearCache(); |
|
2582 |
if (!isUpdating) |
|
2583 |
{ |
|
2584 |
iWorld.EndUpdateL(); |
|
2585 |
} |
|
2586 |
} |
|
2587 |
} |
|
2588 |
||
2589 |
// --------------------------------------------------------------------------- |
|
2590 |
// The function returns if items are always in extended state or in normal. |
|
2591 |
// --------------------------------------------------------------------------- |
|
2592 |
// |
|
2593 |
TBool CFsTreeVisualizerBase::IsItemsAlwaysExtended() |
|
2594 |
{ |
|
2595 |
FUNC_LOG; |
|
2596 |
return iFlags.IsSet(EItemsAlwaysExtended); |
|
2597 |
} |
|
2598 |
||
2599 |
// --------------------------------------------------------------------------- |
|
2600 |
// Set the background texture, clears the background color. |
|
2601 |
// --------------------------------------------------------------------------- |
|
2602 |
// |
|
2603 |
EXPORT_C void CFsTreeVisualizerBase::SetBackgroundTextureL(CAlfTexture& /*aBgTexture*/) |
|
2604 |
{ |
|
2605 |
FUNC_LOG; |
|
2606 |
} |
|
2607 |
||
2608 |
// --------------------------------------------------------------------------- |
|
2609 |
// Sets the background color, clears the background texture. |
|
2610 |
// --------------------------------------------------------------------------- |
|
2611 |
// |
|
2612 |
EXPORT_C void CFsTreeVisualizerBase::SetBackgroundColorL(TRgb aColor) |
|
2613 |
{ |
|
2614 |
FUNC_LOG; |
|
2615 |
if (iWatermarkLayout && iWatermarkLayout->Brushes()) |
|
2616 |
{ |
|
2617 |
TInt count = iWatermarkLayout->Brushes()->Count(); |
|
2618 |
if (count > 0) |
|
2619 |
{//there is only background brush attached to this layout |
|
2620 |
iWatermarkLayout->Brushes()->Remove(KZero); |
|
2621 |
iWatermarkLayout->Brushes()->Reset(); |
|
2622 |
iWatermarkLayout->SetFlag(EAlfVisualChanged); |
|
2623 |
} |
|
2624 |
||
2625 |
CAlfGradientBrush* backgroundBrush = CAlfGradientBrush::NewL( |
|
2626 |
iOwnerControl->Env()); |
|
2627 |
backgroundBrush->SetLayer(EAlfBrushLayerBackground); |
|
2628 |
backgroundBrush->SetColor(aColor); |
|
2629 |
||
2630 |
iWatermarkLayout->Brushes()->AppendL(backgroundBrush, EAlfHasOwnership); |
|
2631 |
} |
|
2632 |
} |
|
2633 |
||
2634 |
// --------------------------------------------------------------------------- |
|
2635 |
// Sets a given brush as a list background. |
|
2636 |
// --------------------------------------------------------------------------- |
|
2637 |
// |
|
2638 |
EXPORT_C void CFsTreeVisualizerBase::SetBackgroundBrushL(CAlfBrush* aBrush) |
|
2639 |
{ |
|
2640 |
FUNC_LOG; |
|
2641 |
||
2642 |
if (iWatermarkLayout && iWatermarkLayout->Brushes()) |
|
2643 |
{ |
|
2644 |
TInt count = iWatermarkLayout->Brushes()->Count(); |
|
2645 |
if (count > 0) |
|
2646 |
{//there is only background brush attached to this layout |
|
2647 |
iWatermarkLayout->Brushes()->Remove(KZero); |
|
2648 |
iWatermarkLayout->Brushes()->Reset(); |
|
2649 |
iWatermarkLayout->SetFlag(EAlfVisualChanged); |
|
2650 |
} |
|
2651 |
} |
|
2652 |
||
2653 |
aBrush->SetLayer(EAlfBrushLayerBackground); |
|
2654 |
iWatermarkLayout->Brushes()->AppendL(aBrush, EAlfHasOwnership); |
|
2655 |
} |
|
2656 |
||
2657 |
// --------------------------------------------------------------------------- |
|
2658 |
// The function clears list's background. |
|
2659 |
// --------------------------------------------------------------------------- |
|
2660 |
// |
|
2661 |
EXPORT_C void CFsTreeVisualizerBase::ClearBackground() |
|
2662 |
{ |
|
2663 |
FUNC_LOG; |
|
2664 |
if (iWatermarkLayout && iWatermarkLayout->Brushes()) |
|
2665 |
{ |
|
2666 |
TInt count = iWatermarkLayout->Brushes()->Count(); |
|
2667 |
if (count > 0) |
|
2668 |
{//there is only background brush attached to this layout |
|
2669 |
iWatermarkLayout->Brushes()->Remove(KZero); |
|
2670 |
iWatermarkLayout->Brushes()->Reset(); |
|
2671 |
iWatermarkLayout->SetFlag(EAlfVisualChanged); |
|
2672 |
} |
|
2673 |
} |
|
2674 |
} |
|
2675 |
||
2676 |
// --------------------------------------------------------------------------- |
|
2677 |
// Sets watermark position. |
|
2678 |
// --------------------------------------------------------------------------- |
|
2679 |
// |
|
2680 |
EXPORT_C void CFsTreeVisualizerBase::SetWatermarkPos(const TPoint& aPosition) |
|
2681 |
{ |
|
2682 |
FUNC_LOG; |
|
2683 |
if (iWatermark) |
|
2684 |
{ |
|
2685 |
TAlfTimedPoint position; |
|
2686 |
position.SetTarget(TAlfRealPoint(aPosition)); |
|
2687 |
iWatermark->SetPos(position); |
|
2688 |
} |
|
2689 |
} |
|
2690 |
||
2691 |
// --------------------------------------------------------------------------- |
|
2692 |
// Sets watermark's size. |
|
2693 |
// --------------------------------------------------------------------------- |
|
2694 |
// |
|
2695 |
EXPORT_C void CFsTreeVisualizerBase::SetWatermarkSize(const TSize& aSize) |
|
2696 |
{ |
|
2697 |
FUNC_LOG; |
|
2698 |
if (iWatermark) |
|
2699 |
{ |
|
2700 |
TAlfTimedPoint size; |
|
2701 |
size.SetTarget(TAlfRealPoint(aSize.AsPoint())); |
|
2702 |
iWatermark->SetSize(size); |
|
2703 |
} |
|
2704 |
} |
|
2705 |
||
2706 |
// --------------------------------------------------------------------------- |
|
2707 |
// Sets watermark opacity. |
|
2708 |
// --------------------------------------------------------------------------- |
|
2709 |
// |
|
2710 |
EXPORT_C void CFsTreeVisualizerBase::SetWatermarkOpacity(const float aOpacity) |
|
2711 |
{ |
|
2712 |
FUNC_LOG; |
|
2713 |
if (iWatermark) |
|
2714 |
{ |
|
2715 |
TAlfTimedValue opacity; |
|
2716 |
opacity.SetTarget(aOpacity, 0); |
|
2717 |
iWatermark->SetOpacity(opacity); |
|
2718 |
} |
|
2719 |
} |
|
2720 |
||
2721 |
// --------------------------------------------------------------------------- |
|
2722 |
// Sets watermark texture. |
|
2723 |
// --------------------------------------------------------------------------- |
|
2724 |
// |
|
2725 |
EXPORT_C void CFsTreeVisualizerBase::SetWatermarkL(CAlfTexture* aTexture) |
|
2726 |
{ |
|
2727 |
FUNC_LOG; |
|
2728 |
if (aTexture) |
|
2729 |
{ |
|
2730 |
if (!iWatermark) |
|
2731 |
{ |
|
2732 |
iWatermark |
|
2733 |
= CFsWatermark::NewL(*iOwnerControl, *iWatermarkLayout); |
|
2734 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2735 |
// <cmail> |
64 | 2736 |
iWatermark->SetWatermarkTextureL(*aTexture); |
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2737 |
// </cmail> |
64 | 2738 |
} |
2739 |
else |
|
2740 |
{ |
|
2741 |
delete iWatermark; |
|
2742 |
iWatermark = NULL; |
|
2743 |
} |
|
2744 |
} |
|
2745 |
||
2746 |
// --------------------------------------------------------------------------- |
|
2747 |
// |
|
2748 |
// --------------------------------------------------------------------------- |
|
2749 |
// |
|
2750 |
void CFsTreeVisualizerBase::TreeEventL( |
|
2751 |
const TFsTreeEvent aEvent, |
|
2752 |
const MFsTreeObserver::TFsTreeEventParams& aParams) |
|
2753 |
{ |
|
2754 |
FUNC_LOG; |
|
2755 |
switch (aEvent) |
|
2756 |
{ |
|
2757 |
case EFsTreeItemAdded: |
|
2758 |
case EFsTreeNodeAdded: |
|
2759 |
{ |
|
2760 |
MFsTreeItemVisualizer* itemVisualizer(iTreeData->ItemVisualizer( |
|
2761 |
aParams.iItemId)); |
|
2762 |
const TBool isHidden(itemVisualizer->IsHidden()); |
|
2763 |
if (!isHidden) |
|
2764 |
{ |
|
2765 |
if (!iListLayout->Count()) |
|
2766 |
{ |
|
2767 |
// Hide empty list marker |
|
2768 |
iRootVisualizer->Hide(); |
|
2769 |
iComponentLayout->UpdateChildrenLayout(); |
|
2770 |
iListLayout->UpdateChildrenLayout(); |
|
2771 |
} |
|
2772 |
if (aParams.iTargetNodeId != KFsTreeRootID) |
|
2773 |
{ |
|
2774 |
MFsTreeNodeVisualizer* nodeVisualizer = |
|
2775 |
iTreeData->NodeVisualizer(aParams.iTargetNodeId); |
|
2776 |
if (nodeVisualizer->IsExpanded()) |
|
2777 |
{ |
|
2778 |
// look for parent's index |
|
2779 |
TInt indexAdd = 0; |
|
2780 |
while (iWorld.Item(indexAdd) != aParams.iTargetNodeId) |
|
2781 |
{ |
|
2782 |
indexAdd++; |
|
2783 |
} |
|
2784 |
||
2785 |
// look for how many children parent already has in |
|
2786 |
// the tree model |
|
2787 |
TInt childCount( 0 ); |
|
2788 |
if ( aParams.iIndex >= 0 ) |
|
2789 |
{ |
|
2790 |
childCount = aParams.iIndex; |
|
2791 |
} |
|
2792 |
else |
|
2793 |
{ |
|
2794 |
// -1 is for excluding the item that is now being |
|
2795 |
// inserted to visualiser |
|
2796 |
// (it has already been inserted to the tree model) |
|
2797 |
childCount = iTreeData->CountChildrenRecursively( |
|
2798 |
aParams.iTargetNodeId ) - 1; |
|
2799 |
} |
|
2800 |
||
2801 |
InsertItemL( aParams.iItemId, indexAdd + 1 + childCount ); |
|
2802 |
} |
|
2803 |
} |
|
2804 |
else if (iWorld.ItemCount() > 0) |
|
2805 |
{ |
|
2806 |
if (aParams.iIndex >= 0) |
|
2807 |
{ |
|
2808 |
TInt indexAdd = 0; |
|
2809 |
TInt nodeCount = 0; |
|
2810 |
while (indexAdd < iWorld.ItemCount() - 1 && nodeCount |
|
2811 |
!= aParams.iIndex) |
|
2812 |
{ |
|
2813 |
indexAdd++; |
|
2814 |
if (iTreeData->Parent(iWorld.Item(indexAdd)) |
|
2815 |
== KFsTreeRootID) |
|
2816 |
{ |
|
2817 |
nodeCount++; |
|
2818 |
} |
|
2819 |
} |
|
2820 |
InsertItemL(aParams.iItemId, indexAdd); |
|
2821 |
} |
|
2822 |
else |
|
2823 |
{ |
|
2824 |
InsertItemL(aParams.iItemId, KErrNotFound); |
|
2825 |
} |
|
2826 |
} |
|
2827 |
else |
|
2828 |
{ |
|
2829 |
InsertItemL(aParams.iItemId, aParams.iIndex); |
|
2830 |
} |
|
2831 |
} |
|
2832 |
} |
|
2833 |
break; |
|
2834 |
case EFsTreeItemRemoved: |
|
2835 |
case EFsTreeNodeRemoved: |
|
2836 |
{ |
|
2837 |
RemoveItemL(aParams.iItemId); |
|
2838 |
} |
|
2839 |
break; |
|
2840 |
case EFsTreeRemovedAll: |
|
2841 |
{ |
|
2842 |
if ( iPhysics ) |
|
2843 |
{ |
|
2844 |
iPhysics->StopPhysics(); |
|
2845 |
} |
|
2846 |
if (!iWorld.IsUpdating()) |
|
2847 |
{ |
|
2848 |
iRootVisualizer->ShowL(*iRootLayout); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2849 |
iRootVisualizer->UpdateL(*iRootData, EFalse, 0, iMarkIcon, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2850 |
iMenuIcon); |
64 | 2851 |
} |
2852 |
iVisibleItems.Reset(); |
|
2853 |
iWorld.RemoveAllL(); |
|
2854 |
iFocusedItem = KFsTreeNoneID; |
|
2855 |
} |
|
2856 |
break; |
|
2857 |
case EFsTreeItemVisualizerChanged: |
|
2858 |
//the selector visual will be destroyed only when changing visualizer |
|
2859 |
if (aParams.iItemId == iFocusedItem) |
|
2860 |
{ |
|
2861 |
iSelectorVisual = NULL; |
|
2862 |
} |
|
2863 |
case EFsTreeItemDataChanged: |
|
2864 |
{ |
|
2865 |
const TFsTreeItemId itemId(aParams.iItemId); |
|
2866 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer( |
|
2867 |
itemId); |
|
2868 |
if (visualizer) |
|
2869 |
{ |
|
2870 |
visualizer->UpdateL(iTreeData->ItemData(itemId), |
|
2871 |
IsItemFocused(itemId), iTreeData->Level(itemId), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2872 |
iMarkIcon, iMenuIcon, 0); |
64 | 2873 |
} |
2874 |
} |
|
2875 |
break; |
|
2876 |
||
2877 |
default: |
|
2878 |
break; |
|
2879 |
} |
|
2880 |
} |
|
2881 |
||
2882 |
// --------------------------------------------------------------------------- |
|
2883 |
// The function implements tree observer's reaction to removing a list item |
|
2884 |
// from the model. If the item was visible then it's removed from the visible |
|
2885 |
// area. If the focused item was removed then the focus is moved to the next |
|
2886 |
// item in the tree hierarchy (if the next item is not present, then the focus |
|
2887 |
// is moved to the previous one). |
|
2888 |
// --------------------------------------------------------------------------- |
|
2889 |
// |
|
2890 |
void CFsTreeVisualizerBase::RemoveItemL(TFsTreeItemId aItemId) |
|
2891 |
{ |
|
2892 |
FUNC_LOG; |
|
2893 |
const TInt removedindex(iWorld.IndexOfItem(aItemId)); |
|
2894 |
iWorld.RemoveL(aItemId); |
|
2895 |
if (iFocusedItem == aItemId) |
|
2896 |
{ |
|
2897 |
if ( iWorld.ItemCount() > removedindex && removedindex != KErrNotFound ) |
|
2898 |
{ |
|
2899 |
SetFocusedItemL(iWorld.Item(removedindex), EFalse); |
|
2900 |
} |
|
2901 |
else if ( iWorld.ItemCount() > 0 && removedindex != KErrNotFound ) |
|
2902 |
{ |
|
2903 |
SetFocusedItemL(iWorld.Item(removedindex - 1), EFalse); |
|
2904 |
} |
|
2905 |
else |
|
2906 |
{ |
|
2907 |
iFocusedItem = KFsTreeNoneID; |
|
2908 |
} |
|
2909 |
} |
|
2910 |
} |
|
2911 |
||
2912 |
// --------------------------------------------------------------------------- |
|
2913 |
// The function checks whether the focused item is not outside the visible |
|
2914 |
// area and if needed scrolls the list so that selected item is fully visible. |
|
2915 |
// --------------------------------------------------------------------------- |
|
2916 |
// |
|
2917 |
void CFsTreeVisualizerBase::MakeFocusedItemFullyVisible() |
|
2918 |
{ |
|
2919 |
FUNC_LOG; |
|
2920 |
} |
|
2921 |
||
2922 |
// --------------------------------------------------------------------------- |
|
2923 |
// |
|
2924 |
// --------------------------------------------------------------------------- |
|
2925 |
// |
|
2926 |
void CFsTreeVisualizerBase::RefreshListViewL() |
|
2927 |
{ |
|
2928 |
FUNC_LOG; |
|
2929 |
if (iTreeData->Count() == 0) |
|
2930 |
{ |
|
2931 |
iRootVisualizer->ShowL(*iRootLayout); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
2932 |
iRootVisualizer->UpdateL(*iRootData, EFalse, 0, iMarkIcon, iMenuIcon); |
64 | 2933 |
} |
2934 |
else |
|
2935 |
{ |
|
2936 |
} |
|
2937 |
} |
|
2938 |
||
2939 |
// --------------------------------------------------------------------------- |
|
2940 |
// Hides item. |
|
2941 |
// --------------------------------------------------------------------------- |
|
2942 |
// |
|
2943 |
void CFsTreeVisualizerBase::HideItemL(const TFsTreeItemId /*aItemId*/) |
|
2944 |
||
2945 |
{ |
|
2946 |
FUNC_LOG; |
|
2947 |
} |
|
2948 |
||
2949 |
// --------------------------------------------------------------------------- |
|
2950 |
// Unhides item. |
|
2951 |
// --------------------------------------------------------------------------- |
|
2952 |
// |
|
2953 |
void CFsTreeVisualizerBase::UnhideItemL(const TFsTreeItemId /*aItemId*/) |
|
2954 |
{ |
|
2955 |
FUNC_LOG; |
|
2956 |
||
2957 |
} |
|
2958 |
||
2959 |
// --------------------------------------------------------------------------- |
|
2960 |
// |
|
2961 |
// --------------------------------------------------------------------------- |
|
2962 |
// |
|
2963 |
void CFsTreeVisualizerBase::SetPadding(const TAlfBoxMetric& aPadding) |
|
2964 |
{ |
|
2965 |
FUNC_LOG; |
|
2966 |
||
2967 |
iWatermarkLayout->SetPadding(aPadding); |
|
2968 |
||
2969 |
} |
|
2970 |
||
2971 |
// --------------------------------------------------------------------------- |
|
2972 |
// List pane's padding taken from Layout Manager or switched off. |
|
2973 |
// --------------------------------------------------------------------------- |
|
2974 |
// |
|
2975 |
void CFsTreeVisualizerBase::EnableListPanePadding(TBool aEnable) |
|
2976 |
{ |
|
2977 |
FUNC_LOG; |
|
2978 |
if (aEnable) |
|
2979 |
{ |
|
2980 |
TRect listPane; |
|
2981 |
CFsLayoutManager::LayoutMetricsRect(TRect( |
|
2982 |
iComponentLayout->Size().Target().AsSize()), |
|
2983 |
CFsLayoutManager::EFsLmMainSpFsListPane, listPane); |
|
2984 |
||
2985 |
if (CFsLayoutManager::IsMirrored()) |
|
2986 |
{ |
|
2987 |
iListLayout->SetPadding(TPoint( |
|
2988 |
iComponentLayout->Size().Target().AsSize().iWidth |
|
2989 |
- listPane.iBr.iX, 0)); |
|
2990 |
iListItemBackgroundLayout->SetPadding(TPoint( |
|
2991 |
iComponentLayout->Size().Target().AsSize().iWidth |
|
2992 |
- listPane.iBr.iX, 0)); |
|
2993 |
} |
|
2994 |
else |
|
2995 |
{ |
|
2996 |
TInt xPadd; |
|
2997 |
xPadd = listPane.iTl.iX; |
|
2998 |
iListLayout->SetPadding(TPoint(xPadd, 0)); |
|
2999 |
iListItemBackgroundLayout->SetPadding(TPoint(xPadd, 0)); |
|
3000 |
} |
|
3001 |
} |
|
3002 |
else |
|
3003 |
{ |
|
3004 |
//no padding |
|
3005 |
TInt padd(0); |
|
3006 |
iListLayout->SetPadding(TPoint(padd, padd)); |
|
3007 |
iListItemBackgroundLayout->SetPadding(TPoint(padd, padd)); |
|
3008 |
} |
|
3009 |
} |
|
3010 |
||
3011 |
// --------------------------------------------------------------------------- |
|
3012 |
// Sets the type of text marquee. |
|
3013 |
// --------------------------------------------------------------------------- |
|
3014 |
// |
|
3015 |
void CFsTreeVisualizerBase::SetTextMarqueeType( |
|
3016 |
const TFsTextMarqueeType aMarqueeType) |
|
3017 |
{ |
|
3018 |
FUNC_LOG; |
|
3019 |
iMarqueeType = aMarqueeType; |
|
3020 |
} |
|
3021 |
||
3022 |
// --------------------------------------------------------------------------- |
|
3023 |
// Gets the type of text marquee. |
|
3024 |
// --------------------------------------------------------------------------- |
|
3025 |
// |
|
3026 |
TFsTextMarqueeType CFsTreeVisualizerBase::TextMarqueeType() const |
|
3027 |
{ |
|
3028 |
FUNC_LOG; |
|
3029 |
return iMarqueeType; |
|
3030 |
} |
|
3031 |
||
3032 |
// --------------------------------------------------------------------------- |
|
3033 |
// Sets the speed of marquee. |
|
3034 |
// --------------------------------------------------------------------------- |
|
3035 |
// |
|
3036 |
void CFsTreeVisualizerBase::SetTextMarqueeSpeed(const TInt aPixelsPerSec) |
|
3037 |
{ |
|
3038 |
FUNC_LOG; |
|
3039 |
iMarqueeSpeed = aPixelsPerSec; |
|
3040 |
} |
|
3041 |
||
3042 |
// --------------------------------------------------------------------------- |
|
3043 |
// Gets the speed of marquee. |
|
3044 |
// --------------------------------------------------------------------------- |
|
3045 |
// |
|
3046 |
TInt CFsTreeVisualizerBase::TextMarqueeSpeed() const |
|
3047 |
{ |
|
3048 |
FUNC_LOG; |
|
3049 |
return iMarqueeSpeed; |
|
3050 |
} |
|
3051 |
||
3052 |
// --------------------------------------------------------------------------- |
|
3053 |
// Sets delay for text marquee start. |
|
3054 |
// --------------------------------------------------------------------------- |
|
3055 |
// |
|
3056 |
void CFsTreeVisualizerBase::SetTextMarqueeStartDelay(const TInt aStartDelay) |
|
3057 |
{ |
|
3058 |
FUNC_LOG; |
|
3059 |
iMarqueStartDelay = aStartDelay; |
|
3060 |
} |
|
3061 |
||
3062 |
// --------------------------------------------------------------------------- |
|
3063 |
// Gets delay for text marquee. |
|
3064 |
// --------------------------------------------------------------------------- |
|
3065 |
// |
|
3066 |
TInt CFsTreeVisualizerBase::TextMarqueeStartDelay() const |
|
3067 |
{ |
|
3068 |
FUNC_LOG; |
|
3069 |
return iMarqueStartDelay; |
|
3070 |
} |
|
3071 |
||
3072 |
// --------------------------------------------------------------------------- |
|
3073 |
// Sets a delay for each cycle start. |
|
3074 |
// --------------------------------------------------------------------------- |
|
3075 |
// |
|
3076 |
void CFsTreeVisualizerBase::SetTextMarqueeCycleStartDelay( |
|
3077 |
const TInt aCycleStartDelay) |
|
3078 |
{ |
|
3079 |
FUNC_LOG; |
|
3080 |
iMarqueCycleStartDelay = aCycleStartDelay; |
|
3081 |
} |
|
3082 |
||
3083 |
// --------------------------------------------------------------------------- |
|
3084 |
// Returns a delay for each cycle start. |
|
3085 |
// --------------------------------------------------------------------------- |
|
3086 |
// |
|
3087 |
TInt CFsTreeVisualizerBase::TextMarqueeCycleStartDelay() const |
|
3088 |
{ |
|
3089 |
FUNC_LOG; |
|
3090 |
return iMarqueCycleStartDelay; |
|
3091 |
} |
|
3092 |
||
3093 |
// --------------------------------------------------------------------------- |
|
3094 |
// Sets number of marquee cycles. |
|
3095 |
// --------------------------------------------------------------------------- |
|
3096 |
// |
|
3097 |
void CFsTreeVisualizerBase::SetTextMarqueeRepetitions( |
|
3098 |
const TInt aMarqueeRepetitions) |
|
3099 |
{ |
|
3100 |
FUNC_LOG; |
|
3101 |
iMarqueeRepetitions = aMarqueeRepetitions; |
|
3102 |
} |
|
3103 |
||
3104 |
// --------------------------------------------------------------------------- |
|
3105 |
// Gets number of marquee cycles. |
|
3106 |
// --------------------------------------------------------------------------- |
|
3107 |
// |
|
3108 |
TInt CFsTreeVisualizerBase::TextMarqueeRepetitions() const |
|
3109 |
{ |
|
3110 |
FUNC_LOG; |
|
3111 |
return iMarqueeRepetitions; |
|
3112 |
} |
|
3113 |
||
3114 |
// --------------------------------------------------------------------------- |
|
3115 |
// |
|
3116 |
// --------------------------------------------------------------------------- |
|
3117 |
// |
|
3118 |
TInt CFsTreeVisualizerBase::GetItemDisplayRectTarget( |
|
3119 |
const TFsTreeItemId aItemId, TAlfRealRect& aRect) |
|
3120 |
{ |
|
3121 |
FUNC_LOG; |
|
3122 |
TInt retVal(KErrNotFound); |
|
3123 |
MFsTreeItemVisualizer* itemVis(NULL); |
|
3124 |
CAlfLayout* lay(NULL); |
|
3125 |
||
3126 |
aRect.iTl = TAlfRealPoint(0.0, 0.0); |
|
3127 |
aRect.iBr = TAlfRealPoint(0.0, 0.0); |
|
3128 |
||
3129 |
retVal = iVisibleItems.Find(aItemId); |
|
3130 |
if (retVal != KErrNotFound) |
|
3131 |
{//item visible |
|
3132 |
itemVis = iTreeData->ItemVisualizer(aItemId); |
|
3133 |
if (itemVis) |
|
3134 |
{ |
|
3135 |
lay = &itemVis->Layout(); |
|
3136 |
if (lay) |
|
3137 |
{ |
|
3138 |
aRect = lay->DisplayRectTarget(); |
|
3139 |
retVal = KErrNone; |
|
3140 |
} |
|
3141 |
else |
|
3142 |
{ |
|
3143 |
retVal = KErrNotFound; |
|
3144 |
} |
|
3145 |
} |
|
3146 |
else |
|
3147 |
{ |
|
3148 |
retVal = KErrNotFound; |
|
3149 |
} |
|
3150 |
} |
|
3151 |
else |
|
3152 |
{ |
|
3153 |
retVal = KErrNotFound; |
|
3154 |
} |
|
3155 |
||
3156 |
return retVal; |
|
3157 |
} |
|
3158 |
||
3159 |
// --------------------------------------------------------------------------- |
|
3160 |
// Internall to TreeList. Do not use directly. |
|
3161 |
// Used to block update during addition of many items/nodes. Currently only |
|
3162 |
// scrollbar is blocked from beign updated.Gets number of marquee cycles. |
|
3163 |
// --------------------------------------------------------------------------- |
|
3164 |
// |
|
3165 |
void CFsTreeVisualizerBase::SetAutoRefreshAtInsert(TBool aAllowRefresh) |
|
3166 |
{ |
|
3167 |
FUNC_LOG; |
|
3168 |
if (!aAllowRefresh && iFlags.IsSet(EAutoRefresh)) |
|
3169 |
{ |
|
3170 |
iWorld.BeginUpdate(); |
|
3171 |
} |
|
3172 |
else if (aAllowRefresh && !iFlags.IsSet(EAutoRefresh)) |
|
3173 |
{ |
|
3174 |
TInt error( KErrNone ); |
|
3175 |
TRAP( error, iWorld.EndUpdateL() ); |
|
3176 |
ERROR_1( error, "iWorld.EndUpdateL failed with error: %d", error ); |
|
3177 |
} |
|
3178 |
iFlags.Assign(EAutoRefresh, aAllowRefresh); |
|
3179 |
} |
|
3180 |
||
3181 |
// --------------------------------------------------------------------------- |
|
3182 |
// Internall to TreeList. Do not use directly. |
|
3183 |
// Used to block update during addition of many items/nodes. Currently only |
|
3184 |
// scrollbar is blocked from beign updated.Gets number of marquee cycles. |
|
3185 |
// --------------------------------------------------------------------------- |
|
3186 |
// |
|
3187 |
TBool CFsTreeVisualizerBase::IsAutoRefreshAtInsert() |
|
3188 |
{ |
|
3189 |
FUNC_LOG; |
|
3190 |
return iFlags.IsSet(EAutoRefresh); |
|
3191 |
} |
|
3192 |
||
3193 |
// --------------------------------------------------------------------------- |
|
3194 |
// CFsTreeVisualizerBase::SetDirectTouchMode |
|
3195 |
// --------------------------------------------------------------------------- |
|
3196 |
// |
|
3197 |
void CFsTreeVisualizerBase::SetDirectTouchMode(const TBool aDirectTouchMode) |
|
3198 |
{ |
|
3199 |
FUNC_LOG; |
|
3200 |
iFlags.Assign(EDirectTouchMode, aDirectTouchMode); |
|
3201 |
} |
|
3202 |
||
3203 |
// --------------------------------------------------------------------------- |
|
3204 |
// CFsTreeVisualizerBase::SetExpandCollapseAllOnLongTap |
|
3205 |
// --------------------------------------------------------------------------- |
|
3206 |
// |
|
3207 |
void CFsTreeVisualizerBase::SetExpandCollapseAllOnLongTap( TBool aExpandCollapse ) |
|
3208 |
{ |
|
3209 |
FUNC_LOG; |
|
3210 |
iFlags.Assign( EExpandCollapseOnLongTap, aExpandCollapse ); |
|
3211 |
} |
|
3212 |
||
3213 |
// --------------------------------------------------------------------------- |
|
3214 |
// CFsTreeVisualizerBase::IsExpandCollapseAllOnLongTap |
|
3215 |
// --------------------------------------------------------------------------- |
|
3216 |
// |
|
3217 |
TBool CFsTreeVisualizerBase::IsExpandCollapseAllOnLongTap() |
|
3218 |
{ |
|
3219 |
FUNC_LOG; |
|
3220 |
return iFlags.IsSet( EExpandCollapseOnLongTap ); |
|
3221 |
} |
|
3222 |
||
3223 |
// --------------------------------------------------------------------------- |
|
3224 |
// From MFsFadeEffectObserver |
|
3225 |
// Function which will receive notifications about fade effect state changes. |
|
3226 |
// --------------------------------------------------------------------------- |
|
3227 |
// |
|
3228 |
void CFsTreeVisualizerBase::FadeEffectEvent( |
|
3229 |
MFsFadeEffectObserver::TFadeEffectState aState) |
|
3230 |
{ |
|
3231 |
FUNC_LOG; |
|
3232 |
switch (aState) |
|
3233 |
{ |
|
3234 |
case MFsFadeEffectObserver::EFadeInFinished: |
|
3235 |
{ |
|
3236 |
if (iVisualizationState == EFsTreeFadingInSlidingIn) |
|
3237 |
{//slide in effect still on |
|
3238 |
iVisualizationState = EFsTreeSlidingIn; |
|
3239 |
} |
|
3240 |
else if (iVisualizationState == EFsTreeFadingIn) |
|
3241 |
{ |
|
3242 |
iVisualizationState = EFsTreeVisible; |
|
3243 |
UpdateScrollBar(); |
|
3244 |
} |
|
3245 |
break; |
|
3246 |
} |
|
3247 |
case MFsFadeEffectObserver::EFadeOutFinished: |
|
3248 |
{ |
|
3249 |
if (iVisualizationState == EFsTreeFadingOutSlidingOut) |
|
3250 |
{//slide out effect still on |
|
3251 |
iVisualizationState = EFsTreeSlidingOut; |
|
3252 |
} |
|
3253 |
else if (iVisualizationState == EFsTreeFadingOut) |
|
3254 |
{ |
|
3255 |
iScrollBar->Show( EFalse ); |
|
3256 |
iVisualizationState = EFsTreeHidden; |
|
3257 |
} |
|
3258 |
break; |
|
3259 |
} |
|
3260 |
default: |
|
3261 |
{ |
|
3262 |
break; |
|
3263 |
} |
|
3264 |
} |
|
3265 |
||
3266 |
if (iVisualizationState == EFsTreeVisible && iVisualizerObserver) |
|
3267 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3268 |
// <cmail> Touch |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3269 |
TRAP_IGNORE(iVisualizerObserver->TreeVisualizerEventL( |
64 | 3270 |
MFsTreeVisualizerObserver::EFsTreeListVisualizerShown, |
3271 |
KFsTreeNoneID )); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3272 |
// </cmail> |
64 | 3273 |
} |
3274 |
||
3275 |
if (iVisualizationState == EFsTreeHidden && iVisualizerObserver) |
|
3276 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3277 |
// <cmail> Touch |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3278 |
TRAP_IGNORE(iVisualizerObserver->TreeVisualizerEventL( |
64 | 3279 |
MFsTreeVisualizerObserver::EFsTreeListVisualizerHidden, |
3280 |
KFsTreeNoneID )); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3281 |
// </cmail> |
64 | 3282 |
} |
3283 |
} |
|
3284 |
||
3285 |
// --------------------------------------------------------------------------- |
|
3286 |
// From MFsSlideEffectObserver |
|
3287 |
// Function which will receive notifications about slide effect state changes. |
|
3288 |
// --------------------------------------------------------------------------- |
|
3289 |
// |
|
3290 |
void CFsTreeVisualizerBase::SlideEffectEvent( |
|
3291 |
MFsSlideEffectObserver::TSlideEffectState aState) |
|
3292 |
{ |
|
3293 |
FUNC_LOG; |
|
3294 |
switch (aState) |
|
3295 |
{ |
|
3296 |
case MFsSlideEffectObserver::ESlideInFinished: |
|
3297 |
{ |
|
3298 |
if (iVisualizationState == EFsTreeFadingInSlidingIn) |
|
3299 |
{//fade in effect still on |
|
3300 |
iVisualizationState = EFsTreeFadingIn; |
|
3301 |
} |
|
3302 |
else if (iVisualizationState == EFsTreeSlidingIn) |
|
3303 |
{ |
|
3304 |
iVisualizationState = EFsTreeVisible; |
|
3305 |
UpdateScrollBar(); |
|
3306 |
} |
|
3307 |
break; |
|
3308 |
} |
|
3309 |
case MFsSlideEffectObserver::ESlideOutFinished: |
|
3310 |
{ |
|
3311 |
if (iVisualizationState == EFsTreeFadingOutSlidingOut) |
|
3312 |
{//fade out effect still on |
|
3313 |
iVisualizationState = EFsTreeFadingOut; |
|
3314 |
} |
|
3315 |
else if (iVisualizationState == EFsTreeSlidingOut) |
|
3316 |
{ |
|
3317 |
iScrollBar->Show( EFalse ); |
|
3318 |
iVisualizationState = EFsTreeHidden; |
|
3319 |
} |
|
3320 |
break; |
|
3321 |
} |
|
3322 |
default: |
|
3323 |
{ |
|
3324 |
break; |
|
3325 |
} |
|
3326 |
} |
|
3327 |
||
3328 |
if (iVisualizationState == EFsTreeVisible && iVisualizerObserver) |
|
3329 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3330 |
// <cmail> Touch |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3331 |
TRAP_IGNORE(iVisualizerObserver->TreeVisualizerEventL( |
64 | 3332 |
MFsTreeVisualizerObserver::EFsTreeListVisualizerShown, |
3333 |
KFsTreeNoneID )); |
|
3334 |
||
3335 |
} |
|
3336 |
||
3337 |
if (iVisualizationState == EFsTreeHidden && iVisualizerObserver) |
|
3338 |
{ |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3339 |
TRAP_IGNORE(iVisualizerObserver->TreeVisualizerEventL( |
64 | 3340 |
MFsTreeVisualizerObserver::EFsTreeListVisualizerHidden, |
3341 |
KFsTreeNoneID )); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3342 |
// </cmail> |
64 | 3343 |
} |
3344 |
} |
|
3345 |
||
3346 |
// --------------------------------------------------------------------------- |
|
3347 |
// From MAlfActionObserver |
|
3348 |
// Called by the server when an action command is executed. |
|
3349 |
// --------------------------------------------------------------------------- |
|
3350 |
// |
|
3351 |
void CFsTreeVisualizerBase::HandleActionL( |
|
3352 |
const TAlfActionCommand& aActionCommand) |
|
3353 |
{ |
|
3354 |
if (KAknsMessageSkinChange == aActionCommand.Id()) |
|
3355 |
{ |
|
3356 |
iScrollBar->NotifyThemeChanged(); |
|
3357 |
} |
|
3358 |
} |
|
3359 |
||
3360 |
// --------------------------------------------------------------------------- |
|
3361 |
// Hides visible list items. Clears the visible items table. |
|
3362 |
// --------------------------------------------------------------------------- |
|
3363 |
// |
|
3364 |
void CFsTreeVisualizerBase::ClearVisibleItemsListL(TBool /*aRemoveAll*/, |
|
3365 |
TBool /*aScrollList*/) |
|
3366 |
{ |
|
3367 |
FUNC_LOG; |
|
3368 |
} |
|
3369 |
||
3370 |
// --------------------------------------------------------------------------- |
|
3371 |
// Applies focus brush to the selected item. |
|
3372 |
// --------------------------------------------------------------------------- |
|
3373 |
// |
|
3374 |
void CFsTreeVisualizerBase::ChangeFocusL(const TFsTreeItemId /*aPrevious*/) |
|
3375 |
{ |
|
3376 |
FUNC_LOG; |
|
3377 |
||
3378 |
} |
|
3379 |
||
3380 |
// --------------------------------------------------------------------------- |
|
3381 |
// CFsTreeVisualizerBase::AdjustVisibleItemsL |
|
3382 |
// --------------------------------------------------------------------------- |
|
3383 |
// |
|
3384 |
void CFsTreeVisualizerBase::AdjustVisibleItemsL() |
|
3385 |
{ |
|
3386 |
FUNC_LOG; |
|
3387 |
||
3388 |
} |
|
3389 |
||
3390 |
// --------------------------------------------------------------------------- |
|
3391 |
// CFsTreeVisualizerBase::InsertItemL |
|
3392 |
// --------------------------------------------------------------------------- |
|
3393 |
// |
|
3394 |
void CFsTreeVisualizerBase::InsertItemL(TFsTreeItemId aItemId, |
|
3395 |
const TInt aSlot) |
|
3396 |
{ |
|
3397 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer(aItemId); |
|
3398 |
ApplyListSpecificValuesToItem(visualizer); |
|
3399 |
//TUint32 oldflags = visualizer->Flags(); |
|
3400 |
//visualizer->SetFlags(oldflags | KFsTreeListItemManagedLayout); |
|
3401 |
const TSize size(visualizer->Size()); |
|
3402 |
//visualizer->SetFlags(oldflags); |
|
3403 |
if (aSlot != KErrNotFound) |
|
3404 |
{ |
|
3405 |
iWorld.InsertL(aItemId, size, aSlot); |
|
3406 |
} |
|
3407 |
else |
|
3408 |
{ |
|
3409 |
iWorld.AppendL(aItemId, size); |
|
3410 |
} |
|
3411 |
} |
|
3412 |
||
3413 |
// --------------------------------------------------------------------------- |
|
3414 |
// Move selection in the list. |
|
3415 |
// --------------------------------------------------------------------------- |
|
3416 |
// |
|
3417 |
void CFsTreeVisualizerBase::MoveSelectionL( |
|
3418 |
const TFsTreeVisualizerMove aMoveType) |
|
3419 |
{ |
|
3420 |
FUNC_LOG; |
|
3421 |
TInt focusedIndex = iWorld.IndexOfItem(iFocusedItem); |
|
3422 |
switch (aMoveType) |
|
3423 |
{ |
|
3424 |
case EFsTreeVisualizerMoveLineUp: |
|
3425 |
{ |
|
3426 |
while (focusedIndex > 0) |
|
3427 |
{ |
|
3428 |
focusedIndex -= 1; |
|
3429 |
if (iTreeData->ItemData(iWorld.Item(focusedIndex)).Type() |
|
3430 |
!= KFsSeparatorDataType) |
|
3431 |
{ |
|
3432 |
SetFocusedItemL(iWorld.Item(focusedIndex)); |
|
3433 |
break; |
|
3434 |
} |
|
3435 |
} |
|
3436 |
break; |
|
3437 |
} |
|
3438 |
case EFsTreeVisualizerMoveLineDown: |
|
3439 |
{ |
|
3440 |
while (focusedIndex < iWorld.ItemCount() - 1) |
|
3441 |
{ |
|
3442 |
focusedIndex += 1; |
|
3443 |
if (iTreeData->ItemData(iWorld.Item(focusedIndex)).Type() |
|
3444 |
!= KFsSeparatorDataType) |
|
3445 |
{ |
|
3446 |
SetFocusedItemL(iWorld.Item(focusedIndex)); |
|
3447 |
break; |
|
3448 |
} |
|
3449 |
} |
|
3450 |
break; |
|
3451 |
} |
|
3452 |
case EFsTreeVisualizerMovePageUp: |
|
3453 |
{ |
|
3454 |
focusedIndex -= iVisibleItems.Count() - 2; |
|
3455 |
while (focusedIndex > 0) |
|
3456 |
{ |
|
3457 |
if (iTreeData->ItemData(iWorld.Item(focusedIndex)).Type() |
|
3458 |
!= KFsSeparatorDataType) |
|
3459 |
{ |
|
3460 |
break; |
|
3461 |
} |
|
3462 |
else |
|
3463 |
{ |
|
3464 |
focusedIndex--; |
|
3465 |
} |
|
3466 |
} |
|
3467 |
if (focusedIndex < 0) |
|
3468 |
{ |
|
3469 |
focusedIndex = 0; |
|
3470 |
} |
|
3471 |
if (iWorld.ItemCount() > 0) |
|
3472 |
{ |
|
3473 |
SetFocusedItemL(iWorld.Item(focusedIndex)); |
|
3474 |
} |
|
3475 |
break; |
|
3476 |
} |
|
3477 |
case EFsTreeVisualizerMovePageDown: |
|
3478 |
{ |
|
3479 |
focusedIndex += iVisibleItems.Count() - 2; |
|
3480 |
while (focusedIndex < iWorld.ItemCount() - 1) |
|
3481 |
{ |
|
3482 |
if (iTreeData->ItemData(iWorld.Item(focusedIndex)).Type() |
|
3483 |
!= KFsSeparatorDataType) |
|
3484 |
{ |
|
3485 |
break; |
|
3486 |
} |
|
3487 |
else |
|
3488 |
{ |
|
3489 |
focusedIndex++; |
|
3490 |
} |
|
3491 |
} |
|
3492 |
if (focusedIndex > iWorld.ItemCount() - 1) |
|
3493 |
{ |
|
3494 |
focusedIndex = iWorld.ItemCount() - 1; |
|
3495 |
} |
|
3496 |
if (iWorld.ItemCount() > 0) |
|
3497 |
{ |
|
3498 |
SetFocusedItemL(iWorld.Item(focusedIndex)); |
|
3499 |
} |
|
3500 |
break; |
|
3501 |
} |
|
3502 |
} |
|
3503 |
iViewPort.ScrollItemToViewL(iFocusedItem, ETrue); |
|
3504 |
} |
|
3505 |
||
3506 |
// --------------------------------------------------------------------------- |
|
3507 |
// Moves selection in the list by one item upwards. |
|
3508 |
// --------------------------------------------------------------------------- |
|
3509 |
// |
|
3510 |
TInt CFsTreeVisualizerBase::MoveSelectionByLineUpL(const TBool /*aChangeFocus*/) |
|
3511 |
{ |
|
3512 |
FUNC_LOG; |
|
3513 |
return 0; |
|
3514 |
} |
|
3515 |
||
3516 |
// --------------------------------------------------------------------------- |
|
3517 |
// Moves selection in the list by one item downwards. |
|
3518 |
// --------------------------------------------------------------------------- |
|
3519 |
// |
|
3520 |
TInt CFsTreeVisualizerBase::MoveSelectionByLineDownL(const TBool /*aChangeFocus*/) |
|
3521 |
{ |
|
3522 |
FUNC_LOG; |
|
3523 |
return 0; |
|
3524 |
} |
|
3525 |
||
3526 |
// --------------------------------------------------------------------------- |
|
3527 |
// Scrolling |
|
3528 |
// --------------------------------------------------------------------------- |
|
3529 |
// |
|
3530 |
void CFsTreeVisualizerBase::Scroll(const TFsTreeItemId aPrevious, |
|
3531 |
TBool aAlignTop) |
|
3532 |
{ |
|
3533 |
FUNC_LOG; |
|
3534 |
TInt currScrollOffset = iListLayout->ScrollOffset().iY.Target(); |
|
3535 |
TInt listItemsHeight = 0; |
|
3536 |
TInt visibleHeight = iComponentLayout->Size().iY.Target(); |
|
3537 |
TInt scrollOffset = 0; |
|
3538 |
||
3539 |
listItemsHeight = VisibleItemsHeight(aPrevious); |
|
3540 |
||
3541 |
if (aAlignTop) |
|
3542 |
{ |
|
3543 |
scrollOffset = 0; |
|
3544 |
} |
|
3545 |
else |
|
3546 |
{ |
|
3547 |
if (listItemsHeight > visibleHeight) |
|
3548 |
{ |
|
3549 |
scrollOffset = listItemsHeight - visibleHeight; |
|
3550 |
} |
|
3551 |
else |
|
3552 |
{ |
|
3553 |
scrollOffset = currScrollOffset; |
|
3554 |
} |
|
3555 |
} |
|
3556 |
||
3557 |
ScrollListLayouts(scrollOffset, iCurrentScrollSpeed); |
|
3558 |
} |
|
3559 |
||
3560 |
// --------------------------------------------------------------------------- |
|
3561 |
// Counts height items from iVisibleItems array which will |
|
3562 |
// be drawn on the screen |
|
3563 |
// --------------------------------------------------------------------------- |
|
3564 |
// |
|
3565 |
TInt CFsTreeVisualizerBase::VisibleItemsHeight(const TFsTreeItemId aPrevious) |
|
3566 |
{ |
|
3567 |
FUNC_LOG; |
|
3568 |
TInt listItemsHeight = 0; |
|
3569 |
MFsTreeItemVisualizer* visualizer = 0; |
|
3570 |
TFsTreeItemId itemId; |
|
3571 |
TInt itemCount = iVisibleItems.Count(); |
|
3572 |
||
3573 |
for (TInt index = 0; index < itemCount; ++index) |
|
3574 |
{ |
|
3575 |
itemId = iVisibleItems[index]; |
|
3576 |
visualizer = iTreeData->ItemVisualizer(itemId); |
|
3577 |
||
3578 |
||
3579 |
if (visualizer) |
|
3580 |
{ |
|
3581 |
if (itemId == iFocusedItem) |
|
3582 |
{ |
|
3583 |
if (visualizer->IsExtendable()) |
|
3584 |
{ |
|
3585 |
listItemsHeight += visualizer->ExtendedSize().iHeight; |
|
3586 |
} |
|
3587 |
else |
|
3588 |
{ |
|
3589 |
listItemsHeight += visualizer->Size().iHeight; |
|
3590 |
} |
|
3591 |
} |
|
3592 |
else if (itemId == aPrevious && iFocusedItem != aPrevious) |
|
3593 |
{ |
|
3594 |
listItemsHeight += visualizer->Size().iHeight; |
|
3595 |
} |
|
3596 |
else if (visualizer->IsExtended() && visualizer->IsExtendable()) |
|
3597 |
{ |
|
3598 |
listItemsHeight += visualizer->ExtendedSize().iHeight; |
|
3599 |
} |
|
3600 |
else |
|
3601 |
{ |
|
3602 |
listItemsHeight += visualizer->Size().iHeight; |
|
3603 |
} |
|
3604 |
} |
|
3605 |
} |
|
3606 |
||
3607 |
return listItemsHeight; |
|
3608 |
} |
|
3609 |
||
3610 |
// --------------------------------------------------------------------------- |
|
3611 |
// Check if item is in expanded node |
|
3612 |
// --------------------------------------------------------------------------- |
|
3613 |
TBool CFsTreeVisualizerBase::IsInExpanded(TFsTreeItemId aItemId) |
|
3614 |
{ |
|
3615 |
FUNC_LOG; |
|
3616 |
TBool result(ETrue); |
|
3617 |
TFsTreeItemId parentId = iTreeData->Parent(aItemId); |
|
3618 |
while (parentId != KFsTreeRootID && parentId != KFsTreeNoneID) |
|
3619 |
{ |
|
3620 |
if (iTreeData->IsNode(parentId)) |
|
3621 |
{ |
|
3622 |
if (iTreeData->NodeVisualizer(parentId)->IsExpanded()) |
|
3623 |
{ |
|
3624 |
result = ETrue; |
|
3625 |
parentId = iTreeData->Parent(parentId); |
|
3626 |
} |
|
3627 |
else |
|
3628 |
{ |
|
3629 |
result = EFalse; |
|
3630 |
break; |
|
3631 |
} |
|
3632 |
} |
|
3633 |
else |
|
3634 |
{ |
|
3635 |
parentId = iTreeData->Parent(parentId); |
|
3636 |
} |
|
3637 |
} |
|
3638 |
||
3639 |
return result; |
|
3640 |
} |
|
3641 |
||
3642 |
// --------------------------------------------------------------------------- |
|
3643 |
// CFsTreeVisualizerBase::UpdateViewPortL |
|
3644 |
// --------------------------------------------------------------------------- |
|
3645 |
// |
|
3646 |
void CFsTreeVisualizerBase::UpdateViewPortL() |
|
3647 |
{ |
|
3648 |
FUNC_LOG; |
|
3649 |
TRect mainPaneRect; |
|
3650 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
3651 |
TRect listRect(iRootLayout->DisplayRectTarget()); |
|
3652 |
listRect.Move(mainPaneRect.iTl); |
|
3653 |
TRect listPane; |
|
3654 |
CFsLayoutManager::LayoutMetricsRect(listRect, |
|
3655 |
CFsLayoutManager::EFsLmMainSpFsListPane, listPane); |
|
3656 |
iWorld.BeginUpdate(); |
|
3657 |
TBool keepFocusedItemInView(EFalse); |
|
3658 |
if (iFocusedItem != KFsTreeNoneID) |
|
3659 |
{ |
|
3660 |
keepFocusedItemInView = iViewPort.ItemRect(iFocusedItem).Height() > 0; |
|
3661 |
} |
|
3662 |
iViewPort.SetSizeL(listPane.Size()); |
|
3663 |
iWorld.Recalculate(*iTreeData); |
|
3664 |
if (keepFocusedItemInView) |
|
3665 |
{ |
|
3666 |
iViewPort.ScrollItemToViewL(iFocusedItem, EFalse); |
|
3667 |
} |
|
3668 |
else |
|
3669 |
{ |
|
3670 |
iViewPort.MakeViewFullyOccupiedL(); |
|
3671 |
} |
|
3672 |
iViewPort.ClearCache(); |
|
3673 |
iWorld.EndUpdateL(); |
|
3674 |
} |
|
3675 |
||
3676 |
// --------------------------------------------------------------------------- |
|
3677 |
// Updates scrollbar, only if update is needed. |
|
3678 |
// --------------------------------------------------------------------------- |
|
3679 |
// |
|
3680 |
void CFsTreeVisualizerBase::UpdateScrollBarIfNeededL() |
|
3681 |
{ |
|
3682 |
FUNC_LOG; |
|
3683 |
if (iScrollBar->ThumbPosition() != iViewPort.Position().iY) |
|
3684 |
{ |
|
3685 |
SetScrollBarModelValues(); |
|
3686 |
iScrollBar->UpdateModelL(iScrollBarModel); |
|
3687 |
iScrollBar->Redraw(); |
|
3688 |
} |
|
3689 |
} |
|
3690 |
||
3691 |
// --------------------------------------------------------------------------- |
|
3692 |
// Sets scrollbar model values. |
|
3693 |
// --------------------------------------------------------------------------- |
|
3694 |
// |
|
3695 |
void CFsTreeVisualizerBase::SetScrollBarModelValues() |
|
3696 |
{ |
|
3697 |
const TInt pageSize(iViewPort.Size().iHeight); |
|
3698 |
iScrollBarModel.SetHeight(Max(iWorld.Height(), pageSize)); |
|
3699 |
iScrollBarModel.SetWindowHeight(pageSize); |
|
3700 |
iScrollBarModel.SetWindowPosition(iViewPort.Position().iY); |
|
3701 |
} |
|
3702 |
||
3703 |
// --------------------------------------------------------------------------- |
|
3704 |
// Updates scrollbar. |
|
3705 |
// --------------------------------------------------------------------------- |
|
3706 |
// |
|
3707 |
void CFsTreeVisualizerBase::UpdateScrollBarL(const TInt /*aTimeout*/) |
|
3708 |
{ |
|
3709 |
FUNC_LOG; |
|
3710 |
||
3711 |
TRect mainPaneRect; |
|
3712 |
AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainPaneRect); |
|
3713 |
TRect listRect(iRootLayout->DisplayRectTarget()); |
|
3714 |
if (!(iScrollBar->LayoutHints() & MUiCScrollBar::ELayoutRelativeToList)) |
|
3715 |
{ |
|
3716 |
listRect.Move(mainPaneRect.iTl); |
|
3717 |
} |
|
3718 |
else |
|
3719 |
{ |
|
3720 |
const TPoint& tl( listRect.iTl ); |
|
3721 |
listRect.Move( -tl.iX, -tl.iY ); |
|
3722 |
} |
|
3723 |
TRect scrollPane, listPane; |
|
3724 |
CFsLayoutManager::LayoutMetricsRect(listRect, |
|
3725 |
CFsLayoutManager::EFsLmSpFsScrollPane, scrollPane); |
|
3726 |
CFsLayoutManager::LayoutMetricsRect(listRect, |
|
3727 |
CFsLayoutManager::EFsLmMainSpFsListPane, listPane); |
|
3728 |
SetScrollBarModelValues(); |
|
3729 |
iScrollBar->UpdateModelL(iScrollBarModel); |
|
3730 |
iScrollBar->Redraw(); |
|
3731 |
||
3732 |
RArray<TInt> columns; |
|
3733 |
CleanupClosePushL(columns); |
|
3734 |
TBool updateLayouts(EFalse); |
|
3735 |
if (iViewPort.IsScrollBarNeeded() && iVisualizationState |
|
3736 |
== EFsTreeVisible) |
|
3737 |
{ |
|
3738 |
iScrollBar->SetRect(scrollPane); |
|
3739 |
if (AknLayoutUtils::LayoutMirrored()) |
|
3740 |
{ |
|
3741 |
if (iScrollBar->LayoutHints() & MUiCScrollBar::ELayoutOnTopOfList) |
|
3742 |
{ |
|
3743 |
columns.AppendL(0); |
|
3744 |
columns.AppendL(listRect.Width()); |
|
3745 |
} |
|
3746 |
else |
|
3747 |
{ |
|
3748 |
columns.AppendL(scrollPane.Width()); |
|
3749 |
columns.AppendL(listPane.Width()); |
|
3750 |
} |
|
3751 |
} |
|
3752 |
else |
|
3753 |
{ |
|
3754 |
if (iScrollBar->LayoutHints() & MUiCScrollBar::ELayoutOnTopOfList) |
|
3755 |
{ |
|
3756 |
columns.AppendL(listRect.Width()); |
|
3757 |
columns.AppendL(0); |
|
3758 |
} |
|
3759 |
else |
|
3760 |
{ |
|
3761 |
columns.AppendL(listPane.Width()); |
|
3762 |
columns.AppendL(scrollPane.Width()); |
|
3763 |
} |
|
3764 |
} |
|
3765 |
iComponentLayout->SetColumnsL(columns); |
|
3766 |
iScrollBar->Show(ETrue); |
|
3767 |
updateLayouts = ETrue; |
|
3768 |
} |
|
3769 |
else if (!iViewPort.IsScrollBarNeeded()) |
|
3770 |
{ |
|
3771 |
if (AknLayoutUtils::LayoutMirrored()) |
|
3772 |
{ |
|
3773 |
columns.AppendL(0); |
|
3774 |
columns.AppendL(listRect.Width()); |
|
3775 |
} |
|
3776 |
else |
|
3777 |
{ |
|
3778 |
columns.AppendL(listRect.Width()); |
|
3779 |
columns.AppendL(0); |
|
3780 |
} |
|
3781 |
iComponentLayout->SetColumnsL(columns); |
|
3782 |
iScrollBar->Show(EFalse); |
|
3783 |
updateLayouts = ETrue; |
|
3784 |
} |
|
3785 |
CleanupStack::PopAndDestroy(); // columns.Close() |
|
3786 |
if (updateLayouts) |
|
3787 |
{ |
|
3788 |
iComponentLayout->UpdateChildrenLayout(); |
|
3789 |
||
3790 |
for (TUint i = 0; i < iVisibleItems.Count(); ++i) |
|
3791 |
{ |
|
3792 |
TFsTreeItemId itemId(iVisibleItems[i]); |
|
3793 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer(itemId); |
|
3794 |
if (visualizer) |
|
3795 |
{ |
|
3796 |
visualizer->UpdateL(iTreeData->ItemData(itemId), |
|
3797 |
IsItemFocused(itemId) && IsFocusShown(), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3798 |
iTreeData->Level(itemId), iMarkIcon, iMenuIcon, 0, EFalse); |
64 | 3799 |
} |
3800 |
} |
|
3801 |
UpdateSelectorVisualL(); |
|
3802 |
} |
|
3803 |
||
3804 |
} |
|
3805 |
||
3806 |
// --------------------------------------------------------------------------- |
|
3807 |
// |
|
3808 |
// --------------------------------------------------------------------------- |
|
3809 |
// |
|
3810 |
TInt CFsTreeVisualizerBase::UpdateScrollBar(const TInt aTimeout) |
|
3811 |
{ |
|
3812 |
FUNC_LOG; |
|
3813 |
TRAPD( error, UpdateScrollBarL( aTimeout ) ); |
|
3814 |
return error; |
|
3815 |
} |
|
3816 |
||
3817 |
// --------------------------------------------------------------------------- |
|
3818 |
// Old API to be removed. Turns on or off vertical scrollbar. |
|
3819 |
// --------------------------------------------------------------------------- |
|
3820 |
// |
|
3821 |
void CFsTreeVisualizerBase::SetVScrollBarL(TBool /*aSetOn*/) |
|
3822 |
{ |
|
3823 |
FUNC_LOG; |
|
3824 |
UpdateScrollBarL(iCurrentScrollSpeed); |
|
3825 |
} |
|
3826 |
||
3827 |
// --------------------------------------------------------------------------- |
|
3828 |
// Turns on or off vertical scrollbar. |
|
3829 |
// --------------------------------------------------------------------------- |
|
3830 |
// |
|
3831 |
void CFsTreeVisualizerBase::SetScrollBarVisibilityL( |
|
3832 |
const TFsScrollbarVisibility aVisibility) |
|
3833 |
{ |
|
3834 |
iScrollbarVisibility = aVisibility; |
|
3835 |
UpdateScrollBarL(iCurrentScrollSpeed); |
|
3836 |
} |
|
3837 |
||
3838 |
// --------------------------------------------------------------------------- |
|
3839 |
// Gets scrollbar visibility. |
|
3840 |
// --------------------------------------------------------------------------- |
|
3841 |
// |
|
3842 |
TFsScrollbarVisibility CFsTreeVisualizerBase::ScrollbarVisibility() const |
|
3843 |
{ |
|
3844 |
FUNC_LOG; |
|
3845 |
return iScrollbarVisibility; |
|
3846 |
} |
|
3847 |
||
3848 |
// --------------------------------------------------------------------------- |
|
3849 |
// Sets border status |
|
3850 |
// --------------------------------------------------------------------------- |
|
3851 |
// |
|
3852 |
void CFsTreeVisualizerBase::SetBorderL(const TBool aVisible, |
|
3853 |
CAlfTexture* aBorderTexture) |
|
3854 |
{ |
|
3855 |
FUNC_LOG; |
|
3856 |
if (!aBorderTexture) |
|
3857 |
{ |
|
3858 |
FsGenericPanic(EFsListPanicBorderNotSet); |
|
3859 |
} |
|
3860 |
||
3861 |
if (aVisible) |
|
3862 |
{ |
|
3863 |
CAlfImageBrush* border = CAlfImageBrush::NewL(iOwnerControl->Env(), |
|
3864 |
TAlfImage(*aBorderTexture)); |
|
3865 |
border->SetLayer(EAlfBrushLayerBackground); |
|
3866 |
||
3867 |
border->SetBorders(-8, -8, -8, -8); |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3868 |
//<cmail> |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3869 |
// layout values needed here (not: only used from FS action menu) |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
3870 |
//</cmail> |
64 | 3871 |
iBorderLayout->SetPadding(TPoint(5, 5)); |
3872 |
||
3873 |
if (iBorderLayout->Brushes()->Count() > 0) |
|
3874 |
{ |
|
3875 |
iBorderLayout->Brushes()->Remove(0); |
|
3876 |
iBorderLayout->Brushes()->Reset(); |
|
3877 |
} |
|
3878 |
||
3879 |
iBorderLayout->Brushes()->AppendL(border, EAlfHasOwnership); |
|
3880 |
} |
|
3881 |
else |
|
3882 |
{ |
|
3883 |
if (iBorderLayout->Brushes()->Count() > 0) |
|
3884 |
{ |
|
3885 |
iBorderLayout->Brushes()->Remove(0); |
|
3886 |
iBorderLayout->Brushes()->Reset(); |
|
3887 |
iBorderLayout->SetPadding(0); |
|
3888 |
} |
|
3889 |
} |
|
3890 |
||
3891 |
iBorderLayout->SetFlag(EAlfVisualChanged); |
|
3892 |
iBorderLayout->UpdateChildrenLayout(); |
|
3893 |
RefreshListViewL(); |
|
3894 |
} |
|
3895 |
||
3896 |
// --------------------------------------------------------------------------- |
|
3897 |
// Sets shadow status |
|
3898 |
// --------------------------------------------------------------------------- |
|
3899 |
// |
|
3900 |
void CFsTreeVisualizerBase::SetShadowL(const TBool aVisible) |
|
3901 |
{ |
|
3902 |
FUNC_LOG; |
|
3903 |
if (aVisible) |
|
3904 |
{ |
|
3905 |
//remove shadow if it's already set |
|
3906 |
if (iShadowLayout && iShadowLayout->Brushes()) |
|
3907 |
{ |
|
3908 |
TInt count = iShadowLayout->Brushes()->Count(); |
|
3909 |
if (count > 0) |
|
3910 |
{//there is only a shadow brush attached to this layout |
|
3911 |
iShadowLayout->Brushes()->Remove(KZero); |
|
3912 |
iShadowLayout->Brushes()->Reset(); |
|
3913 |
iShadowLayout->SetFlag(EAlfVisualChanged); |
|
3914 |
} |
|
3915 |
} |
|
3916 |
//attach shadow brush to layout |
|
3917 |
CAlfShadowBorderBrush* shadow = CAlfShadowBorderBrush::NewLC( |
|
3918 |
iOwnerControl->Env(), KDefaultShadowWidth); |
|
3919 |
shadow->SetOpacity(.25f); |
|
3920 |
||
3921 |
//set paddind to root layout so the shadow can be visible |
|
3922 |
TAlfBoxMetric m; |
|
3923 |
m.iBottom.iMagnitude = KDefaultShadowWidth; |
|
3924 |
m.iLeft.iMagnitude = KZero; |
|
3925 |
m.iRight.iMagnitude = KDefaultShadowWidth; |
|
3926 |
m.iTop.iMagnitude = KZero; |
|
3927 |
iRootLayout->SetPadding(m); |
|
3928 |
||
3929 |
iShadowLayout->EnableBrushesL(ETrue); |
|
3930 |
iShadowLayout->Brushes()->AppendL(shadow, EAlfHasOwnership); |
|
3931 |
CleanupStack::Pop(shadow); |
|
3932 |
||
3933 |
iShadowLayout->SetFlag(EAlfVisualChanged); |
|
3934 |
iRootLayout->UpdateChildrenLayout(KZero); |
|
3935 |
} |
|
3936 |
else |
|
3937 |
{ |
|
3938 |
//remove shadow if it's already set |
|
3939 |
if (iShadowLayout && iShadowLayout->Brushes()) |
|
3940 |
{ |
|
3941 |
TInt count = iShadowLayout->Brushes()->Count(); |
|
3942 |
if (count > 0) |
|
3943 |
{//there is only a shadow brush attached to this layout |
|
3944 |
iShadowLayout->Brushes()->Remove(KZero); |
|
3945 |
iShadowLayout->Brushes()->Reset(); |
|
3946 |
iShadowLayout->SetFlag(EAlfVisualChanged); |
|
3947 |
||
3948 |
//remove paddind from root layout |
|
3949 |
TAlfBoxMetric m; |
|
3950 |
m.iBottom.iMagnitude = KZero; |
|
3951 |
m.iLeft.iMagnitude = KZero; |
|
3952 |
m.iRight.iMagnitude = KZero; |
|
3953 |
m.iTop.iMagnitude = KZero; |
|
3954 |
iRootLayout->SetPadding(m); |
|
3955 |
iRootLayout->UpdateChildrenLayout(KZero); |
|
3956 |
} |
|
3957 |
} |
|
3958 |
} |
|
3959 |
} |
|
3960 |
||
3961 |
// --------------------------------------------------------------------------- |
|
3962 |
// Sets visualizer observer |
|
3963 |
// --------------------------------------------------------------------------- |
|
3964 |
// |
|
3965 |
void CFsTreeVisualizerBase::SetVisualizerObserver( |
|
3966 |
MFsTreeVisualizerObserver* aObserver) |
|
3967 |
{ |
|
3968 |
FUNC_LOG; |
|
3969 |
iVisualizerObserver = aObserver; |
|
3970 |
} |
|
3971 |
||
3972 |
// --------------------------------------------------------------------------- |
|
3973 |
// Returns parent layout. |
|
3974 |
// --------------------------------------------------------------------------- |
|
3975 |
// |
|
3976 |
CAlfLayout& CFsTreeVisualizerBase::ParentLayout() const |
|
3977 |
{ |
|
3978 |
FUNC_LOG; |
|
3979 |
return iParentLayout; |
|
3980 |
} |
|
3981 |
||
3982 |
// --------------------------------------------------------------------------- |
|
3983 |
// Function shows selector or hides it. |
|
3984 |
// --------------------------------------------------------------------------- |
|
3985 |
// |
|
3986 |
EXPORT_C void CFsTreeVisualizerBase::MakeSelectorVisibleL(TBool aVisible) |
|
3987 |
{ |
|
3988 |
MakeSelectorVisibleL( aVisible, 0 ); |
|
3989 |
} |
|
3990 |
||
3991 |
// --------------------------------------------------------------------------- |
|
3992 |
// Function shows selector or hides it. |
|
3993 |
// --------------------------------------------------------------------------- |
|
3994 |
// |
|
3995 |
void CFsTreeVisualizerBase::MakeSelectorVisibleL(TBool aVisible, TInt aDelay) |
|
3996 |
{ |
|
3997 |
FUNC_LOG; |
|
3998 |
TAlfTimedValue opacity; |
|
3999 |
||
4000 |
if (aVisible) |
|
4001 |
{ |
|
4002 |
if (!iSelectorVisual) |
|
4003 |
{ |
|
4004 |
CreateSelectorVisualL(); |
|
4005 |
} |
|
4006 |
||
4007 |
TBool isFocused = IsItemFocused(iFocusedItem); |
|
4008 |
||
4009 |
if (iSelectorVisual) |
|
4010 |
{ |
|
4011 |
if (isFocused && IsFocusShown()) |
|
4012 |
{ |
|
4013 |
if( aDelay ) |
|
4014 |
opacity.SetTarget(iSelectorOpacity, aDelay); |
|
4015 |
else |
|
4016 |
opacity.SetValueNow(iSelectorOpacity); |
|
4017 |
} |
|
4018 |
else |
|
4019 |
{ |
|
4020 |
if( aDelay ) |
|
4021 |
opacity.SetTarget(0.0, aDelay); |
|
4022 |
else |
|
4023 |
opacity.SetValueNow(0.0); |
|
4024 |
} |
|
4025 |
||
4026 |
iSelectorVisual->SetOpacity(opacity); |
|
4027 |
} |
|
4028 |
UpdateSelectorVisualL(); |
|
4029 |
} |
|
4030 |
else |
|
4031 |
{ |
|
4032 |
if (iSelectorVisual) |
|
4033 |
{ |
|
4034 |
opacity.SetValueNow(0); |
|
4035 |
iSelectorVisual->SetOpacity(opacity); |
|
4036 |
} |
|
4037 |
} |
|
4038 |
} |
|
4039 |
||
4040 |
// --------------------------------------------------------------------------- |
|
4041 |
// |
|
4042 |
// --------------------------------------------------------------------------- |
|
4043 |
// |
|
4044 |
void CFsTreeVisualizerBase::UpdateSelectorVisualL(TInt /*aTime*/) |
|
4045 |
{ |
|
4046 |
FUNC_LOG; |
|
4047 |
||
4048 |
if ( iSelectorVisual ) |
|
4049 |
{ |
|
4050 |
if ( iFocusedItem == KFsTreeNoneID || |
|
4051 |
!iFlags.IsSet( EListFocused ) || !IsFocusShown() ) |
|
4052 |
{ |
|
4053 |
TAlfTimedValue opacity; |
|
4054 |
opacity.SetValueNow( 0.0f ); |
|
4055 |
iSelectorVisual->SetOpacity( opacity ); |
|
4056 |
} |
|
4057 |
else |
|
4058 |
{ |
|
4059 |
//check if item is visible |
|
4060 |
MFsTreeItemVisualizer* vis( NULL ); |
|
4061 |
||
4062 |
iListLayout->SetFlag( EAlfVisualFlagFreezeLayout ); |
|
4063 |
iListItemBackgroundLayout->SetFlag( EAlfVisualFlagFreezeLayout ); |
|
4064 |
||
4065 |
TRect itemRect( iViewPort.ItemRect( iFocusedItem ) ); |
|
4066 |
||
4067 |
if ( itemRect.Height() ) |
|
4068 |
{ |
|
4069 |
TSize currSize; |
|
4070 |
currSize.iWidth = iListLayout->Size().iX.Target() - 2 |
|
4071 |
* iListLayout->PaddingInPixels().iTl.iX; |
|
4072 |
currSize.iHeight = itemRect.Height(); |
|
4073 |
iSelectorVisual->SetSize( currSize, 0 ); |
|
4074 |
TAlfRealPoint pNow; |
|
4075 |
pNow.iY = itemRect.iTl.iY; |
|
4076 |
pNow.iX = iListLayout->PaddingInPixels().iTl.iX; |
|
4077 |
iSelectorVisual->SetPos( pNow, 0 ); |
|
4078 |
||
4079 |
TAlfTimedValue opacity( iSelectorOpacity, 0 ); |
|
4080 |
iSelectorVisual->SetOpacity( opacity ); |
|
4081 |
iFocusVisible = ETrue; |
|
4082 |
||
4083 |
if ( iMarqueeType != EFsTextMarqueeNone ) |
|
4084 |
{ |
|
4085 |
vis = iTreeData->ItemVisualizer( iFocusedItem ); |
|
4086 |
if (vis) |
|
4087 |
{ |
|
4088 |
vis->MarqueeL( iMarqueeType, iMarqueeSpeed, |
|
4089 |
iMarqueStartDelay, iMarqueCycleStartDelay, |
|
4090 |
iMarqueeRepetitions ); |
|
4091 |
} |
|
4092 |
} |
|
4093 |
} |
|
4094 |
else |
|
4095 |
{ |
|
4096 |
TAlfTimedValue opacity; |
|
4097 |
opacity.SetValueNow( 0.0f ); |
|
4098 |
iSelectorVisual->SetOpacity( opacity ); |
|
4099 |
} |
|
4100 |
||
4101 |
iListLayout->ClearFlag( EAlfVisualFlagFreezeLayout ); |
|
4102 |
iListItemBackgroundLayout->ClearFlag( EAlfVisualFlagFreezeLayout ); |
|
4103 |
} |
|
4104 |
} |
|
4105 |
else if ( iFocusedItem != KFsTreeNoneID && iFlags.IsSet( EListFocused ) ) |
|
4106 |
{ |
|
4107 |
MakeSelectorVisibleL( ETrue ); |
|
4108 |
} |
|
4109 |
} |
|
4110 |
||
4111 |
// --------------------------------------------------------------------------- |
|
4112 |
// The function deletes selector visual. |
|
4113 |
// --------------------------------------------------------------------------- |
|
4114 |
// |
|
4115 |
void CFsTreeVisualizerBase::DestroySelectorVisualL() |
|
4116 |
{ |
|
4117 |
FUNC_LOG; |
|
4118 |
||
4119 |
if (iSelectorVisual && iSelectorLayout) |
|
4120 |
{ |
|
4121 |
iSelectorLayout->Remove(iSelectorVisual); |
|
4122 |
//destroy |
|
4123 |
iSelectorVisual->RemoveAndDestroyAllD(); |
|
4124 |
iSelectorVisual = NULL; |
|
4125 |
} |
|
4126 |
} |
|
4127 |
||
4128 |
// --------------------------------------------------------------------------- |
|
4129 |
// The function creates selector visual. |
|
4130 |
// --------------------------------------------------------------------------- |
|
4131 |
// |
|
4132 |
void CFsTreeVisualizerBase::CreateSelectorVisualL() |
|
4133 |
{ |
|
4134 |
FUNC_LOG; |
|
4135 |
TAlfTimedValue opacity; |
|
4136 |
||
4137 |
if (!iSelectorVisual) |
|
4138 |
{ |
|
4139 |
if (iFocusedItem != KFsTreeNoneID) |
|
4140 |
{ |
|
4141 |
MFsTreeItemVisualizer* vis = |
|
4142 |
iTreeData->ItemVisualizer( iFocusedItem ); |
|
4143 |
MFsTreeItemData* data = &iTreeData->ItemData( iFocusedItem ); |
|
4144 |
||
4145 |
iListLayout->SetFlag( EAlfVisualFlagFreezeLayout ); |
|
4146 |
iListItemBackgroundLayout->SetFlag( EAlfVisualFlagFreezeLayout ); |
|
4147 |
||
4148 |
iSelectorVisual = CAlfImageVisual::AddNewL(*iOwnerControl, iSelectorLayout); |
|
4149 |
opacity.SetValueNow(0.0f); |
|
4150 |
iSelectorVisual->SetOpacity(opacity); |
|
4151 |
iSelectorVisual->SetScaleMode( CAlfImageVisual::EScaleFit); |
|
4152 |
iSelectorVisual->EnableBrushesL(); |
|
4153 |
||
4154 |
// Set the selector visual size and pos. |
|
4155 |
iSelectorVisual->SetFlags(EAlfVisualFlagManualLayout | |
|
4156 |
EAlfVisualFlagIgnorePointer); |
|
4157 |
||
4158 |
TRect itemRect(iViewPort.ItemRect(iFocusedItem)); |
|
4159 |
itemRect.SetWidth(iListLayout->Size().iX.Target() - 2 * iListLayout->PaddingInPixels().iTl.iX); |
|
4160 |
if ( itemRect.Height() ) |
|
4161 |
{ |
|
4162 |
iSelectorVisual->SetPos(itemRect.iTl); |
|
4163 |
iSelectorVisual->SetSize(itemRect.Size()); |
|
4164 |
} |
|
4165 |
||
4166 |
//create a selector from skin or from a supplied bitmap |
|
4167 |
if ( iSelectorTexture ) |
|
4168 |
{ |
|
4169 |
CAlfImageBrush* brush = CAlfImageBrush::NewLC( |
|
4170 |
iOwnerControl->Env(),TAlfImage(*iSelectorTexture)); |
|
4171 |
||
4172 |
brush->SetBorders(iLeftSelectorBorderWidth, |
|
4173 |
iRightSelectorBorderWidth, |
|
4174 |
iTopSelectorBorderHeight, |
|
4175 |
iBottomSelectorBorderHeight); |
|
4176 |
||
4177 |
iSelectorVisual->Brushes()->AppendL(brush, EAlfHasOwnership); |
|
4178 |
CleanupStack::Pop(brush); |
|
4179 |
} |
|
4180 |
else if ( iSelectorBrush ) |
|
4181 |
{ |
|
4182 |
//append brush supplied by the user to the selector visual |
|
4183 |
iSelectorVisual->Brushes()->AppendL( |
|
4184 |
iSelectorBrush, EAlfDoesNotHaveOwnership); |
|
4185 |
||
4186 |
if ( iSelectorOpacity <= 0.0 || iSelectorOpacity > 1.0 ) |
|
4187 |
{ |
|
4188 |
iSelectorOpacity = 1.0; |
|
4189 |
} |
|
4190 |
||
4191 |
opacity.SetValueNow(iSelectorOpacity); |
|
4192 |
iSelectorVisual->SetOpacity(opacity); |
|
4193 |
} |
|
4194 |
else //no bitmap/brush given - create selector from skin |
|
4195 |
{ |
|
4196 |
// apply a image brush to the visual |
|
4197 |
CAlfFrameBrush* brush = CAlfFrameBrush::NewLC(iOwnerControl->Env(), |
|
4198 |
KAknsIIDQsnFrList); |
|
4199 |
||
4200 |
iSelectorVisual->Brushes()->AppendL(brush, EAlfHasOwnership); |
|
4201 |
CleanupStack::Pop(brush); |
|
4202 |
||
4203 |
CAlfBrush& skinbrush( iSelectorVisual->Brushes()->At( |
|
4204 |
iSelectorVisual->Brushes()->Count() - 1 ) ); |
|
4205 |
CAlfFrameBrush* |
|
4206 |
selectorBrush( static_cast<CAlfFrameBrush*>( &skinbrush ) ); |
|
4207 |
||
4208 |
const TRect outerRect( itemRect.Size() ); //outer rect has the size of item |
|
4209 |
TRect innerRect( outerRect ); |
|
4210 |
||
4211 |
innerRect.Shrink( 5, 5 ); |
|
4212 |
if ( outerRect.Width() > 0 && outerRect.Height() > 0 && |
|
4213 |
innerRect.Width() > 0 && innerRect.Height() > 0 ) |
|
4214 |
{ |
|
4215 |
// aInnerRect, const TRect& aOuterRect |
|
4216 |
selectorBrush->SetFrameRectsL( innerRect, outerRect ); |
|
4217 |
} |
|
4218 |
} |
|
4219 |
||
4220 |
iListLayout->ClearFlag( EAlfVisualFlagFreezeLayout ); |
|
4221 |
iListItemBackgroundLayout->ClearFlag( EAlfVisualFlagFreezeLayout ); |
|
4222 |
} |
|
4223 |
} |
|
4224 |
} |
|
4225 |
||
4226 |
// --------------------------------------------------------------------------- |
|
4227 |
// |
|
4228 |
// --------------------------------------------------------------------------- |
|
4229 |
// |
|
4230 |
void CFsTreeVisualizerBase::UpdateListItemSizes() |
|
4231 |
{ |
|
4232 |
FUNC_LOG; |
|
4233 |
TInt focused = iVisibleItems.Find(iFocusedItem); |
|
4234 |
if (focused == KErrNotFound) |
|
4235 |
{ |
|
4236 |
return; |
|
4237 |
} |
|
4238 |
TInt count = iVisibleItemsBackground.Count(); |
|
4239 |
for (TInt i = 0; i < count; ++i) |
|
4240 |
{ |
|
4241 |
if (i == focused) |
|
4242 |
{//focused item already updated |
|
4243 |
continue; |
|
4244 |
} |
|
4245 |
else |
|
4246 |
{ |
|
4247 |
UpdateListItemSize(i); |
|
4248 |
} |
|
4249 |
} |
|
4250 |
} |
|
4251 |
||
4252 |
// --------------------------------------------------------------------------- |
|
4253 |
// |
|
4254 |
// --------------------------------------------------------------------------- |
|
4255 |
// |
|
4256 |
void CFsTreeVisualizerBase::UpdateListItemSize(TInt aIndex) |
|
4257 |
{ |
|
4258 |
FUNC_LOG; |
|
4259 |
TSize size; |
|
4260 |
TReal32 diff(0); |
|
4261 |
TReal32 speed(0); |
|
4262 |
TAlfTimedPoint sizeTarg; |
|
4263 |
TAlfTimedPoint sizeNow; |
|
4264 |
CAlfDeckLayout* lay; |
|
4265 |
||
4266 |
lay = iVisibleItemsBackground[aIndex]; |
|
4267 |
||
4268 |
sizeNow.iY.SetTarget(lay->Size().iY.ValueNow(), 0); |
|
4269 |
sizeNow.iX.SetTarget(lay->Size().iX.ValueNow(), 0); |
|
4270 |
sizeTarg.iY.SetTarget(lay->Size().iY.Target(), 0); |
|
4271 |
sizeTarg.iX.SetTarget(lay->Size().iX.Target(), 0); |
|
4272 |
||
4273 |
if (sizeNow.iY.Target() != sizeTarg.iY.Target()) |
|
4274 |
{ |
|
4275 |
diff = sizeNow.iY.Target() - sizeTarg.iY.Target(); |
|
4276 |
if (diff < 0) |
|
4277 |
{ |
|
4278 |
diff *= -1; |
|
4279 |
} |
|
4280 |
||
4281 |
if (iCurrentScrollSpeed != 0) |
|
4282 |
{ |
|
4283 |
speed = diff / iCurrentScrollSpeed * 1000; |
|
4284 |
} |
|
4285 |
||
4286 |
TAlfTimedPoint p; |
|
4287 |
p.iY.SetTargetWithSpeed(sizeTarg.iY.Target(), speed); |
|
4288 |
p.iX.SetTarget(sizeTarg.iX.Target(), 0); |
|
4289 |
p.SetStyle(EAlfTimedValueStyleLinear); |
|
4290 |
||
4291 |
lay->SetSize(p); |
|
4292 |
iListLayout->Visual(aIndex).SetSize(p); |
|
4293 |
||
4294 |
} |
|
4295 |
} |
|
4296 |
||
4297 |
// --------------------------------------------------------------------------- |
|
4298 |
// |
|
4299 |
// --------------------------------------------------------------------------- |
|
4300 |
// |
|
4301 |
void CFsTreeVisualizerBase::ScrollListLayoutsL(TInt aScrollOffset, TInt /*aScrollTime*/) |
|
4302 |
{ |
|
4303 |
FUNC_LOG; |
|
4304 |
TPoint position(iViewPort.Position()); |
|
4305 |
if (position.iY != aScrollOffset) |
|
4306 |
{ |
|
4307 |
position.iY = aScrollOffset; |
|
4308 |
iViewPort.SetPositionL(position); |
|
4309 |
} |
|
4310 |
} |
|
4311 |
||
4312 |
// --------------------------------------------------------------------------- |
|
4313 |
// |
|
4314 |
// --------------------------------------------------------------------------- |
|
4315 |
// |
|
4316 |
TInt CFsTreeVisualizerBase::ScrollListLayouts(TInt aScrollOffset, |
|
4317 |
TInt aScrollTime) |
|
4318 |
{ |
|
4319 |
TRAPD( error, ScrollListLayoutsL(aScrollOffset, aScrollTime) ); |
|
4320 |
return error; |
|
4321 |
} |
|
4322 |
||
4323 |
// --------------------------------------------------------------------------- |
|
4324 |
// |
|
4325 |
// --------------------------------------------------------------------------- |
|
4326 |
// |
|
4327 |
TFsTreeItemId CFsTreeVisualizerBase::NextFocusableItem( |
|
4328 |
const TFsTreeItemId aItemId) |
|
4329 |
{ |
|
4330 |
FUNC_LOG; |
|
4331 |
TFsTreeItemId treeItem = KFsTreeNoneID; |
|
4332 |
TFsTreeItemId foundItem = KFsTreeNoneID; |
|
4333 |
||
4334 |
TFsTreeIterator treeIter = iTreeData->Iterator(KFsTreeRootID, aItemId, |
|
4335 |
KFsTreeIteratorSkipCollapsedFlag | KFsTreeIteratorSkipHiddenFlag); |
|
4336 |
||
4337 |
while (treeIter.HasNext()) |
|
4338 |
{ |
|
4339 |
treeItem = treeIter.Next(); |
|
4340 |
if (iTreeData->ItemVisualizer(treeItem)->IsFocusable()) |
|
4341 |
{ |
|
4342 |
foundItem = treeItem; |
|
4343 |
break; |
|
4344 |
} |
|
4345 |
} |
|
4346 |
||
4347 |
return foundItem; |
|
4348 |
} |
|
4349 |
||
4350 |
// --------------------------------------------------------------------------- |
|
4351 |
// |
|
4352 |
// --------------------------------------------------------------------------- |
|
4353 |
// |
|
4354 |
TFsTreeItemId CFsTreeVisualizerBase::PrevFocusableItem( |
|
4355 |
const TFsTreeItemId aItemId) |
|
4356 |
{ |
|
4357 |
FUNC_LOG; |
|
4358 |
TFsTreeItemId treeItem = KFsTreeNoneID; |
|
4359 |
TFsTreeItemId foundItem = KFsTreeNoneID; |
|
4360 |
||
4361 |
TFsTreeIterator treeIter = iTreeData->Iterator(KFsTreeRootID, aItemId, |
|
4362 |
KFsTreeIteratorSkipCollapsedFlag | KFsTreeIteratorSkipHiddenFlag); |
|
4363 |
||
4364 |
while (treeIter.HasPrevious()) |
|
4365 |
{ |
|
4366 |
treeItem = treeIter.Previous(); |
|
4367 |
if (iTreeData->ItemVisualizer(treeItem)->IsFocusable()) |
|
4368 |
{ |
|
4369 |
foundItem = treeItem; |
|
4370 |
break; |
|
4371 |
} |
|
4372 |
} |
|
4373 |
||
4374 |
return foundItem; |
|
4375 |
} |
|
4376 |
||
4377 |
// --------------------------------------------------------------------------- |
|
4378 |
// Function sets current scroll speed based on the up/down key repeats. |
|
4379 |
// --------------------------------------------------------------------------- |
|
4380 |
// |
|
4381 |
void CFsTreeVisualizerBase::SetCurrentScrollSpeed(TInt aKeyRepeats) |
|
4382 |
{ |
|
4383 |
FUNC_LOG; |
|
4384 |
TInt time(0); |
|
4385 |
if (iScrollSpeed > 0) |
|
4386 |
{ |
|
4387 |
time = iIntx->Interval(iScrollSpeed); |
|
4388 |
if (time != iScrollSpeed) |
|
4389 |
{ |
|
4390 |
iCurrentScrollSpeed = time; |
|
4391 |
if (aKeyRepeats > 0) |
|
4392 |
{ |
|
4393 |
iCurrentScrollSpeed = iCurrentScrollSpeed * (1 - aKeyRepeats |
|
4394 |
* iScrollAccelerationRate); |
|
4395 |
if (iCurrentScrollSpeed < 0) |
|
4396 |
{ |
|
4397 |
iCurrentScrollSpeed = 1; |
|
4398 |
} |
|
4399 |
} |
|
4400 |
} |
|
4401 |
else |
|
4402 |
{ |
|
4403 |
iCurrentScrollSpeed = iScrollSpeed; |
|
4404 |
} |
|
4405 |
||
4406 |
if (iCurrentScrollSpeed < iScrollSpeed) |
|
4407 |
{ |
|
4408 |
iCurrentScrollSpeed = KZero; |
|
4409 |
} |
|
4410 |
// TInt part(0); |
|
4411 |
// part = iScrollSpeed * 0.9; |
|
4412 |
||
4413 |
// if ( iCurrentScrollSpeed <= part ) |
|
4414 |
// { |
|
4415 |
// iCurrentScrollSpeed = 0; |
|
4416 |
// } |
|
4417 |
// if (iCurrentScrollSpeed < 200) |
|
4418 |
// { |
|
4419 |
// iCurrentScrollSpeed = 200; |
|
4420 |
// } |
|
4421 |
} |
|
4422 |
} |
|
4423 |
||
4424 |
// --------------------------------------------------------------------------- |
|
4425 |
// Gets default settings from Central Repository. |
|
4426 |
// --------------------------------------------------------------------------- |
|
4427 |
// |
|
4428 |
void CFsTreeVisualizerBase::ReadDefaultValuesFromCenRep() |
|
4429 |
{ |
|
4430 |
FUNC_LOG; |
|
4431 |
CRepository *crep(NULL); |
|
4432 |
TRAP_IGNORE( crep = CRepository::NewL( KCRUidFSGenericUI ) ); |
|
4433 |
||
4434 |
//scroll time |
|
4435 |
if (!crep || crep->Get(KFSGenericUIDefScrollSpeed, iScrollSpeed) |
|
4436 |
!= KErrNone) |
|
4437 |
{ |
|
4438 |
iScrollSpeed = KFsListDefaultScrollSpeed; |
|
4439 |
} |
|
4440 |
if (iScrollSpeed < 0) |
|
4441 |
{ |
|
4442 |
iScrollSpeed = 0; |
|
4443 |
} |
|
4444 |
||
4445 |
//duration of the fade-in effect |
|
4446 |
if (!crep || crep->Get(KFSGenericUIFadeIn, iFadeInEffectTime) != KErrNone) |
|
4447 |
{ |
|
4448 |
iFadeInEffectTime = KFsListDefaultFadeInTime; |
|
4449 |
} |
|
4450 |
if (iFadeInEffectTime < 0) |
|
4451 |
{ |
|
4452 |
iFadeInEffectTime = 0; |
|
4453 |
} |
|
4454 |
||
4455 |
//duration of the fade-out effect |
|
4456 |
if (!crep || crep->Get(KFSGenericUIFadeOut, iFadeOutEffectTime) |
|
4457 |
!= KErrNone) |
|
4458 |
{ |
|
4459 |
iFadeOutEffectTime = KFsListDefaultFadeOutTime; |
|
4460 |
} |
|
4461 |
if (iFadeOutEffectTime < 0) |
|
4462 |
{ |
|
4463 |
iFadeOutEffectTime = 0; |
|
4464 |
} |
|
4465 |
||
4466 |
//duration of the slide-in effect |
|
4467 |
if (!crep || crep->Get(KFSGenericUISlideInTime, iSlideInDuration) |
|
4468 |
!= KErrNone) |
|
4469 |
{ |
|
4470 |
iSlideInDuration = KFsListDefaultSlideInTime; |
|
4471 |
} |
|
4472 |
if (iSlideInDuration < 0) |
|
4473 |
{ |
|
4474 |
iSlideInDuration = KFsListDefaultSlideInTime; |
|
4475 |
} |
|
4476 |
||
4477 |
//duration of the slide-out effect |
|
4478 |
if (!crep || crep->Get(KFSGenericUISlideOutTime, iSlideOutDuration) |
|
4479 |
!= KErrNone) |
|
4480 |
{ |
|
4481 |
iSlideOutDuration = KFsListDefaultSlideOutTime; |
|
4482 |
} |
|
4483 |
if (iSlideOutDuration < 0) |
|
4484 |
{ |
|
4485 |
iSlideOutDuration = 0; |
|
4486 |
} |
|
4487 |
||
4488 |
//direction of the slide-in effect |
|
4489 |
TInt slideInDir; |
|
4490 |
if (!crep || crep->Get(KFSGenericUISlideInDir, slideInDir) != KErrNone) |
|
4491 |
{ |
|
4492 |
slideInDir = KFsListDefaultSlideInDir; |
|
4493 |
} |
|
4494 |
if (slideInDir < 0 || slideInDir > 4) |
|
4495 |
{ |
|
4496 |
slideInDir = 0; |
|
4497 |
} |
|
4498 |
iSlideInDirection |
|
4499 |
= static_cast<MFsTreeVisualizer::TFsSlideEffect> (slideInDir); |
|
4500 |
||
4501 |
//direction of the slide-out effect |
|
4502 |
TInt slideOutDir; |
|
4503 |
if (!crep || crep->Get(KFSGenericUISlideOutDir, slideOutDir) != KErrNone) |
|
4504 |
{ |
|
4505 |
slideOutDir = KFsListDefaultSlideOutDir; |
|
4506 |
} |
|
4507 |
if (slideOutDir < 0 || slideOutDir > 4) |
|
4508 |
{ |
|
4509 |
slideOutDir = 0; |
|
4510 |
} |
|
4511 |
iSlideOutDirection = |
|
4512 |
static_cast<MFsTreeVisualizer::TFsSlideEffect>(slideOutDir); |
|
4513 |
||
4514 |
//item expansion time |
|
4515 |
if ( !crep || crep->Get( KFSGenericUIListExpTimeOut, iCurrentScrollSpeed ) != |
|
4516 |
KErrNone ) |
|
4517 |
{ |
|
4518 |
iCurrentScrollSpeed = KFsListDefaultListExpTimeOut; |
|
4519 |
} |
|
4520 |
if (iCurrentScrollSpeed < 1) |
|
4521 |
{ |
|
4522 |
iCurrentScrollSpeed = 1; |
|
4523 |
} |
|
4524 |
||
4525 |
//list looping type |
|
4526 |
TInt listLooping; |
|
4527 |
if ( !crep || crep->Get( KFSGenericUIListLooping, listLooping) != |
|
4528 |
KErrNone ) |
|
4529 |
{ |
|
4530 |
listLooping = KFsListDefaultListLooping; |
|
4531 |
} |
|
4532 |
if (listLooping < 0 || listLooping > 2) |
|
4533 |
{ |
|
4534 |
listLooping = 0; |
|
4535 |
} |
|
4536 |
iLooping = static_cast<TFsTreeListLoopingType> (listLooping); |
|
4537 |
||
4538 |
delete crep; |
|
4539 |
} |
|
4540 |
||
4541 |
// --------------------------------------------------------------------------- |
|
4542 |
// Sets values to an item which are default for the whole list (e.g. if |
|
4543 |
// items are always extended. |
|
4544 |
// --------------------------------------------------------------------------- |
|
4545 |
// |
|
4546 |
void CFsTreeVisualizerBase::ApplyListSpecificValuesToItem( |
|
4547 |
MFsTreeItemVisualizer *aItemVis) |
|
4548 |
{ |
|
4549 |
FUNC_LOG; |
|
4550 |
//list can have all items in extended or in a normal state |
|
4551 |
aItemVis->SetAlwaysExtended(IsItemsAlwaysExtended()); |
|
4552 |
||
4553 |
//global indentation in pixels for a list component |
|
4554 |
aItemVis->SetIndentation(iLevelIndentation); |
|
4555 |
||
4556 |
//global indentation in pixels for a list component |
|
4557 |
aItemVis->SetTextStyleManager(*iTextStyleManager); |
|
4558 |
} |
|
4559 |
||
4560 |
// --------------------------------------------------------------------------- |
|
4561 |
// The function calculates tree height up to the specified item. |
|
4562 |
// --------------------------------------------------------------------------- |
|
4563 |
// |
|
4564 |
TInt CFsTreeVisualizerBase::CalculateTreeHeightUpToItem( |
|
4565 |
const TFsTreeItemId aItemId, TInt& aHeight) const |
|
4566 |
{ |
|
4567 |
FUNC_LOG; |
|
4568 |
TFsTreeItemId tmpItem(KFsTreeNoneID); |
|
4569 |
TFsTreeItemId itemToFind(KFsTreeNoneID); |
|
4570 |
itemToFind = aItemId; |
|
4571 |
TInt retVal(KErrNone); |
|
4572 |
//validate given item id |
|
4573 |
if (!iTreeData->Contains(itemToFind)) |
|
4574 |
{ |
|
4575 |
retVal = KErrNotFound; |
|
4576 |
} |
|
4577 |
if (retVal == KErrNone) |
|
4578 |
{ |
|
4579 |
//create an iterator |
|
4580 |
TFsTreeIterator iter = iTreeData->Iterator(KFsTreeRootID, |
|
4581 |
KFsTreeRootID, KFsTreeIteratorSkipCollapsedFlag |
|
4582 |
| KFsTreeIteratorSkipHiddenFlag); |
|
4583 |
||
4584 |
TBool notFound(ETrue); |
|
4585 |
TInt height(0); |
|
4586 |
MFsTreeItemVisualizer* vis = NULL; |
|
4587 |
||
4588 |
//iterate up to the given item id and calculate the tree height |
|
4589 |
while (notFound && iter.HasNext()) |
|
4590 |
{ |
|
4591 |
tmpItem = iter.Next(); |
|
4592 |
if (tmpItem == itemToFind) |
|
4593 |
{ |
|
4594 |
notFound = EFalse; |
|
4595 |
continue; |
|
4596 |
} |
|
4597 |
else |
|
4598 |
{//add item's height |
|
4599 |
vis = iTreeData->ItemVisualizer(tmpItem); |
|
4600 |
if (vis->IsExtendable() && vis->IsExtended()) |
|
4601 |
{ |
|
4602 |
height += vis->ExtendedSize().iHeight; |
|
4603 |
} |
|
4604 |
else |
|
4605 |
{ |
|
4606 |
height += vis->Size().iHeight; |
|
4607 |
} |
|
4608 |
} |
|
4609 |
} |
|
4610 |
||
4611 |
if (notFound) |
|
4612 |
{ |
|
4613 |
retVal = KErrNotFound; |
|
4614 |
} |
|
4615 |
else |
|
4616 |
{ |
|
4617 |
retVal = KErrNone; |
|
4618 |
aHeight = height; |
|
4619 |
} |
|
4620 |
} |
|
4621 |
return retVal; |
|
4622 |
} |
|
4623 |
||
4624 |
// --------------------------------------------------------------------------- |
|
4625 |
// Update list's visual content by appending items into empty gap in list. |
|
4626 |
// --------------------------------------------------------------------------- |
|
4627 |
// |
|
4628 |
void CFsTreeVisualizerBase::FillGapWithItemsL(const TInt /*aHeight*/) |
|
4629 |
{ |
|
4630 |
FUNC_LOG; |
|
4631 |
} |
|
4632 |
||
4633 |
// --------------------------------------------------------------------------- |
|
4634 |
// The function checks if the given item id matches the focused one. |
|
4635 |
// --------------------------------------------------------------------------- |
|
4636 |
// |
|
4637 |
TBool CFsTreeVisualizerBase::IsItemFocused(TFsTreeItemId aItemId) const |
|
4638 |
{ |
|
4639 |
FUNC_LOG; |
|
4640 |
TBool isFocused(EFalse); |
|
4641 |
||
4642 |
if (iFocusedItem != KFsTreeNoneID) |
|
4643 |
{ |
|
4644 |
if (iFlags.IsSet(EListFocused) && (aItemId == iFocusedItem)) |
|
4645 |
{ |
|
4646 |
isFocused = ETrue; |
|
4647 |
} |
|
4648 |
} |
|
4649 |
return isFocused; |
|
4650 |
} |
|
4651 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4652 |
// <cmail> "Base class modifications for using touch" |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4653 |
|
64 | 4654 |
// --------------------------------------------------------------------------- |
4655 |
// C++ constructor. |
|
4656 |
// --------------------------------------------------------------------------- |
|
4657 |
// |
|
4658 |
CFsTreeVisualizerBase::CFsTreeVisualizerBase( CAlfControl* aOwnerControl, |
|
4659 |
CAlfLayout& aParent, const TBool aPopUpMode ) |
|
4660 |
: iVisualizationState(EFsTreeHidden), |
|
4661 |
iOwnerControl ( aOwnerControl ), |
|
4662 |
iParentLayout ( aParent ), |
|
4663 |
iTreeData ( NULL ), |
|
4664 |
iFocusedItem ( KFsTreeNoneID ), |
|
4665 |
iListLayout ( NULL ), |
|
4666 |
iLooping ( EFsTreeListLoopingDisabled ), |
|
4667 |
iSelectorTexture(NULL), |
|
4668 |
iSelectorBrush(NULL), |
|
4669 |
iSelectorOpacity(1.0), |
|
4670 |
iLeftSelectorBorderWidth(KFSListDefaultSelectorBorderWidth), |
|
4671 |
iRightSelectorBorderWidth(KFSListDefaultSelectorBorderWidth), |
|
4672 |
iTopSelectorBorderHeight(KFSListDefaultSelectorBorderWidth), |
|
4673 |
iBottomSelectorBorderHeight(KFSListDefaultSelectorBorderWidth), |
|
4674 |
iSelectorMovementType(EFsSelectorMoveImmediately), |
|
4675 |
iMarqueeSpeed(30), |
|
4676 |
iScrollSpeed( 0 ), |
|
4677 |
iCurrentScrollSpeed(0), |
|
4678 |
iScrollAccelerationRate(0.4), |
|
4679 |
iFadeInEffectTime(0), |
|
4680 |
iFadeOutEffectTime(0), |
|
4681 |
iWatermark(NULL), |
|
4682 |
iLevelIndentation ( KFsDefaultIndentation ), |
|
4683 |
iSlideInDuration ( 0 ), |
|
4684 |
iSlideInDirection ( ESlideFromTop ), |
|
4685 |
iSlideOutDuration ( 0 ), |
|
4686 |
iSlideOutDirection ( ESlideFromTop ), |
|
4687 |
iScrollOffset(0), |
|
4688 |
iMarqueeType(EFsTextMarqueeForth), |
|
4689 |
iMarqueStartDelay( 1000 ), //one sec of delay |
|
4690 |
iMarqueCycleStartDelay ( 500 ), //half a sec cycle delay |
|
4691 |
iMarqueeRepetitions (-1), //infinite loop |
|
4692 |
iViewPort( *this, iWorld ) |
|
4693 |
{ |
|
4694 |
FUNC_LOG; |
|
4695 |
iFlags.Set( EAutoRefresh ); |
|
4696 |
iFlags.Assign( EPopupMode, aPopUpMode ); |
|
4697 |
iFlags.Set( EExpandCollapseOnLongTap ); |
|
4698 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4699 |
// </cmail> |
64 | 4700 |
|
4701 |
// --------------------------------------------------------------------------- |
|
4702 |
// Second phase constructor. |
|
4703 |
// --------------------------------------------------------------------------- |
|
4704 |
// |
|
4705 |
void CFsTreeVisualizerBase::ConstructL() |
|
4706 |
{ |
|
4707 |
FUNC_LOG; |
|
4708 |
ReadDefaultValuesFromCenRep(); |
|
4709 |
||
4710 |
if (CAknPhysics::FeatureEnabled()) |
|
4711 |
{ |
|
4712 |
iPhysics = CAknPhysics::NewL(*this, NULL ); |
|
4713 |
iDragHandler = CDragHandler::NewL(*this, |
|
4714 |
iPhysics->HighlightTimeout(), iFlags); |
|
4715 |
iPhysics->SetFriction(KDefaultFriction); |
|
4716 |
} |
|
4717 |
||
4718 |
iRootData = CFsTreePlainOneLineItemData::NewL(); |
|
4719 |
HBufC* empty = StringLoader::LoadL(R_AVKON_EMPTY_POPUP_LIST_TEXT); |
|
4720 |
CleanupStack::PushL(empty); |
|
4721 |
iRootData->SetDataL(*empty); |
|
4722 |
CleanupStack::PopAndDestroy(empty); |
|
4723 |
||
4724 |
iParentLayout.UpdateChildrenLayout(); |
|
4725 |
||
4726 |
iRootVisualizer = CFsTreePlainRootVisualizer::NewL(*iOwnerControl); |
|
4727 |
||
4728 |
iRootLayout = CAlfDeckLayout::AddNewL(*iOwnerControl, &iParentLayout); |
|
4729 |
iRootLayout->EnableBrushesL(); |
|
4730 |
iRootLayout->SetClipping(ETrue); |
|
4731 |
iRootLayout->UpdateChildrenLayout(); |
|
4732 |
||
4733 |
iTextStyleManager = CFsAlfTextStyleManager::NewL( |
|
4734 |
iRootLayout->Env().TextStyleManager()); |
|
4735 |
||
4736 |
iRootVisualizer->SetTextStyleManager(*iTextStyleManager); |
|
4737 |
||
4738 |
iShadowLayout = CAlfDeckLayout::AddNewL(*iOwnerControl, iRootLayout); |
|
4739 |
iShadowLayout->EnableBrushesL(); |
|
4740 |
iShadowLayout->UpdateChildrenLayout(); |
|
4741 |
||
4742 |
iBorderLayout = CAlfDeckLayout::AddNewL(*iOwnerControl, iShadowLayout); |
|
4743 |
iBorderLayout->EnableBrushesL(); |
|
4744 |
iBorderLayout->UpdateChildrenLayout(); |
|
4745 |
||
4746 |
iWatermarkLayout = CAlfDeckLayout::AddNewL(*iOwnerControl, iBorderLayout); |
|
4747 |
iWatermarkLayout->EnableBrushesL(); |
|
4748 |
iWatermarkLayout->UpdateChildrenLayout(); |
|
4749 |
||
4750 |
iComponentLayout = CAlfGridLayout::AddNewL(*iOwnerControl, 1, 1, |
|
4751 |
iWatermarkLayout); |
|
4752 |
iComponentLayout->SetClipping(ETrue); |
|
4753 |
iComponentLayout->EnableBrushesL(); |
|
4754 |
iComponentLayout->UpdateChildrenLayout(); |
|
4755 |
||
4756 |
if (AknLayoutUtils::LayoutMirrored()) |
|
4757 |
{ |
|
4758 |
iDummyScrollbar = CAlfImageVisual::AddNewL(*iOwnerControl); |
|
4759 |
iComponentLayout->Append(iDummyScrollbar); |
|
4760 |
iListDeck = CAlfDeckLayout::AddNewL(*iOwnerControl, iComponentLayout); |
|
4761 |
} |
|
4762 |
else |
|
4763 |
{ |
|
4764 |
iListDeck = CAlfDeckLayout::AddNewL(*iOwnerControl, iComponentLayout); |
|
4765 |
iDummyScrollbar = CAlfImageVisual::AddNewL(*iOwnerControl); |
|
4766 |
iComponentLayout->Append(iDummyScrollbar); |
|
4767 |
} |
|
4768 |
iListItemBackgroundLayout = CAlfFlowLayout::AddNewL(*iOwnerControl, |
|
4769 |
iListDeck); |
|
4770 |
iListItemBackgroundLayout->SetFlowDirection(CAlfFlowLayout::EFlowVertical); |
|
4771 |
iListItemBackgroundLayout->SetClipping(ETrue); |
|
4772 |
iListItemBackgroundLayout->EnableScrollingL(ETrue); |
|
4773 |
TAlfTimedPoint tpListScrollOffset; |
|
4774 |
tpListScrollOffset.SetStyle(EAlfTimedValueStyleLinear); |
|
4775 |
iListItemBackgroundLayout->SetScrollOffset(tpListScrollOffset); |
|
4776 |
||
4777 |
iSelectorLayout = CAlfDeckLayout::AddNewL(*iOwnerControl, iListDeck); |
|
4778 |
iSelectorLayout->SetClipping(ETrue); |
|
4779 |
||
4780 |
iListLayout = CAlfFlowLayout::AddNewL(*iOwnerControl, iListDeck); |
|
4781 |
iListLayout->SetFlowDirection(CAlfFlowLayout::EFlowVertical); |
|
4782 |
||
4783 |
iListLayout->EnableBrushesL(); |
|
4784 |
iListLayout->EnableScrollingL(ETrue); |
|
4785 |
iListLayout->SetScrollOffset(tpListScrollOffset); |
|
4786 |
||
4787 |
//list pane's padding taken from layout manager |
|
4788 |
EnableListPanePadding(ETrue); |
|
4789 |
||
4790 |
iListLayout->UpdateChildrenLayout(); |
|
4791 |
iListItemBackgroundLayout->UpdateChildrenLayout(); |
|
4792 |
||
4793 |
iBorderBrush = CAlfBorderBrush::NewL(iOwnerControl->Env(), 0, 1, 0, 0); |
|
4794 |
static_cast<CAlfBorderBrush*> (iBorderBrush)->SetColor(KRgbGray); |
|
4795 |
static_cast<CAlfBorderBrush*> (iBorderBrush)->SetThickness( |
|
4796 |
TAlfTimedPoint(0.0f, 0.5f)); |
|
4797 |
iBorderBrush->SetLayer(EAlfBrushLayerForeground); |
|
4798 |
||
4799 |
iScrollbarVisibility = EFsScrollbarShowAlways; |
|
4800 |
||
4801 |
iScrollBarLayout = CAlfAnchorLayout::AddNewL( *iOwnerControl, iListDeck ); |
|
4802 |
iScrollBarLayout->SetFlags( EAlfVisualFlagIgnorePointer ); |
|
4803 |
||
4804 |
if ( iFlags.IsSet( EPopupMode ) ) |
|
4805 |
{ |
|
4806 |
iScrollBar = CUiCAknScrollBarAdapter::NewL( *this ); |
|
4807 |
} |
|
4808 |
else |
|
4809 |
{ |
|
4810 |
iScrollBar = CUiCScrollBar::NewL( iOwnerControl->Env(), iScrollBarLayout ); |
|
4811 |
} |
|
4812 |
||
4813 |
iScrollBarModel.SetHeight(iComponentLayout->Size().Target().iY); |
|
4814 |
iScrollBarModel.SetWindowPosition(iViewPort.Position().iY); |
|
4815 |
iScrollBarModel.SetWindowHeight(iListLayout->Size().iY.Target()); |
|
4816 |
||
4817 |
iScrollBar->Show( EFalse ); |
|
4818 |
iScrollBar->UpdateModelL( iScrollBarModel ); |
|
4819 |
||
4820 |
iFadeEffect = CFsFadeEffect::NewL(iOwnerControl, this, iRootLayout, 0); |
|
4821 |
iSlideEffect = CFsSlideEffect::NewL(iOwnerControl, this, iRootLayout, 0); |
|
4822 |
||
4823 |
iFadeInEffectTime = KFsListDefaultFadeInTime; |
|
4824 |
iFadeOutEffectTime = KFsListDefaultFadeOutTime; |
|
4825 |
||
4826 |
iIntx = new (ELeave) CFsInteractionInterval; |
|
4827 |
||
4828 |
iOwnerControl->Env().AddActionObserverL(this); |
|
4829 |
||
4830 |
iWorld.AddObserverL(iViewPort); |
|
4831 |
iWorld.AddObserverL(*this); |
|
4832 |
UpdateViewPortL(); |
|
4833 |
} |
|
4834 |
||
4835 |
// --------------------------------------------------------------------------- |
|
4836 |
// Handle scrollbar events |
|
4837 |
// --------------------------------------------------------------------------- |
|
4838 |
// |
|
4839 |
void CFsTreeVisualizerBase::HandleScrollEventL( const MUiCScrollBar& aScrollBar, |
|
4840 |
MUiCScrollBar::TEvent aEvent ) |
|
4841 |
{ |
|
4842 |
FUNC_LOG; |
|
4843 |
switch (aEvent) |
|
4844 |
{ |
|
4845 |
case MUiCScrollBar::EScrollHome: |
|
4846 |
// Home |
|
4847 |
break; |
|
4848 |
case MUiCScrollBar::EScrollEnd: |
|
4849 |
// End |
|
4850 |
break; |
|
4851 |
default: |
|
4852 |
TPoint position(iViewPort.Position()); |
|
4853 |
position.iY = aScrollBar.ThumbPosition(); |
|
4854 |
iViewPort.SetPositionL(position); |
|
4855 |
break; |
|
4856 |
} |
|
4857 |
} |
|
4858 |
||
4859 |
// --------------------------------------------------------------------------- |
|
4860 |
// Handle visibility change |
|
4861 |
// --------------------------------------------------------------------------- |
|
4862 |
// |
|
4863 |
void CFsTreeVisualizerBase::NotifyControlVisibilityChange(TBool aIsVisible) |
|
4864 |
{ |
|
4865 |
FUNC_LOG; |
|
4866 |
||
4867 |
if (aIsVisible && iVisualizationState == EFsTreeVisible) |
|
4868 |
{ |
|
4869 |
UpdateScrollBar(); |
|
4870 |
} |
|
4871 |
else |
|
4872 |
{ |
|
4873 |
iScrollBar->Show( EFalse ); |
|
4874 |
} |
|
4875 |
} |
|
4876 |
||
4877 |
// --------------------------------------------------------------------------- |
|
4878 |
// |
|
4879 |
// --------------------------------------------------------------------------- |
|
4880 |
// |
|
4881 |
void CFsTreeVisualizerBase::DisableKineticScrolling( TBool aDisable ) |
|
4882 |
{ |
|
4883 |
FUNC_LOG; |
|
4884 |
iKineticScrollingDisabled = aDisable; |
|
4885 |
} |
|
4886 |
||
4887 |
||
4888 |
// --------------------------------------------------------------------------- |
|
4889 |
// |
|
4890 |
// --------------------------------------------------------------------------- |
|
4891 |
// |
|
4892 |
TBool CFsTreeVisualizerBase::IsKineticScrollingDisabled() const |
|
4893 |
{ |
|
4894 |
FUNC_LOG; |
|
4895 |
return iKineticScrollingDisabled; |
|
4896 |
} |
|
4897 |
||
4898 |
// --------------------------------------------------------------------------- |
|
4899 |
// World updated |
|
4900 |
// --------------------------------------------------------------------------- |
|
4901 |
// |
|
4902 |
void CFsTreeVisualizerBase::WorldUpdatedL(const TWorld& /*aWorld*/) |
|
4903 |
{ |
|
4904 |
FUNC_LOG; |
|
4905 |
if (iFlags.IsSet(EPhysicsOn)) |
|
4906 |
{ |
|
4907 |
iFlags.Set(EUpdatePhysicsAfterSimulationFinished); |
|
4908 |
} |
|
4909 |
else |
|
4910 |
{ |
|
4911 |
UpdatePhysicsL(); |
|
4912 |
} |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4913 |
UpdateScrollBarL(); |
64 | 4914 |
} |
4915 |
||
4916 |
// --------------------------------------------------------------------------- |
|
4917 |
// ViewPort updated |
|
4918 |
// --------------------------------------------------------------------------- |
|
4919 |
// |
|
4920 |
void CFsTreeVisualizerBase::ViewPortUpdatedL(TViewPort& aViewPort, TUpdatedByPhysic aUpdateByPhysic) |
|
4921 |
{ |
|
4922 |
FUNC_LOG; |
|
4923 |
||
4924 |
// Only upadte view if the list is visible |
|
4925 |
if (iVisualizationState != EFsTreeVisible) |
|
4926 |
{ |
|
4927 |
return; |
|
4928 |
} |
|
4929 |
||
4930 |
RArray<TFsTreeItemId> visibleItems; |
|
4931 |
RArray<TFsTreeItemId> removableItems; |
|
4932 |
TInt scrollOffset; |
|
4933 |
TBool fullUpdate; |
|
4934 |
CleanupClosePushL(visibleItems); |
|
4935 |
CleanupClosePushL(removableItems); |
|
4936 |
aViewPort.GetVisibleItemsL(removableItems, visibleItems, scrollOffset, |
|
4937 |
fullUpdate); |
|
4938 |
TAlfRefreshMode rm(EAlfRefreshModeAutomatic); |
|
4939 |
rm = CAlfStatic::Env().RefreshMode(); |
|
4940 |
CAlfStatic::Env().SetRefreshMode(EAlfRefreshModeManual); |
|
4941 |
iListLayout->SetFlag(EAlfVisualFlagFreezeLayout); |
|
4942 |
||
4943 |
if(aUpdateByPhysic == EUpdatedByPhisicEnd) |
|
4944 |
{ |
|
4945 |
RArray<TFsTreeItemId> myVisibleItems; |
|
4946 |
TInt myOffset; |
|
4947 |
CleanupClosePushL(myVisibleItems); |
|
4948 |
aViewPort.GetVisibleItemsL(myVisibleItems, myOffset); |
|
4949 |
||
4950 |
for (TInt i = 0; i < myVisibleItems.Count(); i++) |
|
4951 |
{ |
|
4952 |
const TFsTreeItemId itemId(myVisibleItems[i]); |
|
4953 |
if (itemId != KFsTreeNoneID) |
|
4954 |
{ |
|
4955 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer( |
|
4956 |
itemId); |
|
4957 |
visualizer->UpdateL(iTreeData->ItemData(itemId), |
|
4958 |
IsItemFocused(itemId) && IsFocusShown(), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4959 |
iTreeData->Level(itemId), iMarkIcon, iMenuIcon, |
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
4960 |
0); |
64 | 4961 |
} |
4962 |
} |
|
4963 |
CleanupStack::PopAndDestroy(); |
|
4964 |
} |
|
4965 |
||
4966 |
// clear list |
|
4967 |
TInt removed(0); |
|
4968 |
if (fullUpdate) |
|
4969 |
{ |
|
4970 |
removed += iListLayout->Count(); |
|
4971 |
for (TInt i = removed - 1; i >= 0; i--) |
|
4972 |
{ |
|
4973 |
iTreeData->ItemVisualizer(VisualItemId(&iListLayout->Visual(i)))->Hide(); |
|
4974 |
} |
|
4975 |
iVisibleItems.Reset(); |
|
4976 |
} |
|
4977 |
else |
|
4978 |
{ |
|
4979 |
for (TInt i = 0; i < removableItems.Count(); i++) |
|
4980 |
{ |
|
4981 |
MFsTreeItemVisualizer* itemVisualizer(iTreeData->ItemVisualizer(removableItems[i])); |
|
4982 |
if (itemVisualizer) |
|
4983 |
{ |
|
4984 |
CAlfVisual* visual(&itemVisualizer->Layout()); |
|
4985 |
if (iListLayout->FindVisual(visual) != KErrNotFound) |
|
4986 |
{ |
|
4987 |
removed++; |
|
4988 |
} |
|
4989 |
itemVisualizer->Hide(); |
|
4990 |
const TInt index(iVisibleItems.Find(removableItems[i])); |
|
4991 |
if (index != KErrNotFound) |
|
4992 |
{ |
|
4993 |
iVisibleItems.Remove(index); |
|
4994 |
} |
|
4995 |
} |
|
4996 |
} |
|
4997 |
} |
|
4998 |
||
4999 |
// update items to list |
|
5000 |
TInt added(0); |
|
5001 |
for (TInt i = 0; i < visibleItems.Count(); i++) |
|
5002 |
{ |
|
5003 |
const TFsTreeItemId itemId(visibleItems[i]); |
|
5004 |
if (itemId != KFsTreeNoneID) |
|
5005 |
{ |
|
5006 |
MFsTreeItemVisualizer* visualizer = iTreeData->ItemVisualizer( |
|
5007 |
itemId); |
|
5008 |
visualizer->ShowL(*iListLayout); |
|
5009 |
TSize size(visualizer->Size()); |
|
5010 |
TInt listInnerWidth(iListLayout->Size().IntTarget().iX); |
|
5011 |
TAlfTimedPoint tpItemSize( listInnerWidth, size.iHeight ); |
|
5012 |
CAlfLayout& visualizerLayout(visualizer->Layout()); |
|
5013 |
visualizerLayout.SetSize(tpItemSize); |
|
5014 |
visualizer->UpdateL(iTreeData->ItemData(itemId), |
|
5015 |
IsItemFocused(itemId) && IsFocusShown(), |
|
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
5016 |
iTreeData->Level(itemId), iMarkIcon, iMenuIcon, |
64 | 5017 |
0); |
5018 |
visualizerLayout.PropertySetIntegerL(KPropertyItemId(), itemId); |
|
5019 |
visualizerLayout.Brushes()->AppendL(iBorderBrush, |
|
5020 |
EAlfDoesNotHaveOwnership); |
|
5021 |
CAlfBrush* bgBrush(NULL); |
|
5022 |
if (visualizer->GetBackgroundBrush(bgBrush)) |
|
5023 |
{ |
|
5024 |
bgBrush->SetLayer(EAlfBrushLayerBackground); |
|
5025 |
visualizerLayout.Brushes()->AppendL(bgBrush, |
|
5026 |
EAlfDoesNotHaveOwnership); |
|
5027 |
} |
|
5028 |
const TInt orderPosition( |
|
5029 |
i < iListLayout->Count() ? i : iListLayout->Count() - 1); |
|
5030 |
iListLayout->Reorder(visualizerLayout, orderPosition); |
|
5031 |
iVisibleItems.AppendL(itemId); |
|
5032 |
added++; |
|
5033 |
} |
|
5034 |
} |
|
5035 |
||
5036 |
INFO_2("totalItems: %d, visibleItems: %d", iWorld.ItemCount(), visibleItems.Count()); |
|
5037 |
CleanupStack::PopAndDestroy(2); // visibleItems.Close(), removableItems.Close() |
|
5038 |
// scroll list layout by offset |
|
5039 |
TAlfTimedPoint alfOffset; |
|
5040 |
alfOffset.iY.SetTarget(scrollOffset, 0); |
|
5041 |
iListLayout->SetScrollOffset(alfOffset); |
|
5042 |
iListLayout->ClearFlag(EAlfVisualFlagFreezeLayout); |
|
5043 |
iListLayout->UpdateChildrenLayout(); |
|
5044 |
UpdateSelectorVisualL(); |
|
5045 |
UpdateScrollBarIfNeededL(); |
|
5046 |
CAlfStatic::Env().RefreshCallBack(&CAlfStatic::Env()); |
|
5047 |
CAlfStatic::Env().SetRefreshMode(rm); |
|
5048 |
} |
|
5049 |
||
5050 |
// --------------------------------------------------------------------------- |
|
5051 |
// Set panning position |
|
5052 |
// --------------------------------------------------------------------------- |
|
5053 |
// |
|
5054 |
void CFsTreeVisualizerBase::SetPanningPosition(const TPoint& aDelta) |
|
5055 |
{ |
|
5056 |
FUNC_LOG; |
|
5057 |
iPhysics->RegisterPanningPosition(aDelta); |
|
5058 |
iFlags.Set( EListPanning ); |
|
5059 |
SetFocusVisibility( EFalse ); |
|
5060 |
} |
|
5061 |
||
5062 |
// --------------------------------------------------------------------------- |
|
5063 |
// Starts flicking. |
|
5064 |
// --------------------------------------------------------------------------- |
|
5065 |
// |
|
5066 |
void CFsTreeVisualizerBase::StartPhysics(TPoint& aDrag, |
|
5067 |
const TTime& aStartTime) |
|
5068 |
{ |
|
5069 |
FUNC_LOG; |
|
5070 |
TTime startTime( aStartTime ); |
|
5071 |
TTime now; |
|
5072 |
now.HomeTime(); |
|
5073 |
TInt moveTime( now.MicroSecondsFrom( aStartTime ).Int64() ); |
|
5074 |
if (moveTime > KFlickMaxDuration) |
|
5075 |
{ |
|
5076 |
startTime = now - TTimeIntervalMicroSeconds( KFlickMaxDuration - 1 ); |
|
5077 |
aDrag.iY = aDrag.iY * KFlickMaxDuration / moveTime; |
|
5078 |
} |
|
5079 |
if (iPhysics->StartPhysics(aDrag, startTime)) |
|
5080 |
{ |
|
5081 |
iFlags.Set(EPhysicsOn); |
|
5082 |
} |
|
5083 |
} |
|
5084 |
||
5085 |
// --------------------------------------------------------------------------- |
|
5086 |
// Update physics |
|
5087 |
// --------------------------------------------------------------------------- |
|
5088 |
// |
|
5089 |
void CFsTreeVisualizerBase::UpdatePhysicsL() |
|
5090 |
{ |
|
5091 |
FUNC_LOG; |
|
5092 |
if (iPhysics) |
|
5093 |
{ |
|
5094 |
SafeDelete(iPhysics); |
|
5095 |
iPhysics = CAknPhysics::NewL(*this, NULL ); |
|
5096 |
const TSize viewSize(iViewPort.Size()); |
|
5097 |
const TSize worldSize(viewSize.iWidth, Max(iWorld.Height(), |
|
5098 |
viewSize.iHeight)); |
|
5099 |
iPhysics->InitPhysicsL(worldSize, viewSize, EFalse); |
|
5100 |
iPhysics->SetFriction(KDefaultFriction); |
|
5101 |
} |
|
5102 |
} |
|
5103 |
||
5104 |
// --------------------------------------------------------------------------- |
|
5105 |
// Returns viewPort top-left position |
|
5106 |
// --------------------------------------------------------------------------- |
|
5107 |
// |
|
5108 |
TPoint CFsTreeVisualizerBase::ViewPortTopPosition() const |
|
5109 |
{ |
|
5110 |
FUNC_LOG; |
|
5111 |
return iViewPort.Position(); |
|
5112 |
} |
|
5113 |
||
5114 |
// --------------------------------------------------------------------------- |
|
5115 |
// Physic updated view position |
|
5116 |
// --------------------------------------------------------------------------- |
|
5117 |
// |
|
5118 |
void CFsTreeVisualizerBase::ViewPositionChanged(const TPoint& aNewPosition, |
|
5119 |
TBool /*aDrawNow*/, TUint aFlags ) |
|
5120 |
{ |
|
5121 |
FUNC_LOG; |
|
5122 |
TInt error(KErrNone); |
|
5123 |
TRAP( error, iViewPort.SetCenterPositionL(aNewPosition, ETrue, |
|
5124 |
aFlags == 0 ? EUpdatedByPhisic : ENotUpdatedByPhisic ) ); |
|
5125 |
ERROR_1( error, "iViewPort.SetCenterPositionL failed with error: %d", error ); |
|
5126 |
} |
|
5127 |
||
5128 |
// --------------------------------------------------------------------------- |
|
5129 |
// Physic emulation has finished |
|
5130 |
// --------------------------------------------------------------------------- |
|
5131 |
// |
|
5132 |
void CFsTreeVisualizerBase::PhysicEmulationEnded() |
|
5133 |
{ |
|
5134 |
FUNC_LOG; |
|
5135 |
||
5136 |
TRAP_IGNORE( iViewPort.SetCenterPositionL(iViewPort.CenterPosition(), ETrue, EUpdatedByPhisicEnd)); |
|
5137 |
||
5138 |
iFlags.Clear(EPhysicsOn); |
|
5139 |
if (iFlags.IsSet(EUpdatePhysicsAfterSimulationFinished)) |
|
5140 |
{ |
|
5141 |
iFlags.Clear(EUpdatePhysicsAfterSimulationFinished); |
|
5142 |
TRAP_IGNORE( UpdatePhysicsL() ); |
|
5143 |
} |
|
5144 |
} |
|
5145 |
||
5146 |
// --------------------------------------------------------------------------- |
|
5147 |
// |
|
5148 |
// --------------------------------------------------------------------------- |
|
5149 |
// |
|
5150 |
TPoint CFsTreeVisualizerBase::ViewPosition() const |
|
5151 |
{ |
|
5152 |
FUNC_LOG; |
|
5153 |
return iViewPort.CenterPosition(); |
|
5154 |
} |
|
5155 |
||
5156 |
// --------------------------------------------------------------------------- |
|
5157 |
// Wrapper for SetFocusedItemAndSendEventL to trap the error and return it |
|
5158 |
// instead of leaving. |
|
5159 |
// --------------------------------------------------------------------------- |
|
5160 |
// |
|
5161 |
TInt CFsTreeVisualizerBase::SetFocusedItemAndSendEvent( |
|
5162 |
const TFsTreeItemId aItemId, TPointerEventType aEventType, const TPoint& aPoint ) |
|
5163 |
{ |
|
5164 |
FUNC_LOG; |
|
5165 |
TRAPD(error, SetFocusedItemAndSendEventL( aItemId, aEventType, aPoint ) ); |
|
5166 |
return error; |
|
5167 |
} |
|
5168 |
||
5169 |
// --------------------------------------------------------------------------- |
|
5170 |
// Sets the specified item as focused and sends event about touch focusing if |
|
5171 |
// the same item is already focused, action event will be sent instead. |
|
5172 |
// --------------------------------------------------------------------------- |
|
5173 |
// |
|
5174 |
void CFsTreeVisualizerBase::SetFocusedItemAndSendEventL( |
|
5175 |
const TFsTreeItemId aItemId, TPointerEventType aEventType, const TPoint& aPoint ) |
|
5176 |
{ |
|
5177 |
FUNC_LOG; |
|
5178 |
||
5179 |
// Handles all other than pointer up events. |
|
5180 |
// Focus is drawn when: |
|
5181 |
// - new item is selected (FocusedItem() != aItemId) |
|
5182 |
// - pointer is pressed down and focus is not visible by default |
|
5183 |
// (aEventType == EPointerDown ) && IsFocusShown()) |
|
5184 |
if( ( aEventType < EPointerUp ) && |
|
5185 |
( !iFlags.IsSet( EListFocused ) || FocusedItem() != aItemId || |
|
5186 |
( ( aEventType == EPointerDown ) && IsFocusShown() ) ) ) |
|
5187 |
{ |
|
5188 |
SetFocusedItemL( aItemId ); |
|
5189 |
iVisualizerObserver->TreeVisualizerEventL( |
|
5190 |
MFsTreeVisualizerObserver::EFsTreeItemTouchFocused, |
|
5191 |
FocusedItem(), aPoint ); |
|
5192 |
||
5193 |
// If DirectTouchMode (actions happens in pointer down events) |
|
5194 |
if( iFlags.IsSet( EDirectTouchMode ) && aEventType == EPointerDown ) |
|
5195 |
{ |
|
5196 |
iTouchPressed = EFalse; |
|
5197 |
iVisualizerObserver->TreeVisualizerEventL( |
|
5198 |
MFsTreeVisualizerObserver::EFsTreeItemTouchAction, |
|
5199 |
aItemId, aPoint ); |
|
5200 |
} |
|
5201 |
} |
|
5202 |
else if( aEventType == ELongTap ) |
|
5203 |
{ |
|
5204 |
// HandlePointerEventL do not get pointer up event after long tap event |
|
5205 |
// so <code>iTouchPressed</code> flag needs to be reset here. |
|
5206 |
iTouchPressed = EFalse; |
|
5207 |
iVisualizerObserver->TreeVisualizerEventL( |
|
5208 |
MFsTreeVisualizerObserver::EFsTreeItemTouchLongTap, |
|
5209 |
aItemId, aPoint ); |
|
5210 |
} |
|
5211 |
else if( aEventType == EPointerUp ) |
|
5212 |
{ |
|
5213 |
// Ignore pointer up action IF physic emulation was stopped on pointer down |
|
5214 |
if ( !iFlags.IsSet(EIgnorePointerUpAction) ) |
|
5215 |
{ |
|
5216 |
iVisualizerObserver->TreeVisualizerEventL( |
|
5217 |
MFsTreeVisualizerObserver::EFsTreeItemTouchAction, aItemId, aPoint ); |
|
5218 |
} |
|
5219 |
} |
|
5220 |
// Added for tactile feedback |
|
5221 |
MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
5222 |
if( feedback ) |
|
5223 |
{ |
|
5224 |
feedback->InstantFeedback( ETouchFeedbackBasic ); |
|
5225 |
} |
|
5226 |
} |
|
5227 |
||
5228 |
// CFsTreeVisualizerBase::CDragHandler |
|
5229 |
||
5230 |
// --------------------------------------------------------------------------- |
|
5231 |
// |
|
5232 |
// --------------------------------------------------------------------------- |
|
5233 |
// |
|
5234 |
CFsTreeVisualizerBase::CDragHandler* CFsTreeVisualizerBase::CDragHandler::NewL( |
|
5235 |
CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout, |
|
5236 |
const TBitFlags& aFlags) |
|
5237 |
{ |
|
5238 |
FUNC_LOG; |
|
5239 |
CDragHandler* self = new (ELeave) CDragHandler(aTree, aHighlightTimeout, |
|
5240 |
aFlags); |
|
5241 |
CleanupStack::PushL(self); |
|
5242 |
self->ConstructL(); |
|
5243 |
CleanupStack::Pop(self); |
|
5244 |
return self; |
|
5245 |
} |
|
5246 |
||
5247 |
// --------------------------------------------------------------------------- |
|
5248 |
// |
|
5249 |
// --------------------------------------------------------------------------- |
|
5250 |
// |
|
5251 |
CFsTreeVisualizerBase::CDragHandler::~CDragHandler() |
|
5252 |
{ |
|
5253 |
FUNC_LOG; |
|
5254 |
delete iHighlightTimer; |
|
5255 |
} |
|
5256 |
||
5257 |
// --------------------------------------------------------------------------- |
|
5258 |
// |
|
5259 |
// --------------------------------------------------------------------------- |
|
5260 |
// |
|
5261 |
void CFsTreeVisualizerBase::CDragHandler::Reset() |
|
5262 |
{ |
|
5263 |
FUNC_LOG; |
|
5264 |
iFlags.ClearAll(); |
|
5265 |
iHighlightTimer->Cancel(); |
|
5266 |
iItemId = KFsTreeNoneID; |
|
5267 |
iDragDirection = EDraggingNone; |
|
5268 |
} |
|
5269 |
||
5270 |
// --------------------------------------------------------------------------- |
|
5271 |
// |
|
5272 |
// --------------------------------------------------------------------------- |
|
5273 |
// |
|
5274 |
CFsTreeVisualizerBase::CDragHandler::TDragDirection |
|
5275 |
CFsTreeVisualizerBase::CDragHandler::DragDirection( |
|
5276 |
const TPoint& aCurrent, const TPoint aPrevious ) const |
|
5277 |
{ |
|
5278 |
FUNC_LOG; |
|
5279 |
if (aCurrent.iY > aPrevious.iY) |
|
5280 |
{ |
|
5281 |
return EDraggingDown; |
|
5282 |
} |
|
5283 |
else if (aCurrent.iY < aPrevious.iY) |
|
5284 |
{ |
|
5285 |
return EDraggingUp; |
|
5286 |
} |
|
5287 |
else |
|
5288 |
{ |
|
5289 |
return iDragDirection; |
|
5290 |
} |
|
5291 |
} |
|
5292 |
||
5293 |
// --------------------------------------------------------------------------- |
|
5294 |
// |
|
5295 |
// --------------------------------------------------------------------------- |
|
5296 |
// |
|
5297 |
void CFsTreeVisualizerBase::CDragHandler::PointerDown( |
|
5298 |
const TPointerEvent& aEvent, const TFsTreeItemId aItemId ) |
|
5299 |
{ |
|
5300 |
FUNC_LOG; |
|
5301 |
Reset(); |
|
5302 |
iItemId = aItemId; |
|
5303 |
iPosition = aEvent.iParentPosition; |
|
5304 |
iLastPointerPosition = aEvent.iParentPosition; |
|
5305 |
iStartTime.HomeTime(); |
|
5306 |
iFlags.Set( EPointerDownReceived ); |
|
5307 |
iTree.SetFocusedItemAndSendEvent( iItemId, EPointerDown, iPosition ); |
|
5308 |
} |
|
5309 |
||
5310 |
// --------------------------------------------------------------------------- |
|
5311 |
// |
|
5312 |
// --------------------------------------------------------------------------- |
|
5313 |
// |
|
5314 |
void CFsTreeVisualizerBase::CDragHandler::PointerRepeat( |
|
5315 |
const TPointerEvent& aEvent ) |
|
5316 |
{ |
|
5317 |
if( iItemId != KFsTreeNoneID && !IsFlicking() ) |
|
5318 |
{ |
|
5319 |
iFlags.Set( EWasRepeat ); |
|
5320 |
iTree.SetFocusedItemAndSendEvent( iItemId, ELongTap, aEvent.iParentPosition ); |
|
5321 |
} |
|
5322 |
} |
|
5323 |
||
5324 |
// --------------------------------------------------------------------------- |
|
5325 |
// |
|
5326 |
// --------------------------------------------------------------------------- |
|
5327 |
// |
|
5328 |
void CFsTreeVisualizerBase::CDragHandler::PointerUp( |
|
5329 |
const TPointerEvent& aEvent, const TFsTreeItemId aItemId ) |
|
5330 |
{ |
|
5331 |
FUNC_LOG; |
|
5332 |
// If kinetic scrolling is disabled |
|
5333 |
if( iTree.IsKineticScrollingDisabled() ) |
|
5334 |
{ |
|
5335 |
if( ( aItemId != KFsTreeNoneID ) && |
|
5336 |
( iTree.FocusedItem() == aItemId ) ) |
|
5337 |
{ |
|
5338 |
iTree.SetFocusedItemAndSendEvent( iItemId, EPointerUp, aEvent.iParentPosition ); |
|
5339 |
} |
|
5340 |
} |
|
5341 |
else if ( IsFlicking() ) |
|
5342 |
{ |
|
5343 |
TPoint drag(iPosition - aEvent.iParentPosition); |
|
5344 |
iTree.StartPhysics( drag, iStartTime ); |
|
5345 |
} |
|
5346 |
else if( !iFlags.IsSet( EWasRepeat ) && iItemId != KFsTreeNoneID ) |
|
5347 |
{ |
|
5348 |
iTree.SetFocusedItemAndSendEvent( iItemId, EPointerUp, aEvent.iParentPosition ); |
|
5349 |
} |
|
5350 |
iLastPointerPosition = iPosition = TPoint(); |
|
5351 |
iFlags.Clear( EPointerDownReceived ); |
|
5352 |
iDragDirection = EDraggingNone; |
|
5353 |
} |
|
5354 |
||
5355 |
// --------------------------------------------------------------------------- |
|
5356 |
// |
|
5357 |
// --------------------------------------------------------------------------- |
|
5358 |
// |
|
5359 |
TInt CFsTreeVisualizerBase::CDragHandler::DragDelta( |
|
5360 |
const TPointerEvent& aEvent) const |
|
5361 |
{ |
|
5362 |
FUNC_LOG; |
|
5363 |
return Abs(iPosition.iY - aEvent.iPosition.iY); |
|
5364 |
} |
|
5365 |
||
5366 |
// --------------------------------------------------------------------------- |
|
5367 |
// |
|
5368 |
// --------------------------------------------------------------------------- |
|
5369 |
// |
|
5370 |
TPoint CFsTreeVisualizerBase::CDragHandler::PointerDrag( |
|
5371 |
const TPointerEvent& aEvent, const TFsTreeItemId /*aItemId*/) |
|
5372 |
{ |
|
5373 |
FUNC_LOG; |
|
5374 |
// If kinetic scrolling is disabled |
|
5375 |
if( iTree.IsKineticScrollingDisabled() ) |
|
5376 |
{ |
|
5377 |
iLastPointerPosition = iPosition; |
|
5378 |
return aEvent.iPosition; |
|
5379 |
} |
|
5380 |
||
5381 |
if (!iFlags.IsSet(EPointerDownReceived)) |
|
5382 |
{ |
|
5383 |
iLastPointerPosition = iPosition = aEvent.iPosition; |
|
5384 |
iFlags.Set(EPointerDownReceived); |
|
5385 |
} |
|
5386 |
else |
|
5387 |
{ |
|
5388 |
iHighlightTimer->Cancel(); |
|
5389 |
if (!iTreeVisualizerFlags.IsSet(EPhysicsOn)) |
|
5390 |
{ |
|
5391 |
iTree.SetPanningPosition(TPoint(0, iLastPointerPosition.iY |
|
5392 |
- aEvent.iPosition.iY)); |
|
5393 |
} |
|
5394 |
TDragDirection dragDirection(DragDirection(aEvent.iPosition, iLastPointerPosition)); |
|
5395 |
const TBool dragDirectionChanged( |
|
5396 |
(dragDirection == EDraggingUp && iDragDirection == EDraggingDown ) || |
|
5397 |
(dragDirection == EDraggingDown && iDragDirection == EDraggingUp ) ); |
|
5398 |
if (dragDirectionChanged) |
|
5399 |
{ |
|
5400 |
iPosition = aEvent.iPosition; |
|
5401 |
iStartTime.HomeTime(); |
|
5402 |
} |
|
5403 |
iDragDirection = dragDirection; |
|
5404 |
iLastPointerPosition = aEvent.iPosition; |
|
5405 |
} |
|
5406 |
return iPosition - aEvent.iPosition; |
|
5407 |
} |
|
5408 |
||
5409 |
// --------------------------------------------------------------------------- |
|
5410 |
// |
|
5411 |
// --------------------------------------------------------------------------- |
|
5412 |
// |
|
5413 |
void CFsTreeVisualizerBase::CDragHandler::EnableFlicking() |
|
5414 |
{ |
|
5415 |
FUNC_LOG; |
|
5416 |
iFlags.Set(EFlicking); |
|
5417 |
} |
|
5418 |
||
5419 |
// --------------------------------------------------------------------------- |
|
5420 |
// |
|
5421 |
// --------------------------------------------------------------------------- |
|
5422 |
// |
|
5423 |
TBool CFsTreeVisualizerBase::CDragHandler::IsFlicking() const |
|
5424 |
{ |
|
5425 |
FUNC_LOG; |
|
5426 |
return iFlags.IsSet(EFlicking); |
|
5427 |
} |
|
5428 |
||
5429 |
// --------------------------------------------------------------------------- |
|
5430 |
// |
|
5431 |
// --------------------------------------------------------------------------- |
|
5432 |
// |
|
5433 |
CFsTreeVisualizerBase::CDragHandler::CDragHandler( |
|
5434 |
CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout, |
|
5435 |
const TBitFlags& aFlags) : |
|
5436 |
iTree(aTree), iHighlightTimeout(aHighlightTimeout * 1000), |
|
5437 |
iTreeVisualizerFlags(aFlags) |
|
5438 |
{ |
|
5439 |
FUNC_LOG; |
|
5440 |
} |
|
5441 |
||
5442 |
// --------------------------------------------------------------------------- |
|
5443 |
// |
|
5444 |
// --------------------------------------------------------------------------- |
|
5445 |
// |
|
5446 |
void CFsTreeVisualizerBase::CDragHandler::ConstructL() |
|
5447 |
{ |
|
5448 |
FUNC_LOG; |
|
5449 |
iHighlightTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
|
5450 |
} |
|
5451 |
||
5452 |
// --------------------------------------------------------------------------- |
|
5453 |
// |
|
5454 |
// --------------------------------------------------------------------------- |
|
5455 |
// |
|
5456 |
TInt CFsTreeVisualizerBase::CDragHandler::HighlightTimerCallback( TAny* aPtr ) |
|
5457 |
{ |
|
5458 |
FUNC_LOG; |
|
5459 |
CDragHandler* self = reinterpret_cast<CDragHandler*>( aPtr ); |
|
5460 |
self->iHighlightTimer->Cancel(); |
|
5461 |
return self->iTree.SetFocusedItemAndSendEvent( self->iItemId, ELongTap, self->iPosition ); |
|
5462 |
} |
|
5463 |
||
5464 |
// --------------------------------------------------------------------------- |
|
5465 |
// CFsTreeVisualizerBase::IsFocusShown |
|
5466 |
// --------------------------------------------------------------------------- |
|
5467 |
// |
|
5468 |
TBool CFsTreeVisualizerBase::IsFocusShown() |
|
5469 |
{ |
|
5470 |
return ( iTouchPressed || iFocusVisible ) && iFlags.IsClear( EListPanning ); |
|
5471 |
} |
|
5472 |
||
80
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
5473 |
|
726fba06891a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
73
diff
changeset
|
5474 |
// </cmail> |