2 * Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: Abstract base class for hierarchical lists.
19 #ifndef C_AKNTREELIST_H
20 #define C_AKNTREELIST_H
23 #include <AknControl.h>
25 #include <akntreelistobserver.h>
26 #include <AknIconUtils.h> // TScaleMode
29 class CAknTreeListView;
30 class MAknCustomTreeOrdering;
33 /** Flag to indicate that hierarchical list is looping. */
34 const TUint32 KAknTreeListLooping = 0x0001;
36 /** Flag to indicate that hierarchical list structure lines are not visible. */
37 const TUint32 KAknTreeListNoStructureLines = 0x0002;
39 /** Flag to set marquee scrolling on. */
40 const TUint32 KAknTreeListMarqueeScrolling = 0x0004;
42 /** Flag to disable indention of hierarchical list items. Setting this flag
43 also forces the tree structure lines invisible. */
44 const TUint32 KAknTreeListNoIndention = 0x0008;
46 /** Flag to set hierarchical list markable. The list items can always be
47 marked by list client with API methods, but when list is set markable,
48 it responds to specified pointer and key event by marking/unmarking
50 const TUint32 KAknTreeListMarkable = 0x0010;
54 * Abstract base class for hierarchical lists.
56 * This class functions as a base class for hierarchical lists. It contains
57 * the APIs common to all hierarchical lists. The internal structure of the
58 * list is not exposed directly to the list clients, instead the structure
59 * can be accessed through the APIs in this class. The items in the list are
60 * referred with item IDs, which are returned to the client when the items
61 * are added to the list.
63 * List items are divided into leaves and nodes, the difference being that
64 * nodes have expand and collapse functionality and can contain other tree
65 * items as child items, whereas leaves cannot contain other list items.
66 * Methods @c IsLeaf() and @c IsNode() can be used for checking if items
67 * belong into these groups.
69 * The expand and collapse events, among other list events, are send to list
70 * observers through @c MAknTreeListObserver interface. This enables that
71 * the whole list does not have to be populated at once, as the content of
72 * each node can be added when the node is expanded. To avoid unnecessary
73 * memory consumption, the content of each node is removed from the list
74 * when the node is collapsed. However, list items can be set persistent,
75 * in which case they are not removed from nodes on collapse events.
77 * As the hierarchical list items are list specialisation specific, the
78 * specialisations of this class have to provide APIs for constructing and
79 * adding new items to the list, and getting and setting specialisation
80 * specific properties of the list items.
82 * All the methods that might affect the appearance of the list view have an
83 * additional @c aDrawNow parameter, which can be used to indicate whether
84 * the list view should be redrawn to correspond to the modified list
85 * structure. This allows consecutive calls to be made without the list view
86 * being updated between every call by setting the @c aDrawNow parameter to
87 * @c EFalse in all of the calls but the last. The normal draw methods
88 * inherited from @c CCoeControl can also be used to draw the updated view.
90 * @see MAknTreeListObserver
95 NONSHARABLE_CLASS( CAknTreeList ) : public CAknControl
101 // for focus handling after Sort
105 EMoveFocusToFirstItem
111 virtual ~CAknTreeList();
114 * Sets the flags for the hierarchical list.
116 * Flags @c KAknTreeListLooping, @c KAknTreeListNoStructureLines,
117 * @c KAknTreeListMarqueeScrolling, @c KAknTreeListNoIndention, and
118 * @c KAknTreeListMarkable can be used to change the behaviour
121 * Note: Specialisations may override this method in order to restrict the
122 * use of some of the flags in specialised list or to handle specialisation
125 * @param aFlags Flags.
127 IMPORT_C virtual void SetFlags( TUint32 aFlags );
130 * Returns the flags set for the list.
134 IMPORT_C TUint32 Flags() const;
137 * Moves an existing list item to specified target node. The moved item
138 * and the target node have to be specified with the item IDs returned
139 * when the items were added to the hierarchical list. The target node
140 * cannot be a descendant of the moved node. Otherwise, the moving would
141 * break the hierarchical structure. Constant @c KAknTreeIIDRoot can be
142 * used as an ID for the target node when the item is to be moved to the
143 * top-most level of the list.
145 * @param aItem Item ID of the item to be moved.
147 * @param aTargetNode ID of the node, where the item is to be moved.
149 * @param aDrawNow @c ETrue to redraw the list after the item has been
150 * moved, otherwise @c EFalse.
152 * @leave KErrArgument The specified item is the same as the target node
153 * or one of the ancestors of target node.
155 * @leave KErrNoMemory Not enough memory is available for adding the
156 * specified item to the target node.
158 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
160 * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
162 * @pre The moved item and the target node exist in the list, and the
163 * target node is not a descendant of the moved item.
165 * @post The item is moved to the specified target node and into a such
166 * position that the children of the target node remain in sorted
167 * order. The updated list is redrawn, if it is requested with the
168 * aDrawNow parameter.
170 IMPORT_C void MoveItemL( TAknTreeItemID aItem, TAknTreeItemID aTargetNode,
174 * Removes an item from the hierarchical list. The item to be removed has
175 * to be specified with the ID value returned when the item was added to
176 * the hierarchical list. If the removed item is a node containing other
177 * list items, those items are removed from the list as well. Constant
178 * @c KAknTreeIIDRoot can be used to remove every item from the list.
180 * @param aItem Item ID of the item to be removed.
182 * @param aDrawNow @c ETrue to redraw the list after the item has been
183 * removed, othewise @c EFalse.
185 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
187 * @pre The specified item exists in the hierarchical list.
189 * @post The specified item and all of its descendants are removed from
190 * the list. The updated list is drawn, when it is requested with
191 * the aDrawNow parameter.
193 IMPORT_C void RemoveItem( TAknTreeItemID aItem, TBool aDrawNow );
196 * Expands a node in hierarchical list. When a node in the hierarchical
197 * list is expanded, either with this method, or with pointer or key
198 * event, the observer of the list is notified with respective event.
199 * The client of the list can then update the content of the expanded
200 * node. Constant @c KAknTreeIIDRoot can be used to expand every node
201 * in the tree structure.
203 * @param aNode Item ID of the node to be expanded.
205 * @param aDrawNow @c ETrue to redraw the list after the node has been
206 * expanded, otherwise @c EFalse.
208 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
210 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
212 * @pre The specified item exists in the hierarchical list and it is a
215 * @post The specified node is expanded. The updated list is drawn, when
216 * it is requested with the aDrawNow parameter.
218 IMPORT_C void ExpandNode( TAknTreeItemID aNode, TBool aDrawNow );
221 * Collapses a node in hierarchical list. When a node in the hierarchical
222 * list is collapsed, either with this method, or with pointer or key
223 * event, all its content that is not set persistent is removed from the
224 * list to reduce memory consumption. The observer of the hierarchical
225 * list is nofied with the respective event. Constant @c KAknTreeIIDRoot
226 * can be used to collapse every node in the tree structure.
228 * @param aNode Item ID of the node to be collapsed.
230 * @param aDrawNow @c ETrue to redraw the list after the node has been
231 * collapsed, otherwise @c EFalse.
233 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
235 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
237 * @pre The specified item exists in the hierarchical list and it is a
240 * @post The specified item is collapsed and all of its children, which are
241 * not set persistent, are removed from the list.
243 IMPORT_C void CollapseNode( TAknTreeItemID aNode, TBool aDrawNow );
246 * Checks whether the specified node is expanded.
248 * @param aNode Item ID of a node.
250 * @return @c ETrue if the node is expanded.
252 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
254 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
256 IMPORT_C TBool IsExpanded( TAknTreeItemID aNode ) const;
259 * Gets the item ID of the focused item.
261 * @return Item ID of the focused item. Value @c KAknTreeIIDNone is
262 * returned if no item is focused.
264 IMPORT_C TAknTreeItemID FocusedItem() const;
267 * Sets the focused item and its position on the list view. When the
268 * focused item is changed, the vertical position of the view is changed
269 * so that the position of the focused item on the view matches the given
270 * index. The horizontal position of the view is changed so that the
271 * the beginning of the focused item is visible.
273 * @param aItem Item ID of the item to be focused.
275 * @param aIndex The position of the focused item on the list view. If the
276 * index does not refer to any visible view location, that is, the
277 * index is less than zero or greater than or equal to the number of
278 * items in the view, the focused item is changed to specified item,
279 * but the position of the view is not changed.
281 * @param aDrawNow @c ETrue to redraw the list after the focused item
282 * has been changed, otherwise @c EFalse.
284 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
286 IMPORT_C void SetFocusedItem( TAknTreeItemID aItem, TInt aIndex,
290 * Highlight rectangle for the focused item. The returned rectangle is
291 * screen relative and it can be used, for example, when positioning
292 * pop-up for focused item. If the focused item is not visible, the
293 * method returns an empty rectangle.
295 * @return Highlight rectangle of focused list item.
297 IMPORT_C TRect HighlightRect() const;
300 * Adds a new icon to the list to be used by all list items. The same
301 * icon can be used by multiple tree items and its referenced by the
302 * ID returned by this function. The given parameters are also stored
303 * in the tree list, which enables the tree list to reconstruct the
304 * bitmaps on skin change events. If this behaviour is insufficient for
305 * the client, it can always replace the existing icons by itself with
306 * @c AssignIconL or @c AssignColorIconL method.
308 * @param aId Item ID of the icon to be added.
310 * @param aFilename Filename to be used to construct the item,
311 * if no matching item was found in the currently active skin.
313 * @param aBitmapId ID of the bitmap in the file.
314 * Used only if no matching item was found in the currently
317 * @param aMaskId ID of the mask in the file.
318 * Used only if no matching item was found in the currently
321 * @param aScaleMode Scale mode used when icon's bitmap is resized.
323 * @return ID assigned for the added icon.
325 * @leave KErrNoMemory Not enough memory.
327 IMPORT_C TInt AddIconL( const TAknsItemID& aId, const TDesC& aFilename,
328 TInt aBitmapId, TInt aMaskId, TScaleMode aScaleMode );
331 * Adds a new icon to the list. The ownership of given bitmaps is
332 * transferred to the list only if specified with @c aTransferOwnership
333 * parameter. Note that icons added to the list with this method cannot
334 * be reconstructed on skin change events by the list. If necessary,
335 * previously added icons can be replaced with @c AssignIconL method.
337 * @param aIcon Pointer to the bitmap.
339 * @param aMask Pointer to the mask bitmap.
341 * @param aTransferOwnership @c ETrue, if ownership of bitmaps is
342 * transferred to the list. If the method leaves, it is always on the
343 * responsibility of the client code to take care of deleting the bitmaps.
345 * @param aScaleMode The scale mode used when the icon is resized.
347 * @return ID assigned for the added icon.
349 * @leave KErrNoMemory Not enough memory.
351 IMPORT_C TInt AddIconL( CFbsBitmap* aIcon, CFbsBitmap* aMask,
352 TBool aTransferOwnership, TScaleMode aScaleMode );
355 * Adds a new icon to the list to be used by all list items. The same
356 * icon can be used by multiple tree items and it is referenced by the
357 * icon ID returned by this function. The given parameters are stored
358 * in the tree list, and they are used in reconstructing the bitmaps on
359 * skin change events.
361 * @param aId Item ID of the icon to be added.
363 * @param aColorId Item ID of the color table.
365 * @param aColorIndex Index in the color table.
367 * @param aFilename Filename to be used to construct the item,
368 * if no matching item was found in the currently active skin.
370 * @param aBitmapId ID of the bitmap in the file.
371 * Used only if no matching item was found in the currently
374 * @param aMaskId ID of the mask in the file.
375 * Used only if no matching item was found in the currently
378 * @param aDefaultColor Color RGB value to be used, if no color
379 * is found in the currently active skin.
381 * @param aScaleMode Scale mode used when icon's bitmap is resized.
383 * @return ID assigned for the added icon.
385 * @leave KErrNoMemory Not enough memory.
387 IMPORT_C TInt AddColorIconL( const TAknsItemID& aId,
388 const TAknsItemID& aColorId, TInt aColorIndex, const TDesC& aFilename,
389 TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor,
390 TScaleMode aScaleMode );
393 * Assigns an icon to the tree list with the specified ID. If an icon
394 * with specified ID already exists in the list, the existing icon is
395 * replaced with the new one. The given parameters are stored in the
396 * tree list, and they are used in reconstructing the bitmaps on skin
399 * @param aIconId Icon ID assigned for the icon.
401 * @param aId Item ID of the icon to be added.
403 * @param aFilename Filename to be used to construct the item,
404 * if no matching item was found in the currently active skin.
406 * @param aBitmapId ID of the bitmap in the file.
407 * Used only if no matching item was found in the currently
410 * @param aMaskId ID of the mask in the file.
411 * Used only if no matching item was found in the currently
414 * @param aScaleMode Scale mode used when icon's bitmap is resized.
416 * @leave KErrNoMemory Not enough memory.
418 * @leave KErrArgument Specified icon ID is out of allowed range.
420 IMPORT_C void AssignIconL( TInt aIconId, const TAknsItemID& aId,
421 const TDesC& aFilename, TInt aBitmapId, TInt aMaskId,
422 TScaleMode aScaleMode );
425 * Assigns an icon to the tree list with the specified ID. If an icon
426 * with specified ID already exists in the list, the existing icon is
427 * replaced with the new one. The ownership of bitmaps is transferred to
428 * the list only if so specifed with @c aTransferOnwership parameter.
429 * Note that icons added with this method cannot be reconstructed on
430 * skin change events by list.
432 * @param aIconId Icon ID assigned for the icon.
434 * @param aIcon Pointer to the bitmap.
436 * @param aMask Pointer to the mask bitmap.
438 * @param aTransferOwnership @c ETrue, if ownership of bitmaps is
439 * transferred to the list. If the method leaves, it is always on
440 * the responsibility of the client code to take care of deleting
443 * @param aScaleMode Scale mode used when icon's bitmap is resized.
445 * @leave KErrNoMemory Not enough memory.
447 * @leave KErrArgument Specified icon ID is out of allowed range.
449 IMPORT_C void AssignIconL( TInt aIconId, CFbsBitmap* aIcon,
450 CFbsBitmap* aMask, TBool aTransferOwnership, TScaleMode aScaleMode );
453 * Assigns a color icon to the list with the specified ID. If an icon
454 * with specified ID already exists in the list, the existing icon is
455 * replaced with the new one. The given parameters are stored in the
456 * tree list, and they are used in reconstructing the bitmaps on skin
459 * @param aIconId Icon ID assigned for the icon.
461 * @param aId Item ID of the icon to be added.
463 * @param aColorId Item ID of the color table.
465 * @param aColorIndex Index in the color table.
467 * @param aFilename Filename to be used to construct the item,
468 * if no matching item was found in the currently active skin.
470 * @param aBitmapId ID of the bitmap in the file.
471 * Used only if no matching item was found in the currently
474 * @param aMaskId ID of the mask in the file.
475 * Used only if no matching item was found in the currently
478 * @param aDefaultColor Color RGB value to be used, if no color
479 * is found in the currently active skin.
481 * @param aScaleMode Scale mode used when icon's bitmap is resized.
483 * @leave KErrNoMemory Not enough memory.
485 * @leave KErrArgument Specified icon ID is out of allowed range.
487 IMPORT_C void AssignColorIconL( TInt aIconId, const TAknsItemID& aId,
488 const TAknsItemID& aColorId, TInt aColorIndex, const TDesC& aFilename,
489 TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor,
490 TScaleMode aScaleMode );
493 * Removes the specified icon from the tree list. The specified icon cannot
494 * be any of the default tree list icon, in which case the leaves with
495 * value @c KErrArgument. If the specified icon is not found, the function
498 * @param aIconId Icon ID of the removed icon.
500 * @leave KErrArgument if specified icon is one of the default icons.
502 IMPORT_C void RemoveIconL( TInt aIconId );
505 * Returns the number of children of a hierarchical list node. This method,
506 * along with @c Child() method, can be used for enquiring information of
507 * the list structure. Constant @c KAknTreeIIDRoot can be used to get the
508 * item count on the top-most level of the list.
510 * @param aNode Item ID of a node.
512 * @return Number of children of specified node.
514 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
516 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
518 IMPORT_C TInt ChildCount( TAknTreeItemID aNode ) const;
521 * Gets the item ID of a child of a hierarcical list node. The specific
522 * child is specified with an index. The child count for any hierarchical
523 * list node can be get with @c ChildCount() method.
525 * @param aNode Item ID of the node, whose child is enquiried.
527 * @param aIndex Index of the enquiried child.
529 * @return Item ID of the specified child. Value @c KAknTreeIIDNone is
530 * returned, if the child with specified index does not exist.
532 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
534 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
536 IMPORT_C TAknTreeItemID Child( TAknTreeItemID aNode, TInt aIndex ) const;
539 * Returns the item ID of the parent of a hierarchical list item. The
540 * constant @c KAknTreeIIDRoot is returned for all the items on the
541 * top-most level of the tree, and constant @c KaknTereIIDNone for the
542 * items that have no parent, that is, the root node.
544 * @param aItem Item ID of the item, whose parent is enquiried.
546 * @return Item ID of the parent node.
548 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
550 IMPORT_C TAknTreeItemID Parent( TAknTreeItemID aItem ) const;
553 * Checks whether the hierarchical list contains the list item with
554 * specified item ID. The returned value for constant @c KAknTreeIIDRoot
555 * will always be @c ETrue, and for constant @c KAknTreeIIDNone @c EFalse.
557 * @param aItem Item ID.
559 * @return @c ETrue, if the list contains the specified item.
561 IMPORT_C TBool Contains( TAknTreeItemID aItem ) const;
564 * Checks whether a hierarchical list item is a node.
566 * @param aItem Item ID of checked item.
568 * @return @c ETrue, if the specified item is a node.
570 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
572 IMPORT_C TBool IsNode( TAknTreeItemID aItem ) const;
575 * Checks whether a hierarchical list item is a leaf.
577 * @param aItem Item ID of checked item.
579 * @return @c ETrue, if the specified item is a leaf.
581 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
583 IMPORT_C TBool IsLeaf( TAknTreeItemID aItem ) const;
586 * Checks whether a hierarchical list item is marked.
588 * @param aItem Item ID of checked item.
590 * @return @c ETrue for marked item.
592 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
594 IMPORT_C TBool IsMarked( TAknTreeItemID aItem ) const;
597 * Sets an item marked. If the marked item is a node, all of its
598 * descendants are also set marked.
600 * Note that item marking can be changed with this method, even if the
601 * list itself is not set markable. Marking changes can be enabled and
602 * disabled with @c EnableMarking() method.
604 * @param aItem Item ID of the item to be modified.
606 * @param aMarked @c ETrue to set item marked, @c EFalse to unmarked.
608 * @param aDrawNow @c ETrue to redraw the list after the item has been
609 * set marked, otherwise @c EFalse.
611 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
613 IMPORT_C void SetMarked( TAknTreeItemID aItem, TBool aMarked,
617 * Enables or disables marking of specified list item. By default,
618 * marking is enabled for every list item.
620 * When marking is enabled for an item, its marking can be changed from
621 * unmarked to marked, and vice versa, with SetMarked() method, and for
622 * markable list, the marking can also change as a result of user action.
624 * When marking is disabled, the item can still be either unmarked or
625 * marked, but the marking cannot be changed in any way, until it has
626 * been enabled again for the item.
628 * @param aItem Item ID of the list item.
630 * @param aEnable @c ETrue to enable marking, @c EFalse to disable it.
632 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
634 IMPORT_C void EnableMarking( TAknTreeItemID aItem, TBool aEnable );
637 * Gets all the marked items from the tree list. The marked items are
638 * appended to the end of the array passed as parameter.
640 * @param aMarkedItems On return, contains item IDs of all marked items.
642 * @leave KErrNoMemory Appending item to the array fails.
644 IMPORT_C void GetMarkedItemsL( RArray<TAknTreeItemID>& aMarkedItems ) const;
647 * Gets all the marked items from the specified node. The marked items
648 * are appended to the end of the array passed as parameter.
650 * @param aNode Item ID of a node from where the marked items are
653 * @param aMarkedItems On return, contains item IDs of marked items in
654 * the specified node.
656 * @leave KErrNoMemory Appending item to the array fails.
658 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
660 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
662 IMPORT_C void GetMarkedItemsL( TAknTreeItemID aNode,
663 RArray<TAknTreeItemID>& aMarkedItems ) const;
666 * Checks whether the specified node is empty. To decrease memory
667 * consumption, the descendants of tree nodes can be removed from the
668 * hierarchical list when the node is collapsed. As the empty nodes may
669 * have different appearances in the list view, the collapsed nodes can be
670 * set to appear as non-empty with @c SetNonEmpty() method to indicate that
671 * nodes will have some content when expanded.
673 * @param aNode Item ID of checked item.
675 * @return @c ETrue, if the item has been set non-empty.
677 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
679 * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
681 IMPORT_C TBool IsEmpty( TAknTreeItemID aNode ) const;
684 * Sets a node non-empty.
686 * @param aNode Item ID of the item to be modified.
688 * @param aNonEmpty @c ETrue to set node non-empty, @c EFalse to empty.
690 * @param aDrawNow @c ETrue to redraw the list after the setting has been
691 * change, otherwise @c EFalse.
693 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
695 * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
697 IMPORT_C void SetNonEmpty( TAknTreeItemID aNode, TBool aNonEmpty,
701 * Checks if the specified item is set persistent. If an item is set
702 * persistent, it is not removed from the list, when its parent or any of
703 * its ancestors is collapsed. This means also that a node cannot be
704 * automatically removed from the list on collapse event, if any of its
705 * descendants is set persistent.
707 * @param aItem Item ID.
709 * @return @c ETrue, if item is set persistent.
711 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
713 IMPORT_C TBool IsPersistent( TAknTreeItemID aItem ) const;
716 * Sets an item persistent. If the specified item is a node, the state
717 * of all its descendants is also changed accordingly.
719 * @param aItem Item ID.
721 * @param aPersistent @c ETrue to set item persistent.
723 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
725 IMPORT_C void SetPersistent( TAknTreeItemID aItem,
729 * Sets custom ordering for the hierarchical list and sorts the list
730 * with the use of given ordering interface. The given interface is
731 * used until it is replaced with some other ordering.
733 * Note: Ownership of the interface is not transferred to the list.
735 * Note: When custom ordering is set to the list, new items are added
736 * to the end of their parent nodes, because the interface cannot
737 * be used for determining the position for inserted item, as the
738 * client receives its identifier only after it has been inserted.
739 * @c Sort(TAknTreeItemID, TBool, TBool) method can be used for sorting
740 * the node with custom ordering interface after new items have been
741 * inserted in the list.
743 * @param aOrdering Custom ordering interface used in list sorting.
745 * @param aDrawNow @c ETrue to redraw the list after sorting.
747 IMPORT_C void Sort( MAknCustomTreeOrdering* aOrdering, TBool aDrawNow );
750 * Sorts the specified node with the use of previously set ordering
751 * interface. The sorting can be restricted to the specified node, or
752 * the sorting can be set to include also every descendant node of the
753 * specified node. Whole list can be sorted by giving the constant
754 * @c KAknTreeIIDRoot as the @c aNode parameter. This method has no
755 * effect, if no ordering has been set for the list.
757 * @param aNode Item ID of the node that has to be sorted.
759 * @param aSortDescendants @c ETrue to sort the content of the specified
760 * node including the content of its descendant nodes, @c EFalse to
761 * sort only the child items within the specified node.
763 * @param aDrawNow @c ETrue to redraw the list after sorting.
765 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
767 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
769 IMPORT_C void Sort( TAknTreeItemID aNode, TBool aSortDescendants,
773 * Adds an observer for the hierarchical list. Notifications of the list
774 * events are sent to all observers set with this method. Observers can
775 * be removed from the list with @c RemoveObserver() method.
777 * Note: Hierarchical list also sends a state changed event on every list
778 * event through the usual control observer interface that can be set with
779 * @c CCoeControl::SetObserver method.
781 * @param aObserver Implementation of the observer interface.
783 * @post The given interface is set as the observer of the list. The
784 * ownership of the interface is not transferred to the list.
786 IMPORT_C void AddObserverL( MAknTreeListObserver* aObserver );
789 * Removes an observer from the hierarchical list.
791 * @param aObserver The observer interface to be removed.
793 IMPORT_C void RemoveObserver( MAknTreeListObserver* aObserver );
796 * Notifies all of the tree list observers of the specified event. This
797 * method is not exported, as it is intended for internal use only.
799 * @param aEvent The event to be notified.
801 * @param aItem ID of the tree item related to the event.
803 void NotifyObservers( MAknTreeListObserver::TEvent aEvent,
804 TAknTreeItemID aItem );
807 * Checks whether tabulator mode function indicators are enabled.
809 * @return @c ETrue if tabulator mode is enabled.
811 IMPORT_C TBool TabModeFunctionIndicators() const;
814 * Changes the appearance of collapse and expand function indicators. The
815 * appearance of default function indicators suggest that left and right
816 * arrow keys expand and collapse the focused nodes, but when the list is
817 * used with tabulators, those keys are used in changing tabulators.
818 * Alternate representation for function indicator can be set by enabling
819 * tabulator mode indicator with this method.
821 * @param aEnable @c ETrue to enable tabulator mode function indicators,
822 * @c EFalse to use the default function indicators.
824 IMPORT_C void EnableTabModeFunctionIndicatorsL( TBool aEnable );
828 * Sets the focused item and its position on the list view.
830 * When the focused item is changed, the vertical position of the view
831 * is changed as follows:
833 * If the focused item is set on the first page, view is changed
834 * to the beginning of the list.
836 * If the focused item is not set on the first page, view is changed so
837 * that focused item is at the lowest line on the screen.
839 * (In this context first page means actual lines from 0
840 * to max. number of visible lines - 1)
842 * The horizontal position of the view is changed so that the
843 * the beginning of the focused item is visible.
845 * @param aItem Item ID of the item to be focused.
847 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
849 IMPORT_C void SetFocusedItem( TAknTreeItemID aItem );
852 * Gets the index of the focused item on the screen. Possible values are
853 * from 0 to max. number of visible lines - 1. Value -1 is
854 * returned if no item is focused or focused item is not visible.
856 * @return index of the focused item on the screen.
858 IMPORT_C TInt FocusedItemIndex() const;
861 * Gets the index of the item on the screen. Possible values are
862 * from 0 to max. number of visible lines - 1. Value -1 is
863 * returned if the requested item is not visible on the screen.
865 * @return index of the requested item.
867 IMPORT_C TInt VisibleItemIndex( TAknTreeItemID aItem ) const;
871 * Sets custom ordering for the hierarchical list and sorts the list
872 * with the use of given ordering interface. The given interface is
873 * used until it is replaced with some other ordering.
875 * @param aOrdering Custom ordering interface used in list sorting.
877 * @param aFocusBehaviour Tells how focus should be handled after sorting.
878 * @c ESaveFocus saves focus in the item where it was before sorting,
879 * @c EMoveFocusToFirstItem changes view to the beginning of the list
880 * and moves focus to the first item.
882 * @param aDrawNow @c ETrue to redraw the list after sorting.
884 IMPORT_C void Sort( MAknCustomTreeOrdering* aOrdering, TFocusBehaviour aFocusBehaviour, TBool aDrawNow );
887 * Sorts the specified node with the use of previously set ordering
888 * interface. The sorting can be restricted to the specified node, or
889 * the sorting can be set to include also every descendant node of the
890 * specified node. Whole list can be sorted by giving the constant
891 * @c KAknTreeIIDRoot as the @c aNode parameter. This method has no
892 * effect, if no ordering has been set for the list.
894 * @param aNode Item ID of the node that has to be sorted.
896 * @param aFocusBehaviour Tells how focus should be handled after sorting.
897 * @c ESaveFocus saves focus in the item where it was before sorting,
898 * @c EMoveFocusToFirstItem changes view to the beginning of the list
899 * and moves focus to the first item.
901 * @param aSortDescendants @c ETrue to sort the content of the specified
902 * node including the content of its descendant nodes, @c EFalse to
903 * sort only the child items within the specified node.
905 * @param aDrawNow @c ETrue to redraw the list after sorting.
907 * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
909 * @panic EAknHListPanicInvalidItemType Specified item is not a node.
911 IMPORT_C void Sort( TAknTreeItemID aNode, TFocusBehaviour aFocusBehaviour, TBool aSortDescendants, TBool aDrawNow );
914 * Sets text for the empty list. This text is visible if the list box
917 * @param aText The text for the empty list.
919 IMPORT_C void SetEmptyTextL(const TDesC& aText);
922 // From base class CCoeControl
926 * Handles key events. The method will return @c EKeyWasNotConsumed, if
927 * the list is not focused.
929 * @param aKeyEvent The key event.
931 * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or
934 TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
938 * Changes the visibility of the hierarchical list.
940 * @param aVisible @c ETrue to make the list visible, @c EFalse to make
943 void MakeVisible( TBool aVisible );
947 * Sets whether the list is dimmed.
949 * @param aDimmed @c ETrue to set list dimmed, otherwise @c EFalse.
951 void SetDimmed( TBool aDimmed );
955 * Sets the control's containing window by copying it from aContainer.
957 * @param aContainer The compound control that is the container for this
960 void SetContainerWindowL( const CCoeControl& aContainer );
964 * Sets the control as ready to be drawn.
970 * Handles resource changes.
974 void HandleResourceChange( TInt aType );
978 * Gets the control's input capabilities.
980 * @return The control's input capabilities.
982 TCoeInputCapabilities InputCapabilities() const;
986 * Handles pointer events.
988 * @param aPointerEvent Pointer event.
990 void HandlePointerEventL( const TPointerEvent& aPointerEvent );
994 * Gets the number of controls contained in a compound control.
996 * @return The number of component controls contained by this control.
998 TInt CountComponentControls() const;
1002 * Gets an indexed component of a compound control.
1004 * @param aIndex The index of the control.
1006 * @return The component control with an index of aIndex.
1008 CCoeControl* ComponentControl( TInt aIndex ) const;
1018 * Second phase constructor. Completes the construction of the base class.
1019 * When this version of @c BaseConstructL() is used, new window is created
1022 void BaseConstructL();
1025 * Second phase constructor. Completes the construction of the base class.
1027 * @param aContainer Container for the list.
1029 void BaseConstructL( const CCoeControl& aContainer );
1032 * Reference to the tree structure.
1034 * @return Reference to tree structure.
1039 * Constant reference to the tree structure.
1041 * @return Constant reference to tree structure.
1043 const CAknTree& Tree() const;
1046 * Reference to the tree list view.
1048 * @return Reference to tree list view.
1050 CAknTreeListView& View();
1053 * Constant reference to the tree list view.
1055 * @return Constant reference to tree list view.
1057 const CAknTreeListView& View() const;
1059 // from base class CCoeControl
1063 * Handles focus change.
1065 * @param aDrawNow @c EDrawNow to redraw the list.
1067 void FocusChanged( TDrawNow aDrawNow );
1071 * Responds to changes to the size and position of this control.
1077 * Responds to changes in the position of this control.
1079 void PositionChanged();
1083 * Retrieves an object of the same type as that encapsulated in aId.
1085 * @param aId An encapsulated object type ID.
1087 * @return Encapsulates the pointer to the object provided. Note that the
1088 * encapsulated pointer may be NULL
1090 TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
1094 // from base class CCoeControl
1100 * @param aRect Specifies the area that needs to be redrawn.
1102 void Draw( const TRect& aRect ) const;
1121 CAknTreeListView* iView;
1124 * Tree list observers.
1127 RPointerArray<MAknTreeListObserver> iObservers;
1130 * Index to observer array.
1137 #endif // C_AKNTREELIST_H