Link against: aknhlist.lib
#include <akntreelist.h>
Inherits CAknControl.
Inherited by CAknSingleColumnStyleTreeList, and CAknSingleStyleTreeList.
This class functions as a base class for hierarchical lists. It contains the APIs common to all hierarchical lists. The internal structure of the list is not exposed directly to the list clients, instead the structure can be accessed through the APIs in this class. The items in the list are referred with item IDs, which are returned to the client when the items are added to the list.
List items are divided into leaves and nodes, the difference being that nodes have expand and collapse functionality and can contain other tree items as child items, whereas leaves cannot contain other list items. Methods IsLeaf()
and IsNode()
can be used for checking if items belong into these groups.
The expand and collapse events, among other list events, are send to list observers through MAknTreeListObserver
interface. This enables that the whole list does not have to be populated at once, as the content of each node can be added when the node is expanded. To avoid unnecessary memory consumption, the content of each node is removed from the list when the node is collapsed. However, list items can be set persistent, in which case they are not removed from nodes on collapse events.
As the hierarchical list items are list specialisation specific, the specialisations of this class have to provide APIs for constructing and adding new items to the list, and getting and setting specialisation specific properties of the list items.
All the methods that might affect the appearance of the list view have an additional aDrawNow
parameter, which can be used to indicate whether the list view should be redrawn to correspond to the modified list structure. This allows consecutive calls to be made without the list view being updated between every call by setting the aDrawNow
parameter to EFalse
in all of the calls but the last. The normal draw methods inherited from CCoeControl
can also be used to draw the updated view.
Public Types | |
enum | TFocusBehaviour { ESaveFocus, EMoveFocusToFirstItem } |
Public Member Functions | |
virtual | ~CAknTreeList () |
Destructor. | |
virtual IMPORT_C void | SetFlags (TUint32 aFlags) |
Sets the flags for the hierarchical list. | |
IMPORT_C TUint32 | Flags () const |
Returns the flags set for the list. | |
IMPORT_C void | MoveItemL (TAknTreeItemID aItem, TAknTreeItemID aTargetNode, TBool aDrawNow) |
Moves an existing list item to specified target node. | |
IMPORT_C void | RemoveItem (TAknTreeItemID aItem, TBool aDrawNow) |
Removes an item from the hierarchical list. | |
IMPORT_C void | ExpandNode (TAknTreeItemID aNode, TBool aDrawNow) |
Expands a node in hierarchical list. | |
IMPORT_C void | CollapseNode (TAknTreeItemID aNode, TBool aDrawNow) |
Collapses a node in hierarchical list. | |
IMPORT_C TBool | IsExpanded (TAknTreeItemID aNode) const |
Checks whether the specified node is expanded. | |
IMPORT_C TAknTreeItemID | FocusedItem () const |
Gets the item ID of the focused item. | |
IMPORT_C void | SetFocusedItem (TAknTreeItemID aItem, TInt aIndex, TBool aDrawNow) |
Sets the focused item and its position on the list view. | |
IMPORT_C TRect | HighlightRect () const |
Highlight rectangle for the focused item. | |
IMPORT_C TInt | AddIconL (const TAknsItemID &aId, const TDesC &aFilename, TInt aBitmapId, TInt aMaskId, TScaleMode aScaleMode) |
Adds a new icon to the list to be used by all list items. | |
IMPORT_C TInt | AddIconL (CFbsBitmap *aIcon, CFbsBitmap *aMask, TBool aTransferOwnership, TScaleMode aScaleMode) |
Adds a new icon to the list. | |
IMPORT_C TInt | AddColorIconL (const TAknsItemID &aId, const TAknsItemID &aColorId, TInt aColorIndex, const TDesC &aFilename, TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor, TScaleMode aScaleMode) |
Adds a new icon to the list to be used by all list items. | |
IMPORT_C void | AssignIconL (TInt aIconId, const TAknsItemID &aId, const TDesC &aFilename, TInt aBitmapId, TInt aMaskId, TScaleMode aScaleMode) |
Assigns an icon to the tree list with the specified ID. | |
IMPORT_C void | AssignIconL (TInt aIconId, CFbsBitmap *aIcon, CFbsBitmap *aMask, TBool aTransferOwnership, TScaleMode aScaleMode) |
Assigns an icon to the tree list with the specified ID. | |
IMPORT_C void | AssignColorIconL (TInt aIconId, const TAknsItemID &aId, const TAknsItemID &aColorId, TInt aColorIndex, const TDesC &aFilename, TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor, TScaleMode aScaleMode) |
Assigns a color icon to the list with the specified ID. | |
IMPORT_C void | RemoveIconL (TInt aIconId) |
Removes the specified icon from the tree list. | |
IMPORT_C TInt | ChildCount (TAknTreeItemID aNode) const |
Returns the number of children of a hierarchical list node. | |
IMPORT_C TAknTreeItemID | Child (TAknTreeItemID aNode, TInt aIndex) const |
Gets the item ID of a child of a hierarcical list node. | |
IMPORT_C TAknTreeItemID | Parent (TAknTreeItemID aItem) const |
Returns the item ID of the parent of a hierarchical list item. | |
IMPORT_C TBool | Contains (TAknTreeItemID aItem) const |
Checks whether the hierarchical list contains the list item with specified item ID. | |
IMPORT_C TBool | IsNode (TAknTreeItemID aItem) const |
Checks whether a hierarchical list item is a node. | |
IMPORT_C TBool | IsLeaf (TAknTreeItemID aItem) const |
Checks whether a hierarchical list item is a leaf. | |
IMPORT_C TBool | IsMarked (TAknTreeItemID aItem) const |
Checks whether a hierarchical list item is marked. | |
IMPORT_C void | SetMarked (TAknTreeItemID aItem, TBool aMarked, TBool aDrawNow) |
Sets an item marked. | |
IMPORT_C void | EnableMarking (TAknTreeItemID aItem, TBool aEnable) |
Enables or disables marking of specified list item. | |
IMPORT_C void | GetMarkedItemsL (RArray< TAknTreeItemID > &aMarkedItems) const |
Gets all the marked items from the tree list. | |
IMPORT_C void | GetMarkedItemsL (TAknTreeItemID aNode, RArray< TAknTreeItemID > &aMarkedItems) const |
Gets all the marked items from the specified node. | |
IMPORT_C TBool | IsEmpty (TAknTreeItemID aNode) const |
Checks whether the specified node is empty. | |
IMPORT_C void | SetNonEmpty (TAknTreeItemID aNode, TBool aNonEmpty, TBool aDrawNow) |
Sets a node non-empty. | |
IMPORT_C TBool | IsPersistent (TAknTreeItemID aItem) const |
Checks if the specified item is set persistent. | |
IMPORT_C void | SetPersistent (TAknTreeItemID aItem, TBool aPersistent) |
Sets an item persistent. | |
IMPORT_C void | Sort (MAknCustomTreeOrdering *aOrdering, TBool aDrawNow) |
Sets custom ordering for the hierarchical list and sorts the list with the use of given ordering interface. | |
IMPORT_C void | Sort (TAknTreeItemID aNode, TBool aSortDescendants, TBool aDrawNow) |
Sorts the specified node with the use of previously set ordering interface. | |
IMPORT_C void | AddObserverL (MAknTreeListObserver *aObserver) |
Adds an observer for the hierarchical list. | |
IMPORT_C void | RemoveObserver (MAknTreeListObserver *aObserver) |
Removes an observer from the hierarchical list. | |
void | NotifyObservers (MAknTreeListObserver::TEvent aEvent, TAknTreeItemID aItem) |
Notifies all of the tree list observers of the specified event. | |
IMPORT_C TBool | TabModeFunctionIndicators () const |
Checks whether tabulator mode function indicators are enabled. | |
IMPORT_C void | EnableTabModeFunctionIndicatorsL (TBool aEnable) |
Changes the appearance of collapse and expand function indicators. | |
IMPORT_C void | SetFocusedItem (TAknTreeItemID aItem) |
Sets the focused item and its position on the list view. | |
IMPORT_C TInt | FocusedItemIndex () const |
Gets the index of the focused item on the screen. | |
IMPORT_C TInt | VisibleItemIndex (TAknTreeItemID aItem) const |
Gets the index of the item on the screen. | |
IMPORT_C void | Sort (MAknCustomTreeOrdering *aOrdering, TFocusBehaviour aFocusBehaviour, TBool aDrawNow) |
Sets custom ordering for the hierarchical list and sorts the list with the use of given ordering interface. | |
IMPORT_C void | Sort (TAknTreeItemID aNode, TFocusBehaviour aFocusBehaviour, TBool aSortDescendants, TBool aDrawNow) |
Sorts the specified node with the use of previously set ordering interface. | |
IMPORT_C void | SetEmptyTextL (const TDesC &aText) |
Sets text for the empty list. | |
TKeyResponse | OfferKeyEventL (const TKeyEvent &aKeyEvent, TEventCode aType) |
From CCoeControl. | |
void | MakeVisible (TBool aVisible) |
From CCoeControl. | |
void | SetDimmed (TBool aDimmed) |
From CCoeControl. | |
void | SetContainerWindowL (const CCoeControl &aContainer) |
From CCoeControl. | |
void | ActivateL () |
From CCoeControl. | |
void | HandleResourceChange (TInt aType) |
From CCoeControl. | |
TCoeInputCapabilities | InputCapabilities () const |
From CCoeControl. | |
void | HandlePointerEventL (const TPointerEvent &aPointerEvent) |
From CCoeControl. | |
TInt | CountComponentControls () const |
From CCoeControl. | |
CCoeControl * | ComponentControl (TInt aIndex) const |
From CCoeControl. | |
Protected Member Functions | |
CAknTreeList () | |
Constructor. | |
void | BaseConstructL () |
Second phase constructor. | |
void | BaseConstructL (const CCoeControl &aContainer) |
Second phase constructor. | |
CAknTree & | Tree () |
Reference to the tree structure. | |
const CAknTree & | Tree () const |
Constant reference to the tree structure. | |
CAknTreeListView & | View () |
Reference to the tree list view. | |
const CAknTreeListView & | View () const |
Constant reference to the tree list view. | |
void | FocusChanged (TDrawNow aDrawNow) |
From CCoeControl. | |
void | SizeChanged () |
From CCoeControl. | |
void | PositionChanged () |
From CCoeControl. | |
TTypeUid::Ptr | MopSupplyObject (TTypeUid aId) |
From CCoeControl. |
|
|
Destructor. |
|
Constructor. |
|
From CCoeControl. Sets the control as ready to be drawn. |
|
Adds a new icon to the list to be used by all list items. The same icon can be used by multiple tree items and it is referenced by the icon ID returned by this function. The given parameters are stored in the tree list, and they are used in reconstructing the bitmaps on skin change events.
|
|
Adds a new icon to the list.
The ownership of given bitmaps is transferred to the list only if specified with
|
|
Adds a new icon to the list to be used by all list items.
The same icon can be used by multiple tree items and its referenced by the ID returned by this function. The given parameters are also stored in the tree list, which enables the tree list to reconstruct the bitmaps on skin change events. If this behaviour is insufficient for the client, it can always replace the existing icons by itself with
|
|
Adds an observer for the hierarchical list.
Notifications of the list events are sent to all observers set with this method. Observers can be removed from the list with
Note: Hierarchical list also sends a state changed event on every list event through the usual control observer interface that can be set with
|
|
Assigns a color icon to the list with the specified ID. If an icon with specified ID already exists in the list, the existing icon is replaced with the new one. The given parameters are stored in the tree list, and they are used in reconstructing the bitmaps on skin change events.
|
|
Assigns an icon to the tree list with the specified ID.
If an icon with specified ID already exists in the list, the existing icon is replaced with the new one. The ownership of bitmaps is transferred to the list only if so specifed with
|
|
Assigns an icon to the tree list with the specified ID. If an icon with specified ID already exists in the list, the existing icon is replaced with the new one. The given parameters are stored in the tree list, and they are used in reconstructing the bitmaps on skin change events.
|
|
Second phase constructor. Completes the construction of the base class.
|
|
Second phase constructor.
Completes the construction of the base class. When this version of |
|
Gets the item ID of a child of a hierarcical list node.
The specific child is specified with an index. The child count for any hierarchical list node can be get with
|
|
Returns the number of children of a hierarchical list node.
This method, along with
|
|
Collapses a node in hierarchical list.
When a node in the hierarchical list is collapsed, either with this method, or with pointer or key event, all its content that is not set persistent is removed from the list to reduce memory consumption. The observer of the hierarchical list is nofied with the respective event. Constant
|
|
From CCoeControl. Gets an indexed component of a compound control.
|
|
Checks whether the hierarchical list contains the list item with specified item ID.
The returned value for constant
|
|
From CCoeControl. Gets the number of controls contained in a compound control.
|
|
Enables or disables marking of specified list item. By default, marking is enabled for every list item. When marking is enabled for an item, its marking can be changed from unmarked to marked, and vice versa, with SetMarked() method, and for markable list, the marking can also change as a result of user action. When marking is disabled, the item can still be either unmarked or marked, but the marking cannot be changed in any way, until it has been enabled again for the item.
|
|
Changes the appearance of collapse and expand function indicators. The appearance of default function indicators suggest that left and right arrow keys expand and collapse the focused nodes, but when the list is used with tabulators, those keys are used in changing tabulators. Alternate representation for function indicator can be set by enabling tabulator mode indicator with this method.
|
|
Expands a node in hierarchical list.
When a node in the hierarchical list is expanded, either with this method, or with pointer or key event, the observer of the list is notified with respective event. The client of the list can then update the content of the expanded node. Constant
|
|
Returns the flags set for the list.
|
|
From CCoeControl. Handles focus change.
|
|
Gets the item ID of the focused item.
|
|
Gets the index of the focused item on the screen. Possible values are from 0 to max. number of visible lines - 1. Value -1 is returned if no item is focused or focused item is not visible.
|
|
Gets all the marked items from the specified node. The marked items are appended to the end of the array passed as parameter.
|
|
Gets all the marked items from the tree list. The marked items are appended to the end of the array passed as parameter.
|
|
From CCoeControl. Handles pointer events.
|
|
From CCoeControl. Handles resource changes.
Reimplemented in CAknSingleColumnStyleTreeList. |
|
Highlight rectangle for the focused item. The returned rectangle is screen relative and it can be used, for example, when positioning pop-up for focused item. If the focused item is not visible, the method returns an empty rectangle.
|
|
From CCoeControl. Gets the control's input capabilities.
|
|
Checks whether the specified node is empty.
To decrease memory consumption, the descendants of tree nodes can be removed from the hierarchical list when the node is collapsed. As the empty nodes may have different appearances in the list view, the collapsed nodes can be set to appear as non-empty with
|
|
Checks whether the specified node is expanded.
|
|
Checks whether a hierarchical list item is a leaf.
|
|
Checks whether a hierarchical list item is marked.
|
|
Checks whether a hierarchical list item is a node.
|
|
Checks if the specified item is set persistent. If an item is set persistent, it is not removed from the list, when its parent or any of its ancestors is collapsed. This means also that a node cannot be automatically removed from the list on collapse event, if any of its descendants is set persistent.
|
|
From CCoeControl. Changes the visibility of the hierarchical list.
|
|
From CCoeControl. Retrieves an object of the same type as that encapsulated in aId.
|
|
Moves an existing list item to specified target node.
The moved item and the target node have to be specified with the item IDs returned when the items were added to the hierarchical list. The target node cannot be a descendant of the moved node. Otherwise, the moving would break the hierarchical structure. Constant
|
|
Notifies all of the tree list observers of the specified event. This method is not exported, as it is intended for internal use only.
|
|
From CCoeControl.
Handles key events. The method will return
|
|
Returns the item ID of the parent of a hierarchical list item.
The constant
|
|
From CCoeControl. Responds to changes in the position of this control. |
|
Removes the specified icon from the tree list.
The specified icon cannot be any of the default tree list icon, in which case the leaves with value
|
|
Removes an item from the hierarchical list.
The item to be removed has to be specified with the ID value returned when the item was added to the hierarchical list. If the removed item is a node containing other list items, those items are removed from the list as well. Constant
|
|
Removes an observer from the hierarchical list.
|
|
From CCoeControl. Sets the control's containing window by copying it from aContainer.
|
|
From CCoeControl. Sets whether the list is dimmed.
|
|
Sets text for the empty list. This text is visible if the list box has no items.
|
|
Sets the flags for the hierarchical list.
Flags Note: Specialisations may override this method in order to restrict the use of some of the flags in specialised list or to handle specialisation specific flags.
Reimplemented in CAknSingleColumnStyleTreeList, and CAknSingleStyleTreeList. |
|
Sets the focused item and its position on the list view. When the focused item is changed, the vertical position of the view is changed as follows: If the focused item is set on the first page, view is changed to the beginning of the list. If the focused item is not set on the first page, view is changed so that focused item is at the lowest line on the screen. (In this context first page means actual lines from 0 to max. number of visible lines - 1) The horizontal position of the view is changed so that the the beginning of the focused item is visible.
|
|
Sets the focused item and its position on the list view. When the focused item is changed, the vertical position of the view is changed so that the position of the focused item on the view matches the given index. The horizontal position of the view is changed so that the the beginning of the focused item is visible.
|
|
Sets an item marked. If the marked item is a node, all of its descendants are also set marked.
Note that item marking can be changed with this method, even if the list itself is not set markable. Marking changes can be enabled and disabled with
|
|
Sets a node non-empty.
|
|
Sets an item persistent. If the specified item is a node, the state of all its descendants is also changed accordingly.
|
|
From CCoeControl. Responds to changes to the size and position of this control. |
|
Sorts the specified node with the use of previously set ordering interface.
The sorting can be restricted to the specified node, or the sorting can be set to include also every descendant node of the specified node. Whole list can be sorted by giving the constant
|
|
Sets custom ordering for the hierarchical list and sorts the list with the use of given ordering interface. The given interface is used until it is replaced with some other ordering.
|
|
Sorts the specified node with the use of previously set ordering interface.
The sorting can be restricted to the specified node, or the sorting can be set to include also every descendant node of the specified node. Whole list can be sorted by giving the constant
|
|
Sets custom ordering for the hierarchical list and sorts the list with the use of given ordering interface. The given interface is used until it is replaced with some other ordering. Note: Ownership of the interface is not transferred to the list.
Note: When custom ordering is set to the list, new items are added to the end of their parent nodes, because the interface cannot be used for determining the position for inserted item, as the client receives its identifier only after it has been inserted.
|
|
Checks whether tabulator mode function indicators are enabled.
|
|
Constant reference to the tree structure.
|
|
Reference to the tree structure.
|
|
Constant reference to the tree list view.
|
|
Reference to the tree list view.
|
|
Gets the index of the item on the screen. Possible values are from 0 to max. number of visible lines - 1. Value -1 is returned if the requested item is not visible on the screen.
|