emailuis/uicomponents/inc/fstreerichitemvisualizer.h
changeset 0 8466d47a6819
child 18 6b8f3b30d0ec
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:  A visualizer for data items with rich text.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_FSTREERICHITEMVISUALIZER_H
       
    21 #define C_FSTREERICHITEMVISUALIZER_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 //<cmail> removed __FS_ALFRED_SUPPORT flag
       
    26 //#include <fsconfig.h>
       
    27 //</cmail> removed __FS_ALFRED_SUPPORT flag
       
    28 
       
    29 
       
    30 #include "fstreeitemvisualizerbase.h"
       
    31 
       
    32 class CAlfControl;
       
    33 class CAlfLayout;
       
    34 class CAlfTexture;
       
    35 class CAlfFlowLayout;
       
    36 class CAlfViewportLayout;
       
    37 class CAlfTextVisual;
       
    38 class CAlfImageVisual;
       
    39 
       
    40 
       
    41 class CFsTreeRichItemData;
       
    42 class CFsTreeList;
       
    43 class CFsTextStyleManager;
       
    44 class CFsLayoutManager;
       
    45 
       
    46 /**
       
    47  * CFsTreeRichItemVisualizer is a visualizer for data items with rich text.
       
    48  *
       
    49  * Thic class is a concrete implementation for the MFsTreeItemVisualizer
       
    50  * interface. It provides visualization for data items with rich text.
       
    51  *
       
    52  * @code
       
    53  *
       
    54  * @endcode
       
    55  *
       
    56  * @lib
       
    57  */
       
    58 NONSHARABLE_CLASS( CFsTreeRichItemVisualizer )
       
    59     : public CFsTreeItemVisualizerBase
       
    60     {
       
    61 
       
    62 public:
       
    63 
       
    64     /**
       
    65      * Two-phased constructor
       
    66      *
       
    67      * @param aOwnerControl Owner control.
       
    68      * @param aTextStyleManager Text style manager.
       
    69      */
       
    70     IMPORT_C static CFsTreeRichItemVisualizer* NewL(
       
    71         CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager );
       
    72 
       
    73     /**
       
    74     * Destructor.
       
    75     */
       
    76     virtual ~CFsTreeRichItemVisualizer();
       
    77     
       
    78     /**
       
    79      * Returns the type of the item's visualizer.
       
    80      */
       
    81     virtual TFsTreeItemVisualizerType Type() const;
       
    82 
       
    83     /**
       
    84      * Create a visual based on the text object.
       
    85      *
       
    86      * @param aOwnerControl Owner control.
       
    87      * @param aParentLayout Layout for the text.
       
    88      * @param aText Contains the text.
       
    89      * @param aSize Size where to fit the text.
       
    90      */
       
    91     CAlfFlowLayout* CreateTextLineL( CAlfControl& aOwnerControl,
       
    92         CAlfLayout* aParentLayout, const CFsTreeRichItemData* aText,
       
    93         TSize aSize );
       
    94 
       
    95     /**
       
    96      * Create a font style.
       
    97      *
       
    98      * @param charFormat Contains character format attributes.
       
    99      */
       
   100     TInt CreateStyleL( TCharFormat& charFormat );
       
   101 
       
   102 // from base class MFsTreeItemVisualizer
       
   103 
       
   104     /**
       
   105      * From MFsTreeItemVisualizer.
       
   106      * A call to this function means that the item is requested to draw itself
       
   107      * within specified parent layout. Data to be visualized is passed as an
       
   108      * argument.
       
   109      *
       
   110      * Parameter descriptions will be added when the final function prototype
       
   111      * is ready.
       
   112      */
       
   113     virtual void ShowL( CAlfLayout& aParentLayout,
       
   114                         const TUint aTimeout = 0 );
       
   115 
       
   116     /**
       
   117      * From MFsTreeItemVisualizer.
       
   118      * A call to this function means that the item is requested to update its
       
   119      * visual content.
       
   120      */
       
   121     virtual void UpdateL( const MFsTreeItemData& aData,
       
   122                         TBool aFocused,
       
   123                         const TUint aLevel,
       
   124                         CAlfTexture*& aMarkIcon,
       
   125                         CAlfTexture*& aMenuIcon,
       
   126                         const TUint aTimeout = 0,
       
   127                         TBool aUpdateData = ETrue);
       
   128 
       
   129     /**
       
   130      * From MFsTreeItemVisualizer.
       
   131      * A call to this function means that the item goes out of the visible
       
   132      * items scope. The visualizer should destroy all its visuals to save
       
   133      * memory.
       
   134      */
       
   135     virtual void Hide( const TInt aTimeout = 0 );
       
   136     
       
   137     /**
       
   138      * From MFsTreeItemVisualizer.
       
   139      * This method marquees the text in tree item if it is too long.
       
   140      * 
       
   141      * @param aMarqueeType Type of marquee.
       
   142      * @param aMarqueeSpeed Speed of marquee in pixels per second.
       
   143      * @param aMarqueeStartDelay Marquee's start delay in miliseconds.
       
   144      * @param aMarqueeCycleStartDelay Marquee cycle's start delay.
       
   145      * @param aMarqueeRepetitions Number of marquee's cycles.
       
   146      */
       
   147     virtual void MarqueeL(const TFsTextMarqueeType aMarqueeType,
       
   148                           const TUint aMarqueeSpeed,
       
   149                           const TInt aMarqueeStartDelay,
       
   150                           const TInt aMarqueeCycleStartDelay,
       
   151                           const TInt aMarqueeRepetitions);
       
   152 
       
   153 protected:
       
   154 
       
   155     /**
       
   156      * C++ constructor
       
   157      *
       
   158      * @param aOwnerControl Owner control.
       
   159      * @param aTextStyleManager Text style manager.
       
   160      */
       
   161     CFsTreeRichItemVisualizer(
       
   162         CAlfControl& aOwnerControl, CFsAlfTextStyleManager& aTextStyleManager );
       
   163 
       
   164     /**
       
   165      * Second phase constructor
       
   166      *
       
   167      */
       
   168     void ConstructL( );
       
   169     
       
   170 private:
       
   171 
       
   172     /**
       
   173      * Updates the layout metrics using layout manager that was set by 
       
   174      * tree visualizer. 
       
   175      */
       
   176     virtual void UpdateLayout(  
       
   177             const CFsTreeRichItemData* aData,
       
   178             const TInt aIndentation );
       
   179 
       
   180 private:
       
   181     
       
   182     /**
       
   183      * Layout for the richtext.
       
   184      * Own.
       
   185      */
       
   186     CAlfFlowLayout* iTextLayout;
       
   187     
       
   188     /**
       
   189      * Viewport layouut containing text visual. Used for text marquee.
       
   190      * Own.
       
   191      */
       
   192     CAlfViewportLayout* iViewportLayout;
       
   193     
       
   194     /**
       
   195      * Text visual.
       
   196      * Own.
       
   197      */
       
   198     CAlfTextVisual* iTextVisual;
       
   199     
       
   200     /**
       
   201      * Visual for an icon.
       
   202      */
       
   203     CAlfImageVisual* iIconVisual;
       
   204     
       
   205     /**
       
   206      * Visual for a mark icon.
       
   207      */
       
   208     CAlfImageVisual* iIconMarked;
       
   209     
       
   210     /**
       
   211      * Visual for a menu icon.
       
   212      */
       
   213     CAlfImageVisual* iIconMenu;
       
   214 
       
   215     };
       
   216 
       
   217 
       
   218 #endif  // C_FSTREERICHITEMVISUALIZER_H