emailuis/uicomponents/inc/fstreelist.h
changeset 0 8466d47a6819
child 2 5253a20d2a1e
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Freestyle tree list component
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSTREELIST_H
       
    20 #define C_FSTREELIST_H
       
    21 
       
    22 
       
    23 /////SYSTEM INCLUDES
       
    24 
       
    25 //////TOOLKIT INCLUDES
       
    26 // <cmail> SF
       
    27 #include <alf/alfcontrol.h>
       
    28 // </cmail>
       
    29 
       
    30 //////PROJECT INCLUDES
       
    31 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    32 //#include <fsconfig.h>
       
    33 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    34 
       
    35 #include "fstreelistconstants.h"
       
    36 #include "fstreevisualizerbase.h"
       
    37 #include "fstreevisualizerobserver.h"
       
    38 
       
    39 //////TOOLKIT CLASSES
       
    40 class CAlfEnv;
       
    41 class CAlfTexture;
       
    42 
       
    43 //////PROJECT CLASSES
       
    44 class CFsTree;
       
    45 class CFsTreeControl;
       
    46 class MFsTreeListObserver;
       
    47 class MFsTreeItemData;
       
    48 class MFsTreeItemVisualizer;
       
    49 class MFsTreeNodeVisualizer;
       
    50 class CFsAlfTextStyleManager;
       
    51 
       
    52 /** An array of tree list observers */
       
    53 typedef RPointerArray<MFsTreeListObserver> RFsTreeListObservers;
       
    54 
       
    55 /**
       
    56  * CFsTreeList is a component for creating and displaying hierarchical list
       
    57  * using tree data structure.
       
    58  *
       
    59  * @code
       
    60  *
       
    61  * @endcode
       
    62  *
       
    63  * @lib
       
    64  */
       
    65 class CFsTreeList  : public CBase, MFsTreeVisualizerObserver
       
    66     {
       
    67 public: // Construction
       
    68 
       
    69 
       
    70     /** Pre-defined types of markability in list */
       
    71     enum TFsTreeListMarkType
       
    72         {
       
    73         EFsTreeListNonMarkable,
       
    74         EFsTreeListMarkable,
       
    75         EFsTreeListMultiMarkable
       
    76         };
       
    77 
       
    78     /** Pre-defined types of scrolling in list
       
    79      *  OLD API - to be removed.
       
    80      * */
       
    81     enum TFsTreeListScrollbars
       
    82         {
       
    83         EFsTreeListNoScrollbars,
       
    84         EFsTreeListVerticalScrollbar
       
    85         };
       
    86 
       
    87     /**
       
    88      * Two-phased constructor
       
    89      *
       
    90      * @param aTreeV Pointer to the class responsible for visualizing tree
       
    91      *        structure
       
    92      * @param aEnv Reference to the UI toolkit environment
       
    93      */
       
    94     IMPORT_C static CFsTreeList* NewL( CFsTreeVisualizerBase& aTreeV,
       
    95                                        CAlfEnv& aEnv );
       
    96 
       
    97     /**
       
    98      * C++ destructor
       
    99      */
       
   100     IMPORT_C virtual ~CFsTreeList();
       
   101 
       
   102     /**
       
   103      * Adds observer to the list of observers
       
   104      *
       
   105      * @param aTreeListObserver Reference to the list observer
       
   106      */
       
   107     IMPORT_C void AddObserverL( MFsTreeListObserver& aTreeListObserver );
       
   108 
       
   109     /**
       
   110      * Removes observer from the list of observers
       
   111      *
       
   112      * @param aTreeListObserver         Reference to the list observer
       
   113      *
       
   114      * @panic ETreeListPanicObserverNotFound The given observer was not
       
   115      *                                  registered previously
       
   116      */
       
   117     IMPORT_C void RemoveObserver( MFsTreeListObserver& aTreeListObserver );
       
   118 
       
   119 public: // Tree list configuration
       
   120 
       
   121     /**
       
   122      * Returns a hitckcock control associated with the component.
       
   123      */
       
   124     IMPORT_C CAlfControl* TreeControl( ) const;
       
   125 
       
   126     /**
       
   127      * The function sets duration of the slide-in effect.
       
   128      *
       
   129      * @param aTimeMiliseconds Slide in time in milliseconds.
       
   130      */
       
   131     IMPORT_C void SetSlideInDuration ( TInt aTimeMiliseconds );
       
   132 
       
   133     /**
       
   134      * The function returns slide in effect's duration.
       
   135      *
       
   136      * @return Slide in duration in miliseconds.
       
   137      */
       
   138     IMPORT_C TInt SlideInDuration ( ) const;
       
   139 
       
   140     /**
       
   141      * The function sets direction of the slide in effect.
       
   142      *
       
   143      * @param aDirection A direction of the slide in effect.
       
   144      */
       
   145     IMPORT_C void SetSlideInDirection (
       
   146             MFsTreeVisualizer::TFsSlideEffect aDirection );
       
   147 
       
   148     /**
       
   149      * The function returns direction of the slide in effect.
       
   150      *
       
   151      * @return A direction of the slide in effect.
       
   152      */
       
   153     IMPORT_C MFsTreeVisualizer::TFsSlideEffect SlideInDirection ( ) const;
       
   154 
       
   155     /**
       
   156      * The function sets duration of the slide-out effect.
       
   157      *
       
   158      * @param aTimeMiliseconds Slide out time in milliseconds.
       
   159      */
       
   160     IMPORT_C void SetSlideOutDuration ( TInt aTimeMiliseconds );
       
   161 
       
   162     /**
       
   163      * The function returns slide out effect's duration.
       
   164      *
       
   165      * @return Slide out duration in miliseconds.
       
   166      */
       
   167     IMPORT_C TInt SlideOutDuration ( ) const;
       
   168 
       
   169     /**
       
   170      * The function sets direction of the slide out effect.
       
   171      *
       
   172      * @param aDirection A direction of the slide out effect.
       
   173      */
       
   174     IMPORT_C void SetSlideOutDirection (
       
   175             MFsTreeVisualizer::TFsSlideEffect aDirection );
       
   176 
       
   177     /**
       
   178      * The function returns direction of the slide out effect.
       
   179      *
       
   180      * @return A direction of the slide out effect.
       
   181      */
       
   182     IMPORT_C MFsTreeVisualizer::TFsSlideEffect SlideOutDirection ( ) const;
       
   183 
       
   184     /**
       
   185      * Returns information about looping type of the list.
       
   186      *
       
   187      * @return Type of list looping. EFsTreeListLoopingDisabled when looping
       
   188      *         is turned off.
       
   189      */
       
   190     IMPORT_C TFsTreeListLoopingType LoopingType() const;
       
   191 
       
   192     /**
       
   193      * Returns information whether list is markable, non-markable or
       
   194      * multi-markable
       
   195      *
       
   196      * @return Returns markability of the list
       
   197      */
       
   198     IMPORT_C TFsTreeListMarkType MarkType() const;
       
   199 
       
   200     /**
       
   201      * OLD API - to be removed.
       
   202      * Returns information about scrollbars used by list visual
       
   203      *
       
   204      * @return Returns a type of scrollbars that the list uses
       
   205      */
       
   206     IMPORT_C TFsTreeListScrollbars HasScrollBars() const;
       
   207 
       
   208     /**
       
   209      * Old API - to be removed
       
   210      *
       
   211      * @param aFlag Scrollbar type for the list
       
   212      */
       
   213     IMPORT_C void SetScrollBarsL( const TFsTreeListScrollbars aFlag );
       
   214 
       
   215 
       
   216     /**
       
   217      * Returns information about scrollbars used by list visual
       
   218      *
       
   219      * @return Returns a type of scrollbars that the list uses
       
   220      */
       
   221     IMPORT_C TFsScrollbarVisibility ScrollbarVisibility() const;
       
   222 
       
   223     /**
       
   224      * Enables or disables scrollbars
       
   225      *
       
   226      * @param aFlag Scrollbar type for the list
       
   227      */
       
   228     IMPORT_C void SetScrollbarVisibilityL(const TFsScrollbarVisibility aVisibility);
       
   229 
       
   230     /**
       
   231      * Sets type of list's looping.
       
   232      *
       
   233      * @param aLoopingType type of list looping.
       
   234      */
       
   235     IMPORT_C void SetLoopingType( const TFsTreeListLoopingType aLoopingType );
       
   236 
       
   237 
       
   238     /**
       
   239      * The functions sets fade-in's effect duration.
       
   240      * @param aFadeTime A time in miliseconds for fade in effect.
       
   241      */
       
   242     IMPORT_C void SetFadeInEffectTime( TInt aFadeTime );
       
   243 
       
   244     /**
       
   245      * The functions returns fade-in's effect duration.
       
   246      * @return A time in miliseconds for fade in effect.
       
   247      */
       
   248     IMPORT_C TInt FadeInEffectTime( );
       
   249 
       
   250     /**
       
   251      * The functions sets fade-out's effect duration.
       
   252      * @param aFadeTime A time in miliseconds for fade-out effect.
       
   253      */
       
   254     IMPORT_C void SetFadeOutEffectTime( TInt aFadeTime );
       
   255 
       
   256     /**
       
   257      * The functions returns fade-out's effect duration.
       
   258      * @return A time in miliseconds for fade-out effect.
       
   259      */
       
   260     IMPORT_C TInt FadeOutEffectTime( );
       
   261 
       
   262     /**
       
   263      * Function sets the time of list scroll per item and the scroll
       
   264      * acceleration rate.
       
   265      * @param aScrollTime Time (in miliseconds) at which the list items are
       
   266      *                    scrolled.
       
   267      * @param aScrollAcceleration Rate of scroll acceleration when the up/down
       
   268      *                            key is pressed for a long time. This is
       
   269      *                            multiplied by the number of up/down key
       
   270      *                            repeats. Acceleration rate should be in
       
   271      *                            0.0-1.0 range.
       
   272      */
       
   273     IMPORT_C void SetScrollTime ( TInt aScrollTime,
       
   274                                   TReal aScrollAcceleration = 0.0 );
       
   275 
       
   276     /**
       
   277      * Function gets the values of scroll speed and its acceleration rate.
       
   278      *
       
   279      * @param aScrollTime Time (in miliseconds) at which the list items are
       
   280      *                    scrolled.
       
   281      *
       
   282      * @param aScrollAcceleration Rate of scroll acceleration when the up/down
       
   283      *                            key is pressed for a long time.
       
   284      */
       
   285     IMPORT_C void GetScrollTime( TInt& aScrollTime,
       
   286                                  TReal& aScrollAcceleration );
       
   287 
       
   288     /**
       
   289      * Enables or disables marking of list items
       
   290      *
       
   291      * @param aFlag Type of markability for the list
       
   292      */
       
   293     IMPORT_C void SetMarkTypeL( const TFsTreeListMarkType aFlag );
       
   294 
       
   295     /**
       
   296      * Returns information whether list enables indention or not
       
   297      *
       
   298      * @return ETrue if indention is enabled, EFalse otherwise
       
   299      */
       
   300     IMPORT_C TInt Indentation() const;
       
   301 
       
   302     /**
       
   303      * Enables or disables indention for list
       
   304      *
       
   305      * @param aIndentation Indentation in pixels.
       
   306      */
       
   307     IMPORT_C void SetIndentationL( const TInt aIndentation );
       
   308 
       
   309     /**
       
   310      * The functions sets wether all item in the list should be always in
       
   311      * extended state or in normal state.
       
   312      * The list view is refreshed.
       
   313      *
       
   314      * @param aAlwaysExtended ETrue if items should be always extended. EFalse
       
   315      *                        if items should be in normal state.
       
   316      */
       
   317     IMPORT_C void SetItemsAlwaysExtendedL ( TBool aAlwaysExtended );
       
   318 
       
   319     /*
       
   320      * The function returns if items are always in extended state or in
       
   321      * normal.
       
   322      *
       
   323      * @return ETrue if items are always in extended state, EFalse if items
       
   324      *         are in normal state.
       
   325      */
       
   326     IMPORT_C TBool IsItemsAlwaysExtended ( );
       
   327 
       
   328 public: // Tree management
       
   329 
       
   330     /**
       
   331      * Inserts new item as a child of parent given by Id with the given
       
   332      * position
       
   333      *
       
   334      * @param aItemD Pointer to item's data
       
   335      * @param aItemV Pointer to item's visualizer
       
   336      * @param aParentId Id of parent node
       
   337      * @param aIndex Position of new item in the list of parent's children (if
       
   338      *               omitted, the item is inserted as last)
       
   339      * @param aAllowRefresh Blocks/Allows view update after an item has been added
       
   340      *               to the tree list. Currently works only with scrollbar update.
       
   341      *
       
   342      * @return Id of the inserted item
       
   343      *
       
   344      * @panic EFsListPanicParentIdNotFound The specified parent id was not
       
   345      *                          found
       
   346      * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's
       
   347      *                                    number of children
       
   348      */
       
   349     IMPORT_C TFsTreeItemId InsertItemL( MFsTreeItemData& aItemD,
       
   350                                         MFsTreeItemVisualizer& aItemV,
       
   351                                         const TFsTreeItemId aParentId,
       
   352                                         const TInt aIndex = -1,
       
   353                                         const TBool aAllowRefresh = ETrue);
       
   354 
       
   355     /**
       
   356      * Inserts new node as a child of parent given by Id with the given
       
   357      * position
       
   358      *
       
   359      * @param aItemD Pointer to node's data
       
   360      * @param aItemV Pointer to node's visualizer
       
   361      * @param aParentId Id of parent node
       
   362      * @param aIndex Position of new node in the list of parent's children (if
       
   363      *               omitted, the node is inserted as last)
       
   364      *
       
   365      * @return Id of the inserted node
       
   366      *
       
   367      * @panic EFsListPanicParentIdNotFound The specified parent id was not
       
   368      *                          found
       
   369      * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's
       
   370      *                                    number of children
       
   371      */
       
   372     IMPORT_C TFsTreeItemId InsertNodeL( MFsTreeItemData& aItemD,
       
   373                                         MFsTreeNodeVisualizer& aNodeV,
       
   374                                         const TFsTreeItemId aParentId,
       
   375                                         const TInt aIndex = -1,
       
   376                                         const TBool aAllowRefresh = ETrue );
       
   377 
       
   378     /**
       
   379      * Removes the item with given Id from the list. If aItemId is a node all
       
   380      * its children will be removed as well.
       
   381      *
       
   382      * @param aItemId Id of the item to be removed
       
   383      *
       
   384      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   385      *                                  the list
       
   386      */
       
   387     IMPORT_C void RemoveL( const TFsTreeItemId aItemId );
       
   388 
       
   389     /**
       
   390      * Removes all items from the list.
       
   391      */
       
   392     IMPORT_C void RemoveAllL( );
       
   393 
       
   394     /**
       
   395      * Removes all children of the given node.
       
   396      *
       
   397      * @param aNodeId Id of the node
       
   398      *
       
   399      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   400      *                                  the list
       
   401      * @panic EFsListPanicInvalidItemType Item id was passed instead of the
       
   402      *                                  node id
       
   403      */
       
   404     IMPORT_C void RemoveChildrenL( const TFsTreeItemId aNodeId );
       
   405 
       
   406     /**
       
   407      * Moves the item with given Id to the list of children of parent with
       
   408      * given id
       
   409      *
       
   410      * @param aItemId Id of the item to be moved
       
   411      * @param aTargetNode Id of the new parent node
       
   412      * @param aIndex Position of the item in the list of new parent's children
       
   413      *               (if omitted, the item/node is inserted as last)
       
   414      *
       
   415      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   416      *                                  the list
       
   417      * @panic EFsListPanicParentIdNotFound The specified parent id was not
       
   418      *                                  found
       
   419      * @panic EFsListPanicInvalidItemType Item id was passed as a second param
       
   420      *                                    instead of the node id
       
   421      * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's
       
   422      *                                    number of children
       
   423      */
       
   424     IMPORT_C void MoveItemL( const TFsTreeItemId aItemId,
       
   425             const TFsTreeItemId aTargetNode, const TInt aIndex = -1 );
       
   426 
       
   427     /**
       
   428      * Checks if a node has children, if parameter is omitted, root of the
       
   429      * list is checked to indicate if the list is empty
       
   430      *
       
   431      * @param aNodeId Id of a node
       
   432      *
       
   433      * @return Etrue if a node has children, EFalse if it does not
       
   434      *
       
   435      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   436      *                                  the list
       
   437      * @panic EFsListPanicInvalidItemType Item id was passed instead of the
       
   438      *                          node id
       
   439      */
       
   440     IMPORT_C TBool IsEmpty(const TFsTreeItemId aNodeId = KFsTreeRootID) const;
       
   441 
       
   442     /**
       
   443      * Returns the level of an item in tree.
       
   444      *
       
   445      * @param aItemId Id of an item.
       
   446      *
       
   447      * @return Level of an item.
       
   448      */
       
   449     IMPORT_C TUint Level( const TFsTreeItemId aItemId ) const;
       
   450 
       
   451     /**
       
   452      * Counts elements in the list
       
   453      *
       
   454      * @return Number of list items
       
   455      */
       
   456     IMPORT_C TUint Count() const;
       
   457 
       
   458     /**
       
   459      * Gets the number of children of the given node
       
   460      *
       
   461      * @param aNodeId Id of the node
       
   462      *
       
   463      * @return Number of node's children
       
   464      *
       
   465      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   466      *                                  the list
       
   467      * @panic EFsListPanicInvalidItemType Item id was passed instead of the
       
   468      *                      node id
       
   469      */
       
   470     IMPORT_C TUint CountChildren( const TFsTreeItemId aNodeId ) const;
       
   471 
       
   472     /**
       
   473      * Gets the id of a child of the specified node with the position given
       
   474      *
       
   475      * @param aNodeId Id of a node
       
   476      * @param aIndex Index of the child
       
   477      *
       
   478      * @return Id of a child
       
   479      *
       
   480      * @panic EFsListPanicInvalidItemId The specified item id was not found in
       
   481      *                                  the list
       
   482      * @panic EFsListPanicInvalidItemType Item id was passed instead of the
       
   483      *                      node id
       
   484      * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's
       
   485      *                                    number of children
       
   486      */
       
   487     IMPORT_C TFsTreeItemId Child( const TFsTreeItemId aNodeId,
       
   488             const TUint aIndex ) const;
       
   489 
       
   490     /**
       
   491      * Returns the index of a child for a given parent
       
   492      *
       
   493      * @param aNodeId Id of a node
       
   494      * @param aItemId Id of a child
       
   495      *
       
   496      * @return Index of a child
       
   497      *
       
   498      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   499      *                                  in the list
       
   500      * @panic EFsListPanicInvalidItemType Item id was passed instead of
       
   501      *                                  the node id
       
   502      * @panic EFsListPanicIndexOutOfRange Specified index exceeds node's
       
   503      *                                  number of children
       
   504      */
       
   505     IMPORT_C TUint ChildIndex( const TFsTreeItemId aNodeId,
       
   506             const TFsTreeItemId aItemId ) const;
       
   507 
       
   508     /**
       
   509      * Gets the parent's id for the specified item. If KFsTreeRootID is passed
       
   510      * then KFsTreeNoneID  is returned.
       
   511      *
       
   512      * @param aItemId Id of an item
       
   513      *
       
   514      * @return Id of item's parent
       
   515      *
       
   516      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   517      *                                  in the list
       
   518      */
       
   519     IMPORT_C TFsTreeItemId Parent( const TFsTreeItemId aItemId ) const;
       
   520 
       
   521     /**
       
   522      * Checks whether the item with specified id belongs to the list
       
   523      *
       
   524      * @param aItemId Id of an item
       
   525      *
       
   526      * @return ETrue if the item is in the list, EFalse otherwise
       
   527      */
       
   528     IMPORT_C TBool Contains( const TFsTreeItemId aItemId ) const;
       
   529 
       
   530     /**
       
   531      * Checks whether the item with specified id is a node
       
   532      *
       
   533      * @param aItemId Id of an item
       
   534      *
       
   535      * @return ETrue if the item is a node, EFalse otherwise
       
   536      *
       
   537      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   538      *                                  in the list
       
   539      */
       
   540     IMPORT_C TBool IsNode( const TFsTreeItemId aItemId ) const;
       
   541 
       
   542     /**
       
   543     * Sets focus state of list component
       
   544     * @param aFocused status of the focus to be set
       
   545     */
       
   546     IMPORT_C void SetFocusedL( const TBool aFocused );
       
   547 
       
   548     /**
       
   549     * Returns state of the focus
       
   550     * @return State of the focus
       
   551     */
       
   552     IMPORT_C TBool IsFocused() const;
       
   553 
       
   554     /**
       
   555     * Returns item visualizer for given item id.
       
   556     */
       
   557     IMPORT_C CFsTreeList* ItemMenu( TFsTreeItemId aItemId );
       
   558 
       
   559 public: // Visualization management
       
   560 
       
   561     /**
       
   562      * Displays the list.
       
   563      *
       
   564      * @param aFadeIn Defines if list visual should or shouldn't fade in to
       
   565      *                the screen.
       
   566      * @param aSlideIn ETrue if slide in effect should be used, EFalse if not.
       
   567      */
       
   568     IMPORT_C void ShowListL( const TBool aFadeIn = EFalse,
       
   569                              const TBool aSlideIn = EFalse );
       
   570 
       
   571 
       
   572     /**
       
   573      * Sets direct touch mode.
       
   574      *
       
   575      * @param aDirectTouchMode  ETrue if list should work as in direct touch, EFalse
       
   576      *                          otherwise.
       
   577      */
       
   578     IMPORT_C void SetDirectTouchMode( const TBool aDirectTouchMode );
       
   579 
       
   580     /**
       
   581      * Hides the list.
       
   582      *
       
   583      * @param aFadeOut Defines if list visual should or shouldn't fade out
       
   584      *                 from the screen.
       
   585      * @param aSlideOut ETrue if slide out effect should be used,EFalse if not
       
   586      */
       
   587     IMPORT_C void HideListL( const TBool aFadeOut = EFalse,
       
   588                             const TBool aSlideOut = EFalse );
       
   589 
       
   590     /**
       
   591      * Gets the currently focused (highlighted) item id
       
   592      *
       
   593      * @return Id of the item being focused (highlighted)
       
   594      */
       
   595     IMPORT_C TFsTreeItemId FocusedItem() const;
       
   596 
       
   597     /**
       
   598      * Sets the focus (highlight) upon the item with given id
       
   599      *
       
   600      * @param aItemId Id of the item that is to be focused (highlighted)
       
   601      *
       
   602      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   603      *                                  in the list
       
   604      */
       
   605     IMPORT_C void SetFocusedItemL( const TFsTreeItemId aItemId );
       
   606 
       
   607     /**
       
   608      * Checks whether the item with specified id is marked.
       
   609      *
       
   610      * @param aItemId Id of an item.
       
   611      *
       
   612      * @return ETrue if the item is marked, EFalse otherwise.
       
   613      *
       
   614      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   615      *                                  in the list.
       
   616      */
       
   617     IMPORT_C TBool IsMarked( const TFsTreeItemId aItemId ) const;
       
   618 
       
   619     /**
       
   620      * Checks whether the node with specified id is expanded.
       
   621      *
       
   622      * @param aNodeId Id of a node
       
   623      *
       
   624      * @return ETrue if the node is expanded, EFalse otherwise
       
   625      *
       
   626      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   627      *                                  in the list
       
   628      * @panic EFsListPanicInvalidItemType Item id was passed instead of
       
   629      *                                  the node id
       
   630      */
       
   631     IMPORT_C TBool IsExpanded( const TFsTreeItemId aNodeId );
       
   632 
       
   633     /**
       
   634      * Marks the item.
       
   635      *
       
   636      * @param aItemId Id of an item
       
   637      *
       
   638      * @param aMarked ETrue to set item marked, EFalse to unmarked.
       
   639      *
       
   640      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   641      *                                  in the list
       
   642      * @panic EFsListPanicIsNonMarkable The list is non-markable
       
   643      */
       
   644     IMPORT_C void MarkItemL( const TFsTreeItemId aItemId, TBool aMarked );
       
   645 
       
   646     /**
       
   647      * Expands the node. Does nothing when the node is already expanded.
       
   648      *
       
   649      * @param aNodeId Id of a node
       
   650      *
       
   651      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   652      *                                  in the list
       
   653      * @panic EFsListPanicInvalidItemType Item id was passed instead of
       
   654      *                                  the node id
       
   655      */
       
   656     IMPORT_C void ExpandNodeL( const TFsTreeItemId aNodeId );
       
   657 
       
   658     /**
       
   659      * Collapses the node. Does nothing when the node is already collapsed.
       
   660      *
       
   661      * @param aNodeId Id of a node
       
   662      *
       
   663      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   664      *                                  in the list
       
   665      * @panic EFsListPanicInvalidItemType Item id was passed instead of
       
   666      *                                  the node id
       
   667      */
       
   668     IMPORT_C void CollapseNodeL( const TFsTreeItemId aNodeId );
       
   669 
       
   670     /**
       
   671      * Gets the list of marked items
       
   672      *
       
   673      * @param aMarkedItems Reference to the array that the list will copy
       
   674      *                     array of marked items' ids to
       
   675      */
       
   676     IMPORT_C void GetMarkedItemsL( RFsTreeItemIdList& aMarkedItems ) const;
       
   677 
       
   678     /**
       
   679      * Gets the reference to the item/node data (const)
       
   680      *
       
   681      * @param aItemId Id of the item/node
       
   682      *
       
   683      * @return Reference to the item/node data (const)
       
   684      *
       
   685      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   686      *                                  in the list
       
   687      */
       
   688     IMPORT_C MFsTreeItemData& ItemData(const TFsTreeItemId aItemId) const;
       
   689 
       
   690     /**
       
   691      * Sets the reference to the item/node data
       
   692      *
       
   693      * @param aData Reference to the item/node data
       
   694      * @param aItemId Id of the item/node
       
   695      *
       
   696      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   697      *                                  in the list
       
   698      */
       
   699     IMPORT_C void SetItemDataL( MFsTreeItemData& aData,
       
   700             const TFsTreeItemId aItemId );
       
   701 
       
   702     /**
       
   703      * Gets the reference to the item visualizer (const)
       
   704      *
       
   705      * @param aItemId Id of the item
       
   706      *
       
   707      * @return Reference to the item visualizer (const)
       
   708      *
       
   709      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   710      *                                  in the list
       
   711      */
       
   712     IMPORT_C MFsTreeItemVisualizer& ItemVisualizer(
       
   713             const TFsTreeItemId aItemId ) const;
       
   714 
       
   715     /**
       
   716      * Sets the reference to the item visualizer
       
   717      *
       
   718      * @param aVisualizer Reference to the new item's visualizer
       
   719      * @param aItemId Id of the item
       
   720      *
       
   721      * @panic EFsListPanicInvalidItemId The specified item id was not found
       
   722      *                                  in the list
       
   723      */
       
   724     IMPORT_C void SetItemVisualizerL( MFsTreeItemVisualizer& aVisualizer,
       
   725             const TFsTreeItemId aItemId );
       
   726 
       
   727     /**
       
   728      * Gets the reference to the tree visualizer
       
   729      *
       
   730      * @return Reference to the tree visualizer currently used by the tree
       
   731      *         list.
       
   732      */
       
   733     IMPORT_C CFsTreeVisualizerBase& TreeVisualizer() const;
       
   734 
       
   735     /**
       
   736      * Sets a tree visualizer for the list
       
   737      *
       
   738      * @param aTreeV Reference to the tree visualizer that the tree list will
       
   739      *               be using
       
   740      */
       
   741     IMPORT_C void SetTreeVisualizer( CFsTreeVisualizerBase& aTreeV );
       
   742 
       
   743     /**
       
   744      * Sets visiblity of the border
       
   745      */
       
   746      IMPORT_C virtual void SetBorderL( const TBool aVisible,
       
   747          CAlfTexture* aBorderTexture = 0 );
       
   748 
       
   749      /**
       
   750      * Sets visiblity of the shadow
       
   751      */
       
   752      IMPORT_C void SetShadowL( const TBool aVisible );
       
   753 
       
   754      /**
       
   755       * Returns the items's target bounding rectangle in display coordinates if the item is visible.
       
   756       * Display coordinates are defined relative to the display's visible area.
       
   757       *
       
   758       * @param aItemId Item's ID.
       
   759       * @param aRect Out parameter. If successfull, contains item's target rectangle.
       
   760       * @return KErrNone if successfull,
       
   761       *         KErrNotFound 1. the list does not contain item with given ID.
       
   762       *                      2. item is not visible
       
   763       */
       
   764      IMPORT_C TInt GetItemDisplayRectTarget ( const TFsTreeItemId aItemId, TAlfRealRect& aRect );
       
   765 
       
   766      //From MFsTreeVisualizerObserver
       
   767 
       
   768      /**
       
   769       *
       
   770       */
       
   771      // <cmail> Touch
       
   772      IMPORT_C virtual void TreeVisualizerEventL(
       
   773              const TFsTreeVisualizerEvent aEvent,
       
   774              const TFsTreeItemId aId = KFsTreeNoneID ) const;
       
   775      // </cmail>
       
   776 
       
   777     /**
       
   778      * Gets the reference to the text style manager.
       
   779      *
       
   780      * @return Reference to the text style manager.
       
   781      */
       
   782      IMPORT_C CFsAlfTextStyleManager& TextStyleManager() const;
       
   783 
       
   784     /**
       
   785       * Sets the type of text marquee.
       
   786       *
       
   787       * @param aMarquee Type of marquee.
       
   788       */
       
   789     IMPORT_C void SetTextMarqueeType(const TFsTextMarqueeType aMarquee);
       
   790 
       
   791     /**
       
   792      * Returns the type of text marquee.
       
   793      *
       
   794      * @return Type of marquee.
       
   795      */
       
   796     IMPORT_C TFsTextMarqueeType TextMarqueeType() const;
       
   797 
       
   798     /**
       
   799      * Sets the speed of marquee.
       
   800      *
       
   801      * @param aPixelsPerSec How many pixels per second.
       
   802      */
       
   803     IMPORT_C void SetTextMarqueeSpeed ( const TInt aPixelsPerSec );
       
   804 
       
   805     /**
       
   806       * Returns the speed of marquee.
       
   807       *
       
   808       * @return How many pixels per second.
       
   809       */
       
   810     IMPORT_C TInt TextMarqueeSpeed ( ) const;
       
   811 
       
   812     /**
       
   813       * Sets delay for text marquee start.
       
   814       *
       
   815       * @param aStartDelay Time after which the text marquee starts (in miliseconds).
       
   816       */
       
   817     IMPORT_C void SetTextMarqueeStartDelay ( const TInt aStartDelay );
       
   818 
       
   819      /**
       
   820       * Returns delay for text marquee.
       
   821       *
       
   822       * @return Time after which the text marquee starts (in miliseconds).
       
   823       */
       
   824     IMPORT_C TInt TextMarqueeStartDelay () const;
       
   825 
       
   826     /**
       
   827      * Sets a delay for each cycle start.
       
   828      *
       
   829      * @param aCycleStartDelay Time after which the text marquee cycle starts (in miliseconds).
       
   830      */
       
   831     IMPORT_C void SetTextMarqueeCycleStartDelay ( const TInt aCycleStartDelay );
       
   832 
       
   833     /**
       
   834      * Returns a delay for each cycle start.
       
   835      *
       
   836      * @return Time after which the text marquee cycle starts (in miliseconds).
       
   837      */
       
   838     IMPORT_C TInt TextMarqueeCycleStartDelay () const;
       
   839 
       
   840      /**
       
   841       * Sets repetitions number of marquee cycle.
       
   842       *
       
   843       * @param aRepetitions Number of marquee cycles. Negetive values - infinite loop.
       
   844       */
       
   845     IMPORT_C void SetTextMarqueeRepetitions ( const TInt aMarqueeRepetitions );
       
   846 
       
   847     /**
       
   848       * Returns repetitions number of marquee cycle.
       
   849       *
       
   850       * @return Number of marquee cycles. Negetive values - infinite loop.
       
   851       */
       
   852     IMPORT_C TInt TextMarqueeRepetitions ( ) const;
       
   853 
       
   854     /**
       
   855      * Disables kinetic scrolling (Drag events will not scroll the list).
       
   856      *
       
   857      * @param aDisable ETrue if kinetic scrolling should be disabled.
       
   858      */
       
   859     IMPORT_C void DisableKineticScrolling( TBool aDisable );
       
   860 
       
   861 protected: //Construction
       
   862 
       
   863     /**
       
   864      * C++ constructor
       
   865      */
       
   866     IMPORT_C CFsTreeList( CAlfEnv& aEnv, CFsTreeVisualizerBase& aTreeV );
       
   867 
       
   868     /**
       
   869      * Second phase constructor
       
   870      *
       
   871      * @param aEnv Reference to the UI toolkit environment
       
   872      */
       
   873     IMPORT_C void ConstructL( CAlfEnv& aEnv );
       
   874 
       
   875 protected: //Data members
       
   876 
       
   877     /**
       
   878      * Alf env
       
   879      */
       
   880     CAlfEnv* iEnv;
       
   881 
       
   882     /**
       
   883      * Visualizer class
       
   884      * Not own
       
   885      */
       
   886     CFsTreeVisualizerBase* iTreeVisualizer;
       
   887 
       
   888     /**
       
   889      * Tree data structure clas
       
   890      * Own
       
   891      */
       
   892     CFsTree* iTree;
       
   893 
       
   894     /**
       
   895      * Controller class for the list
       
   896      * Own
       
   897      */
       
   898     CFsTreeControl* iTreeControl;
       
   899 
       
   900     /**
       
   901      * Loop flag
       
   902      */
       
   903     TBool iIsLooping;
       
   904 
       
   905     /**
       
   906      * part of OLD API - to be removed.
       
   907      * SScrollbar flag
       
   908      */
       
   909     TFsTreeListScrollbars iHasScrollBars;
       
   910 
       
   911 
       
   912     /**
       
   913      * Id of the focused item
       
   914      */
       
   915     TFsTreeItemId iFocusedItem;
       
   916 
       
   917     /**
       
   918      * Type of markability
       
   919      */
       
   920     TFsTreeListMarkType iMarkType;
       
   921 
       
   922     /**
       
   923      * Array of observers
       
   924      */
       
   925     RFsTreeListObservers iObservers;
       
   926 
       
   927     /**
       
   928      * Text style manager.
       
   929      * Own
       
   930      */
       
   931     CFsAlfTextStyleManager* iTextStyleManager;
       
   932 
       
   933     /**
       
   934      * The list has focus or not.
       
   935      */
       
   936     TBool iListFocused;
       
   937 
       
   938     };
       
   939 
       
   940 #endif // C_FSTREELIST_H
       
   941