1.1 --- a/epoc32/include/mw/aknsinglestyletreelist.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/aknsinglestyletreelist.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,350 @@
1.4 -aknsinglestyletreelist.h
1.5 +/*
1.6 +* Copyright (c) 2006, 2007 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description: Single style hierarchical list.
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#ifndef C_AKNSINGLESTYLETREELIST_H
1.24 +#define C_AKNSINGLESTYLETREELIST_H
1.25 +
1.26 +
1.27 +#include <akntreelist.h>
1.28 +
1.29 +
1.30 +/**
1.31 + * Single style hierarchical list.
1.32 + *
1.33 + * Single style hierarchical list is a hierarchical list specialisation for
1.34 + * a list type with simple list items, which contain only a folder or file
1.35 + * icon, single line of text and some optional icons. This class provides
1.36 + * only the specialisation specific APIs for the list usage. The common
1.37 + * hierarchical list APIs are located in its base class.
1.38 + *
1.39 + * Here is an example of how an instance of window-owning single style
1.40 + * hierarchical list can be constructed:
1.41 + *
1.42 + * @code
1.43 + * // Construct the list, set its size, and make it visible.
1.44 + * CAknSingleStyleTreeList* list = CAknSingleStyleTreeList::NewL();
1.45 + * list->SetRect( rect );
1.46 + * list->MakeVisible( ETrue );
1.47 + * @endcode
1.48 + *
1.49 + * Adding items to the constructed list:
1.50 + *
1.51 + * @code
1.52 + * // Add a node to the top-most level of the tree.
1.53 + * _LIT( KNodeText, "Node" );
1.54 + * TUint32 flags = CAknSingleStyleTreeList::EPersistent;
1.55 + * TAknTreeItemID node = list->AddNodeL( KAknTreeIIDRoot, KNodeText,
1.56 + * flags, EFalse );
1.57 + *
1.58 + * // Add a leaf to the previously added node.
1.59 + * _LIT( KLeafText, "Leaf" );
1.60 + * TAknTreeItemID leaf = list->AddLeafL( node, KLeafText, flags, EFalse );
1.61 + * @endcode
1.62 + *
1.63 + * Changing icons for the list items:
1.64 + *
1.65 + * @code
1.66 + * // Add icon to the list and set it to existing list item.
1.67 + * TInt iconId = list->AddIconL( KAknsIIDQgnPropBtCarkit,
1.68 + * AknIconUtils::AvkonIconFileName(), EMbmAvkonQgn_prop_bt_carkit,
1.69 + * EMbmAvkonQgn_prop_bt_carkit_mask, EAspectRatioPreserved );
1.70 + * list->SetIcon( leaf, CAknSingleStyleTreeList::ELeaf, iconId, ETrue );
1.71 + * @endcode
1.72 + *
1.73 + * @see CAknTreeList
1.74 + *
1.75 + * @lib aknhlist.lib
1.76 + * @since S60 v3.2
1.77 + */
1.78 +NONSHARABLE_CLASS( CAknSingleStyleTreeList ) : public CAknTreeList
1.79 + {
1.80 +
1.81 +public:
1.82 +
1.83 + /** Icon types usable with single style hierarchical list. Normal icons
1.84 + are used when the list item is not focused, and highlighted icons are
1.85 + used when list item is focused. Normal icons are used also when list
1.86 + item is focused, if corresponding highlighted icon is not specified
1.87 + for the list item. */
1.88 + enum TIconType
1.89 + {
1.90 + /** Leaf icon. Only usable with tree leaves. */
1.91 + ELeaf = 0,
1.92 + /** Highlighted leaf icon. Only usable with tree leaves. */
1.93 + EHighlightedLeaf = 1,
1.94 + /** Expanded node icon. Only usable with tree nodes. */
1.95 + EExpandedNode = 2,
1.96 + /** Highlighted expanded node icon. Only usable with tree nodes. */
1.97 + EHighlightedExpandedNode = 3,
1.98 + /** Collapsed node icon. Only usable with tree nodes. */
1.99 + ECollapsedNode = 4,
1.100 + /** Highlighted collapsed node icon. Only usable with tree nodes. */
1.101 + EHighlightedCollapsedNode = 5,
1.102 + /** First optional icon. */
1.103 + EOptionalIcon1 = 6,
1.104 + /** First highlighted optional icon. */
1.105 + EHighlightedOptionalIcon1 = 7,
1.106 + /** Second optional icon. */
1.107 + EOptionalIcon2 = 8,
1.108 + /** Second highlighted optional icon. */
1.109 + EHighlightedOptionalIcon2 = 9
1.110 + };
1.111 +
1.112 + /** Single style hierarchical list ordering types. */
1.113 + enum TOrdering
1.114 + {
1.115 + /** Ascending alphabetical ordering based on item text fields. */
1.116 + EAscendingAlphabeticalOrdering,
1.117 + /** Descending alphabetical ordering based on item text fields. */
1.118 + EDescendingAlphabeticalOrdering
1.119 + };
1.120 +
1.121 + /** Flags usable with single style tree items. */
1.122 + enum TSingleStyleItemFlags
1.123 + {
1.124 + /** Item is persistent. */
1.125 + EPersistent = 0x01,
1.126 + /** Item is marked. */
1.127 + EMarked = 0x02,
1.128 + /** Item is expanded. Applicable to nodes only. */
1.129 + EExpanded = 0x04,
1.130 + /** Item appears non-empty. Applicable to nodes only. */
1.131 + ENonEmpty = 0x08
1.132 + };
1.133 +
1.134 + /**
1.135 + * Two phased constructor. Creates a new single style hierarchical list
1.136 + * instance as window-owning control.
1.137 + *
1.138 + * @return Newly constructed object.
1.139 + *
1.140 + * @leave KErrNoMemory Not enough memory.
1.141 + */
1.142 + IMPORT_C static CAknSingleStyleTreeList* NewL();
1.143 +
1.144 + /**
1.145 + * Two phased constructor. Creates a new single style hierarchical list
1.146 + * instance as non-window-owning component control to the compound control
1.147 + * given as parameter.
1.148 + *
1.149 + * @param aContainer The compound control used as container for the list.
1.150 + *
1.151 + * @return Newly constructed object.
1.152 + *
1.153 + * @leave KErrNoMemory Not enough memory.
1.154 + */
1.155 + IMPORT_C static CAknSingleStyleTreeList* NewL(
1.156 + const CCoeControl& aContainer );
1.157 +
1.158 + /**
1.159 + * Otherwise identical to @c NewL(), but leaves the newly created object
1.160 + * in the cleanup stack.
1.161 + *
1.162 + * @copydoc CAknSingleStyleTreeList::NewL()
1.163 + *
1.164 + * @post Newly constructed object is left in cleanup stack.
1.165 + */
1.166 + IMPORT_C static CAknSingleStyleTreeList* NewLC();
1.167 +
1.168 + /**
1.169 + * Otherwise identical to @c NewL( const CCoeControl& ), but leaves the
1.170 + * newly created object in the cleanup stack.
1.171 + *
1.172 + * @copydoc CAknSingleStyleTreeList::NewL( const CCoeControl& )
1.173 + *
1.174 + * @post Newly constructed object is left in cleanup stack.
1.175 + */
1.176 + IMPORT_C static CAknSingleStyleTreeList* NewLC(
1.177 + const CCoeControl& aContainer );
1.178 +
1.179 + /**
1.180 + * Destructor.
1.181 + */
1.182 + virtual ~CAknSingleStyleTreeList();
1.183 +
1.184 + /**
1.185 + * Adds new leaf (file) to single style hierarchical list. New leaf with
1.186 + * the specified content is created and added to the specified parent node.
1.187 + * Constant @c KAknTreeIIDRoot can be used, if the new item is to be added
1.188 + * to the top-most level of the hierarchical list.
1.189 + *
1.190 + * @param aParent The item ID of the parent node.
1.191 + *
1.192 + * @param aText Text for the added item.
1.193 + *
1.194 + * @param aFlags Flags for the added item.
1.195 + *
1.196 + * @param aDrawNow @c ETrue, if the list is to be redrawn after the item
1.197 + * has been added to the list, otherwise @c EFalse.
1.198 + *
1.199 + * @return The item ID for the added leaf.
1.200 + *
1.201 + * @leave KErrNoMemory Not enough memory.
1.202 + *
1.203 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.204 + *
1.205 + * @panic EAknHListPanicInvalidItemType Specified parent item is not a node.
1.206 + */
1.207 + IMPORT_C TAknTreeItemID AddLeafL( TAknTreeItemID aParent,
1.208 + const TDesC& aText, TUint32 aFlags, TBool aDrawNow );
1.209 +
1.210 + /**
1.211 + * Adds new node (folder) to single style hierarchical list. New node with
1.212 + * the specified content is created and added to the specified parent node.
1.213 + * Constant @c KAknTreeIIDRoot can be used, if the new item is to be added
1.214 + * to the top-most level of the hierarchical list.
1.215 + *
1.216 + * @param aParent The item ID of the parent node.
1.217 + *
1.218 + * @param aText Text for the added node.
1.219 + *
1.220 + * @param aFlags Flags for the added node.
1.221 + *
1.222 + * @param aDrawNow @c ETrue to redraw the list after the node has been
1.223 + * added, otherwise @c EFalse.
1.224 + *
1.225 + * @return The Item ID for the added node.
1.226 + *
1.227 + * @leave KErrNoMemory Not enough memory.
1.228 + *
1.229 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.230 + *
1.231 + * @panic EAknHListPanicInvalidItemType Specified parent item is not a node.
1.232 + */
1.233 + IMPORT_C TAknTreeItemID AddNodeL( TAknTreeItemID aParent,
1.234 + const TDesC& aText, TUint32 aFlags, TBool aDrawNow );
1.235 +
1.236 + /**
1.237 + * Sorts the hierarchical list according to the given ordering.
1.238 + *
1.239 + * @param aOrdering Type of ordering.
1.240 + *
1.241 + * @param aDrawNow @c ETrue to redraw the list after it has been sorted
1.242 + * according the new ordering, otherwise @c EFalse.
1.243 + *
1.244 + * @leave KErrNoMemory Not enough memory.
1.245 + */
1.246 + IMPORT_C void SortL( TOrdering aOrdering, TBool aDrawNow );
1.247 +
1.248 + /**
1.249 + * Changes the text of the specified item. Note that the change of text
1.250 + * might also affect the item's position in the list, when the items are
1.251 + * ordered based on their text fields.
1.252 + *
1.253 + * @param aItem Item ID of modified item.
1.254 + *
1.255 + * @param aText New text for the item.
1.256 + *
1.257 + * @param aDrawNow @c ETrue if the list is to be redrawn after the text
1.258 + * has been changed.
1.259 + *
1.260 + * @leave KErrNoMemory Not enough memory for adding text.
1.261 + *
1.262 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.263 + *
1.264 + * @panic EAknHListPanicInvalidItemType Specified item has invalid type.
1.265 + */
1.266 + IMPORT_C void SetTextL( TAknTreeItemID aItem, const TDesC& aText,
1.267 + TBool aDrawNow );
1.268 +
1.269 + /**
1.270 + * Returns the text field of the specified item.
1.271 + *
1.272 + * @param aItem Item ID.
1.273 + *
1.274 + * @return Text of the specified item.
1.275 + *
1.276 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.277 + */
1.278 + IMPORT_C const TDesC& Text( TAknTreeItemID aItem ) const;
1.279 +
1.280 + /**
1.281 + * Sets an icon for a list item. Every list item may have several icons,
1.282 + * so the correct icon has to be specified with the icon type. Note that
1.283 + * the type has to be applicable to the specified list item. Pre-defined
1.284 + * icon IDs can be found within @c AknTreeListIconID namespace. Constant
1.285 + * @c AknTreeListIconID::KDefault can be used to indicate that default
1.286 + * icon is to be used, and constant @c AknTreeListIconID::KNone to
1.287 + * indicate that no icon is to be used.
1.288 + *
1.289 + * @param aItem Item ID of the modified list item.
1.290 + *
1.291 + * @param aType The type of the icon to be added.
1.292 + *
1.293 + * @param aIconId Icon ID. Icon ID is the integer value returned by the
1.294 + * @c AddIconL() method when the icon was added to the list.
1.295 + *
1.296 + * @param aDrawNow @c ETrue to redraw the list after the icon has been
1.297 + * changed, othewise @c EFalse.
1.298 + *
1.299 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.300 + *
1.301 + * @panic EAknHListPanicInvalidItemType Specified icon is not applicable
1.302 + * with the item type.
1.303 + */
1.304 + IMPORT_C void SetIcon( TAknTreeItemID aItem, TIconType aType,
1.305 + TInt aIconId, TBool aDrawNow );
1.306 +
1.307 + /**
1.308 + * Returns the icon ID set for the specified icon of a list item.
1.309 + *
1.310 + * @param aItem Item ID of a list item.
1.311 + *
1.312 + * @param aType Type defining the specific icon within list item.
1.313 + *
1.314 + * @return Icon ID. The value @c AknTreeListIconID::KDefault is returned,
1.315 + * if no icon has been set. Value @c KErrNotFound is returned, if the
1.316 + * item does not contain icon of specified type.
1.317 + *
1.318 + * @panic EAknHListPanicInvalidItemID Item with specified ID is not found.
1.319 + */
1.320 + IMPORT_C TInt Icon( TAknTreeItemID aItem, TIconType aType ) const;
1.321 +
1.322 +// from base class CAknTreeList
1.323 +
1.324 + /**
1.325 + * From CAknTreeList.
1.326 + * Sets the flags for the single style hierarchical list.
1.327 + *
1.328 + * @param aFlags Flags.
1.329 + */
1.330 + void SetFlags( TUint32 aFlags );
1.331 +
1.332 +private:
1.333 +
1.334 + /**
1.335 + * Default constructor.
1.336 + */
1.337 + CAknSingleStyleTreeList();
1.338 +
1.339 + /**
1.340 + * Second phase constructor.
1.341 + */
1.342 + void ConstructL();
1.343 +
1.344 + /**
1.345 + * Second phase constructor.
1.346 + *
1.347 + * @param aContainer Container for the list.
1.348 + */
1.349 + void ConstructL( const CCoeControl& aContainer );
1.350 +
1.351 + };
1.352 +
1.353 +
1.354 +#endif // C_AKNSINGLESTYLETREELIST_H