|
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 component |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_FSTREELIST_H |
|
20 #define C_FSTREELIST_H |
|
21 |
|
22 |
|
23 /////SYSTEM INCLUDES |
|
24 |
|
25 //////TOOLKIT INCLUDES |
|
26 // <cmail> SF |
|
27 #include <alf/alfcontrol.h> |
|
28 // </cmail> |
|
29 |
|
30 //////PROJECT INCLUDES |
|
31 //<cmail> removed __FS_ALFRED_SUPPORT flag |
|
32 //#include <fsconfig.h> |
|
33 //</cmail> removed __FS_ALFRED_SUPPORT flag |
|
34 |
|
35 #include "fstreelistconstants.h" |
|
36 #include "fstreevisualizerbase.h" |
|
37 #include "fstreevisualizerobserver.h" |
|
38 |
|
39 //////TOOLKIT CLASSES |
|
40 class CAlfEnv; |
|
41 class CAlfTexture; |
|
42 |
|
43 //////PROJECT CLASSES |
|
44 class CFsTree; |
|
45 class CFsTreeControl; |
|
46 class MFsTreeListObserver; |
|
47 class MFsTreeItemData; |
|
48 class MFsTreeItemVisualizer; |
|
49 class MFsTreeNodeVisualizer; |
|
50 class CFsAlfTextStyleManager; |
|
51 |
|
52 /** An array of tree list observers */ |
|
53 typedef RPointerArray<MFsTreeListObserver> RFsTreeListObservers; |
|
54 |
|
55 /** |
|
56 * Batch updates for the tree. |
|
57 */ |
|
58 class MFsTreeBatchProcessing |
|
59 { |
|
60 public: |
|
61 /** |
|
62 * Begin batch update. During batch update changes to the world |
|
63 * will not be updated on screen until the EndUpdateL is called. |
|
64 */ |
|
65 virtual void BeginUpdate() = 0; |
|
66 |
|
67 /** |
|
68 * End batch update. All changes done between BeginUpdate and EndUpdateL |
|
69 * will be shown on screen. |
|
70 */ |
|
71 virtual void EndUpdateL() = 0; |
|
72 }; |
|
73 |
|
74 /** |
|
75 * CFsTreeList is a component for creating and displaying hierarchical list |
|
76 * using tree data structure. |
|
77 * |
|
78 * @code |
|
79 * |
|
80 * @endcode |
|
81 * |
|
82 * @lib |
|
83 */ |
|
84 class CFsTreeList : public CBase, MFsTreeVisualizerObserver, MFsTreeBatchProcessing |
|
85 { |
|
86 public: // from MFsTreeBatchProcessing |
|
87 |
|
88 /** |
|
89 * @see MFsTreeBatchProcessing::BeginUpdate |
|
90 */ |
|
91 void BeginUpdate(); |
|
92 |
|
93 /** |
|
94 * @see MFsTreeBatchProcessing::EndUpdateL |
|
95 */ |
|
96 void EndUpdateL(); |
|
97 |
|
98 public: // Construction |
|
99 |
|
100 |
|
101 /** Pre-defined types of markability in list */ |
|
102 enum TFsTreeListMarkType |
|
103 { |
|
104 EFsTreeListNonMarkable, |
|
105 EFsTreeListMarkable, |
|
106 EFsTreeListMultiMarkable |
|
107 }; |
|
108 |
|
109 /** Pre-defined types of scrolling in list |
|
110 * OLD API - to be removed. |
|
111 * */ |
|
112 enum TFsTreeListScrollbars |
|
113 { |
|
114 EFsTreeListNoScrollbars, |
|
115 EFsTreeListVerticalScrollbar |
|
116 }; |
|
117 |
|
118 /** |
|
119 * Two-phased constructor |
|
120 * |
|
121 * @param aTreeV Pointer to the class responsible for visualizing tree |
|
122 * structure |
|
123 * @param aEnv Reference to the UI toolkit environment |
|
124 */ |
|
125 IMPORT_C static CFsTreeList* NewL( CFsTreeVisualizerBase& aTreeV, |
|
126 CAlfEnv& aEnv ); |
|
127 |
|
128 /** |
|
129 * C++ destructor |
|
130 */ |
|
131 IMPORT_C virtual ~CFsTreeList(); |
|
132 |
|
133 /** |
|
134 * Adds observer to the list of observers |
|
135 * |
|
136 * @param aTreeListObserver Reference to the list observer |
|
137 */ |
|
138 IMPORT_C void AddObserverL( MFsTreeListObserver& aTreeListObserver ); |
|
139 |
|
140 /** |
|
141 * Removes observer from the list of observers |
|
142 * |
|
143 * @param aTreeListObserver Reference to the list observer |
|
144 * |
|
145 * @panic ETreeListPanicObserverNotFound The given observer was not |
|
146 * registered previously |
|
147 */ |
|
148 IMPORT_C void RemoveObserver( MFsTreeListObserver& aTreeListObserver ); |
|
149 |
|
150 public: // Tree list configuration |
|
151 |
|
152 /** |
|
153 * Returns a hitckcock control associated with the component. |
|
154 */ |
|
155 IMPORT_C CAlfControl* TreeControl( ) const; |
|
156 |
|
157 /** |
|
158 * The function sets duration of the slide-in effect. |
|
159 * |
|
160 * @param aTimeMiliseconds Slide in time in milliseconds. |
|
161 */ |
|
162 IMPORT_C void SetSlideInDuration ( TInt aTimeMiliseconds ); |
|
163 |
|
164 /** |
|
165 * The function returns slide in effect's duration. |
|
166 * |
|
167 * @return Slide in duration in miliseconds. |
|
168 */ |
|
169 IMPORT_C TInt SlideInDuration ( ) const; |
|
170 |
|
171 /** |
|
172 * The function sets direction of the slide in effect. |
|
173 * |
|
174 * @param aDirection A direction of the slide in effect. |
|
175 */ |
|
176 IMPORT_C void SetSlideInDirection ( |
|
177 MFsTreeVisualizer::TFsSlideEffect aDirection ); |
|
178 |
|
179 /** |
|
180 * The function returns direction of the slide in effect. |
|
181 * |
|
182 * @return A direction of the slide in effect. |
|
183 */ |
|
184 IMPORT_C MFsTreeVisualizer::TFsSlideEffect SlideInDirection ( ) const; |
|
185 |
|
186 /** |
|
187 * The function sets duration of the slide-out effect. |
|
188 * |
|
189 * @param aTimeMiliseconds Slide out time in milliseconds. |
|
190 */ |
|
191 IMPORT_C void SetSlideOutDuration ( TInt aTimeMiliseconds ); |
|
192 |
|
193 /** |
|
194 * The function returns slide out effect's duration. |
|
195 * |
|
196 * @return Slide out duration in miliseconds. |
|
197 */ |
|
198 IMPORT_C TInt SlideOutDuration ( ) const; |
|
199 |
|
200 /** |
|
201 * The function sets direction of the slide out effect. |
|
202 * |
|
203 * @param aDirection A direction of the slide out effect. |
|
204 */ |
|
205 IMPORT_C void SetSlideOutDirection ( |
|
206 MFsTreeVisualizer::TFsSlideEffect aDirection ); |
|
207 |
|
208 /** |
|
209 * The function returns direction of the slide out effect. |
|
210 * |
|
211 * @return A direction of the slide out effect. |
|
212 */ |
|
213 IMPORT_C MFsTreeVisualizer::TFsSlideEffect SlideOutDirection ( ) const; |
|
214 |
|
215 /** |
|
216 * Returns information about looping type of the list. |
|
217 * |
|
218 * @return Type of list looping. EFsTreeListLoopingDisabled when looping |
|
219 * is turned off. |
|
220 */ |
|
221 IMPORT_C TFsTreeListLoopingType LoopingType() const; |
|
222 |
|
223 /** |
|
224 * Returns information whether list is markable, non-markable or |
|
225 * multi-markable |
|
226 * |
|
227 * @return Returns markability of the list |
|
228 */ |
|
229 IMPORT_C TFsTreeListMarkType MarkType() const; |
|
230 |
|
231 /** |
|
232 * OLD API - to be removed. |
|
233 * Returns information about scrollbars used by list visual |
|
234 * |
|
235 * @return Returns a type of scrollbars that the list uses |
|
236 */ |
|
237 IMPORT_C TFsTreeListScrollbars HasScrollBars() const; |
|
238 |
|
239 /** |
|
240 * Old API - to be removed |
|
241 * |
|
242 * @param aFlag Scrollbar type for the list |
|
243 */ |
|
244 IMPORT_C void SetScrollBarsL( const TFsTreeListScrollbars aFlag ); |
|
245 |
|
246 |
|
247 /** |
|
248 * Returns information about scrollbars used by list visual |
|
249 * |
|
250 * @return Returns a type of scrollbars that the list uses |
|
251 */ |
|
252 IMPORT_C TFsScrollbarVisibility ScrollbarVisibility() const; |
|
253 |
|
254 /** |
|
255 * Enables or disables scrollbars |
|
256 * |
|
257 * @param aFlag Scrollbar type for the list |
|
258 */ |
|
259 IMPORT_C void SetScrollbarVisibilityL(const TFsScrollbarVisibility aVisibility); |
|
260 |
|
261 /** |
|
262 * Sets type of list's looping. |
|
263 * |
|
264 * @param aLoopingType type of list looping. |
|
265 */ |
|
266 IMPORT_C void SetLoopingType( const TFsTreeListLoopingType aLoopingType ); |
|
267 |
|
268 |
|
269 /** |
|
270 * The functions sets fade-in's effect duration. |
|
271 * @param aFadeTime A time in miliseconds for fade in effect. |
|
272 */ |
|
273 IMPORT_C void SetFadeInEffectTime( TInt aFadeTime ); |
|
274 |
|
275 /** |
|
276 * The functions returns fade-in's effect duration. |
|
277 * @return A time in miliseconds for fade in effect. |
|
278 */ |
|
279 IMPORT_C TInt FadeInEffectTime( ); |
|
280 |
|
281 /** |
|
282 * The functions sets fade-out's effect duration. |
|
283 * @param aFadeTime A time in miliseconds for fade-out effect. |
|
284 */ |
|
285 IMPORT_C void SetFadeOutEffectTime( TInt aFadeTime ); |
|
286 |
|
287 /** |
|
288 * The functions returns fade-out's effect duration. |
|
289 * @return A time in miliseconds for fade-out effect. |
|
290 */ |
|
291 IMPORT_C TInt FadeOutEffectTime( ); |
|
292 |
|
293 /** |
|
294 * Function sets the time of list scroll per item and the scroll |
|
295 * acceleration rate. |
|
296 * @param aScrollTime Time (in miliseconds) at which the list items are |
|
297 * scrolled. |
|
298 * @param aScrollAcceleration Rate of scroll acceleration when the up/down |
|
299 * key is pressed for a long time. This is |
|
300 * multiplied by the number of up/down key |
|
301 * repeats. Acceleration rate should be in |
|
302 * 0.0-1.0 range. |
|
303 */ |
|
304 IMPORT_C void SetScrollTime ( TInt aScrollTime, |
|
305 TReal aScrollAcceleration = 0.0 ); |
|
306 |
|
307 /** |
|
308 * Function gets the values of scroll speed and its acceleration rate. |
|
309 * |
|
310 * @param aScrollTime Time (in miliseconds) at which the list items are |
|
311 * scrolled. |
|
312 * |
|
313 * @param aScrollAcceleration Rate of scroll acceleration when the up/down |
|
314 * key is pressed for a long time. |
|
315 */ |
|
316 IMPORT_C void GetScrollTime( TInt& aScrollTime, |
|
317 TReal& aScrollAcceleration ); |
|
318 |
|
319 /** |
|
320 * Enables or disables marking of list items |
|
321 * |
|
322 * @param aFlag Type of markability for the list |
|
323 */ |
|
324 IMPORT_C void SetMarkTypeL( const TFsTreeListMarkType aFlag ); |
|
325 |
|
326 /** |
|
327 * Returns information whether list enables indention or not |
|
328 * |
|
329 * @return ETrue if indention is enabled, EFalse otherwise |
|
330 */ |
|
331 IMPORT_C TInt Indentation() const; |
|
332 |
|
333 /** |
|
334 * Enables or disables indention for list |
|
335 * |
|
336 * @param aIndentation Indentation in pixels. |
|
337 */ |
|
338 IMPORT_C void SetIndentationL( const TInt aIndentation ); |
|
339 |
|
340 /** |
|
341 * The functions sets wether all item in the list should be always in |
|
342 * extended state or in normal state. |
|
343 * The list view is refreshed. |
|
344 * |
|
345 * @param aAlwaysExtended ETrue if items should be always extended. EFalse |
|
346 * if items should be in normal state. |
|
347 */ |
|
348 IMPORT_C void SetItemsAlwaysExtendedL ( TBool aAlwaysExtended ); |
|
349 |
|
350 /* |
|
351 * The function returns if items are always in extended state or in |
|
352 * normal. |
|
353 * |
|
354 * @return ETrue if items are always in extended state, EFalse if items |
|
355 * are in normal state. |
|
356 */ |
|
357 IMPORT_C TBool IsItemsAlwaysExtended ( ); |
|
358 |
|
359 public: // Tree management |
|
360 |
|
361 /** |
|
362 * Inserts new item as a child of parent given by Id with the given |
|
363 * position |
|
364 * |
|
365 * @param aItemD Pointer to item's data |
|
366 * @param aItemV Pointer to item's visualizer |
|
367 * @param aParentId Id of parent node |
|
368 * @param aIndex Position of new item in the list of parent's children (if |
|
369 * omitted, the item is inserted as last) |
|
370 * @param aAllowRefresh Blocks/Allows view update after an item has been added |
|
371 * to the tree list. Currently works only with scrollbar update. |
|
372 * |
|
373 * @return Id of the inserted item |
|
374 * |
|
375 * @panic EFsListPanicParentIdNotFound The specified parent id was not |
|
376 * found |
|
377 * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's |
|
378 * number of children |
|
379 */ |
|
380 IMPORT_C TFsTreeItemId InsertItemL( MFsTreeItemData& aItemD, |
|
381 MFsTreeItemVisualizer& aItemV, |
|
382 const TFsTreeItemId aParentId, |
|
383 const TInt aIndex = -1, |
|
384 const TBool aAllowRefresh = ETrue); |
|
385 |
|
386 /** |
|
387 * Inserts new node as a child of parent given by Id with the given |
|
388 * position |
|
389 * |
|
390 * @param aItemD Pointer to node's data |
|
391 * @param aItemV Pointer to node's visualizer |
|
392 * @param aParentId Id of parent node |
|
393 * @param aIndex Position of new node in the list of parent's children (if |
|
394 * omitted, the node is inserted as last) |
|
395 * |
|
396 * @return Id of the inserted node |
|
397 * |
|
398 * @panic EFsListPanicParentIdNotFound The specified parent id was not |
|
399 * found |
|
400 * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's |
|
401 * number of children |
|
402 */ |
|
403 IMPORT_C TFsTreeItemId InsertNodeL( MFsTreeItemData& aItemD, |
|
404 MFsTreeNodeVisualizer& aNodeV, |
|
405 const TFsTreeItemId aParentId, |
|
406 const TInt aIndex = -1, |
|
407 const TBool aAllowRefresh = ETrue ); |
|
408 |
|
409 /** |
|
410 * Removes the item with given Id from the list. If aItemId is a node all |
|
411 * its children will be removed as well. |
|
412 * |
|
413 * @param aItemId Id of the item to be removed |
|
414 * |
|
415 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
416 * the list |
|
417 */ |
|
418 IMPORT_C void RemoveL( const TFsTreeItemId aItemId ); |
|
419 |
|
420 /** |
|
421 * Removes all items from the list. |
|
422 */ |
|
423 IMPORT_C void RemoveAllL( ); |
|
424 |
|
425 /** |
|
426 * Removes all children of the given node. |
|
427 * |
|
428 * @param aNodeId Id of the node |
|
429 * |
|
430 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
431 * the list |
|
432 * @panic EFsListPanicInvalidItemType Item id was passed instead of the |
|
433 * node id |
|
434 */ |
|
435 IMPORT_C void RemoveChildrenL( const TFsTreeItemId aNodeId ); |
|
436 |
|
437 /** |
|
438 * Moves the item with given Id to the list of children of parent with |
|
439 * given id |
|
440 * |
|
441 * @param aItemId Id of the item to be moved |
|
442 * @param aTargetNode Id of the new parent node |
|
443 * @param aIndex Position of the item in the list of new parent's children |
|
444 * (if omitted, the item/node is inserted as last) |
|
445 * |
|
446 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
447 * the list |
|
448 * @panic EFsListPanicParentIdNotFound The specified parent id was not |
|
449 * found |
|
450 * @panic EFsListPanicInvalidItemType Item id was passed as a second param |
|
451 * instead of the node id |
|
452 * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's |
|
453 * number of children |
|
454 */ |
|
455 IMPORT_C void MoveItemL( const TFsTreeItemId aItemId, |
|
456 const TFsTreeItemId aTargetNode, const TInt aIndex = -1 ); |
|
457 |
|
458 /** |
|
459 * Checks if a node has children, if parameter is omitted, root of the |
|
460 * list is checked to indicate if the list is empty |
|
461 * |
|
462 * @param aNodeId Id of a node |
|
463 * |
|
464 * @return Etrue if a node has children, EFalse if it does not |
|
465 * |
|
466 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
467 * the list |
|
468 * @panic EFsListPanicInvalidItemType Item id was passed instead of the |
|
469 * node id |
|
470 */ |
|
471 IMPORT_C TBool IsEmpty(const TFsTreeItemId aNodeId = KFsTreeRootID) const; |
|
472 |
|
473 /** |
|
474 * Returns the level of an item in tree. |
|
475 * |
|
476 * @param aItemId Id of an item. |
|
477 * |
|
478 * @return Level of an item. |
|
479 */ |
|
480 IMPORT_C TUint Level( const TFsTreeItemId aItemId ) const; |
|
481 |
|
482 /** |
|
483 * Counts elements in the list |
|
484 * |
|
485 * @return Number of list items |
|
486 */ |
|
487 IMPORT_C TUint Count() const; |
|
488 |
|
489 /** |
|
490 * Gets the number of children of the given node |
|
491 * |
|
492 * @param aNodeId Id of the node |
|
493 * |
|
494 * @return Number of node's children |
|
495 * |
|
496 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
497 * the list |
|
498 * @panic EFsListPanicInvalidItemType Item id was passed instead of the |
|
499 * node id |
|
500 */ |
|
501 IMPORT_C TUint CountChildren( const TFsTreeItemId aNodeId ) const; |
|
502 |
|
503 /** |
|
504 * Gets the id of a child of the specified node with the position given |
|
505 * |
|
506 * @param aNodeId Id of a node |
|
507 * @param aIndex Index of the child |
|
508 * |
|
509 * @return Id of a child |
|
510 * |
|
511 * @panic EFsListPanicInvalidItemId The specified item id was not found in |
|
512 * the list |
|
513 * @panic EFsListPanicInvalidItemType Item id was passed instead of the |
|
514 * node id |
|
515 * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's |
|
516 * number of children |
|
517 */ |
|
518 IMPORT_C TFsTreeItemId Child( const TFsTreeItemId aNodeId, |
|
519 const TUint aIndex ) const; |
|
520 |
|
521 /** |
|
522 * Returns the index of a child for a given parent |
|
523 * |
|
524 * @param aNodeId Id of a node |
|
525 * @param aItemId Id of a child |
|
526 * |
|
527 * @return Index of a child |
|
528 * |
|
529 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
530 * in the list |
|
531 * @panic EFsListPanicInvalidItemType Item id was passed instead of |
|
532 * the node id |
|
533 * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's |
|
534 * number of children |
|
535 */ |
|
536 IMPORT_C TUint ChildIndex( const TFsTreeItemId aNodeId, |
|
537 const TFsTreeItemId aItemId ) const; |
|
538 |
|
539 /** |
|
540 * Gets the parent's id for the specified item. If KFsTreeRootID is passed |
|
541 * then KFsTreeNoneID is returned. |
|
542 * |
|
543 * @param aItemId Id of an item |
|
544 * |
|
545 * @return Id of item's parent |
|
546 * |
|
547 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
548 * in the list |
|
549 */ |
|
550 IMPORT_C TFsTreeItemId Parent( const TFsTreeItemId aItemId ) const; |
|
551 |
|
552 /** |
|
553 * Checks whether the item with specified id belongs to the list |
|
554 * |
|
555 * @param aItemId Id of an item |
|
556 * |
|
557 * @return ETrue if the item is in the list, EFalse otherwise |
|
558 */ |
|
559 IMPORT_C TBool Contains( const TFsTreeItemId aItemId ) const; |
|
560 |
|
561 /** |
|
562 * Checks whether the item with specified id is a node |
|
563 * |
|
564 * @param aItemId Id of an item |
|
565 * |
|
566 * @return ETrue if the item is a node, EFalse otherwise |
|
567 * |
|
568 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
569 * in the list |
|
570 */ |
|
571 IMPORT_C TBool IsNode( const TFsTreeItemId aItemId ) const; |
|
572 |
|
573 /** |
|
574 * Sets focus state of list component |
|
575 * @param aFocused status of the focus to be set |
|
576 */ |
|
577 IMPORT_C void SetFocusedL( const TBool aFocused ); |
|
578 |
|
579 /** |
|
580 * Returns state of the focus |
|
581 * @return State of the focus |
|
582 */ |
|
583 IMPORT_C TBool IsFocused() const; |
|
584 |
|
585 /** |
|
586 * Returns item visualizer for given item id. |
|
587 */ |
|
588 IMPORT_C CFsTreeList* ItemMenu( TFsTreeItemId aItemId ); |
|
589 |
|
590 public: // Visualization management |
|
591 |
|
592 /** |
|
593 * Displays the list. |
|
594 * |
|
595 * @param aFadeIn Defines if list visual should or shouldn't fade in to |
|
596 * the screen. |
|
597 * @param aSlideIn ETrue if slide in effect should be used, EFalse if not. |
|
598 */ |
|
599 IMPORT_C void ShowListL( const TBool aFadeIn = EFalse, |
|
600 const TBool aSlideIn = EFalse ); |
|
601 |
|
602 |
|
603 /** |
|
604 * Sets direct touch mode. |
|
605 * |
|
606 * @param aDirectTouchMode ETrue if list should work as in direct touch, EFalse |
|
607 * otherwise. |
|
608 */ |
|
609 IMPORT_C void SetDirectTouchMode( const TBool aDirectTouchMode ); |
|
610 |
|
611 /** |
|
612 * Hides the list. |
|
613 * |
|
614 * @param aFadeOut Defines if list visual should or shouldn't fade out |
|
615 * from the screen. |
|
616 * @param aSlideOut ETrue if slide out effect should be used,EFalse if not |
|
617 */ |
|
618 IMPORT_C void HideListL( const TBool aFadeOut = EFalse, |
|
619 const TBool aSlideOut = EFalse ); |
|
620 |
|
621 /** |
|
622 * Gets the currently focused (highlighted) item id |
|
623 * |
|
624 * @return Id of the item being focused (highlighted) |
|
625 */ |
|
626 IMPORT_C TFsTreeItemId FocusedItem() const; |
|
627 |
|
628 /** |
|
629 * Sets the focus (highlight) upon the item with given id |
|
630 * |
|
631 * @param aItemId Id of the item that is to be focused (highlighted) |
|
632 * |
|
633 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
634 * in the list |
|
635 */ |
|
636 IMPORT_C void SetFocusedItemL( const TFsTreeItemId aItemId ); |
|
637 |
|
638 /** |
|
639 * Checks whether the item with specified id is marked. |
|
640 * |
|
641 * @param aItemId Id of an item. |
|
642 * |
|
643 * @return ETrue if the item is marked, EFalse otherwise. |
|
644 * |
|
645 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
646 * in the list. |
|
647 */ |
|
648 IMPORT_C TBool IsMarked( const TFsTreeItemId aItemId ) const; |
|
649 |
|
650 /** |
|
651 * Checks whether the node with specified id is expanded. |
|
652 * |
|
653 * @param aNodeId Id of a node |
|
654 * |
|
655 * @return ETrue if the node is expanded, EFalse otherwise |
|
656 * |
|
657 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
658 * in the list |
|
659 * @panic EFsListPanicInvalidItemType Item id was passed instead of |
|
660 * the node id |
|
661 */ |
|
662 IMPORT_C TBool IsExpanded( const TFsTreeItemId aNodeId ); |
|
663 |
|
664 /** |
|
665 * Marks the item. |
|
666 * |
|
667 * @param aItemId Id of an item |
|
668 * |
|
669 * @param aMarked ETrue to set item marked, EFalse to unmarked. |
|
670 * |
|
671 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
672 * in the list |
|
673 * @panic EFsListPanicIsNonMarkable The list is non-markable |
|
674 */ |
|
675 IMPORT_C void MarkItemL( const TFsTreeItemId aItemId, TBool aMarked ); |
|
676 |
|
677 /** |
|
678 * Expands the node. Does nothing when the node is already expanded. |
|
679 * |
|
680 * @param aNodeId Id of a node |
|
681 * |
|
682 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
683 * in the list |
|
684 * @panic EFsListPanicInvalidItemType Item id was passed instead of |
|
685 * the node id |
|
686 */ |
|
687 IMPORT_C void ExpandNodeL( const TFsTreeItemId aNodeId ); |
|
688 |
|
689 /** |
|
690 * Collapses the node. Does nothing when the node is already collapsed. |
|
691 * |
|
692 * @param aNodeId Id of a node |
|
693 * |
|
694 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
695 * in the list |
|
696 * @panic EFsListPanicInvalidItemType Item id was passed instead of |
|
697 * the node id |
|
698 */ |
|
699 IMPORT_C void CollapseNodeL( const TFsTreeItemId aNodeId ); |
|
700 |
|
701 /** |
|
702 * Gets the list of marked items |
|
703 * |
|
704 * @param aMarkedItems Reference to the array that the list will copy |
|
705 * array of marked items' ids to |
|
706 */ |
|
707 IMPORT_C void GetMarkedItemsL( RFsTreeItemIdList& aMarkedItems ) const; |
|
708 |
|
709 /** |
|
710 * Gets the reference to the item/node data (const) |
|
711 * |
|
712 * @param aItemId Id of the item/node |
|
713 * |
|
714 * @return Reference to the item/node data (const) |
|
715 * |
|
716 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
717 * in the list |
|
718 */ |
|
719 IMPORT_C MFsTreeItemData& ItemData(const TFsTreeItemId aItemId) const; |
|
720 |
|
721 /** |
|
722 * Sets the reference to the item/node data |
|
723 * |
|
724 * @param aData Reference to the item/node data |
|
725 * @param aItemId Id of the item/node |
|
726 * |
|
727 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
728 * in the list |
|
729 */ |
|
730 IMPORT_C void SetItemDataL( MFsTreeItemData& aData, |
|
731 const TFsTreeItemId aItemId ); |
|
732 |
|
733 /** |
|
734 * Gets the reference to the item visualizer (const) |
|
735 * |
|
736 * @param aItemId Id of the item |
|
737 * |
|
738 * @return Reference to the item visualizer (const) |
|
739 * |
|
740 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
741 * in the list |
|
742 */ |
|
743 IMPORT_C MFsTreeItemVisualizer& ItemVisualizer( |
|
744 const TFsTreeItemId aItemId ) const; |
|
745 |
|
746 /** |
|
747 * Sets the reference to the item visualizer |
|
748 * |
|
749 * @param aVisualizer Reference to the new item's visualizer |
|
750 * @param aItemId Id of the item |
|
751 * |
|
752 * @panic EFsListPanicInvalidItemId The specified item id was not found |
|
753 * in the list |
|
754 */ |
|
755 IMPORT_C void SetItemVisualizerL( MFsTreeItemVisualizer& aVisualizer, |
|
756 const TFsTreeItemId aItemId ); |
|
757 |
|
758 /** |
|
759 * Gets the reference to the tree visualizer |
|
760 * |
|
761 * @return Reference to the tree visualizer currently used by the tree |
|
762 * list. |
|
763 */ |
|
764 IMPORT_C CFsTreeVisualizerBase& TreeVisualizer() const; |
|
765 |
|
766 /** |
|
767 * Sets a tree visualizer for the list |
|
768 * |
|
769 * @param aTreeV Reference to the tree visualizer that the tree list will |
|
770 * be using |
|
771 */ |
|
772 IMPORT_C void SetTreeVisualizer( CFsTreeVisualizerBase& aTreeV ); |
|
773 |
|
774 /** |
|
775 * Sets visiblity of the border |
|
776 */ |
|
777 IMPORT_C virtual void SetBorderL( const TBool aVisible, |
|
778 CAlfTexture* aBorderTexture = 0 ); |
|
779 |
|
780 /** |
|
781 * Sets visiblity of the shadow |
|
782 */ |
|
783 IMPORT_C void SetShadowL( const TBool aVisible ); |
|
784 |
|
785 /** |
|
786 * Returns the items's target bounding rectangle in display coordinates if the item is visible. |
|
787 * Display coordinates are defined relative to the display's visible area. |
|
788 * |
|
789 * @param aItemId Item's ID. |
|
790 * @param aRect Out parameter. If successfull, contains item's target rectangle. |
|
791 * @return KErrNone if successfull, |
|
792 * KErrNotFound 1. the list does not contain item with given ID. |
|
793 * 2. item is not visible |
|
794 */ |
|
795 IMPORT_C TInt GetItemDisplayRectTarget ( const TFsTreeItemId aItemId, TAlfRealRect& aRect ); |
|
796 |
|
797 //From MFsTreeVisualizerObserver |
|
798 |
|
799 /** |
|
800 * |
|
801 */ |
|
802 IMPORT_C virtual void TreeVisualizerEventL( |
|
803 const TFsTreeVisualizerEvent aEvent, |
|
804 const TFsTreeItemId aId, |
|
805 const TPoint& aPoint ) const; |
|
806 |
|
807 /** |
|
808 * Gets the reference to the text style manager. |
|
809 * |
|
810 * @return Reference to the text style manager. |
|
811 */ |
|
812 IMPORT_C CFsAlfTextStyleManager& TextStyleManager() const; |
|
813 |
|
814 /** |
|
815 * Sets the type of text marquee. |
|
816 * |
|
817 * @param aMarquee Type of marquee. |
|
818 */ |
|
819 IMPORT_C void SetTextMarqueeType(const TFsTextMarqueeType aMarquee); |
|
820 |
|
821 /** |
|
822 * Returns the type of text marquee. |
|
823 * |
|
824 * @return Type of marquee. |
|
825 */ |
|
826 IMPORT_C TFsTextMarqueeType TextMarqueeType() const; |
|
827 |
|
828 /** |
|
829 * Sets the speed of marquee. |
|
830 * |
|
831 * @param aPixelsPerSec How many pixels per second. |
|
832 */ |
|
833 IMPORT_C void SetTextMarqueeSpeed ( const TInt aPixelsPerSec ); |
|
834 |
|
835 /** |
|
836 * Returns the speed of marquee. |
|
837 * |
|
838 * @return How many pixels per second. |
|
839 */ |
|
840 IMPORT_C TInt TextMarqueeSpeed ( ) const; |
|
841 |
|
842 /** |
|
843 * Sets delay for text marquee start. |
|
844 * |
|
845 * @param aStartDelay Time after which the text marquee starts (in miliseconds). |
|
846 */ |
|
847 IMPORT_C void SetTextMarqueeStartDelay ( const TInt aStartDelay ); |
|
848 |
|
849 /** |
|
850 * Returns delay for text marquee. |
|
851 * |
|
852 * @return Time after which the text marquee starts (in miliseconds). |
|
853 */ |
|
854 IMPORT_C TInt TextMarqueeStartDelay () const; |
|
855 |
|
856 /** |
|
857 * Sets a delay for each cycle start. |
|
858 * |
|
859 * @param aCycleStartDelay Time after which the text marquee cycle starts (in miliseconds). |
|
860 */ |
|
861 IMPORT_C void SetTextMarqueeCycleStartDelay ( const TInt aCycleStartDelay ); |
|
862 |
|
863 /** |
|
864 * Returns a delay for each cycle start. |
|
865 * |
|
866 * @return Time after which the text marquee cycle starts (in miliseconds). |
|
867 */ |
|
868 IMPORT_C TInt TextMarqueeCycleStartDelay () const; |
|
869 |
|
870 /** |
|
871 * Sets repetitions number of marquee cycle. |
|
872 * |
|
873 * @param aRepetitions Number of marquee cycles. Negetive values - infinite loop. |
|
874 */ |
|
875 IMPORT_C void SetTextMarqueeRepetitions ( const TInt aMarqueeRepetitions ); |
|
876 |
|
877 /** |
|
878 * Returns repetitions number of marquee cycle. |
|
879 * |
|
880 * @return Number of marquee cycles. Negetive values - infinite loop. |
|
881 */ |
|
882 IMPORT_C TInt TextMarqueeRepetitions ( ) const; |
|
883 |
|
884 /** |
|
885 * Disables kinetic scrolling (Drag events will not scroll the list). |
|
886 * |
|
887 * @param aDisable ETrue if kinetic scrolling should be disabled. |
|
888 */ |
|
889 IMPORT_C void DisableKineticScrolling( TBool aDisable ); |
|
890 |
|
891 protected: //Construction |
|
892 |
|
893 /** |
|
894 * C++ constructor |
|
895 */ |
|
896 IMPORT_C CFsTreeList( CAlfEnv& aEnv, CFsTreeVisualizerBase& aTreeV ); |
|
897 |
|
898 /** |
|
899 * Second phase constructor |
|
900 * |
|
901 * @param aEnv Reference to the UI toolkit environment |
|
902 */ |
|
903 IMPORT_C void ConstructL( CAlfEnv& aEnv ); |
|
904 |
|
905 protected: //Data members |
|
906 |
|
907 /** |
|
908 * Alf env |
|
909 */ |
|
910 CAlfEnv* iEnv; |
|
911 |
|
912 /** |
|
913 * Visualizer class |
|
914 * Not own |
|
915 */ |
|
916 CFsTreeVisualizerBase* iTreeVisualizer; |
|
917 |
|
918 /** |
|
919 * Tree data structure clas |
|
920 * Own |
|
921 */ |
|
922 CFsTree* iTree; |
|
923 |
|
924 /** |
|
925 * Controller class for the list |
|
926 * Own |
|
927 */ |
|
928 CFsTreeControl* iTreeControl; |
|
929 |
|
930 /** |
|
931 * Loop flag |
|
932 */ |
|
933 TBool iIsLooping; |
|
934 |
|
935 /** |
|
936 * part of OLD API - to be removed. |
|
937 * SScrollbar flag |
|
938 */ |
|
939 TFsTreeListScrollbars iHasScrollBars; |
|
940 |
|
941 |
|
942 /** |
|
943 * Id of the focused item |
|
944 */ |
|
945 TFsTreeItemId iFocusedItem; |
|
946 |
|
947 /** |
|
948 * Type of markability |
|
949 */ |
|
950 TFsTreeListMarkType iMarkType; |
|
951 |
|
952 /** |
|
953 * Array of observers |
|
954 */ |
|
955 RFsTreeListObservers iObservers; |
|
956 |
|
957 /** |
|
958 * Text style manager. |
|
959 * Own |
|
960 */ |
|
961 CFsAlfTextStyleManager* iTextStyleManager; |
|
962 |
|
963 /** |
|
964 * The list has focus or not. |
|
965 */ |
|
966 TBool iListFocused; |
|
967 |
|
968 }; |
|
969 |
|
970 #endif // C_FSTREELIST_H |
|
971 |