menufw/menufwui/mmwidgets/inc/mmgridview.h
branchRCL_3
changeset 12 9674c1a575e9
parent 5 c743ef5928ba
child 26 1b758917cafc
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  CMmGridView declaration
    14 * Description:  CMmGridView declaration
    15 *  Version     : %version: MM_24.1.9 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_24.1.10 % << Don't touch! Updated by Synergy at check-out.
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #ifndef C_MMGRIDVIEW_H
    20 #ifndef C_MMGRIDVIEW_H
    21 #define C_MMGRIDVIEW_H
    21 #define C_MMGRIDVIEW_H
    22 
    22 
    23 #include <e32std.h>
    23 #include <e32std.h>
    24 #include <e32base.h>
    24 #include <e32base.h>
    25 #include <AknGridView.h> 
    25 #include <AknGridView.h>
    26 
    26 
    27 /**
    27 /**
    28  *  Multimedia Menu Grid View.
    28  *  Multimedia Menu Grid View.
    29  *
    29  *
    30  *  @code
    30  *  @code
    36 NONSHARABLE_CLASS( CMmGridView ) : public CAknGridView
    36 NONSHARABLE_CLASS( CMmGridView ) : public CAknGridView
    37     {
    37     {
    38 public:
    38 public:
    39     /**
    39     /**
    40      * Two-phased constructor.
    40      * Two-phased constructor.
    41      * 
    41      *
    42      * @since S60 v3.0
    42      * @since S60 v3.0
    43      */
    43      */
    44     static CMmGridView* NewL();
    44     static CMmGridView* NewL();
    45     
    45 
    46     /**
    46     /**
    47      * Two-phased constructor.
    47      * Two-phased constructor.
    48      * 
    48      *
    49      * @since S60 v3.0
    49      * @since S60 v3.0
    50      */
    50      */
    51     static CMmGridView* NewLC();
    51     static CMmGridView* NewLC();
    52 
    52 
    53     /**
    53     /**
    54      * Destructor.
    54      * Destructor.
    55      * 
    55      *
    56      * @since S60 v3.0
    56      * @since S60 v3.0
    57      */
    57      */
    58     virtual ~CMmGridView();
    58     virtual ~CMmGridView();
    59     
    59 
    60     /**
    60     /**
    61      * Draws the grid within the given clipping rectangle.
    61      * Draws the grid within the given clipping rectangle.
    62      *
    62      *
    63      * @since S60 v3.0
    63      * @since S60 v3.0
    64      * @param aClipRect Clipping rectangle.
    64      * @param aClipRect Clipping rectangle.
    65      */
    65      */
    66 	void Draw( const TRect* aClipRect ) const;
    66 	void Draw( const TRect* aClipRect ) const;
    67 	
    67 
    68 	/**
    68 	/**
    69      * Gets item position.
    69      * Gets item position.
    70      * 
    70      *
    71      * This fuction from @c CAknGridView is overridden so that it
    71      * This fuction from @c CAknGridView is overridden so that it
    72      * returns 'mirrored' item positions when mirrored layout is
    72      * returns 'mirrored' item positions when mirrored layout is
    73      * used. 
    73      * used.
    74      * 
    74      *
    75      * @since S60 v3.0
    75      * @since S60 v3.0
    76      * @param aItemIndex Item index.
    76      * @param aItemIndex Item index.
    77      * @return Item position.
    77      * @return Item position.
    78      */
    78      */
    79     TPoint ItemPos( TInt aItemIndex ) const;
    79     TPoint ItemPos( TInt aItemIndex ) const;
    80     
    80 
    81     /**
    81     /**
    82      * Converts an (x, y) pixel position to an item index.
    82      * Converts an (x, y) pixel position to an item index.
    83      * 
    83      *
    84      * This fuction from @c CAknGridView has been overridden in order
    84      * This fuction from @c CAknGridView has been overridden in order
    85      * to make it work properly when mirrored layout is used.
    85      * to make it work properly when mirrored layout is used.
    86      * 
    86      *
    87      * @param aPosition Pixel position in the viewing rectangle.
    87      * @param aPosition Pixel position in the viewing rectangle.
    88      * @param aItemIndex Reference to the item index.
    88      * @param aItemIndex Reference to the item index.
    89      * @return Whether there was an item at aPosition.
    89      * @return Whether there was an item at aPosition.
    90      */  
    90      */
    91     TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
    91     TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
    92 	
    92 
    93 	/**
    93 	/**
    94 	 * Returns this view's gc.
    94 	 * Returns this view's gc.
    95 	 * 
    95 	 *
    96 	 * @return pointer to gc
    96 	 * @return pointer to gc
    97 	 */
    97 	 */
    98 	CWindowGc* Gc();
    98 	CWindowGc* Gc();
    99 	
    99 
   100     /**
   100     /**
   101      * @see CAknGridView::UpdateSelectionL
   101      * @see CAknGridView::UpdateSelectionL
   102      * 
   102      *
   103      * This method of CAknGridView is overriden to so that
   103      * This method of CAknGridView is overriden to so that
   104      * correct effects are displayed when moving highlight with 
   104      * correct effects are displayed when moving highlight with
   105      * rocker key in mirrored layout.
   105      * rocker key in mirrored layout.
   106      * Please note that it is necessary because of the hackish
   106      * Please note that it is necessary because of the hackish
   107      * solution used to draw items in mirrored layout.
   107      * solution used to draw items in mirrored layout.
   108      */
   108      */
   109     void UpdateSelectionL( TSelectionMode aSelectionMode );
   109     void UpdateSelectionL( TSelectionMode aSelectionMode );
   110 
   110 
   111 	/**
   111 	/**
   112 	 * @see CAknGridView::MoveCursorL
   112 	 * @see CAknGridView::MoveCursorL
   113 	 * 
   113 	 *
   114 	 * This method of CAknGridView is overriden to so that
   114 	 * This method of CAknGridView is overriden to so that
   115 	 * correct effects are displayed when moving highlight with 
   115 	 * correct effects are displayed when moving highlight with
   116 	 * rocker key in mirrored layout.
   116 	 * rocker key in mirrored layout.
   117      * Please note that it is necessary because of the hackish
   117      * Please note that it is necessary because of the hackish
   118      * solution used to draw items in mirrored layout.
   118      * solution used to draw items in mirrored layout.
   119 	 */
   119 	 */
   120     void MoveCursorL( TCursorMovement aCursorMovement,
   120     void MoveCursorL( TCursorMovement aCursorMovement,
   121             TSelectionMode aSelectionMode );
   121             TSelectionMode aSelectionMode );
   122 
   122 
   123     /**
   123     /**
   124      * Gets the current widget vertical item offset.
   124      * Gets the current widget vertical item offset.
   125      * 
   125      *
   126      * @since S60 v5.0
   126      * @since S60 v5.0
   127      * @return The current widget vertical item offset.
   127      * @return The current widget vertical item offset.
   128      */
   128      */
   129     TInt VerticalItemOffset() const;
   129     TInt VerticalItemOffset() const;
   130     
   130 
   131 	/**
   131 	/**
   132 	* This function sets item height in pixels.
   132 	* This function sets item height in pixels.
   133 	* @param aItemHeight New height in pixels for this view’s items.
   133 	* @param aItemHeight New height in pixels for this view’s items.
   134 	*/	
   134 	*/
   135     void SetItemHeight(TInt aItemHeight);
   135     void SetItemHeight(TInt aItemHeight);
   136     
   136 
   137     /**
   137     /**
   138      * Updates various member variables in this grid view and related objects
   138      * Updates various member variables in this grid view and related objects
   139      * with item dimensions taken from the template library.
   139      * with item dimensions taken from the template library.
   140      */
   140      */
   141     void UpdateItemHeightAndWidth();
   141     void UpdateItemHeightAndWidth();
   142 
   142 
   143 private:
   143 private:
   144 	
   144 
   145     /**
   145     /**
   146      * Default constructor.
   146      * Default constructor.
   147      * 
   147      *
   148      * @since S60 v3.0 
   148      * @since S60 v3.0
   149      */
   149      */
   150     CMmGridView();
   150     CMmGridView();
   151 
   151 
   152     /**
   152     /**
   153      * 2nd phase constructor.
   153      * 2nd phase constructor.
   154      * 
   154      *
   155      * @since S60 v3.0 
   155      * @since S60 v3.0
   156      */
   156      */
   157     void ConstructL();
   157     void ConstructL();
   158     
   158 
   159     /**
   159     /**
   160      * Draws the grid within the given clipping rectangle.
   160      * Draws the grid within the given clipping rectangle.
   161      *
   161      *
   162      * @since S60 v3.0
   162      * @since S60 v3.0
   163      * @param aClipRect Clipping rectangle.
   163      * @param aClipRect Clipping rectangle.
   164      */
   164      */
   165     void DoDraw( const TRect* aClipRect ) const;
   165     void DoDraw( const TRect* aClipRect ) const;
   166     
   166 
   167     /**
   167     /**
   168      * Gets item position.
   168      * Gets item position.
   169      * 
   169      *
   170      * AVKON implementation of ItemPos method does not always work properly.
   170      * AVKON implementation of ItemPos method does not always work properly.
   171      * It fails when:
   171      * It fails when:
   172      *   aItemIndex < TopItemIndex() - NumberOfColsInView()
   172      *   aItemIndex < TopItemIndex() - NumberOfColsInView()
   173      * Because of that problem this method was created. It is now used in
   173      * Because of that problem this method was created. It is now used in
   174      * CMmGridView::ItemPos in place where base class (AVKON) implementation
   174      * CMmGridView::ItemPos in place where base class (AVKON) implementation
   175      * was used previously.
   175      * was used previously.
   176      * 
   176      *
   177      * @param aItemIndex Item index.
   177      * @param aItemIndex Item index.
   178      * @return Item position.
   178      * @return Item position.
   179      */
   179      */
   180     TPoint CorrectItemPos( TInt aItemIndex ) const;
   180     TPoint CorrectItemPos( TInt aItemIndex ) const;
   181 
   181 
   182 private:
   182 private:
   183 
   183 
   184     /**
   184     /**
   185      * Stores cursor movement flag during CMmGridView::MoveCursorL execution.
   185      * Stores cursor movement flag during CMmGridView::MoveCursorL execution.
   186      * 
   186      *
   187      * When CMmGridView::MoveCursorL is not executing this member variable is
   187      * When CMmGridView::MoveCursorL is not executing this member variable is
   188      * always set to ECursorFirstItem. This is part of the hack that allows
   188      * always set to ECursorFirstItem. This is part of the hack that allows
   189      * for correct effects to be displayed when using rocker key in mirrored
   189      * for correct effects to be displayed when using rocker key in mirrored
   190      * layout.
   190      * layout.
   191      */
   191      */
   192     TCursorMovement iLastCurMove;
   192     TCursorMovement iLastCurMove;
   193     
   193 
   194     /**
   194     /**
   195      * Stores previosly highlighted item index during CMmGridView::MoveCursorL
   195      * Stores previosly highlighted item index during CMmGridView::MoveCursorL
   196      * execution.
   196      * execution.
   197      * 
   197      *
   198      * When CMmGridView::MoveCursorL is not executing this member variable is
   198      * When CMmGridView::MoveCursorL is not executing this member variable is
   199      * always set to KErrNotFound. This is part of the hack that allows
   199      * always set to KErrNotFound. This is part of the hack that allows
   200      * for correct effects to be displayed when using rocker key in mirrored
   200      * for correct effects to be displayed when using rocker key in mirrored
   201      * layout.
   201      * layout.
   202      */
   202      */
   203     TInt iOldIndex;	
   203     TInt iOldIndex;
   204     };
   204     };
   205 
   205 
   206 #endif // C_MMGRIDVIEW_H
   206 #endif // C_MMGRIDVIEW_H