emailuis/uicomponents/inc/fsseparatorvisualizer.h
changeset 0 8466d47a6819
child 29 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 separator.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSSEPARATORVISUALIZER_H
       
    20 #define C_FSSEPARATORVISUALIZER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //#include <fsconfig.h> <cmail>
       
    24 // <cmail> SF
       
    25 #include <alf/alfeventhandler.h>
       
    26 #include <alf/alflinevisual.h>
       
    27 // </cmail>
       
    28 #include "fstreeitemvisualizerbase.h"
       
    29 
       
    30 class CAlfViewportLayout;
       
    31 
       
    32 class CFsSeparatorData;
       
    33 
       
    34 const TInt KDefaultSeparatorThickness = 1;
       
    35 const TInt KDefaultWidth = 200;
       
    36 const TInt KDefaultHeight = 5;
       
    37 /**
       
    38  * CFsSeparatorVisualizer is a visualizer for data items separator.
       
    39  *
       
    40  * Thic class is a concrete implementation for the MFsTreeItemVisualizer 
       
    41  * interface. It provides visualization for data items separator.
       
    42  * 
       
    43  * @code
       
    44  *
       
    45  * @endcode
       
    46  *
       
    47  * @lib 
       
    48  */
       
    49 NONSHARABLE_CLASS( CFsSeparatorVisualizer ): 
       
    50                                   public CFsTreeItemVisualizerBase
       
    51     {
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Two-phased constructor
       
    56      * 
       
    57      * @param aOwnerControl Owner control.
       
    58      */
       
    59     IMPORT_C static CFsSeparatorVisualizer* NewL( 
       
    60                                                  CAlfControl& aOwnerControl );
       
    61                                               
       
    62     /** 
       
    63     * C++ destructor
       
    64     */
       
    65     virtual ~CFsSeparatorVisualizer();    
       
    66     
       
    67 public: 
       
    68 
       
    69     /**
       
    70      * The function sets separator's thickness in pixels.
       
    71      * 
       
    72      * @param aPixelThickness Thickness of the separator line (in pixels)
       
    73      */
       
    74     virtual void SetSeparatorThickness( const TInt aThickness );
       
    75     
       
    76     /**
       
    77      * The function returns thikness of the separator line.
       
    78      * 
       
    79      * @return Thickness of the separator line (in pixels)
       
    80      */
       
    81     virtual TInt SeparatorThickness( ) const;
       
    82     
       
    83     /**
       
    84      * Sets the width of separator line. The separator line is always centered 
       
    85      * horizontaly. The line width is given as the percentage of the whole item's width.
       
    86      * 
       
    87      * @param aWidth Percent of item's width covered by separator line. 
       
    88      *               Valid values are in range <1.0 , 0.1>    
       
    89      */
       
    90     virtual void SetSeparatorWidth ( TReal32 aWidth );
       
    91     
       
    92     /**
       
    93      * Returns the width of the separator line.
       
    94      * 
       
    95      * @return Percent of item's width covered by separator line.
       
    96      */
       
    97     virtual TReal32 SetSeparatorWidth ( ) const;
       
    98     
       
    99 // from base class MFsTreeItemVisualizer
       
   100     
       
   101     /**
       
   102      * From MFsTreeItemVisualizer.
       
   103      * Returns the type of the separator visualizer class.
       
   104      */
       
   105     virtual TFsTreeItemVisualizerType Type() const;
       
   106 
       
   107     /**
       
   108      * Sets multiple flags for an item at one time.
       
   109      * Setting KFsTreeListItemFocusable flag has o effect - item is always non-focusable.
       
   110      * KFsTreeListItemManagedLayout flag has no effect.
       
   111      * KFsTreeListItemExtendable flag has no effect.
       
   112      * KFsTreeListItemExtended flag has no effect.
       
   113      * KFsTreeListItemAlwaysExtended  flag has no effect.
       
   114      * 
       
   115      * @param aFlags Flags for separator visualizer.
       
   116      */
       
   117     virtual void SetFlags( TUint32 aFlags );
       
   118     
       
   119     /**
       
   120      * Returns the size of an item in a normal (not expanded) state.
       
   121      * 
       
   122      * @return Size in pixels of an item when it is not expanded.
       
   123      */
       
   124     virtual TSize Size() const;   
       
   125     
       
   126     /**
       
   127      * From MFsTreeItemVisualizer.
       
   128      * Sets the item's visualization state to extended. 
       
   129      * Separator cannot be extended - the function has no effect. 
       
   130      * 
       
   131      * @param aFlag ETrue to visualize item as extended.
       
   132      */
       
   133     virtual void SetExtended( TBool aFlag );
       
   134     
       
   135     /**
       
   136      * From MFsTreeItemVisualizer.
       
   137      * Returns extended/not extended state of the item visualization.
       
   138      * Separator cannot be extended - the function always returns EFalse.
       
   139      * 
       
   140      * @return EFalse
       
   141      */
       
   142     virtual TBool IsExtended() const;
       
   143     
       
   144     /**
       
   145      * From MFsTreeItemVisualizer.
       
   146      * Sets if an item can be in expanded state or not.
       
   147      * Separator is not expandable - the function has no effect.
       
   148      * 
       
   149      * @param aFlag ETrue if item can be in expanded state.
       
   150      */
       
   151     virtual void SetExtendable( TBool aFlag );
       
   152     
       
   153     /**
       
   154      * From MFsTreeItemVisualizer.
       
   155      * Returns an information if item can be in expanded state.
       
   156      * Separator is not expandable - the function always returns EFalse.
       
   157      * 
       
   158      * @return EFalse
       
   159      */
       
   160     virtual TBool IsExtendable( );
       
   161     
       
   162     /**
       
   163      * From MFsTreeItemVisualizer.
       
   164      * This functions sets wether an item should always be in extended state.
       
   165      * 
       
   166      * @param ETrue if item should always be in extended state.
       
   167      */
       
   168     virtual void SetAlwaysExtended( TBool aAlwaysExtended );
       
   169     
       
   170     /**
       
   171      * From MFsTreeItemVisualizer.
       
   172      * This function returns wether an item is always in extended state.
       
   173      * 
       
   174      * @return ETrue if item is always in extended state.
       
   175      */
       
   176     virtual TBool IsAlwaysExtended( ) const;
       
   177     
       
   178     /**
       
   179      * From MFsTreeItemVisualizer.
       
   180      * A call to this function means that the item is requested to draw itself
       
   181      * within specified parent layout. Data to be visualized is passed as an
       
   182      * argument. 
       
   183      * 
       
   184      * Parameter descriptions will be added when the final function prototype
       
   185      * is ready.
       
   186      */
       
   187     virtual void ShowL( CAlfLayout& aParentLayout,
       
   188                         const TUint aTimeout = 0 );
       
   189 
       
   190     /**
       
   191     * A call to this function means that the item is requested to update its
       
   192     * visual content.
       
   193     */
       
   194     virtual void UpdateL( const MFsTreeItemData& aData,
       
   195                           TBool aFocused,
       
   196                           const TUint aLevel,
       
   197                           CAlfTexture*& aMarkIcon,
       
   198                           CAlfTexture*& aMenuIcon,
       
   199                           const TUint aTimeout = 0,
       
   200                           TBool aUpdateData = ETrue);
       
   201     
       
   202     /**
       
   203      * From MFsTreeItemVisualizer.
       
   204      * A call to this function means that the item goes out of the visible 
       
   205      * items scope. The visualizer should destroy all its visuals to save 
       
   206      * memory.
       
   207      */
       
   208     virtual void Hide( const TInt aTimeout = 0 );
       
   209     
       
   210     
       
   211     /**
       
   212      * From MFsTreeItemVisualizer.
       
   213      * This method marquees the text in tree item if it is too long.
       
   214      * 
       
   215      * @param aMarqueeType Type of marquee.
       
   216      * @param aMarqueeSpeed Speed of marquee in pixels per second.
       
   217      * @param aMarqueeStartDelay Marquee's start delay in miliseconds.
       
   218      * @param aMarqueeCycleStartDelay Marquee cycle's start delay.
       
   219      * @param aMarqueeRepetitions Number of marquee's cycles.
       
   220      */
       
   221     virtual void MarqueeL(const TFsTextMarqueeType aMarqueeType,
       
   222                           const TUint aMarqueeSpeed,
       
   223                           const TInt aMarqueeStartDelay,
       
   224                           const TInt aMarqueeCycleStartDelay,
       
   225                           const TInt aMarqueeRepetitions);
       
   226     
       
   227 
       
   228 protected:
       
   229 
       
   230     /**
       
   231      * C++ constructor
       
   232      * 
       
   233      * @param aOwnerControl Owner control.
       
   234      */
       
   235     CFsSeparatorVisualizer( CAlfControl& aOwnerControl );
       
   236     
       
   237     /**
       
   238      * Second phase constructor
       
   239      *
       
   240      */
       
   241     void ConstructL( );
       
   242     
       
   243 protected:
       
   244 
       
   245     /**
       
   246      * Visual for drawing a separator line.
       
   247      */
       
   248     CAlfLineVisual* iLineVisual;
       
   249     
       
   250     /**
       
   251      * Thickness of the separator line (in pixels).
       
   252      */
       
   253     TInt iThickness;
       
   254     
       
   255     /**
       
   256      * Width of a separator line - percentage of item's width covered by a separator line.  
       
   257      */
       
   258     TReal32 iWidth;
       
   259     
       
   260     };
       
   261     
       
   262 #endif  // C_FSSEPARATORVISUALIZER_H