epoc32/include/mw/akntreelist.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Abstract base class for hierarchical lists.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef C_AKNTREELIST_H
williamr@2
    20
#define C_AKNTREELIST_H
williamr@2
    21
williamr@2
    22
williamr@4
    23
#include <AknControl.h>
williamr@2
    24
#include <w32std.h>
williamr@2
    25
#include <akntreelistobserver.h>
williamr@4
    26
#include <AknIconUtils.h> // TScaleMode
williamr@2
    27
williamr@2
    28
class CAknTree;
williamr@2
    29
class CAknTreeListView;
williamr@2
    30
class MAknCustomTreeOrdering;
williamr@2
    31
class TAknsItemID;
williamr@2
    32
williamr@2
    33
/** Flag to indicate that hierarchical list is looping. */
williamr@2
    34
const TUint32 KAknTreeListLooping = 0x0001;
williamr@2
    35
williamr@2
    36
/** Flag to indicate that hierarchical list structure lines are not visible. */
williamr@2
    37
const TUint32 KAknTreeListNoStructureLines = 0x0002;
williamr@2
    38
williamr@2
    39
/** Flag to set marquee scrolling on. */
williamr@2
    40
const TUint32 KAknTreeListMarqueeScrolling = 0x0004;
williamr@2
    41
williamr@2
    42
/** Flag to disable indention of hierarchical list items. Setting this flag
williamr@2
    43
    also forces the tree structure lines invisible. */
williamr@2
    44
const TUint32 KAknTreeListNoIndention = 0x0008;
williamr@2
    45
williamr@2
    46
/** Flag to set hierarchical list markable. The list items can always be
williamr@2
    47
    marked by list client with API methods, but when list is set markable,
williamr@2
    48
    it responds to specified pointer and key event by marking/unmarking
williamr@2
    49
    items as required. */
williamr@2
    50
const TUint32 KAknTreeListMarkable = 0x0010;
williamr@2
    51
williamr@2
    52
williamr@2
    53
/**
williamr@2
    54
 *  Abstract base class for hierarchical lists.
williamr@2
    55
 *
williamr@2
    56
 *  This class functions as a base class for hierarchical lists. It contains
williamr@2
    57
 *  the APIs common to all hierarchical lists. The internal structure of the
williamr@2
    58
 *  list is not exposed directly to the list clients, instead the structure
williamr@2
    59
 *  can be accessed through the APIs in this class. The items in the list are
williamr@2
    60
 *  referred with item IDs, which are returned to the client when the items
williamr@2
    61
 *  are added to the list.
williamr@2
    62
 *
williamr@2
    63
 *  List items are divided into leaves and nodes, the difference being that
williamr@2
    64
 *  nodes have expand and collapse functionality and can contain other tree
williamr@2
    65
 *  items as child items, whereas leaves cannot contain other list items.
williamr@2
    66
 *  Methods @c IsLeaf() and @c IsNode() can be used for checking if items
williamr@2
    67
 *  belong into these groups.
williamr@2
    68
 *
williamr@2
    69
 *  The expand and collapse events, among other list events, are send to list
williamr@2
    70
 *  observers through @c MAknTreeListObserver interface. This enables that
williamr@2
    71
 *  the whole list does not have to be populated at once, as the content of
williamr@2
    72
 *  each node can be added when the node is expanded. To avoid unnecessary
williamr@2
    73
 *  memory consumption, the content of each node is removed from the list
williamr@2
    74
 *  when the node is collapsed. However, list items can be set persistent,
williamr@2
    75
 *  in which case they are not removed from nodes on collapse events.
williamr@2
    76
 *
williamr@2
    77
 *  As the hierarchical list items are list specialisation specific, the
williamr@2
    78
 *  specialisations of this class have to provide APIs for constructing and
williamr@2
    79
 *  adding new items to the list, and getting and setting specialisation
williamr@2
    80
 *  specific properties of the list items.
williamr@2
    81
 *
williamr@2
    82
 *  All the methods that might affect the appearance of the list view have an
williamr@2
    83
 *  additional @c aDrawNow parameter, which can be used to indicate whether
williamr@2
    84
 *  the list view should be redrawn to correspond to the modified list
williamr@2
    85
 *  structure. This allows consecutive calls to be made without the list view
williamr@2
    86
 *  being updated between every call by setting the @c aDrawNow parameter to
williamr@2
    87
 *  @c EFalse in all of the calls but the last. The normal draw methods 
williamr@2
    88
 *  inherited from @c CCoeControl can also be used to draw the updated view.
williamr@2
    89
 *
williamr@2
    90
 *  @see MAknTreeListObserver
williamr@2
    91
 *
williamr@2
    92
 *  @lib aknhlist.lib
williamr@2
    93
 *  @since S60 v3.2
williamr@2
    94
 */
williamr@2
    95
NONSHARABLE_CLASS( CAknTreeList ) : public CAknControl
williamr@2
    96
    {
williamr@2
    97
williamr@2
    98
public:
williamr@2
    99
williamr@2
   100
williamr@2
   101
	// for focus handling after Sort
williamr@2
   102
   enum TFocusBehaviour
williamr@2
   103
            {
williamr@2
   104
            ESaveFocus,
williamr@2
   105
            EMoveFocusToFirstItem
williamr@2
   106
            };
williamr@2
   107
williamr@2
   108
    /**
williamr@2
   109
     * Destructor.
williamr@2
   110
     */
williamr@2
   111
    virtual ~CAknTreeList();
williamr@2
   112
williamr@2
   113
    /**
williamr@2
   114
     * Sets the flags for the hierarchical list.
williamr@2
   115
     *
williamr@2
   116
     * Flags @c KAknTreeListLooping, @c KAknTreeListNoStructureLines,
williamr@2
   117
     * @c KAknTreeListMarqueeScrolling, @c KAknTreeListNoIndention, and
williamr@2
   118
     * @c KAknTreeListMarkable can be used to change the behaviour
williamr@2
   119
     * of the list.
williamr@2
   120
     *
williamr@2
   121
     * Note: Specialisations may override this method in order to restrict the
williamr@2
   122
     * use of some of the flags in specialised list or to handle specialisation
williamr@2
   123
     * specific flags.
williamr@2
   124
     *
williamr@2
   125
     * @param aFlags Flags.
williamr@2
   126
     */
williamr@2
   127
    IMPORT_C virtual void SetFlags( TUint32 aFlags );
williamr@2
   128
williamr@2
   129
    /**
williamr@2
   130
     * Returns the flags set for the list.
williamr@2
   131
     *
williamr@2
   132
     * @return Flags.
williamr@2
   133
     */
williamr@2
   134
    IMPORT_C TUint32 Flags() const;
williamr@2
   135
williamr@2
   136
    /**
williamr@2
   137
     * Moves an existing list item to specified target node. The moved item
williamr@2
   138
     * and the target node have to be specified with the item IDs returned
williamr@2
   139
     * when the items were added to the hierarchical list. The target node
williamr@2
   140
     * cannot be a descendant of the moved node. Otherwise, the moving would
williamr@2
   141
     * break the hierarchical structure. Constant @c KAknTreeIIDRoot can be
williamr@2
   142
     * used as an ID for the target node when the item is to be moved to the
williamr@2
   143
     * top-most level of the list.
williamr@2
   144
     *
williamr@2
   145
     * @param aItem Item ID of the item to be moved.
williamr@2
   146
     *
williamr@2
   147
     * @param aTargetNode ID of the node, where the item is to be moved.
williamr@2
   148
     *
williamr@2
   149
     * @param aDrawNow @c ETrue to redraw the list after the item has been
williamr@2
   150
     *      moved, otherwise @c EFalse.
williamr@2
   151
     *
williamr@2
   152
     * @leave KErrArgument The specified item is the same as the target node
williamr@2
   153
     *      or one of the ancestors of target node. 
williamr@2
   154
     *
williamr@2
   155
     * @leave KErrNoMemory Not enough memory is available for adding the
williamr@2
   156
     *      specified item to the target node.
williamr@2
   157
     *
williamr@2
   158
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   159
     *
williamr@2
   160
     * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
williamr@2
   161
     *
williamr@2
   162
     * @pre The moved item and the target node exist in the list, and the
williamr@2
   163
     *      target node is not a descendant of the moved item.
williamr@2
   164
     *
williamr@2
   165
     * @post The item is moved to the specified target node and into a such
williamr@2
   166
     *      position that the children of the target node remain in sorted
williamr@2
   167
     *      order. The updated list is redrawn, if it is requested with the
williamr@2
   168
     *      aDrawNow parameter.
williamr@2
   169
     */
williamr@2
   170
    IMPORT_C void MoveItemL( TAknTreeItemID aItem, TAknTreeItemID aTargetNode,
williamr@2
   171
        TBool aDrawNow );
williamr@2
   172
williamr@2
   173
    /**
williamr@2
   174
     * Removes an item from the hierarchical list. The item to be removed has
williamr@2
   175
     * to be specified with the ID value returned when the item was added to
williamr@2
   176
     * the hierarchical list. If the removed item is a node containing other
williamr@2
   177
     * list items, those items are removed from the list as well. Constant
williamr@2
   178
     * @c KAknTreeIIDRoot can be used to remove every item from the list.
williamr@2
   179
     *
williamr@2
   180
     * @param aItem Item ID of the item to be removed.
williamr@2
   181
     *
williamr@2
   182
     * @param aDrawNow @c ETrue to redraw the list after the item has been
williamr@2
   183
     *      removed, othewise @c EFalse.
williamr@2
   184
     *
williamr@2
   185
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   186
     *
williamr@2
   187
     * @pre The specified item exists in the hierarchical list.
williamr@2
   188
     *
williamr@2
   189
     * @post The specified item and all of its descendants are removed from
williamr@2
   190
     *      the list. The updated list is drawn, when it is requested with
williamr@2
   191
     *      the aDrawNow parameter.
williamr@2
   192
     */
williamr@2
   193
    IMPORT_C void RemoveItem( TAknTreeItemID aItem, TBool aDrawNow );
williamr@2
   194
williamr@2
   195
    /**
williamr@2
   196
     * Expands a node in hierarchical list. When a node in the hierarchical
williamr@2
   197
     * list is expanded, either with this method, or with pointer or key
williamr@2
   198
     * event, the observer of the list is notified with respective event.
williamr@2
   199
     * The client of the list can then update the content of the expanded
williamr@2
   200
     * node. Constant @c KAknTreeIIDRoot can be used to expand every node
williamr@2
   201
     * in the tree structure.
williamr@2
   202
     *
williamr@2
   203
     * @param aNode Item ID of the node to be expanded.
williamr@2
   204
     * 
williamr@2
   205
     * @param aDrawNow @c ETrue to redraw the list after the node has been
williamr@2
   206
     *      expanded, otherwise @c EFalse.
williamr@2
   207
     *
williamr@2
   208
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   209
     *
williamr@2
   210
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   211
     *
williamr@2
   212
     * @pre The specified item exists in the hierarchical list and it is a
williamr@2
   213
     *      node.
williamr@2
   214
     *
williamr@2
   215
     * @post The specified node is expanded. The updated list is drawn, when
williamr@2
   216
     *      it is requested with the aDrawNow parameter.
williamr@2
   217
     */
williamr@2
   218
    IMPORT_C void ExpandNode( TAknTreeItemID aNode, TBool aDrawNow );
williamr@2
   219
williamr@2
   220
    /**
williamr@2
   221
     * Collapses a node in hierarchical list. When a node in the hierarchical
williamr@2
   222
     * list is collapsed, either with this method, or with pointer or key
williamr@2
   223
     * event, all its content that is not set persistent is removed from the
williamr@2
   224
     * list to reduce memory consumption. The observer of the hierarchical
williamr@2
   225
     * list is nofied with the respective event. Constant @c KAknTreeIIDRoot
williamr@2
   226
     * can be used to collapse every node in the tree structure.
williamr@2
   227
     *
williamr@2
   228
     * @param aNode Item ID of the node to be collapsed.
williamr@2
   229
     *
williamr@2
   230
     * @param aDrawNow @c ETrue to redraw the list after the node has been
williamr@2
   231
     *      collapsed, otherwise @c EFalse.
williamr@2
   232
     *
williamr@2
   233
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   234
     *
williamr@2
   235
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   236
     *
williamr@2
   237
     * @pre The specified item exists in the hierarchical list and it is a
williamr@2
   238
     *      node.
williamr@2
   239
     *
williamr@2
   240
     * @post The specified item is collapsed and all of its children, which are
williamr@2
   241
     *      not set persistent, are removed from the list.
williamr@2
   242
     */
williamr@2
   243
    IMPORT_C void CollapseNode( TAknTreeItemID aNode, TBool aDrawNow );
williamr@2
   244
williamr@2
   245
    /**
williamr@2
   246
     * Checks whether the specified node is expanded.
williamr@2
   247
     *
williamr@2
   248
     * @param aNode Item ID of a node.
williamr@2
   249
     *
williamr@2
   250
     * @return @c ETrue if the node is expanded.
williamr@2
   251
     *
williamr@2
   252
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   253
     *
williamr@2
   254
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   255
     */
williamr@2
   256
    IMPORT_C TBool IsExpanded( TAknTreeItemID aNode ) const;
williamr@2
   257
williamr@2
   258
    /**
williamr@2
   259
     * Gets the item ID of the focused item.
williamr@2
   260
     *
williamr@2
   261
     * @return Item ID of the focused item. Value @c KAknTreeIIDNone is
williamr@2
   262
     *      returned if no item is focused.
williamr@2
   263
     */
williamr@2
   264
    IMPORT_C TAknTreeItemID FocusedItem() const;
williamr@2
   265
williamr@2
   266
    /**
williamr@2
   267
     * Sets the focused item and its position on the list view. When the
williamr@2
   268
     * focused item is changed, the vertical position of the view is changed
williamr@2
   269
     * so that the position of the focused item on the view matches the given
williamr@2
   270
     * index. The horizontal position of the view is changed so that the
williamr@2
   271
     * the beginning of the focused item is visible.
williamr@2
   272
     *
williamr@2
   273
     * @param aItem Item ID of the item to be focused.
williamr@2
   274
     *
williamr@2
   275
     * @param aIndex The position of the focused item on the list view. If the
williamr@2
   276
     *      index does not refer to any visible view location, that is, the
williamr@2
   277
     *      index is less than zero or greater than or equal to the number of
williamr@2
   278
     *      items in the view, the focused item is changed to specified item,
williamr@2
   279
     *      but the position of the view is not changed.
williamr@2
   280
     *
williamr@2
   281
     * @param aDrawNow @c ETrue to redraw the list after the focused item
williamr@2
   282
     *      has been changed, otherwise @c EFalse.
williamr@2
   283
     *
williamr@2
   284
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   285
     */
williamr@2
   286
    IMPORT_C void SetFocusedItem( TAknTreeItemID aItem, TInt aIndex,
williamr@2
   287
        TBool aDrawNow );
williamr@2
   288
williamr@2
   289
    /**
williamr@2
   290
     * Highlight rectangle for the focused item. The returned rectangle is
williamr@2
   291
     * screen relative and it can be used, for example, when positioning
williamr@2
   292
     * pop-up for focused item. If the focused item is not visible, the
williamr@2
   293
     * method returns an empty rectangle.
williamr@2
   294
     *
williamr@2
   295
     * @return Highlight rectangle of focused list item.
williamr@2
   296
     */
williamr@2
   297
    IMPORT_C TRect HighlightRect() const;
williamr@2
   298
williamr@2
   299
    /**
williamr@2
   300
     * Adds a new icon to the list to be used by all list items. The same
williamr@2
   301
     * icon can be used by multiple tree items and its referenced by the
williamr@2
   302
     * ID returned by this function. The given parameters are also stored
williamr@2
   303
     * in the tree list, which enables the tree list to reconstruct the
williamr@2
   304
     * bitmaps on skin change events. If this behaviour is insufficient for
williamr@2
   305
     * the client, it can always replace the existing icons by itself with
williamr@2
   306
     * @c AssignIconL or @c AssignColorIconL method.
williamr@2
   307
     *
williamr@2
   308
     * @param aId Item ID of the icon to be added.
williamr@2
   309
     *
williamr@2
   310
     * @param aFilename Filename to be used to construct the item, 
williamr@2
   311
     *      if no matching item was found in the currently active skin.
williamr@2
   312
     *
williamr@2
   313
     * @param aBitmapId ID of the bitmap in the file. 
williamr@2
   314
     *      Used only if no matching item was found in the currently 
williamr@2
   315
     *      active skin.
williamr@2
   316
     *
williamr@2
   317
     * @param aMaskId ID of the mask in the file.
williamr@2
   318
     *      Used only if no matching item was found in the currently
williamr@2
   319
     *      active skin.
williamr@2
   320
     * 
williamr@2
   321
     * @param aScaleMode Scale mode used when icon's bitmap is resized.
williamr@2
   322
     *
williamr@2
   323
     * @return ID assigned for the added icon.
williamr@2
   324
     *
williamr@2
   325
     * @leave KErrNoMemory Not enough memory.
williamr@2
   326
     */
williamr@2
   327
    IMPORT_C TInt AddIconL( const TAknsItemID& aId, const TDesC& aFilename,
williamr@2
   328
        TInt aBitmapId, TInt aMaskId, TScaleMode aScaleMode );
williamr@2
   329
williamr@2
   330
    /**
williamr@2
   331
     * Adds a new icon to the list. The ownership of given bitmaps is
williamr@2
   332
     * transferred to the list only if specified with @c aTransferOwnership
williamr@2
   333
     * parameter. Note that icons added to the list with this method cannot
williamr@2
   334
     * be reconstructed on skin change events by the list. If necessary,
williamr@2
   335
     * previously added icons can be replaced with @c AssignIconL method.
williamr@2
   336
     *
williamr@2
   337
     * @param aIcon Pointer to the bitmap.
williamr@2
   338
     *
williamr@2
   339
     * @param aMask Pointer to the mask bitmap.
williamr@2
   340
     *
williamr@2
   341
     * @param aTransferOwnership @c ETrue, if ownership of bitmaps is
williamr@2
   342
     * transferred to the list. If the method leaves, it is always on the
williamr@2
   343
     * responsibility of the client code to take care of deleting the bitmaps.
williamr@2
   344
     *
williamr@2
   345
     * @param aScaleMode The scale mode used when the icon is resized.
williamr@2
   346
     *
williamr@2
   347
     * @return ID assigned for the added icon.
williamr@2
   348
     *
williamr@2
   349
     * @leave KErrNoMemory Not enough memory.
williamr@2
   350
     */
williamr@2
   351
    IMPORT_C TInt AddIconL( CFbsBitmap* aIcon, CFbsBitmap* aMask,
williamr@2
   352
        TBool aTransferOwnership, TScaleMode aScaleMode );
williamr@2
   353
williamr@2
   354
    /**
williamr@2
   355
     * Adds a new icon to the list to be used by all list items. The same
williamr@2
   356
     * icon can be used by multiple tree items and it is referenced by the
williamr@2
   357
     * icon ID returned by this function. The given parameters are stored
williamr@2
   358
     * in the tree list, and they are used in reconstructing the bitmaps on
williamr@2
   359
     * skin change events.
williamr@2
   360
     *
williamr@2
   361
     * @param aId Item ID of the icon to be added.
williamr@2
   362
     *
williamr@2
   363
     * @param aColorId Item ID of the color table.
williamr@2
   364
     *
williamr@2
   365
     * @param aColorIndex Index in the color table.
williamr@2
   366
     *
williamr@2
   367
     * @param aFilename Filename to be used to construct the item, 
williamr@2
   368
     *      if no matching item was found in the currently active skin.
williamr@2
   369
     *
williamr@2
   370
     * @param aBitmapId ID of the bitmap in the file. 
williamr@2
   371
     *      Used only if no matching item was found in the currently 
williamr@2
   372
     *      active skin.
williamr@2
   373
     *
williamr@2
   374
     * @param aMaskId ID of the mask in the file.
williamr@2
   375
     *      Used only if no matching item was found in the currently
williamr@2
   376
     *      active skin.
williamr@2
   377
     *
williamr@2
   378
     * @param aDefaultColor Color RGB value to be used, if no color
williamr@2
   379
     *      is found in the currently active skin.
williamr@2
   380
     *
williamr@2
   381
     * @param aScaleMode Scale mode used when icon's bitmap is resized.
williamr@2
   382
     *
williamr@2
   383
     * @return ID assigned for the added icon.
williamr@2
   384
     *
williamr@2
   385
     * @leave KErrNoMemory Not enough memory.
williamr@2
   386
     */
williamr@2
   387
    IMPORT_C TInt AddColorIconL( const TAknsItemID& aId,
williamr@2
   388
        const TAknsItemID& aColorId, TInt aColorIndex, const TDesC& aFilename,
williamr@2
   389
        TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor,
williamr@2
   390
        TScaleMode aScaleMode );
williamr@2
   391
williamr@2
   392
    /**
williamr@2
   393
     * Assigns an icon to the tree list with the specified ID. If an icon
williamr@2
   394
     * with specified ID already exists in the list, the existing icon is
williamr@2
   395
     * replaced with the new one. The given parameters are stored in the
williamr@2
   396
     * tree list, and they are used in reconstructing the bitmaps on skin
williamr@2
   397
     * change events.
williamr@2
   398
     *
williamr@2
   399
     * @param aIconId Icon ID assigned for the icon.
williamr@2
   400
     *
williamr@2
   401
     * @param aId Item ID of the icon to be added.
williamr@2
   402
     *
williamr@2
   403
     * @param aFilename Filename to be used to construct the item, 
williamr@2
   404
     *      if no matching item was found in the currently active skin.
williamr@2
   405
     *
williamr@2
   406
     * @param aBitmapId ID of the bitmap in the file. 
williamr@2
   407
     *      Used only if no matching item was found in the currently 
williamr@2
   408
     *      active skin.
williamr@2
   409
     *
williamr@2
   410
     * @param aMaskId ID of the mask in the file.
williamr@2
   411
     *      Used only if no matching item was found in the currently
williamr@2
   412
     *      active skin.
williamr@2
   413
     *
williamr@2
   414
     * @param aScaleMode Scale mode used when icon's bitmap is resized.
williamr@2
   415
     *
williamr@2
   416
     * @leave KErrNoMemory Not enough memory.
williamr@2
   417
     *
williamr@2
   418
     * @leave KErrArgument Specified icon ID is out of allowed range.
williamr@2
   419
     */
williamr@2
   420
    IMPORT_C void AssignIconL( TInt aIconId, const TAknsItemID& aId,
williamr@2
   421
        const TDesC& aFilename, TInt aBitmapId, TInt aMaskId,
williamr@2
   422
        TScaleMode aScaleMode );
williamr@2
   423
williamr@2
   424
    /**
williamr@2
   425
     * Assigns an icon to the tree list with the specified ID. If an icon
williamr@2
   426
     * with specified ID already exists in the list, the existing icon is
williamr@2
   427
     * replaced with the new one. The ownership of bitmaps is transferred to
williamr@2
   428
     * the list only if so specifed with @c aTransferOnwership parameter.
williamr@2
   429
     * Note that icons added with this method cannot be reconstructed on
williamr@2
   430
     * skin change events by list.
williamr@2
   431
     *
williamr@2
   432
     * @param aIconId Icon ID assigned for the icon.
williamr@2
   433
     *
williamr@2
   434
     * @param aIcon Pointer to the bitmap.
williamr@2
   435
     *
williamr@2
   436
     * @param aMask Pointer to the mask bitmap.
williamr@2
   437
     *
williamr@2
   438
     * @param aTransferOwnership @c ETrue, if ownership of bitmaps is
williamr@2
   439
     *      transferred to the list. If the method leaves, it is always on
williamr@2
   440
     *      the responsibility of the client code to take care of deleting
williamr@2
   441
     *      the bitmaps.
williamr@2
   442
     *
williamr@2
   443
     * @param aScaleMode Scale mode used when icon's bitmap is resized.
williamr@2
   444
     *
williamr@2
   445
     * @leave KErrNoMemory Not enough memory.
williamr@2
   446
     *
williamr@2
   447
     * @leave KErrArgument Specified icon ID is out of allowed range.
williamr@2
   448
     */
williamr@2
   449
    IMPORT_C void AssignIconL( TInt aIconId, CFbsBitmap* aIcon,
williamr@2
   450
        CFbsBitmap* aMask, TBool aTransferOwnership, TScaleMode aScaleMode );
williamr@2
   451
williamr@2
   452
    /**
williamr@2
   453
     * Assigns a color icon to the list with the specified ID. If an icon
williamr@2
   454
     * with specified ID already exists in the list, the existing icon is
williamr@2
   455
     * replaced with the new one. The given parameters are stored in the
williamr@2
   456
     * tree list, and they are used in reconstructing the bitmaps on skin
williamr@2
   457
     * change events.
williamr@2
   458
     *
williamr@2
   459
     * @param aIconId Icon ID assigned for the icon.
williamr@2
   460
     *
williamr@2
   461
     * @param aId Item ID of the icon to be added.
williamr@2
   462
     *
williamr@2
   463
     * @param aColorId Item ID of the color table.
williamr@2
   464
     *
williamr@2
   465
     * @param aColorIndex Index in the color table.
williamr@2
   466
     *
williamr@2
   467
     * @param aFilename Filename to be used to construct the item, 
williamr@2
   468
     *      if no matching item was found in the currently active skin.
williamr@2
   469
     *
williamr@2
   470
     * @param aBitmapId ID of the bitmap in the file. 
williamr@2
   471
     *      Used only if no matching item was found in the currently 
williamr@2
   472
     *      active skin.
williamr@2
   473
     *
williamr@2
   474
     * @param aMaskId ID of the mask in the file.
williamr@2
   475
     *      Used only if no matching item was found in the currently
williamr@2
   476
     *      active skin.
williamr@2
   477
     *
williamr@2
   478
     * @param aDefaultColor Color RGB value to be used, if no color
williamr@2
   479
     *      is found in the currently active skin.
williamr@2
   480
     *
williamr@2
   481
     * @param aScaleMode Scale mode used when icon's bitmap is resized.
williamr@2
   482
     *
williamr@2
   483
     * @leave KErrNoMemory Not enough memory.
williamr@2
   484
     *
williamr@2
   485
     * @leave KErrArgument Specified icon ID is out of allowed range.
williamr@2
   486
     */ 
williamr@2
   487
    IMPORT_C void AssignColorIconL( TInt aIconId, const TAknsItemID& aId,
williamr@2
   488
        const TAknsItemID& aColorId, TInt aColorIndex, const TDesC& aFilename,
williamr@2
   489
        TInt aBitmapId, TInt aMaskId, TRgb aDefaultColor,
williamr@2
   490
        TScaleMode aScaleMode );
williamr@2
   491
williamr@2
   492
    /**
williamr@2
   493
     * Removes the specified icon from the tree list. The specified icon cannot
williamr@2
   494
     * be any of the default tree list icon, in which case the leaves with
williamr@2
   495
     * value @c KErrArgument. If the specified icon is not found, the function
williamr@2
   496
     * does nothing.
williamr@2
   497
     *
williamr@2
   498
     * @param aIconId Icon ID of the removed icon.
williamr@2
   499
     *
williamr@2
   500
     * @leave KErrArgument if specified icon is one of the default icons.
williamr@2
   501
     */
williamr@2
   502
    IMPORT_C void RemoveIconL( TInt aIconId );
williamr@2
   503
williamr@2
   504
    /**
williamr@2
   505
     * Returns the number of children of a hierarchical list node. This method,
williamr@2
   506
     * along with @c Child() method, can be used for enquiring information of
williamr@2
   507
     * the list structure. Constant @c KAknTreeIIDRoot can be used to get the
williamr@2
   508
     * item count on the top-most level of the list.
williamr@2
   509
     *
williamr@2
   510
     * @param aNode Item ID of a node.
williamr@2
   511
     *
williamr@2
   512
     * @return Number of children of specified node.
williamr@2
   513
     *
williamr@2
   514
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   515
     *
williamr@2
   516
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   517
     */
williamr@2
   518
    IMPORT_C TInt ChildCount( TAknTreeItemID aNode ) const;
williamr@2
   519
williamr@2
   520
    /**
williamr@2
   521
     * Gets the item ID of a child of a hierarcical list node. The specific
williamr@2
   522
     * child is specified with an index. The child count for any hierarchical
williamr@2
   523
     * list node can be get with @c ChildCount() method.
williamr@2
   524
     *
williamr@2
   525
     * @param aNode Item ID of the node, whose child is enquiried.
williamr@2
   526
     *
williamr@2
   527
     * @param aIndex Index of the enquiried child.
williamr@2
   528
     *
williamr@2
   529
     * @return Item ID of the specified child. Value @c KAknTreeIIDNone is
williamr@2
   530
     *      returned, if the child with specified index does not exist.
williamr@2
   531
     * 
williamr@2
   532
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   533
     *
williamr@2
   534
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   535
     */
williamr@2
   536
    IMPORT_C TAknTreeItemID Child( TAknTreeItemID aNode, TInt aIndex ) const;
williamr@2
   537
williamr@2
   538
    /**
williamr@2
   539
     * Returns the item ID of the parent of a hierarchical list item. The
williamr@2
   540
     * constant @c KAknTreeIIDRoot is returned for all the items on the
williamr@2
   541
     * top-most level of the tree, and constant @c KaknTereIIDNone for the
williamr@2
   542
     * items that have no parent, that is, the root node.
williamr@2
   543
     *
williamr@2
   544
     * @param aItem Item ID of the item, whose parent is enquiried.
williamr@2
   545
     *
williamr@2
   546
     * @return Item ID of the parent node.
williamr@2
   547
     *
williamr@2
   548
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   549
     */
williamr@2
   550
    IMPORT_C TAknTreeItemID Parent( TAknTreeItemID aItem ) const;
williamr@2
   551
williamr@2
   552
    /**
williamr@2
   553
     * Checks whether the hierarchical list contains the list item with
williamr@2
   554
     * specified item ID. The returned value for constant @c KAknTreeIIDRoot
williamr@2
   555
     * will always be @c ETrue, and for constant @c KAknTreeIIDNone @c EFalse.
williamr@2
   556
     *
williamr@2
   557
     * @param aItem Item ID.
williamr@2
   558
     *
williamr@2
   559
     * @return @c ETrue, if the list contains the specified item.
williamr@2
   560
     */
williamr@2
   561
    IMPORT_C TBool Contains( TAknTreeItemID aItem ) const;
williamr@2
   562
williamr@2
   563
    /**
williamr@2
   564
     * Checks whether a hierarchical list item is a node.
williamr@2
   565
     *
williamr@2
   566
     * @param aItem Item ID of checked item.
williamr@2
   567
     *
williamr@2
   568
     * @return @c ETrue, if the specified item is a node.
williamr@2
   569
     *
williamr@2
   570
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   571
     */
williamr@2
   572
    IMPORT_C TBool IsNode( TAknTreeItemID aItem ) const;
williamr@2
   573
williamr@2
   574
    /**
williamr@2
   575
     * Checks whether a hierarchical list item is a leaf.
williamr@2
   576
     *
williamr@2
   577
     * @param aItem Item ID of checked item.
williamr@2
   578
     *
williamr@2
   579
     * @return @c ETrue, if the specified item is a leaf.
williamr@2
   580
     *
williamr@2
   581
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   582
     */
williamr@2
   583
    IMPORT_C TBool IsLeaf( TAknTreeItemID aItem ) const;
williamr@2
   584
williamr@2
   585
    /** 
williamr@2
   586
     * Checks whether a hierarchical list item is marked.
williamr@2
   587
     *
williamr@2
   588
     * @param aItem Item ID of checked item.
williamr@2
   589
     *
williamr@2
   590
     * @return @c ETrue for marked item.
williamr@2
   591
     *
williamr@2
   592
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   593
     */
williamr@2
   594
    IMPORT_C TBool IsMarked( TAknTreeItemID aItem ) const;
williamr@2
   595
williamr@2
   596
    /**
williamr@2
   597
     * Sets an item marked. If the marked item is a node, all of its
williamr@2
   598
     * descendants are also set marked.
williamr@2
   599
     *
williamr@2
   600
     * Note that item marking can be changed with this method, even if the
williamr@2
   601
     * list itself is not set markable. Marking changes can be enabled and
williamr@2
   602
     * disabled with @c EnableMarking() method.
williamr@2
   603
     *
williamr@2
   604
     * @param aItem Item ID of the item to be modified.
williamr@2
   605
     * 
williamr@2
   606
     * @param aMarked @c ETrue to set item marked, @c EFalse to unmarked.
williamr@2
   607
     *
williamr@2
   608
     * @param aDrawNow @c ETrue to redraw the list after the item has been
williamr@2
   609
     *      set marked, otherwise @c EFalse.
williamr@2
   610
     *
williamr@2
   611
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   612
     */
williamr@2
   613
    IMPORT_C void SetMarked( TAknTreeItemID aItem, TBool aMarked,
williamr@2
   614
        TBool aDrawNow );
williamr@2
   615
williamr@2
   616
    /**
williamr@2
   617
     * Enables or disables marking of specified list item. By default,
williamr@2
   618
     * marking is enabled for every list item.
williamr@2
   619
     *
williamr@2
   620
     * When marking is enabled for an item, its marking can be changed from
williamr@2
   621
     * unmarked to marked, and vice versa, with SetMarked() method, and for
williamr@2
   622
     * markable list, the marking can also change as a result of user action.
williamr@2
   623
     *
williamr@2
   624
     * When marking is disabled, the item can still be either unmarked or
williamr@2
   625
     * marked, but the marking cannot be changed in any way, until it has
williamr@2
   626
     * been enabled again for the item.
williamr@2
   627
     *
williamr@2
   628
     * @param aItem Item ID of the list item.
williamr@2
   629
     *
williamr@2
   630
     * @param aEnable @c ETrue to enable marking, @c EFalse to disable it.
williamr@2
   631
     *
williamr@2
   632
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   633
     */
williamr@2
   634
    IMPORT_C void EnableMarking( TAknTreeItemID aItem, TBool aEnable );
williamr@2
   635
williamr@2
   636
    /**
williamr@2
   637
     * Gets all the marked items from the tree list. The marked items are
williamr@2
   638
     * appended to the end of the array passed as parameter.
williamr@2
   639
     *
williamr@2
   640
     * @param aMarkedItems On return, contains item IDs of all marked items.
williamr@2
   641
     *
williamr@2
   642
     * @leave KErrNoMemory Appending item to the array fails.
williamr@2
   643
     */
williamr@2
   644
    IMPORT_C void GetMarkedItemsL( RArray<TAknTreeItemID>& aMarkedItems ) const;
williamr@2
   645
williamr@2
   646
    /**
williamr@2
   647
     * Gets all the marked items from the specified node. The marked items
williamr@2
   648
     * are appended to the end of the array passed as parameter.
williamr@2
   649
     *
williamr@2
   650
     * @param aNode Item ID of a node from where the marked items are
williamr@2
   651
     *      retrieved.
williamr@2
   652
     *
williamr@2
   653
     * @param aMarkedItems On return, contains item IDs of marked items in
williamr@2
   654
     *      the specified node.
williamr@2
   655
     *
williamr@2
   656
     * @leave KErrNoMemory Appending item to the array fails.
williamr@2
   657
     *
williamr@2
   658
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   659
     *
williamr@2
   660
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   661
     */
williamr@2
   662
    IMPORT_C void GetMarkedItemsL( TAknTreeItemID aNode,
williamr@2
   663
        RArray<TAknTreeItemID>& aMarkedItems ) const;
williamr@2
   664
williamr@2
   665
    /**
williamr@2
   666
     * Checks whether the specified node is empty. To decrease memory
williamr@2
   667
     * consumption, the descendants of tree nodes can be removed from the
williamr@2
   668
     * hierarchical list when the node is collapsed. As the empty nodes may
williamr@2
   669
     * have different appearances in the list view, the collapsed nodes can be
williamr@2
   670
     * set to appear as non-empty with @c SetNonEmpty() method to indicate that
williamr@2
   671
     * nodes will have some content when expanded.
williamr@2
   672
     *
williamr@2
   673
     * @param aNode Item ID of checked item.
williamr@2
   674
     *
williamr@2
   675
     * @return @c ETrue, if the item has been set non-empty.
williamr@2
   676
     *
williamr@2
   677
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   678
     *
williamr@2
   679
     * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
williamr@2
   680
     */
williamr@2
   681
    IMPORT_C TBool IsEmpty( TAknTreeItemID aNode ) const;
williamr@2
   682
williamr@2
   683
    /**
williamr@2
   684
     * Sets a node non-empty.
williamr@2
   685
     *
williamr@2
   686
     * @param aNode Item ID of the item to be modified.
williamr@2
   687
     *
williamr@2
   688
     * @param aNonEmpty @c ETrue to set node non-empty, @c EFalse to empty.
williamr@2
   689
     *
williamr@2
   690
     * @param aDrawNow @c ETrue to redraw the list after the setting has been
williamr@2
   691
     *      change, otherwise @c EFalse.
williamr@2
   692
     *      
williamr@2
   693
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   694
     *
williamr@2
   695
     * @panic EAknHListPanicInvalidItemType Specified target item is not a node.
williamr@2
   696
     */
williamr@2
   697
    IMPORT_C void SetNonEmpty( TAknTreeItemID aNode, TBool aNonEmpty,
williamr@2
   698
        TBool aDrawNow );
williamr@2
   699
williamr@2
   700
    /**
williamr@2
   701
     * Checks if the specified item is set persistent. If an item is set
williamr@2
   702
     * persistent, it is not removed from the list, when its parent or any of
williamr@2
   703
     * its ancestors is collapsed. This means also that a node cannot be
williamr@2
   704
     * automatically removed from the list on collapse event, if any of its
williamr@2
   705
     * descendants is set persistent.
williamr@2
   706
     *
williamr@2
   707
     * @param aItem Item ID.
williamr@2
   708
     *
williamr@2
   709
     * @return @c ETrue, if item is set persistent.
williamr@2
   710
     *
williamr@2
   711
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   712
     */
williamr@2
   713
    IMPORT_C TBool IsPersistent( TAknTreeItemID aItem ) const;
williamr@2
   714
williamr@2
   715
    /**
williamr@2
   716
     * Sets an item persistent. If the specified item is a node, the state
williamr@2
   717
     * of all its descendants is also changed accordingly.
williamr@2
   718
     *
williamr@2
   719
     * @param aItem Item ID.
williamr@2
   720
     *
williamr@2
   721
     * @param aPersistent @c ETrue to set item persistent.
williamr@2
   722
     *
williamr@2
   723
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   724
     */
williamr@2
   725
    IMPORT_C void SetPersistent( TAknTreeItemID aItem,
williamr@2
   726
        TBool aPersistent );
williamr@2
   727
williamr@2
   728
    /**
williamr@2
   729
     * Sets custom ordering for the hierarchical list and sorts the list
williamr@2
   730
     * with the use of given ordering interface. The given interface is
williamr@2
   731
     * used until it is replaced with some other ordering.
williamr@2
   732
     *
williamr@2
   733
     * Note: Ownership of the interface is not transferred to the list.
williamr@2
   734
     *
williamr@2
   735
     * Note: When custom ordering is set to the list, new items are added
williamr@2
   736
     * to the end of their parent nodes, because the interface cannot
williamr@2
   737
     * be used for determining the position for inserted item, as the
williamr@2
   738
     * client receives its identifier only after it has been inserted.
williamr@2
   739
     * @c Sort(TAknTreeItemID, TBool, TBool) method can be used for sorting
williamr@2
   740
     * the node with custom ordering interface after new items have been
williamr@2
   741
     * inserted in the list.
williamr@2
   742
     *
williamr@2
   743
     * @param aOrdering Custom ordering interface used in list sorting.
williamr@2
   744
     *
williamr@2
   745
     * @param aDrawNow @c ETrue to redraw the list after sorting.
williamr@2
   746
     */
williamr@2
   747
    IMPORT_C void Sort( MAknCustomTreeOrdering* aOrdering, TBool aDrawNow );
williamr@2
   748
williamr@2
   749
    /**
williamr@2
   750
     * Sorts the specified node with the use of previously set ordering
williamr@2
   751
     * interface. The sorting can be restricted to the specified node, or
williamr@2
   752
     * the sorting can be set to include also every descendant node of the
williamr@2
   753
     * specified node. Whole list can be sorted by giving the constant
williamr@2
   754
     * @c KAknTreeIIDRoot as the @c aNode parameter. This method has no
williamr@2
   755
     * effect, if no ordering has been set for the list.
williamr@2
   756
     * 
williamr@2
   757
     * @param aNode Item ID of the node that has to be sorted.
williamr@2
   758
     *
williamr@2
   759
     * @param aSortDescendants @c ETrue to sort the content of the specified
williamr@2
   760
     *      node including the content of its descendant nodes, @c EFalse to
williamr@2
   761
     *      sort only the child items within the specified node.
williamr@2
   762
     *
williamr@2
   763
     * @param aDrawNow @c ETrue to redraw the list after sorting.
williamr@2
   764
     *
williamr@2
   765
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   766
     *
williamr@2
   767
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   768
     */
williamr@2
   769
    IMPORT_C void Sort( TAknTreeItemID aNode, TBool aSortDescendants,
williamr@2
   770
        TBool aDrawNow );
williamr@2
   771
williamr@2
   772
    /**
williamr@2
   773
     * Adds an observer for the hierarchical list. Notifications of the list
williamr@2
   774
     * events are sent to all observers set with this method. Observers can
williamr@2
   775
     * be removed from the list with @c RemoveObserver() method.
williamr@2
   776
     *
williamr@2
   777
     * Note: Hierarchical list also sends a state changed event on every list
williamr@2
   778
     * event through the usual control observer interface that can be set with
williamr@2
   779
     * @c CCoeControl::SetObserver method.
williamr@2
   780
     *
williamr@2
   781
     * @param aObserver Implementation of the observer interface.
williamr@2
   782
     *
williamr@2
   783
     * @post The given interface is set as the observer of the list. The
williamr@2
   784
     *      ownership of the interface is not transferred to the list.
williamr@2
   785
     */
williamr@2
   786
    IMPORT_C void AddObserverL( MAknTreeListObserver* aObserver );
williamr@2
   787
williamr@2
   788
    /**
williamr@2
   789
     * Removes an observer from the hierarchical list.
williamr@2
   790
     *
williamr@2
   791
     * @param aObserver The observer interface to be removed.
williamr@2
   792
     */
williamr@2
   793
    IMPORT_C void RemoveObserver( MAknTreeListObserver* aObserver );
williamr@2
   794
williamr@2
   795
    /**
williamr@2
   796
     * Notifies all of the tree list observers of the specified event. This
williamr@2
   797
     * method is not exported, as it is intended for internal use only.
williamr@2
   798
     *
williamr@2
   799
     * @param aEvent The event to be notified.
williamr@2
   800
     *
williamr@2
   801
     * @param aItem ID of the tree item related to the event.
williamr@2
   802
     */
williamr@2
   803
    void NotifyObservers( MAknTreeListObserver::TEvent aEvent,
williamr@2
   804
        TAknTreeItemID aItem );
williamr@2
   805
williamr@2
   806
    /**
williamr@2
   807
     * Checks whether tabulator mode function indicators are enabled.
williamr@2
   808
     *
williamr@2
   809
     * @return @c ETrue if tabulator mode is enabled.
williamr@2
   810
     */
williamr@2
   811
    IMPORT_C TBool TabModeFunctionIndicators() const;
williamr@2
   812
williamr@2
   813
    /**
williamr@2
   814
     * Changes the appearance of collapse and expand function indicators. The
williamr@2
   815
     * appearance of default function indicators suggest that left and right
williamr@2
   816
     * arrow keys expand and collapse the focused nodes, but when the list is
williamr@2
   817
     * used with tabulators, those keys are used in changing tabulators.
williamr@2
   818
     * Alternate representation for function indicator can be set by enabling
williamr@2
   819
     * tabulator mode indicator with this method.
williamr@2
   820
     *
williamr@2
   821
     * @param aEnable @c ETrue to enable tabulator mode function indicators,
williamr@2
   822
     *      @c EFalse to use the default function indicators.
williamr@2
   823
     */
williamr@2
   824
    IMPORT_C void EnableTabModeFunctionIndicatorsL( TBool aEnable );
williamr@2
   825
    
williamr@2
   826
williamr@2
   827
    /**
williamr@2
   828
     * Sets the focused item and its position on the list view. 
williamr@2
   829
     * 
williamr@2
   830
     * When the focused item is changed, the vertical position of the view
williamr@2
   831
     * is changed as follows:
williamr@2
   832
     * 
williamr@2
   833
     * If the focused item is set on the first page, view is changed
williamr@2
   834
     * to the beginning of the list.
williamr@2
   835
     * 
williamr@2
   836
     * If the focused item is not set on the first page, view is changed so 
williamr@2
   837
     * that focused item is at the lowest line on the screen.
williamr@2
   838
     * 
williamr@2
   839
     * (In this context first page means actual lines from 0
williamr@2
   840
     * to max. number of visible lines - 1)
williamr@2
   841
     *
williamr@2
   842
     * The horizontal position of the view is changed so that the
williamr@2
   843
     * the beginning of the focused item is visible.
williamr@2
   844
     *
williamr@2
   845
     * @param aItem Item ID of the item to be focused.
williamr@2
   846
     *
williamr@2
   847
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   848
     */
williamr@2
   849
 	IMPORT_C void SetFocusedItem( TAknTreeItemID aItem );
williamr@2
   850
 	 	
williamr@2
   851
 	/**
williamr@2
   852
     * Gets the index of the focused item on the screen. Possible values are
williamr@2
   853
     * from 0 to max. number of visible lines - 1. Value -1 is
williamr@2
   854
     * returned if no item is focused or focused item is not visible. 
williamr@2
   855
     *
williamr@2
   856
     * @return index of the focused item on the screen.
williamr@2
   857
     */
williamr@2
   858
 	IMPORT_C TInt FocusedItemIndex() const;
williamr@2
   859
 	
williamr@2
   860
 	/**
williamr@2
   861
     * Gets the index of the item on the screen. Possible values are
williamr@2
   862
     * from 0 to max. number of visible lines - 1. Value -1 is
williamr@2
   863
     * returned if the requested item is not visible on the screen. 
williamr@2
   864
     *
williamr@2
   865
     * @return index of the requested item.
williamr@2
   866
     */
williamr@2
   867
 	IMPORT_C TInt VisibleItemIndex( TAknTreeItemID aItem ) const;
williamr@2
   868
williamr@2
   869
 	
williamr@2
   870
 	/**
williamr@2
   871
     * Sets custom ordering for the hierarchical list and sorts the list
williamr@2
   872
     * with the use of given ordering interface. The given interface is
williamr@2
   873
     * used until it is replaced with some other ordering.
williamr@2
   874
     *
williamr@2
   875
     * @param aOrdering Custom ordering interface used in list sorting.
williamr@2
   876
     *
williamr@2
   877
     * @param aFocusBehaviour Tells how focus should be handled after sorting.
williamr@2
   878
     *      @c ESaveFocus saves focus in the item where it was before sorting, 
williamr@2
   879
     *      @c EMoveFocusToFirstItem changes view to the beginning of the list
williamr@2
   880
     *      and moves focus to the first item.  
williamr@2
   881
     *
williamr@2
   882
     * @param aDrawNow @c ETrue to redraw the list after sorting.
williamr@2
   883
     */
williamr@2
   884
 	IMPORT_C void Sort( MAknCustomTreeOrdering* aOrdering, TFocusBehaviour aFocusBehaviour, TBool aDrawNow );
williamr@2
   885
williamr@2
   886
	/**
williamr@2
   887
     * Sorts the specified node with the use of previously set ordering
williamr@2
   888
     * interface. The sorting can be restricted to the specified node, or
williamr@2
   889
     * the sorting can be set to include also every descendant node of the
williamr@2
   890
     * specified node. Whole list can be sorted by giving the constant
williamr@2
   891
     * @c KAknTreeIIDRoot as the @c aNode parameter. This method has no
williamr@2
   892
     * effect, if no ordering has been set for the list.
williamr@2
   893
     *
williamr@2
   894
     * @param aNode Item ID of the node that has to be sorted.
williamr@2
   895
     * 
williamr@2
   896
     * @param aFocusBehaviour Tells how focus should be handled after sorting.
williamr@2
   897
     *      @c ESaveFocus saves focus in the item where it was before sorting, 
williamr@2
   898
     *      @c EMoveFocusToFirstItem changes view to the beginning of the list
williamr@2
   899
     *      and moves focus to the first item. 
williamr@2
   900
     *
williamr@2
   901
     * @param aSortDescendants @c ETrue to sort the content of the specified
williamr@2
   902
     *      node including the content of its descendant nodes, @c EFalse to
williamr@2
   903
     *      sort only the child items within the specified node.
williamr@2
   904
     *
williamr@2
   905
     * @param aDrawNow @c ETrue to redraw the list after sorting.
williamr@2
   906
     *
williamr@2
   907
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   908
     *
williamr@2
   909
     * @panic EAknHListPanicInvalidItemType Specified item is not a node.
williamr@2
   910
     */
williamr@2
   911
   	IMPORT_C void Sort( TAknTreeItemID aNode, TFocusBehaviour aFocusBehaviour, TBool aSortDescendants, TBool aDrawNow );
williamr@2
   912
        
williamr@2
   913
    /**
williamr@2
   914
     * Sets text for the empty list. This text is visible if the list box 
williamr@2
   915
     * has no items.
williamr@2
   916
     *
williamr@2
   917
     * @param aText The text for the empty list.
williamr@2
   918
     */
williamr@2
   919
	IMPORT_C void SetEmptyTextL(const TDesC& aText);
williamr@2
   920
williamr@2
   921
williamr@2
   922
// From base class CCoeControl
williamr@2
   923
williamr@2
   924
    /**
williamr@2
   925
     * From CCoeControl.
williamr@2
   926
     * Handles key events. The method will return @c EKeyWasNotConsumed, if
williamr@2
   927
     * the list is not focused.
williamr@2
   928
     *
williamr@2
   929
     * @param aKeyEvent The key event.
williamr@2
   930
     *
williamr@2
   931
     * @param aType The type of key event: @c EEventKey, @c EEventKeyUp or 
williamr@2
   932
     *      @c EEventKeyDown.
williamr@2
   933
     */
williamr@2
   934
    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
williamr@2
   935
williamr@2
   936
    /**
williamr@2
   937
     * From CCoeControl.
williamr@2
   938
     * Changes the visibility of the hierarchical list.
williamr@2
   939
     *
williamr@2
   940
     * @param aVisible @c ETrue to make the list visible, @c EFalse to make
williamr@2
   941
     *      it invisible.
williamr@2
   942
     */
williamr@2
   943
    void MakeVisible( TBool aVisible );
williamr@2
   944
williamr@2
   945
    /**
williamr@2
   946
     * From CCoeControl.
williamr@2
   947
     * Sets whether the list is dimmed.
williamr@2
   948
     *
williamr@2
   949
     * @param aDimmed @c ETrue to set list dimmed, otherwise @c EFalse.
williamr@2
   950
     */
williamr@2
   951
    void SetDimmed( TBool aDimmed );
williamr@2
   952
williamr@2
   953
    /**
williamr@2
   954
     * From CCoeControl.
williamr@2
   955
     * Sets the control's containing window by copying it from aContainer.
williamr@2
   956
     *
williamr@2
   957
     * @param aContainer The compound control that is the container for this
williamr@2
   958
     *      control.
williamr@2
   959
     */
williamr@2
   960
    void SetContainerWindowL( const CCoeControl& aContainer );
williamr@2
   961
williamr@2
   962
    /**
williamr@2
   963
     * From CCoeControl.
williamr@2
   964
     * Sets the control as ready to be drawn.
williamr@2
   965
     */
williamr@2
   966
    void ActivateL();
williamr@2
   967
williamr@2
   968
    /**
williamr@2
   969
     * From CCoeControl.
williamr@2
   970
     * Handles resource changes.
williamr@2
   971
     *
williamr@2
   972
     * @param aType
williamr@2
   973
     */
williamr@2
   974
    void HandleResourceChange( TInt aType );
williamr@2
   975
williamr@2
   976
    /**
williamr@2
   977
     * From CCoeControl.
williamr@2
   978
     * Gets the control's input capabilities.
williamr@2
   979
     *
williamr@2
   980
     * @return The control's input capabilities.
williamr@2
   981
     */
williamr@2
   982
    TCoeInputCapabilities InputCapabilities() const;
williamr@2
   983
williamr@2
   984
    /**
williamr@2
   985
     * From CCoeControl.
williamr@2
   986
     * Handles pointer events.
williamr@2
   987
     *
williamr@2
   988
     * @param aPointerEvent Pointer event.
williamr@2
   989
     */
williamr@2
   990
    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
williamr@2
   991
williamr@2
   992
    /**
williamr@2
   993
     * From CCoeControl.
williamr@2
   994
     * Gets the number of controls contained in a compound control.
williamr@2
   995
     *
williamr@2
   996
     * @return The number of component controls contained by this control.
williamr@2
   997
     */
williamr@2
   998
    TInt CountComponentControls() const;
williamr@2
   999
williamr@2
  1000
    /**
williamr@2
  1001
     * From CCoeControl.
williamr@2
  1002
     * Gets an indexed component of a compound control.
williamr@2
  1003
     *
williamr@2
  1004
     * @param aIndex The index of the control.
williamr@2
  1005
     *
williamr@2
  1006
     * @return The component control with an index of aIndex.
williamr@2
  1007
     */
williamr@2
  1008
    CCoeControl* ComponentControl( TInt aIndex ) const;
williamr@2
  1009
williamr@2
  1010
protected:
williamr@2
  1011
williamr@2
  1012
    /**
williamr@2
  1013
     * Constructor.
williamr@2
  1014
     */
williamr@2
  1015
    CAknTreeList();
williamr@2
  1016
williamr@2
  1017
    /**
williamr@2
  1018
     * Second phase constructor. Completes the construction of the base class.
williamr@2
  1019
     * When this version of @c BaseConstructL() is used, new window is created
williamr@2
  1020
     * for the list.
williamr@2
  1021
     */
williamr@2
  1022
    void BaseConstructL();
williamr@2
  1023
williamr@2
  1024
    /** 
williamr@2
  1025
     * Second phase constructor. Completes the construction of the base class.
williamr@2
  1026
     *
williamr@2
  1027
     * @param aContainer Container for the list.
williamr@2
  1028
     */
williamr@2
  1029
    void BaseConstructL( const CCoeControl& aContainer );
williamr@2
  1030
williamr@2
  1031
    /**
williamr@2
  1032
     * Reference to the tree structure.
williamr@2
  1033
     *
williamr@2
  1034
     * @return Reference to tree structure.
williamr@2
  1035
     */
williamr@2
  1036
    CAknTree& Tree();
williamr@2
  1037
williamr@2
  1038
    /**
williamr@2
  1039
     * Constant reference to the tree structure.
williamr@2
  1040
     *
williamr@2
  1041
     * @return Constant reference to tree structure.
williamr@2
  1042
     */
williamr@2
  1043
    const CAknTree& Tree() const;
williamr@2
  1044
williamr@2
  1045
    /**
williamr@2
  1046
     * Reference to the tree list view.
williamr@2
  1047
     *
williamr@2
  1048
     * @return Reference to tree list view.
williamr@2
  1049
     */
williamr@2
  1050
    CAknTreeListView& View();
williamr@2
  1051
williamr@2
  1052
    /**
williamr@2
  1053
     * Constant reference to the tree list view.
williamr@2
  1054
     *
williamr@2
  1055
     * @return Constant reference to tree list view.
williamr@2
  1056
     */
williamr@2
  1057
    const CAknTreeListView& View() const;
williamr@2
  1058
williamr@2
  1059
// from base class CCoeControl
williamr@2
  1060
williamr@2
  1061
    /**
williamr@2
  1062
     * From CCoeControl.
williamr@2
  1063
     * Handles focus change.
williamr@2
  1064
     *
williamr@2
  1065
     * @param aDrawNow @c EDrawNow to redraw the list.
williamr@2
  1066
     */
williamr@2
  1067
    void FocusChanged( TDrawNow aDrawNow );
williamr@2
  1068
williamr@2
  1069
    /**
williamr@2
  1070
     * From CCoeControl.
williamr@2
  1071
     * Responds to changes to the size and position of this control.
williamr@2
  1072
     */
williamr@2
  1073
    void SizeChanged();
williamr@2
  1074
williamr@2
  1075
    /**
williamr@2
  1076
     * From CCoeControl.
williamr@2
  1077
     * Responds to changes in the position of this control.
williamr@2
  1078
     */
williamr@2
  1079
    void PositionChanged();
williamr@2
  1080
williamr@2
  1081
    /**
williamr@2
  1082
     * From CCoeControl.
williamr@2
  1083
     * Retrieves an object of the same type as that encapsulated in aId.
williamr@2
  1084
     *
williamr@2
  1085
     * @param aId An encapsulated object type ID.
williamr@2
  1086
     *
williamr@2
  1087
     * @return Encapsulates the pointer to the object provided. Note that the
williamr@2
  1088
     *      encapsulated pointer may be NULL
williamr@2
  1089
     */
williamr@2
  1090
    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
williamr@2
  1091
williamr@2
  1092
private:
williamr@2
  1093
williamr@2
  1094
// from base class CCoeControl
williamr@2
  1095
    
williamr@2
  1096
    /**
williamr@2
  1097
     * From CCoeControl.
williamr@2
  1098
     * Draws the list.
williamr@2
  1099
     *
williamr@2
  1100
     * @param aRect Specifies the area that needs to be redrawn.
williamr@2
  1101
     */
williamr@2
  1102
    void Draw( const TRect& aRect ) const;
williamr@2
  1103
williamr@2
  1104
private: // data
williamr@2
  1105
williamr@2
  1106
    /**
williamr@2
  1107
     * Flags.
williamr@2
  1108
     */
williamr@2
  1109
    TUint32 iFlags;
williamr@2
  1110
williamr@2
  1111
    /**
williamr@2
  1112
     * Tree structure.
williamr@2
  1113
     * Own.
williamr@2
  1114
     */
williamr@2
  1115
    CAknTree* iTree;
williamr@2
  1116
williamr@2
  1117
    /**
williamr@2
  1118
     * Tree list view.
williamr@2
  1119
     * Own.
williamr@2
  1120
     */
williamr@2
  1121
    CAknTreeListView* iView;
williamr@2
  1122
williamr@2
  1123
    /**
williamr@2
  1124
     * Tree list observers.
williamr@2
  1125
     * Not own.
williamr@2
  1126
     */
williamr@2
  1127
    RPointerArray<MAknTreeListObserver> iObservers;
williamr@2
  1128
williamr@2
  1129
    /**
williamr@2
  1130
     * Index to observer array.
williamr@2
  1131
     */
williamr@2
  1132
    TInt iIndex;
williamr@2
  1133
williamr@2
  1134
    };
williamr@2
  1135
williamr@2
  1136
williamr@2
  1137
#endif // C_AKNTREELIST_H