menufw/menufwui/mmwidgets/inc/mmlistboxview.h
branchRCL_3
changeset 34 5456b4e8b3a8
child 35 3321d3e205b6
equal deleted inserted replaced
33:5f0182e07bfb 34:5456b4e8b3a8
       
     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:
       
    15 *  Version     : %version: MM_12.1.9 % << Don't touch! Updated by Synergy at check-out.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef MMLISTBOXVIEW_H
       
    21 #define MMLISTBOXVIEW_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <eikfrlb.h>
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31  *  Multimedia Menu Listbox view.
       
    32  *
       
    33  *  @code
       
    34  *  @endcode
       
    35  *  @lib mmwidgets
       
    36  *  @since S60 v3.0
       
    37  *  @ingroup group_mmwidgets
       
    38  */
       
    39 NONSHARABLE_CLASS( CMmListBoxView ) : public CFormattedCellListBoxView
       
    40     {
       
    41 public:
       
    42     // Constructors and destructor
       
    43 
       
    44     /**
       
    45      * Destructor.
       
    46      */
       
    47     ~CMmListBoxView();
       
    48 
       
    49     /**
       
    50      * Two-phased constructor.
       
    51      */
       
    52     static CMmListBoxView* NewL();
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      */
       
    57     static CMmListBoxView* NewLC();
       
    58 
       
    59   /**
       
    60    * Calculate the bottom item index.
       
    61    *
       
    62    * @since S60 v3.0
       
    63    */
       
    64     void CalcBottomItemIndex();
       
    65 
       
    66   /**
       
    67    * Draw the view.
       
    68    *
       
    69    * @since S60 v3.0
       
    70    * @param clipRect Clipping rectangle.
       
    71    */
       
    72     void Draw(const TRect* clipRect) const;
       
    73 
       
    74   /**
       
    75    * Draws the listbox within the given clipping rect.
       
    76    *
       
    77    * @since S60 v3.0
       
    78    * @param clipRect Clipping rectangle.
       
    79    */
       
    80     void DoDraw(const TRect* aClipRect) const;
       
    81 
       
    82   /**
       
    83    * Draw item in view. It is possible that it
       
    84    * calls drawing of more than one item.
       
    85    *
       
    86    * @since S60 v3.0
       
    87    * @param aItemIndex Item index.
       
    88    */
       
    89     void DrawItem(TInt aItemIndex) const;
       
    90 
       
    91   /**
       
    92    * Draw a single item in view.
       
    93    *
       
    94    * @since S60 v3.0
       
    95    * @param aItemIndex Item index.
       
    96    */
       
    97     void DrawSingleItem (TInt aItemIndex) const;
       
    98 
       
    99   /**
       
   100    * Sets aItemIndex to the index of the item whose bounding box contains aPosition.
       
   101    *
       
   102    * @since S60 v3.0
       
   103    * @param aPosition Item position.
       
   104    * @param aItemIndex Item index.
       
   105    * @return Was item found.
       
   106    */
       
   107     TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
       
   108 
       
   109   /**
       
   110    * Gets item position.
       
   111    *
       
   112    * @since S60 v3.0
       
   113    * @param aItemIndex Item index.
       
   114    * @return Item position.
       
   115    */
       
   116     TPoint ItemPos(TInt aItemIndex) const;
       
   117 
       
   118   /**
       
   119    * Sets item height.
       
   120    *
       
   121    * @since S60 v3.0
       
   122    * @param aItemHeight Item height.
       
   123    */
       
   124     void SetItemHeight(TInt aItemHeight);
       
   125 
       
   126   /**
       
   127    * Calculates new top item index so item is visible.
       
   128    *
       
   129    * @since S60 v3.0
       
   130    * @param aItemIndex Item to be visible.
       
   131    * @return New top item index.
       
   132    */
       
   133     TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const;
       
   134 
       
   135   /**
       
   136    * Draw background between rects.
       
   137    *
       
   138    * @since S60 v3.0
       
   139    * @param aUsedPortionOfViewRect Inner rect.
       
   140    * @param aSmallerViewRect Outer rect.
       
   141    */
       
   142     void RedrawBackground( TRect aUsedPortionOfViewRect, TRect aSmallerViewRect) const;
       
   143 
       
   144   /**
       
   145    * Draws background in list which is not covered by vivible items.
       
   146    *
       
   147    * @since S60 v3.0
       
   148    */
       
   149     void RedrawBackground() const;
       
   150 
       
   151   /**
       
   152    * Gets total height of items within range.
       
   153    *
       
   154    * @since S60 v3.0
       
   155    * @param aStartIndex Start item index.
       
   156    * @param aEndIndex End item index.
       
   157    * @return Total height of items starting from aStartIndex, ending with aEndIndex.
       
   158    */
       
   159     TInt GetTotalHeight( TInt aStartIndex, TInt aEndIndex ) const;
       
   160 
       
   161     /**
       
   162      * Gets the current widget vertical item offset.
       
   163      *
       
   164      * @since S60 v5.0
       
   165      * @return The current widget vertical item offset.
       
   166      */
       
   167     TInt VerticalItemOffset() const;
       
   168 
       
   169     /**
       
   170      * Overridden to allow for disabling this method in certain situations.
       
   171      *
       
   172      * @param aItemIndex Item index.
       
   173      */
       
   174     TBool ScrollToMakeItemVisible(TInt aItemIndex);
       
   175 
       
   176     /**
       
   177      * Disables ScrollToMakeItemVisible.
       
   178      * When disabled, ScrollToMakeItemVisible does nothing.
       
   179      *
       
   180      * @param aDisable Self-explanatory.
       
   181      */
       
   182     void DisableScrollToItem( TBool aDisable );
       
   183 
       
   184     /**
       
   185      * Gets number of items in model.
       
   186      *
       
   187      * @return
       
   188      */
       
   189     TInt ModelItemsCount();
       
   190 
       
   191 private:
       
   192 
       
   193     /**
       
   194      * Constructor for performing 1st stage construction.
       
   195      */
       
   196     CMmListBoxView();
       
   197 
       
   198     /**
       
   199      * Default symbian 2nd stage constructor.
       
   200      */
       
   201     void ConstructL();
       
   202 
       
   203   /**
       
   204    * Updates average item height.
       
   205    *
       
   206    * @since S60 v3.0
       
   207    */
       
   208      void UpdateAverageItemHeight();
       
   209 
       
   210   /**
       
   211    * Gets last item index depending on height.
       
   212    *
       
   213    * @since S60 v3.0
       
   214    * @param aStartIndex Start item index.
       
   215    * @param aHeight Height of area.
       
   216    * @return Last item index.
       
   217    */
       
   218     TInt GetLastIndexInHeight( const TInt aStartIndex, TInt aHeight ) const;
       
   219 
       
   220   /**
       
   221    * Sets the previously drawn current item index.
       
   222    *
       
   223    * @since S60 v3.0
       
   224    * @param aIndex Current Item index.
       
   225    */
       
   226     void SetPreviouslyDrawnCurrentItemIndex( TBool aIndex );
       
   227 
       
   228 private:
       
   229 
       
   230   /**
       
   231    * iCurrentItemIndex
       
   232    */
       
   233   TInt iPreviouslyDrawnCurrentItemIndex;
       
   234 
       
   235   /**
       
   236    * When ETrue, disables ScrollToMakeItemVisible method.
       
   237    */
       
   238   TBool iScrollToItemDisabled;
       
   239     };
       
   240 
       
   241 #endif // MMLISTBOXVIEW_H