menufw/menufwui/mmwidgets/inc/mmlistboxitemdrawer.h
branchRCL_3
changeset 16 9674c1a575e9
parent 4 4d54b72983ae
child 38 79311d856354
equal deleted inserted replaced
15:ff572dfe6d86 16:9674c1a575e9
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  CMmListBoxItemDrawer
    14 * Description:  CMmListBoxItemDrawer
    15 *  Version     : %version: MM_38.1.15 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_38.1.16 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #ifndef C_MMLISTBOXITEMDRAWER_H
    20 #ifndef C_MMLISTBOXITEMDRAWER_H
    92      * Destructor.
    92      * Destructor.
    93      *
    93      *
    94      * @since S60 v3.0
    94      * @since S60 v3.0
    95      */
    95      */
    96     ~CMmListBoxItemDrawer();
    96     ~CMmListBoxItemDrawer();
    97     
    97 
    98     /**
    98     /**
    99      * Enables/disables cached data use.
    99      * Enables/disables cached data use.
   100      * 
   100      *
   101      * When aEnable is true:
   101      * When aEnable is true:
   102      * Enables the use of cached data when drawing items.
   102      * Enables the use of cached data when drawing items.
   103      * This significantly improves performance.
   103      * This significantly improves performance.
   104      * Do not ever try to use this feature in edit mode.
   104      * Do not ever try to use this feature in edit mode.
   105      * 
   105      *
   106      * When aEnable is false:
   106      * When aEnable is false:
   107      * Restores the normal mode where data needed for drawing
   107      * Restores the normal mode where data needed for drawing
   108      * items is retrieved from the model and the cached data
   108      * items is retrieved from the model and the cached data
   109      * is updated with the information retrieved from the model
   109      * is updated with the information retrieved from the model
   110      * 
   110      *
   111      * @param aEnable Self-explanatory.
   111      * @param aEnable Self-explanatory.
   112      */
   112      */
   113     void EnableCachedDataUse( TBool aEnable );
   113     void EnableCachedDataUse( TBool aEnable );
   114     
   114 
   115     /**
   115     /**
   116      * Returns ETrue if item drawer is using cached data.
   116      * Returns ETrue if item drawer is using cached data.
   117      * To start/stop using cached data, use the @c EnableCachedDataUse
   117      * To start/stop using cached data, use the @c EnableCachedDataUse
   118      * method.
   118      * method.
   119      * 
   119      *
   120      * @return ETrue if cached data is used, EFalse otherwise.
   120      * @return ETrue if cached data is used, EFalse otherwise.
   121      */
   121      */
   122     TBool CachedDataUseIsEnabled() const;
   122     TBool CachedDataUseIsEnabled() const;
   123     
   123 
   124     /**
   124     /**
   125      * This method should be called whenever items(s) are removed
   125      * This method should be called whenever items(s) are removed
   126      * in order to remove corresponding entries in the local
   126      * in order to remove corresponding entries in the local
   127      * items data cache.
   127      * items data cache.
   128      * 
   128      *
   129      * @param aItemCount current item count
   129      * @param aItemCount current item count
   130      */
   130      */
   131     void TrimCacheSize( TInt aItemCount );
   131     void TrimCacheSize( TInt aItemCount );
   132     
   132 
   133     /**
   133     /**
   134      * Invalidates the cached data for all items.
   134      * Invalidates the cached data for all items.
   135      */
   135      */
   136     void InvalidateCache();
   136     void InvalidateCache();
   137 
   137 
   152      * @param aItemIndex Item index.
   152      * @param aItemIndex Item index.
   153      * @param aItemIsCurrent Is item the current widget item.
   153      * @param aItemIsCurrent Is item the current widget item.
   154      * @return Size of item.
   154      * @return Size of item.
   155      */
   155      */
   156     TSize GetItemSize( TInt aItemIndex, TBool aItemIsCurrent ) const;
   156     TSize GetItemSize( TInt aItemIndex, TBool aItemIsCurrent ) const;
   157     
   157 
   158     /**
   158     /**
   159      * Gets rect of indicator.
   159      * Gets rect of indicator.
   160      *
   160      *
   161      * @since S60 v3.0
   161      * @since S60 v3.0
   162      * @return Rect of indicator.
   162      * @return Rect of indicator.
   370      *
   370      *
   371      * @since S60 5.0
   371      * @since S60 5.0
   372      * @param aPosition Floating item index to be removed.
   372      * @param aPosition Floating item index to be removed.
   373      */
   373      */
   374     void RemoveFloatingItem( TInt aPosition );
   374     void RemoveFloatingItem( TInt aPosition );
   375     
   375 
   376     /**
   376     /**
   377      * Removes all floating items.
   377      * Removes all floating items.
   378      *
   378      *
   379      * @since S60 5.0
   379      * @since S60 5.0
   380      */
   380      */
   381     void RemoveFloatingItems();
   381     void RemoveFloatingItems();
   382     
   382 
   383     /**
   383     /**
   384      * Gets floating item at particular index in the
   384      * Gets floating item at particular index in the
   385      * floating item array.
   385      * floating item array.
   386      *
   386      *
   387      * @since S60 5.0
   387      * @since S60 5.0
   467 	 * @since S60 v3.0
   467 	 * @since S60 v3.0
   468 	 * @param aDrawn Should highlight and move indicators be drawn.
   468 	 * @param aDrawn Should highlight and move indicators be drawn.
   469 	 */
   469 	 */
   470 	void SetHighlightShown( TBool aDrawn );
   470 	void SetHighlightShown( TBool aDrawn );
   471 
   471 
       
   472     /**
       
   473      * Draws background and separator lines.
       
   474      *
       
   475      * @since S60 v3.0
       
   476      * @param aItemTextRect Item rectangle.
       
   477      */
       
   478     void DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const;
       
   479 
   472 protected:
   480 protected:
   473     /**
   481     /**
   474      * From CListItemDrawer. Draws an item.
   482      * From CListItemDrawer. Draws an item.
   475      *
   483      *
   476      * @since S60 v3.0
   484      * @since S60 v3.0
   497      */
   505      */
   498     void DrawItemText( TInt aItemIndex, const TRect& aItemTextRect,
   506     void DrawItemText( TInt aItemIndex, const TRect& aItemTextRect,
   499     		TBool aItemIsCurrent, TBool aViewIsEmphasized,
   507     		TBool aItemIsCurrent, TBool aViewIsEmphasized,
   500     		TBool aItemIsSelected ) const;
   508     		TBool aItemIsSelected ) const;
   501     /**
   509     /**
   502      * Draws the actual item contents for the specified item in the specified 
   510      * Draws the actual item contents for the specified item in the specified
   503      * rectangle.
   511      * rectangle.
   504      *
   512      *
   505      * @param aItemIndex Index of the item to draw. 
   513      * @param aItemIndex Index of the item to draw.
   506      * @param aActualItemRect Area to draw into. 
   514      * @param aActualItemRect Area to draw into.
   507      * @param aItemIsCurrent @c ETrue if the item is current. 
   515      * @param aItemIsCurrent @c ETrue if the item is current.
   508      * @param aViewIsEmphasized @c ETrue if the view is emphasised. 
   516      * @param aViewIsEmphasized @c ETrue if the view is emphasised.
   509      * @param aViewIsDimmed Ignored
   517      * @param aViewIsDimmed Ignored
   510      * @param aItemIsSelected @c ETrue if the item is selected.
   518      * @param aItemIsSelected @c ETrue if the item is selected.
   511      */
   519      */
   512     void DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect,
   520     void DrawActualItem(TInt aItemIndex, const TRect& aActualItemRect,
   513 			TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed,
   521 			TBool aItemIsCurrent, TBool aViewIsEmphasized, TBool aViewIsDimmed,
   514 			TBool aItemIsSelected) const;
   522 			TBool aItemIsSelected) const;
   515     /**
       
   516      * Draws background and separator lines.
       
   517      *
       
   518      * @since S60 v3.0
       
   519      * @param aItemTextRect Item rectangle.
       
   520      */
       
   521     void DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const;
       
   522 
   523 
   523     /**
   524     /**
   524      * Sets up item currently drawn item subcells.
   525      * Sets up item currently drawn item subcells.
   525      * Also, fills-in/updates the cache information for the item at index
   526      * Also, fills-in/updates the cache information for the item at index
   526      * aItemIndex.
   527      * aItemIndex.
   665      * @param aSubcellIncrement Is incremented if backdrop subcell template is appended.
   666      * @param aSubcellIncrement Is incremented if backdrop subcell template is appended.
   666      */
   667      */
   667     void SetupIconSubcellL(
   668     void SetupIconSubcellL(
   668     		RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex, TInt aItemIndex,
   669     		RArray<TTemplateChild>& aTemplateChildArray, TInt aChildIndex, TInt aItemIndex,
   669     		RBuf& aItemText, TInt& aSubcellIncrement ) const;
   670     		RBuf& aItemText, TInt& aSubcellIncrement ) const;
   670     
   671 
   671     /**
   672     /**
   672      * Determines whether a bitmap of given size needs scaling to be displayed
   673      * Determines whether a bitmap of given size needs scaling to be displayed
   673      * in a rectangular area of some given target size.
   674      * in a rectangular area of some given target size.
   674      * 
   675      *
   675      * This method assumes that the bitmap will always be scaled with aspect
   676      * This method assumes that the bitmap will always be scaled with aspect
   676      * ratio preserved. A bitmap does not need scaling if its size meets either
   677      * ratio preserved. A bitmap does not need scaling if its size meets either
   677      * of the two conditions:
   678      * of the two conditions:
   678      * 1. bitmap width is nearly the same* as target area width and bitmap height
   679      * 1. bitmap width is nearly the same* as target area width and bitmap height
   679      *    is not greater than target height
   680      *    is not greater than target height
   681      *    nearly the same* as target height.
   682      *    nearly the same* as target height.
   682      * * nearly the same means that it is exactly the same or differs by at most
   683      * * nearly the same means that it is exactly the same or differs by at most
   683      * 1 pixel.
   684      * 1 pixel.
   684      * Please note that a bitmap which is too small (i.e. neither its width or its
   685      * Please note that a bitmap which is too small (i.e. neither its width or its
   685      * height is close to the target width/height) will be regarded as one that
   686      * height is close to the target width/height) will be regarded as one that
   686      * needs scaling. 
   687      * needs scaling.
   687      * 
   688      *
   688      * @param aBmpSize size of the bitmap
   689      * @param aBmpSize size of the bitmap
   689      * @param aTargetSize size of the area where bitmap will be displayed
   690      * @param aTargetSize size of the area where bitmap will be displayed
   690      * @return ETrue if bitmap does not need scaling
   691      * @return ETrue if bitmap does not need scaling
   691      */
   692      */
   692     TBool BitmapFitsIntoTarget( TSize aBmpSize, TSize aTargetSize ) const;
   693     TBool BitmapFitsIntoTarget( TSize aBmpSize, TSize aTargetSize ) const;
   726     /**
   727     /**
   727      * Returns highlight visibility.
   728      * Returns highlight visibility.
   728      *
   729      *
   729      * @param aItemIndex An index of a currently drawn item.
   730      * @param aItemIndex An index of a currently drawn item.
   730      * @param aItemIsCurrent Is aItemIndex the current item index.
   731      * @param aItemIsCurrent Is aItemIndex the current item index.
   731      * @param aAllowHighlightForNonDraggedItem Should highlight be shown 
   732      * @param aAllowHighlightForNonDraggedItem Should highlight be shown
   732      * 	(set in case when effects are used).
   733      * 	(set in case when effects are used).
   733      * @return ETrue if highlight is drawn for the actually drawn item.
   734      * @return ETrue if highlight is drawn for the actually drawn item.
   734      */
   735      */
   735     TBool GetHighlightVisibility(  TInt aItemIndex, 
   736     TBool GetHighlightVisibility(  TInt aItemIndex,
   736     		TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem  ) const;
   737     		TBool aItemIsCurrent, TBool aAllowHighlightForNonDraggedItem  ) const;
   737     
   738 
   738     /**
   739     /**
   739      * Returns backdrop visibility.
   740      * Returns backdrop visibility.
   740      *
   741      *
   741      * @param aItemIndex An index of a currently drawn item.
   742      * @param aItemIndex An index of a currently drawn item.
   742      * @param aItemIsCurrent Is aItemIndex the current item index.
   743      * @param aItemIsCurrent Is aItemIndex the current item index.
   884     /**
   885     /**
   885      * Template library. Stores template attributes.
   886      * Template library. Stores template attributes.
   886      * Not own.
   887      * Not own.
   887      */
   888      */
   888     CMmTemplateLibrary* iTemplateLibrary;
   889     CMmTemplateLibrary* iTemplateLibrary;
   889     
   890 
   890     /**
   891     /**
   891      * Storage for cached items data. The data is updated during normal operation
   892      * Storage for cached items data. The data is updated during normal operation
   892      * and used when iUseCache is ETrue.
   893      * and used when iUseCache is ETrue.
   893      * Own.
   894      * Own.
   894      */
   895      */
   903 
   904 
   904     /**
   905     /**
   905      * Stores information on the last used subcells configuration.
   906      * Stores information on the last used subcells configuration.
   906      * Such information is needed to determine whether it is necessary to
   907      * Such information is needed to determine whether it is necessary to
   907      * setup subcells before drawing a particular item or is it possible
   908      * setup subcells before drawing a particular item or is it possible
   908      * to skip this step because the subcells are already set properly.  
   909      * to skip this step because the subcells are already set properly.
   909      */
   910      */
   910     mutable TMmSubcellsSetupCode iLastSubcellsSetupCode;
   911     mutable TMmSubcellsSetupCode iLastSubcellsSetupCode;
   911 
   912 
   912     /**
   913     /**
   913      * Set to ETrue if item has backdrop.
   914      * Set to ETrue if item has backdrop.
   914      */
   915      */
   915     mutable TBool iItemHasBackdrop;
   916     mutable TBool iItemHasBackdrop;
   916     
   917 
   917     /**
   918     /**
   918      * Number of subcells in iData.
   919      * Number of subcells in iData.
   919      */
   920      */
   920     mutable TInt iCurrentNumberOfSubcellsSet;
   921     mutable TInt iCurrentNumberOfSubcellsSet;
   921     
   922 
   922     /**
   923     /**
   923      * A structure that stores color information needed to draw an item.
   924      * A structure that stores color information needed to draw an item.
   924      */
   925      */
   925     mutable CFormattedCellListBoxData::TColors iColors;
   926     mutable CFormattedCellListBoxData::TColors iColors;
   926     
   927 
   927     /**
   928     /**
   928      * ETrue if the item that was last drawn was a floating item.
   929      * ETrue if the item that was last drawn was a floating item.
   929      */
   930      */
   930     mutable TBool iLastDrawnItemWasFloating;
   931     mutable TBool iLastDrawnItemWasFloating;
   931 
   932