epoc32/include/mw/aknsinglestyletreelist.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:  Single style hierarchical list.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#ifndef C_AKNSINGLESTYLETREELIST_H
williamr@2
    20
#define C_AKNSINGLESTYLETREELIST_H
williamr@2
    21
williamr@2
    22
williamr@2
    23
#include <akntreelist.h>
williamr@2
    24
williamr@2
    25
williamr@2
    26
/**
williamr@2
    27
 *  Single style hierarchical list.
williamr@2
    28
 *
williamr@2
    29
 *  Single style hierarchical list is a hierarchical list specialisation for
williamr@2
    30
 *  a list type with simple list items, which contain only a folder or file
williamr@2
    31
 *  icon, single line of text and some optional icons. This class provides
williamr@2
    32
 *  only the specialisation specific APIs for the list usage. The common
williamr@2
    33
 *  hierarchical list APIs are located in its base class.
williamr@2
    34
 *
williamr@2
    35
 *  Here is an example of how an instance of window-owning single style
williamr@2
    36
 *  hierarchical list can be constructed:
williamr@2
    37
 *
williamr@2
    38
 *  @code
williamr@2
    39
 *  // Construct the list, set its size, and make it visible.
williamr@2
    40
 *  CAknSingleStyleTreeList* list = CAknSingleStyleTreeList::NewL();
williamr@2
    41
 *  list->SetRect( rect );
williamr@2
    42
 *  list->MakeVisible( ETrue );
williamr@2
    43
 *  @endcode
williamr@2
    44
 *
williamr@2
    45
 *  Adding items to the constructed list:
williamr@2
    46
 *
williamr@2
    47
 *  @code
williamr@2
    48
 *  // Add a node to the top-most level of the tree.
williamr@2
    49
 *  _LIT( KNodeText, "Node" );
williamr@2
    50
 *  TUint32 flags = CAknSingleStyleTreeList::EPersistent;
williamr@2
    51
 *  TAknTreeItemID node = list->AddNodeL( KAknTreeIIDRoot, KNodeText,
williamr@2
    52
 *      flags, EFalse );
williamr@2
    53
 *
williamr@2
    54
 *  // Add a leaf to the previously added node.
williamr@2
    55
 *  _LIT( KLeafText, "Leaf" );
williamr@2
    56
 *  TAknTreeItemID leaf = list->AddLeafL( node, KLeafText, flags, EFalse );
williamr@2
    57
 *  @endcode
williamr@2
    58
 *
williamr@2
    59
 *  Changing icons for the list items:
williamr@2
    60
 *
williamr@2
    61
 *  @code
williamr@2
    62
 *  // Add icon to the list and set it to existing list item.
williamr@2
    63
 *  TInt iconId = list->AddIconL( KAknsIIDQgnPropBtCarkit,
williamr@2
    64
 *      AknIconUtils::AvkonIconFileName(), EMbmAvkonQgn_prop_bt_carkit,
williamr@2
    65
 *      EMbmAvkonQgn_prop_bt_carkit_mask, EAspectRatioPreserved );
williamr@2
    66
 *  list->SetIcon( leaf, CAknSingleStyleTreeList::ELeaf, iconId, ETrue );
williamr@2
    67
 *  @endcode
williamr@2
    68
 *
williamr@2
    69
 *  @see CAknTreeList
williamr@2
    70
 *
williamr@2
    71
 *  @lib aknhlist.lib
williamr@2
    72
 *  @since S60 v3.2
williamr@2
    73
 */
williamr@2
    74
NONSHARABLE_CLASS( CAknSingleStyleTreeList ) : public CAknTreeList
williamr@2
    75
    {
williamr@2
    76
williamr@2
    77
public:
williamr@2
    78
williamr@2
    79
    /** Icon types usable with single style hierarchical list. Normal icons
williamr@2
    80
        are used when the list item is not focused, and highlighted icons are
williamr@2
    81
        used when list item is focused. Normal icons are used also when list
williamr@2
    82
        item is focused, if corresponding highlighted icon is not specified
williamr@2
    83
        for the list item. */
williamr@2
    84
    enum TIconType
williamr@2
    85
        {
williamr@2
    86
        /** Leaf icon. Only usable with tree leaves. */
williamr@2
    87
        ELeaf                       = 0,
williamr@2
    88
        /** Highlighted leaf icon. Only usable with tree leaves. */
williamr@2
    89
        EHighlightedLeaf            = 1,
williamr@2
    90
        /** Expanded node icon. Only usable with tree nodes. */
williamr@2
    91
        EExpandedNode               = 2,
williamr@2
    92
        /** Highlighted expanded node  icon. Only usable with tree nodes. */
williamr@2
    93
        EHighlightedExpandedNode    = 3,
williamr@2
    94
        /** Collapsed node icon. Only usable with tree nodes. */
williamr@2
    95
        ECollapsedNode              = 4,
williamr@2
    96
        /** Highlighted collapsed node icon. Only usable with tree nodes. */
williamr@2
    97
        EHighlightedCollapsedNode   = 5,
williamr@2
    98
        /** First optional icon. */
williamr@2
    99
        EOptionalIcon1              = 6,
williamr@2
   100
        /** First highlighted optional icon. */
williamr@2
   101
        EHighlightedOptionalIcon1   = 7,
williamr@2
   102
        /** Second optional icon. */
williamr@2
   103
        EOptionalIcon2              = 8,
williamr@2
   104
        /** Second highlighted optional icon. */
williamr@2
   105
        EHighlightedOptionalIcon2   = 9
williamr@2
   106
        };
williamr@2
   107
williamr@2
   108
    /** Single style hierarchical list ordering types. */
williamr@2
   109
    enum TOrdering
williamr@2
   110
        {
williamr@2
   111
        /** Ascending alphabetical ordering based on item text fields. */
williamr@2
   112
        EAscendingAlphabeticalOrdering,
williamr@2
   113
        /** Descending alphabetical ordering based on item text fields. */
williamr@2
   114
        EDescendingAlphabeticalOrdering
williamr@2
   115
        };
williamr@2
   116
williamr@2
   117
    /** Flags usable with single style tree items. */
williamr@2
   118
    enum TSingleStyleItemFlags
williamr@2
   119
        {
williamr@2
   120
        /** Item is persistent. */
williamr@2
   121
        EPersistent = 0x01,
williamr@2
   122
        /** Item is marked. */
williamr@2
   123
        EMarked     = 0x02,
williamr@2
   124
        /** Item is expanded. Applicable to nodes only. */
williamr@2
   125
        EExpanded   = 0x04,
williamr@2
   126
        /** Item appears non-empty. Applicable to nodes only. */
williamr@2
   127
        ENonEmpty   = 0x08
williamr@2
   128
        };
williamr@2
   129
williamr@2
   130
    /**
williamr@2
   131
     * Two phased constructor. Creates a new single style hierarchical list
williamr@2
   132
     * instance as window-owning control.
williamr@2
   133
     *
williamr@2
   134
     * @return Newly constructed object.
williamr@2
   135
     *
williamr@2
   136
     * @leave KErrNoMemory Not enough memory.
williamr@2
   137
     */
williamr@2
   138
    IMPORT_C static CAknSingleStyleTreeList* NewL();
williamr@2
   139
williamr@2
   140
    /**
williamr@2
   141
     * Two phased constructor. Creates a new single style hierarchical list
williamr@2
   142
     * instance as non-window-owning component control to the compound control
williamr@2
   143
     * given as parameter.
williamr@2
   144
     *
williamr@2
   145
     * @param aContainer The compound control used as container for the list.
williamr@2
   146
     *
williamr@2
   147
     * @return Newly constructed object.
williamr@2
   148
     *
williamr@2
   149
     * @leave KErrNoMemory Not enough memory.
williamr@2
   150
     */
williamr@2
   151
    IMPORT_C static CAknSingleStyleTreeList* NewL(
williamr@2
   152
        const CCoeControl& aContainer );
williamr@2
   153
williamr@2
   154
    /**
williamr@2
   155
     * Otherwise identical to @c NewL(), but leaves the newly created object
williamr@2
   156
     * in the cleanup stack.
williamr@2
   157
     *
williamr@2
   158
     * @copydoc CAknSingleStyleTreeList::NewL()
williamr@2
   159
     *
williamr@2
   160
     * @post Newly constructed object is left in cleanup stack.
williamr@2
   161
     */
williamr@2
   162
    IMPORT_C static CAknSingleStyleTreeList* NewLC();
williamr@2
   163
williamr@2
   164
    /**
williamr@2
   165
     * Otherwise identical to @c NewL( const CCoeControl& ), but leaves the
williamr@2
   166
     * newly created object in the cleanup stack.
williamr@2
   167
     *
williamr@2
   168
     * @copydoc CAknSingleStyleTreeList::NewL( const CCoeControl& )
williamr@2
   169
     *
williamr@2
   170
     * @post Newly constructed object is left in cleanup stack.
williamr@2
   171
     */
williamr@2
   172
    IMPORT_C static CAknSingleStyleTreeList* NewLC(
williamr@2
   173
        const CCoeControl& aContainer );
williamr@2
   174
williamr@2
   175
    /**
williamr@2
   176
     * Destructor.
williamr@2
   177
     */
williamr@2
   178
    virtual ~CAknSingleStyleTreeList();
williamr@2
   179
williamr@2
   180
    /**
williamr@2
   181
     * Adds new leaf (file) to single style hierarchical list. New leaf with
williamr@2
   182
     * the specified content is created and added to the specified parent node.
williamr@2
   183
     * Constant @c KAknTreeIIDRoot can be used, if the new item is to be added
williamr@2
   184
     * to the top-most level of the hierarchical list.
williamr@2
   185
     *
williamr@2
   186
     * @param aParent The item ID of the parent node.
williamr@2
   187
     *
williamr@2
   188
     * @param aText Text for the added item.
williamr@2
   189
     *
williamr@2
   190
     * @param aFlags Flags for the added item.
williamr@2
   191
     *
williamr@2
   192
     * @param aDrawNow @c ETrue, if the list is to be redrawn after the item
williamr@2
   193
     *      has been added to the list, otherwise @c EFalse.
williamr@2
   194
     *
williamr@2
   195
     * @return The item ID for the added leaf.
williamr@2
   196
     *
williamr@2
   197
     * @leave KErrNoMemory Not enough memory.
williamr@2
   198
     *
williamr@2
   199
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   200
     *
williamr@2
   201
     * @panic EAknHListPanicInvalidItemType Specified parent item is not a node.
williamr@2
   202
     */
williamr@2
   203
    IMPORT_C TAknTreeItemID AddLeafL( TAknTreeItemID aParent,
williamr@2
   204
        const TDesC& aText, TUint32 aFlags, TBool aDrawNow );
williamr@2
   205
williamr@2
   206
    /**
williamr@2
   207
     * Adds new node (folder) to single style hierarchical list. New node with
williamr@2
   208
     * the specified content is created and added to the specified parent node.
williamr@2
   209
     * Constant @c KAknTreeIIDRoot can be used, if the new item is to be added
williamr@2
   210
     * to the top-most level of the hierarchical list.
williamr@2
   211
     *
williamr@2
   212
     * @param aParent The item ID of the parent node.
williamr@2
   213
     *
williamr@2
   214
     * @param aText Text for the added node.
williamr@2
   215
     *
williamr@2
   216
     * @param aFlags Flags for the added node.
williamr@2
   217
     *
williamr@2
   218
     * @param aDrawNow @c ETrue to redraw the list after the node has been
williamr@2
   219
     *      added, otherwise @c EFalse.
williamr@2
   220
     *
williamr@2
   221
     * @return The Item ID for the added node.
williamr@2
   222
     *
williamr@2
   223
     * @leave KErrNoMemory Not enough memory.
williamr@2
   224
     *
williamr@2
   225
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   226
     *
williamr@2
   227
     * @panic EAknHListPanicInvalidItemType Specified parent item is not a node.
williamr@2
   228
     */
williamr@2
   229
    IMPORT_C TAknTreeItemID AddNodeL( TAknTreeItemID aParent,
williamr@2
   230
        const TDesC& aText, TUint32 aFlags, TBool aDrawNow );
williamr@2
   231
williamr@2
   232
    /**
williamr@2
   233
     * Sorts the hierarchical list according to the given ordering.
williamr@2
   234
     *
williamr@2
   235
     * @param aOrdering Type of ordering.
williamr@2
   236
     *
williamr@2
   237
     * @param aDrawNow @c ETrue to redraw the list after it has been sorted
williamr@2
   238
     *      according the new ordering, otherwise @c EFalse.
williamr@2
   239
     *
williamr@2
   240
     * @leave KErrNoMemory Not enough memory.
williamr@2
   241
     */
williamr@2
   242
    IMPORT_C void SortL( TOrdering aOrdering, TBool aDrawNow );
williamr@2
   243
williamr@2
   244
    /** 
williamr@2
   245
     * Changes the text of the specified item. Note that the change of text
williamr@2
   246
     * might also affect the item's position in the list, when the items are
williamr@2
   247
     * ordered based on their text fields.
williamr@2
   248
     *
williamr@2
   249
     * @param aItem Item ID of modified item.
williamr@2
   250
     *
williamr@2
   251
     * @param aText New text for the item.
williamr@2
   252
     *
williamr@2
   253
     * @param aDrawNow @c ETrue if the list is to be redrawn after the text
williamr@2
   254
     *      has been changed.
williamr@2
   255
     *
williamr@2
   256
     * @leave KErrNoMemory Not enough memory for adding text.
williamr@2
   257
     *
williamr@2
   258
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   259
     *
williamr@2
   260
     * @panic EAknHListPanicInvalidItemType Specified item has invalid type.
williamr@2
   261
     */
williamr@2
   262
    IMPORT_C void SetTextL( TAknTreeItemID aItem, const TDesC& aText,
williamr@2
   263
        TBool aDrawNow );
williamr@2
   264
williamr@2
   265
    /**
williamr@2
   266
     * Returns the text field of the specified item.
williamr@2
   267
     *
williamr@2
   268
     * @param aItem Item ID.
williamr@2
   269
     *
williamr@2
   270
     * @return Text of the specified item.
williamr@2
   271
     *
williamr@2
   272
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   273
     */ 
williamr@2
   274
    IMPORT_C const TDesC& Text( TAknTreeItemID aItem ) const;
williamr@2
   275
williamr@2
   276
    /**
williamr@2
   277
     * Sets an icon for a list item. Every list item may have several icons,
williamr@2
   278
     * so the correct icon has to be specified with the icon type. Note that
williamr@2
   279
     * the type has to be applicable to the specified list item. Pre-defined
williamr@2
   280
     * icon IDs can be found within @c AknTreeListIconID namespace. Constant
williamr@2
   281
     * @c AknTreeListIconID::KDefault can be used to indicate that default
williamr@2
   282
     * icon is to be used, and constant @c AknTreeListIconID::KNone to
williamr@2
   283
     * indicate that no icon is to be used.
williamr@2
   284
     *
williamr@2
   285
     * @param aItem Item ID of the modified list item.
williamr@2
   286
     *
williamr@2
   287
     * @param aType The type of the icon to be added.
williamr@2
   288
     *
williamr@2
   289
     * @param aIconId Icon ID. Icon ID is the integer value returned by the
williamr@2
   290
     *      @c AddIconL() method when the icon was added to the list.
williamr@2
   291
     *
williamr@2
   292
     * @param aDrawNow @c ETrue to redraw the list after the icon has been
williamr@2
   293
     *      changed, othewise @c EFalse.
williamr@2
   294
     *
williamr@2
   295
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   296
     *
williamr@2
   297
     * @panic EAknHListPanicInvalidItemType Specified icon is not applicable
williamr@2
   298
     *      with the item type.
williamr@2
   299
     */
williamr@2
   300
    IMPORT_C void SetIcon( TAknTreeItemID aItem, TIconType aType,
williamr@2
   301
        TInt aIconId, TBool aDrawNow );
williamr@2
   302
williamr@2
   303
    /**
williamr@2
   304
     * Returns the icon ID set for the specified icon of a list item.
williamr@2
   305
     *
williamr@2
   306
     * @param aItem Item ID of a list item.
williamr@2
   307
     *
williamr@2
   308
     * @param aType Type defining the specific icon within list item.
williamr@2
   309
     *
williamr@2
   310
     * @return Icon ID. The value @c AknTreeListIconID::KDefault is returned,
williamr@2
   311
     *      if no icon has been set. Value @c KErrNotFound is returned, if the
williamr@2
   312
     *      item does not contain icon of specified type.
williamr@2
   313
     *
williamr@2
   314
     * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
williamr@2
   315
     */
williamr@2
   316
    IMPORT_C TInt Icon( TAknTreeItemID aItem, TIconType aType ) const;
williamr@2
   317
williamr@2
   318
// from base class CAknTreeList
williamr@2
   319
williamr@2
   320
    /**
williamr@2
   321
     * From CAknTreeList.
williamr@2
   322
     * Sets the flags for the single style hierarchical list.
williamr@2
   323
     *
williamr@2
   324
     * @param aFlags Flags.
williamr@2
   325
     */
williamr@2
   326
    void SetFlags( TUint32 aFlags );
williamr@2
   327
williamr@2
   328
private:
williamr@2
   329
williamr@2
   330
    /**
williamr@2
   331
     * Default constructor.
williamr@2
   332
     */
williamr@2
   333
    CAknSingleStyleTreeList();
williamr@2
   334
williamr@2
   335
    /**
williamr@2
   336
     * Second phase constructor.
williamr@2
   337
     */
williamr@2
   338
    void ConstructL();
williamr@2
   339
williamr@2
   340
    /**
williamr@2
   341
     * Second phase constructor.
williamr@2
   342
     *
williamr@2
   343
     * @param aContainer Container for the list.
williamr@2
   344
     */
williamr@2
   345
    void ConstructL( const CCoeControl& aContainer );
williamr@2
   346
williamr@2
   347
    };
williamr@2
   348
williamr@2
   349
williamr@2
   350
#endif // C_AKNSINGLESTYLETREELIST_H