emailuis/uicomponents/inc/fstreeplainonelinenodevisualizer.h
branchRCL_3
changeset 25 3533d4323edc
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     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:  A visualizer for nodes with plain text.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSTREEPLAINONELINENODEVISUALIZER_H
       
    20 #define C_FSTREEPLAINONELINENODEVISUALIZER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    24 //#include <fsconfig.h>
       
    25 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    26 
       
    27 #include "fstreenodevisualizerbase.h"
       
    28 
       
    29 class CAlfViewportLayout;
       
    30 class CAlfTextVisual;
       
    31 class CAlfImageVisual;
       
    32 
       
    33 class CFsTreeList;
       
    34 class CFsLayoutManager;
       
    35 class CFsTreePlainOneLineNodeData;
       
    36 class TFsMarqueeClet;
       
    37 
       
    38 
       
    39 /**
       
    40  * CFsTreePlainNodeVisualizer is a visualizer for nodes with plain text.
       
    41  *
       
    42  * Thic class is a concrete implementation for the MFsTreeNodeVisualizer 
       
    43  * interface. It provides visualization for nodes with plain text.
       
    44  * 
       
    45  * @code
       
    46  *
       
    47  * @endcode
       
    48  *
       
    49  * @lib 
       
    50  */
       
    51 NONSHARABLE_CLASS( CFsTreePlainOneLineNodeVisualizer ): 
       
    52                                             public CFsTreeNodeVisualizerBase
       
    53     {
       
    54 public:
       
    55 
       
    56     /**
       
    57      * Two-phased constructor
       
    58      * 
       
    59      * @param aOwnerControl Owner control.
       
    60      */
       
    61     IMPORT_C static CFsTreePlainOneLineNodeVisualizer* NewL( 
       
    62                                                  CAlfControl& aOwnerControl );
       
    63     
       
    64     /**
       
    65     * C++ destructor
       
    66     */
       
    67     virtual ~CFsTreePlainOneLineNodeVisualizer(); 
       
    68 
       
    69 public: // from base class MFsTreeItemVisualizer
       
    70 
       
    71     /**
       
    72      * From MFsTreeItemVisualizer.
       
    73      * Returns the type of the item's visualizer.
       
    74      */
       
    75     virtual TFsTreeItemVisualizerType Type() const;
       
    76     
       
    77     /**
       
    78      * From MFsTreeItemVisualizer.
       
    79      * Sets multiple flags for a node at one time.
       
    80      * 
       
    81      * KFsTreeListItemExtendable flag has no effect.
       
    82      * KFsTreeListItemExtended flag has no effect.
       
    83      * KFsTreeListItemAlwaysExtended  flag has no effect.
       
    84      * 
       
    85      * @param aFlags Flags for node visualizer.
       
    86      */
       
    87     virtual void SetFlags( TUint32 aFlags );
       
    88     
       
    89     void SetExpanded( TBool aFlag, const MFsTreeItemData* aData = 0 );
       
    90     
       
    91     /**
       
    92      * From MFsTreeItemVisualizer.
       
    93      * Sets item's visualization state to extended.
       
    94      *  
       
    95      * Node cannot be extended - the function has no effect. 
       
    96      * 
       
    97      * @param aIsExtended ETrue to visualize item as extended.
       
    98      */
       
    99     virtual void SetExtended( TBool aIsExtended );
       
   100     
       
   101     /**
       
   102      * From MFsTreeItemVisualizer.
       
   103      * Returns extended/not extended state of the item visualization.
       
   104      * 
       
   105      * Node cannot be extended - the function always returns EFalse.
       
   106      * 
       
   107      * @return EFalse
       
   108      */
       
   109     virtual TBool IsExtended() const;
       
   110     
       
   111     /**
       
   112      * From MFsTreeItemVisualizer.
       
   113      * Sets if an item can be in expanded state or not.
       
   114      * 
       
   115      * Node is not extendable - the function has no effect.
       
   116      * 
       
   117      * @param aIsExtendable ETrue if item can be in expanded state.
       
   118      */
       
   119     virtual void SetExtendable( TBool aIsExtendable );
       
   120     
       
   121     /**
       
   122      * From MFsTreeItemVisualizer.
       
   123      * Returns an information if item can be in expanded state.
       
   124      * 
       
   125      * Node is not extendable - the function always returns EFalse.
       
   126      * 
       
   127      * @return EFalse
       
   128      */
       
   129     virtual TBool IsExtendable( );
       
   130     
       
   131     /**
       
   132      * From MFsTreeItemVisualizer.
       
   133      * This functions sets wether an item should always be in extended state.
       
   134      * 
       
   135      * Node cannot be made always extended. This function has no effect.
       
   136      * 
       
   137      * @param aAlwaysExtended ETrue if item should always be in extended state.
       
   138      */
       
   139     virtual void SetAlwaysExtended( TBool aAlwaysExtended );
       
   140     
       
   141     /**
       
   142      * From MFsTreeItemVisualizer.
       
   143      * This function returns wether an item is always in extended state.
       
   144      * 
       
   145      * Node cannot be made always extended. The function always returns EFalse.
       
   146      * 
       
   147      * @return EFalse.
       
   148      */
       
   149     virtual TBool IsAlwaysExtended( ) const;
       
   150     
       
   151     /**
       
   152      * From MFsTreeItemVisualizer.
       
   153      * A call to this function means that the node is requested to draw itself
       
   154      * within specified parent layout. Data to be visualized is passed as an
       
   155      * argument. 
       
   156      * 
       
   157      * Parameter descriptions will be added when the final function prototype
       
   158      * is ready.
       
   159      */
       
   160     virtual void ShowL( CAlfLayout& aParentLayout,
       
   161                         const TUint aTimeout = 0 );
       
   162 
       
   163     /**
       
   164     * A call to this function means that the item is requested to update its
       
   165     * visual content.
       
   166     */
       
   167     virtual void UpdateL( const MFsTreeItemData& aData,
       
   168                           TBool aFocused,
       
   169                           const TUint aLevel,
       
   170                           CAlfTexture*& aMarkIcon,
       
   171                           CAlfTexture*& aMenuIcon,
       
   172                           const TUint aTimeout = 0,
       
   173                           TBool aUpdateData = ETrue);
       
   174     
       
   175     /**
       
   176      * From MFsTreeItemVisualizer.
       
   177      * A call to this function means that the node goes out of the visible 
       
   178      * items scope. The visualizer should destroy all its visuals to save 
       
   179      * memory.
       
   180      */
       
   181     virtual void Hide( const TInt aTimeout = 0 );
       
   182     
       
   183     /**
       
   184      * From MFsTreeItemVisualizer.
       
   185      * This method marquees the text in tree item if it is too long.
       
   186      * 
       
   187      * @param aMarqueeType Type of marquee.
       
   188      * @param aMarqueeSpeed Speed of marquee in pixels per second.
       
   189      * @param aMarqueeStartDelay Marquee's start delay in miliseconds.
       
   190      * @param aMarqueeCycleStartDelay Marquee cycle's start delay.
       
   191      * @param aMarqueeRepetitions Number of marquee's cycles.
       
   192      */
       
   193     virtual void MarqueeL(const TFsTextMarqueeType aMarqueeType,
       
   194                           const TUint aMarqueeSpeed,
       
   195                           const TInt aMarqueeStartDelay,
       
   196                           const TInt aMarqueeCycleStartDelay,
       
   197                           const TInt aMarqueeRepetitions);
       
   198                           
       
   199     /**
       
   200     * This method sets flag disable wrapping the text item.
       
   201     */
       
   202     virtual void OffWrapping();
       
   203     
       
   204     /**
       
   205      * 
       
   206      */
       
   207     virtual TBool OfferEventL(const TAlfEvent& aEvent);
       
   208         
       
   209 protected:
       
   210 
       
   211     /**
       
   212      * C++ constructor
       
   213      * 
       
   214      * @param aOwnerControl Owner control.
       
   215      */
       
   216     CFsTreePlainOneLineNodeVisualizer( CAlfControl& aOwnerControl );
       
   217     
       
   218     /**
       
   219      * Second phase constructor
       
   220      *
       
   221      */
       
   222     void ConstructL( );
       
   223     
       
   224 private:
       
   225 
       
   226     /**
       
   227      * Updates the layout metrics using layout manager that was set by 
       
   228      * tree visualizer. 
       
   229      * 
       
   230      * @param aLayoutManager Reference to the layout manager.
       
   231      */
       
   232     void UpdateLayout( const CFsTreePlainOneLineNodeData* aData,
       
   233             const TInt aIndentation,
       
   234             CAlfTexture*& aMarkIcon,
       
   235             CAlfTexture*& aMenuIcon );
       
   236     
       
   237 private: // member data
       
   238     
       
   239     
       
   240     /**
       
   241      * Viewport layouut containing text visual. Used for text marquee.
       
   242      * Own.
       
   243      */
       
   244     CAlfViewportLayout* iViewportLayout;
       
   245     
       
   246     /**
       
   247      * Text visual.
       
   248      * Own.
       
   249      */
       
   250     CAlfTextVisual* iTextVisual;
       
   251     
       
   252     /**
       
   253      * Visual for an icon.
       
   254      */
       
   255     CAlfImageVisual* iIconVisual;
       
   256     
       
   257     /**
       
   258      * Visual for a mark icon.
       
   259      */
       
   260     CAlfImageVisual* iIconMarked;
       
   261     
       
   262     /**
       
   263      * Visual for a menu icon.
       
   264      */
       
   265     CAlfImageVisual* iIconMenu;
       
   266     
       
   267     /**
       
   268      * Clet for text marquee.
       
   269      * Own.
       
   270      */
       
   271     TFsMarqueeClet* iTextMarquee;
       
   272     };
       
   273     
       
   274 
       
   275 #endif  // C_FSTREEPLAINONELINENODEVISUALIZER_H