emailuis/uicomponents/inc/fsmultilineitemvisualizer.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 class for the MultiLine item.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSMULTILINEITEMVISUALIZER_H
       
    20 #define C_FSMULTILINEITEMVISUALIZER_H
       
    21 
       
    22 class CAlfControl;
       
    23 class CAlfLayout;
       
    24 class CAlfTexture;
       
    25 
       
    26 class CFsMultiLineItemData;
       
    27 
       
    28 #include "fstreeitemvisualizerbase.h"
       
    29 
       
    30 /**
       
    31  * CFsMultiLineItemVisualizer is a visualizer for an item with 1-4 lines.
       
    32  *
       
    33  * This class is a concrete implementation for the MFsTreeItemVisualizer 
       
    34  * interface. It provides visualization for a Multiline item's data.
       
    35  * 
       
    36  * @code
       
    37  *
       
    38  * @endcode
       
    39  *
       
    40  * @lib 
       
    41  */
       
    42 NONSHARABLE_CLASS( CFsMultiLineItemVisualizer ): 
       
    43                                   public CFsTreeItemVisualizerBase
       
    44     {
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Two-phased constructor
       
    49      * 
       
    50      * @param aOwnerControl Owner control.
       
    51      */
       
    52     IMPORT_C static CFsMultiLineItemVisualizer* NewL( 
       
    53                                                  CAlfControl& aOwnerControl );
       
    54                                               
       
    55     /** 
       
    56     * C++ destructor
       
    57     */
       
    58     virtual ~CFsMultiLineItemVisualizer();    
       
    59 
       
    60 public:
       
    61     
       
    62     //visualizer's interface
       
    63     
       
    64     /**
       
    65      * The function sets how many lines the multiline item has when it's not extended.
       
    66      * 
       
    67      * @param aNumberOfLines Number of lines in not extended state (1-4).Note that
       
    68      *        the value should be <= than the number of lines in extended state.
       
    69      */
       
    70     virtual void SetNumberOfLinesWhenNotExtended( TInt aNumberOfLines );
       
    71     
       
    72     /**
       
    73      * The function returns how many lines the item has when it's not extended.
       
    74      * 
       
    75      * @return Number of lines in not extended state (1-4).
       
    76      */
       
    77     virtual TInt NumberOfLinesWhenNotExtended( ) const;
       
    78     
       
    79     /**
       
    80      * The function sets how many lines the multiline item has when it's extended.
       
    81      * 
       
    82      * @param aNumberOfLines Number of lines in extended state (1-4).Note that
       
    83      *        the value should be >= than the number of lines in not extended state.
       
    84      */
       
    85     virtual void SetNumberOfLinesWhenExtended( TInt aNumberOfLines );
       
    86     
       
    87     /**
       
    88      * The function returns how many lines the item has when it's extended.
       
    89      * 
       
    90      * @return Number of lines in extended state (1-4).
       
    91      */
       
    92     virtual TInt NumberOfLinesWhenExtended( ) const;
       
    93 
       
    94     /**
       
    95      * The function sets state of the item's checkbox.
       
    96      * A call of this function should be followed by a call of list's 
       
    97      * visualizer's function UpdateItemL() or RefreshListViewL().
       
    98      * 
       
    99      * @param ETrue Sets checkbox to "on" state.
       
   100      *        EFalse Sets checkbox to "off" state.
       
   101      */
       
   102     virtual void SetCheckboxState( TBool aChecked );
       
   103     
       
   104     /**
       
   105      * The function returns state of the item's checkbox.
       
   106      * 
       
   107      * @return ETrue Checkbox is in "on" state.
       
   108      *         EFalse Checkbox is in "off" state.
       
   109      */
       
   110     virtual TBool CheckboxState () const;
       
   111     
       
   112     /**
       
   113      * The function sets whether place holders should be kept when icons in the 
       
   114      * first column are not present.
       
   115      * 
       
   116      * @param ETrue if place holders should be present. EFalse otherwise.
       
   117      */
       
   118     virtual void SetKeepEmptyIconsPlaceHolders( TBool aKeep );
       
   119     
       
   120     /**
       
   121      * The function returns whether place holders are kept in case icons are
       
   122      * not set.
       
   123      * 
       
   124      * @returm ETrue if place holders are present. EFasle otherwise.
       
   125      */
       
   126     virtual TBool IsKeepEmptyIconsPlaceHolders( ) const;
       
   127 
       
   128 public: 
       
   129     
       
   130 // from base class MFsTreeItemVisualizer
       
   131     
       
   132     /**
       
   133      * Returns the type of the item's visualizer.
       
   134      */
       
   135     virtual TFsTreeItemVisualizerType Type() const;
       
   136     
       
   137     /**
       
   138      * From MFsTreeItemVisualizer.
       
   139      * Returns the size of an item in a normal (not extended) state.
       
   140      * 
       
   141      * @return Size in pixels of an item when it is not extended.
       
   142      */
       
   143     virtual TSize Size() const;
       
   144     
       
   145     /**
       
   146      * From MFsTreeItemVisualizer.
       
   147      * Returns the size of an item in expanded state.
       
   148      * 
       
   149      * @return Size in pixels of the item when it is in expanded state.
       
   150      */
       
   151     virtual TSize ExtendedSize() const;
       
   152     
       
   153     /**
       
   154      * From MFsTreeItemVisualizer.
       
   155      * A call to this function means that the item is requested to draw itself
       
   156      * within specified parent layout. Data to be visualized is passed as an
       
   157      * argument. 
       
   158      * 
       
   159      * Parameter descriptions will be added when the final function prototype
       
   160      * is ready.
       
   161      */
       
   162     virtual void ShowL( CAlfLayout& aParentLayout,
       
   163                         const TUint aTimeout = 0 );
       
   164 
       
   165     /**
       
   166     * A call to this function means that the item is requested to update its
       
   167     * visual content.
       
   168     */
       
   169     virtual void UpdateL( const MFsTreeItemData& aData,
       
   170                           TBool aFocused,
       
   171                           const TUint aLevel,
       
   172                           CAlfTexture*& aMarkIcon,
       
   173                           CAlfTexture*& aMenuIcon,
       
   174                           const TUint aTimeout = 0,
       
   175                           TBool aUpdateData = ETrue);
       
   176     
       
   177     /**
       
   178      * From MFsTreeItemVisualizer.
       
   179      * A call to this function means that the item goes out of the visible 
       
   180      * items scope. The visualizer should destroy all its visuals to save 
       
   181      * memory.
       
   182      */
       
   183     virtual void Hide( const TInt aTimeout = 0 );
       
   184       
       
   185 
       
   186 protected:
       
   187 
       
   188     /**
       
   189      * C++ constructor
       
   190      * 
       
   191      * @param aOwnerControl Owner control.
       
   192      */
       
   193     CFsMultiLineItemVisualizer( CAlfControl& aOwnerControl );
       
   194     
       
   195     /**
       
   196      * Second phase constructor
       
   197      *
       
   198      */
       
   199     void ConstructL( );
       
   200     
       
   201 private:
       
   202 
       
   203     /**
       
   204      */
       
   205     void UpdateLayout(const CFsMultiLineItemData* aData, const TInt aIndentation );
       
   206     
       
   207     /**
       
   208      * Returns item's size in state with given number of lines.
       
   209      * 
       
   210      * @param  aNumberLines Number of item's lines (1-4)
       
   211      * @return Size of item. TSize(0,0) in case invalid number of lines was passed to the func.
       
   212      */
       
   213     TSize SizeWithNumberOfLines( const TInt aNumberLines ) const;
       
   214     
       
   215 protected: //data
       
   216 
       
   217     /**
       
   218      * State of item's checkbox.
       
   219      * 
       
   220      * ETrue - checkbox is "on"
       
   221      * EFalse - checkbox is "off"
       
   222      */
       
   223     TBool iCheckState;
       
   224 
       
   225     /**
       
   226      * Place holders for empty icons should be kept or not.
       
   227      */
       
   228     TBool iKeepPlaceHolders;
       
   229     
       
   230     /**
       
   231      * Number of lines (1-4) when item is not extended.
       
   232      */
       
   233     TInt iNumLinesNotExtended;
       
   234     
       
   235     /**
       
   236      * Number of lines (1-4) when item is extended.
       
   237      */
       
   238     TInt iNumLinesExtended;
       
   239 
       
   240 ///////////////////////////first line///////////////////////////    
       
   241     /**
       
   242      * Text visual.
       
   243      * Own.
       
   244      */
       
   245     CAlfTextVisual* iFirstLineTextVis;
       
   246     
       
   247     /**
       
   248      * Visual for an icon.
       
   249      */
       
   250     CAlfImageVisual* iFirstLineIconVis;
       
   251     
       
   252     /**
       
   253      * Visual for a checkbox icon.
       
   254      */
       
   255     CAlfImageVisual* iCheckBoxIconVis;
       
   256 
       
   257     /**
       
   258      * Visual for a mark icon.
       
   259      */
       
   260     CAlfImageVisual* iMarkIconVis;
       
   261     
       
   262     /**
       
   263      * Visual for a menu icon.
       
   264      */
       
   265     CAlfImageVisual* iMenuIconVis;
       
   266 
       
   267 ///////////////////////////second line///////////////////////////
       
   268     /**
       
   269      * 
       
   270      */
       
   271     CAlfTextVisual* iSecondLineTextVis;
       
   272         
       
   273     /**
       
   274      * Visual for an icon.
       
   275      */
       
   276     CAlfImageVisual* iSecondLineIconVis;
       
   277 
       
   278 ///////////////////////////third line///////////////////////////
       
   279     /**
       
   280      */
       
   281     CAlfTextVisual* iThirdLineTextVis;
       
   282         
       
   283     /**
       
   284      * Visual for an icon.
       
   285      */
       
   286     CAlfImageVisual* iThirdLineIconVis;
       
   287     
       
   288 ///////////////////////////fourth line///////////////////////////
       
   289     /**
       
   290      */
       
   291     CAlfTextVisual* iFourthLineTextVis;
       
   292         
       
   293     /**
       
   294      * Visual for an icon.
       
   295      */
       
   296     CAlfImageVisual* iFourthLineIconVis;
       
   297     
       
   298     };
       
   299 
       
   300 #endif //C_FSMULTILINEITEMVISUALIZER_H