epoc32/include/mw/akngrid.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
parent 1 666f914201fb
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@2
     5
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     6
* which accompanies this distribution, and is available
williamr@2
     7
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  
williamr@2
    15
*     This is a concrete class for the handling of a grid. The class handles a
williamr@2
    16
*     rectangular grid arrangement of items held in any linear ordering i.e 
williamr@2
    17
*     cells ordered top to bottom and left, left to right and down etc.
williamr@2
    18
*
williamr@2
    19
*
williamr@2
    20
*/
williamr@2
    21
williamr@2
    22
williamr@2
    23
#if !defined(__AKNGRID_H__)
williamr@2
    24
#define __AKNGRID_H__
williamr@2
    25
williamr@2
    26
// INCLUDES
williamr@2
    27
#include <eiktxlbx.h>
williamr@2
    28
#include <eiklbv.h>
williamr@2
    29
#include <eikfrlbd.h>
williamr@2
    30
#include <eikfrlb.h>
williamr@2
    31
williamr@2
    32
#include <AknGridM.h>
williamr@2
    33
#include <AknGridView.h>
williamr@2
    34
#include <Aknappui.h>
williamr@2
    35
williamr@2
    36
// CLASS PREDEFINITIONS
williamr@2
    37
class CAknGridExtension;
williamr@2
    38
williamr@2
    39
// CLASS DECLARATION
williamr@2
    40
williamr@2
    41
/**
williamr@2
    42
*  Application grid handling class from Avkon.
williamr@2
    43
*  Provides support for ordering application grids items.
williamr@2
    44
*
williamr@2
    45
*  @since Series 60 0.9
williamr@2
    46
*/
williamr@2
    47
class CAknGrid : public CEikListBox
williamr@2
    48
    {
williamr@2
    49
private:// enums
williamr@2
    50
    enum TIndicatorEvent
williamr@2
    51
        {
williamr@2
    52
        EMove,
williamr@2
    53
        EChangeNumOfItems,
williamr@2
    54
        EResize
williamr@2
    55
        };
williamr@2
    56
public:
williamr@2
    57
williamr@2
    58
    /**
williamr@2
    59
    * Base class default constructor.
williamr@2
    60
    * @return A pointer to a new @c CAknGrid object.
williamr@2
    61
    */
williamr@2
    62
    IMPORT_C CAknGrid();
williamr@2
    63
    
williamr@2
    64
    /**
williamr@2
    65
    * Destructor.
williamr@2
    66
    */
williamr@2
    67
    IMPORT_C virtual ~CAknGrid();
williamr@2
    68
    
williamr@2
    69
    /**
williamr@2
    70
    * This function gives @c CAknGridM class pointer to @c CAknGrid class. 
williamr@2
    71
    * Usually, the @c CAknGridM class object is instantiated automatically 
williamr@2
    72
    * during the construction phase of the @c CAknGrid object. If an 
williamr@2
    73
    * application programmer provides their own grid model class, the 
williamr@2
    74
    * application programmer must instantiate their own grid model class object
williamr@2
    75
    * and give it to the @c CAknGrid object using the @c SetModel function 
williamr@2
    76
    * before calling the @c ConstructL/ConstructFromResourceL function.
williamr@2
    77
    * @param aModel Pointer to @c CAknGridM class.
williamr@2
    78
    */  
williamr@2
    79
    IMPORT_C void SetModel(CAknGridM* aModel);
williamr@2
    80
williamr@2
    81
    /**
williamr@2
    82
    * This is Symbian default constructor. The @c ConstructL function needs to
williamr@2
    83
    * be called in case resource data is not used. If a leave occurs the 
williamr@2
    84
    * framework generates a Symbian Leave code.
williamr@2
    85
    * @param aPatent A CCoeControl pointer.
williamr@2
    86
    * @param aFlags Parameter for @c CEikListBox constructor. If the 
williamr@2
    87
    * parameter is missing default value is 0.
williamr@2
    88
    */  
williamr@2
    89
    IMPORT_C void ConstructL(const CCoeControl* aParent, TInt aFlags = 0);
williamr@2
    90
williamr@2
    91
    /**
williamr@2
    92
    * The @c ConstructFromResourceL function needs to be called in case 
williamr@2
    93
    * resource data is used. Usually, the @c CAknGridM class object is 
williamr@2
    94
    * instantiated automatically during the construction phase of the 
williamr@2
    95
    * @c CAknGrid object. If an application programmer provides their own grid
williamr@2
    96
    * model class, the application programmer must instantiate their own grid 
williamr@2
    97
    * model class object and give it to the @c CAknGrid object using the 
williamr@2
    98
    * @c SetModel function before calling the 
williamr@2
    99
    * @c ConstructL/ConstructFromResourceL function. If a leave occurs the 
williamr@2
   100
    * framework generates a Symbian Leave code.
williamr@2
   101
    * @param aReader Construct controls from resource file.
williamr@2
   102
    */
williamr@2
   103
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   104
williamr@2
   105
    /**
williamr@2
   106
    * Sets the orientation of the grid, either vertical or horizontal, the
williamr@2
   107
    * ordering of the data and the size of the primary dimension of the
williamr@2
   108
    * grid. The value for the parameter @c aNumOfItemsInPrimaryOrient must be
williamr@2
   109
    * greater than zero since this determines the number of items (be it rows
williamr@2
   110
    * or columns) in the primary orientation of the grid. If a leave occurs
williamr@2
   111
    * the framework generates a Symbian Leave code.
williamr@2
   112
    * @param aVerticalOrientation Items vertical orientation.
williamr@2
   113
    * @param aLeftToRight @c ETrue left to right.
williamr@2
   114
    * @param aTopToBottom @c ETrue top to bottom.
williamr@2
   115
    * @param aNumOfItemsInPrimaryOrient Number of items in primary orient.  
williamr@2
   116
    * @param aNumOfItemsInSecondaryOrient Number of items in Secondary orient.
williamr@2
   117
    * @param aSizeOfItems Item size.
williamr@2
   118
    * @param aWidthOfSpaceBetweenItems =0 Width of space between items.
williamr@2
   119
    * @param aHeightOfSpaceBetweenItems =0 Height of space between items.
williamr@2
   120
    */
williamr@2
   121
    IMPORT_C void SetLayoutL(TBool aVerticalOrientation,
williamr@2
   122
                             TBool aLeftToRight,
williamr@2
   123
                             TBool aTopToBottom,
williamr@2
   124
                             TInt aNumOfItemsInPrimaryOrient,
williamr@2
   125
                             TInt aNumOfItemsInSecondaryOrient,
williamr@2
   126
                             TSize aSizeOfItems,
williamr@2
   127
                             TInt aWidthOfSpaceBetweenItems=0,
williamr@2
   128
                             TInt aHeightOfSpaceBetweenItems=0);
williamr@2
   129
williamr@2
   130
    /**
williamr@2
   131
    * Sets the layout from a resource. Layout includes orientation (either
williamr@2
   132
    * vertical or horizontal), horizontal and vertical direction of numbering,
williamr@2
   133
    * the number of items in the primary and secondary orientation, and the 
williamr@2
   134
    * primary and secondary scrolling types. If a leave occurs the framework 
williamr@2
   135
    * generates a Symbian Leave code.
williamr@2
   136
    * @param aReader Constructs controls from a resource file. 
williamr@2
   137
    */
williamr@2
   138
    IMPORT_C void SetLayoutFromResourceL(TResourceReader& aReader);
williamr@2
   139
williamr@2
   140
    /**
williamr@2
   141
    * Sets the movement of the cursor with respect to scrolling when the
williamr@2
   142
    * end item in the current row or column, whichever is the primary
williamr@2
   143
    * orientation of the data items, is encountered. The movement maybe
williamr@2
   144
    * either stop, loop back to same row or column or move onto the
williamr@2
   145
    * next logical data item in the sequence.
williamr@2
   146
    * @param aScrollingType Items scrolling type enum definition.
williamr@2
   147
    */
williamr@2
   148
    IMPORT_C void SetPrimaryScrollingType(CAknGridView::TScrollingType aScrollingType);
williamr@2
   149
    
williamr@2
   150
    /** 
williamr@2
   151
    * Sets the movement of the cursor with respect to scrolling when the
williamr@2
   152
    * end item in the secondary dimension of the grid is encountered.
williamr@2
   153
    * The movement maybe either stop, loop back back to same row or column
williamr@2
   154
    * or move onto the next logical data item in the sequence.
williamr@2
   155
    * @param aSecondaryScrolling Secondary scrolling type enum definition.
williamr@2
   156
    */
williamr@2
   157
    IMPORT_C void SetSecondaryScrollingType(CAknGridView::TScrollingType aSecondaryScrolling);
williamr@2
   158
williamr@2
   159
    /**
williamr@2
   160
    * Sets the starting position of the data within the grid. A blank page 
williamr@2
   161
    * cannot be accessed (since cannot move into empty cells) so  a totally 
williamr@2
   162
    * blank page is the same as if the page never existed since the user 
williamr@2
   163
    * cannot scroll into it. For this reason it is suggested that the start
williamr@2
   164
    * position be no more than one page into the grid. If a leave occurs 
williamr@2
   165
    * the framework generates a Symbian Leave code.
williamr@2
   166
    * @param aGridStartPosition Parameter manipulate the grid's starting 
williamr@2
   167
    * position.
williamr@2
   168
    */
williamr@2
   169
    IMPORT_C void SetStartPositionL(TPoint aGridStartPosition);
williamr@2
   170
williamr@2
   171
    /**
williamr@2
   172
    * @c CurrentDataIndex retrieves the index of the selection. In grids, you 
williamr@2
   173
    * should use this method instead of @c CEikListBox::CurrentItemIndex(), 
williamr@2
   174
    * when you are manipulating data stored in the grid's @c ItemTextArray. 
williamr@2
   175
    * While @c CurrentItemIndex() returns the same value as 
williamr@2
   176
    * @c CurrentItemIndex() on most phones, there will be difference in some 
williamr@2
   177
    * language variants where text reading/writing direction is different from 
williamr@2
   178
    * left-to-right.
williamr@2
   179
    * @return A current position of highlight.
williamr@2
   180
    */
williamr@2
   181
    IMPORT_C TInt CurrentDataIndex() const;
williamr@2
   182
    
williamr@2
   183
    /**
williamr@2
   184
    * Moves the cursor to the required grid data index.
williamr@2
   185
    * @param aDataIndex Data index value.
williamr@2
   186
    */
williamr@2
   187
    IMPORT_C void SetCurrentDataIndex(TInt aDataIndex);
williamr@2
   188
williamr@2
   189
    /**
williamr@2
   190
    * The grid position function. Gives the data index by using grid's 
williamr@2
   191
    * position. The position must be given from the top left corner. If 
williamr@2
   192
    * the function returns -1 the item's position is invalid.
williamr@2
   193
    * @param aGridPosition The data item's co-ordinate values. 
williamr@2
   194
    * @return Activated item's index value.
williamr@2
   195
    */
williamr@2
   196
    IMPORT_C TInt IndexOfPosition(TPoint aGridPosition) const;
williamr@2
   197
    
williamr@2
   198
    /**
williamr@2
   199
    * The grid position function. Gives the data item's co-ordinate values 
williamr@2
   200
    * by using item's index value.
williamr@2
   201
    * @param aItemIndex The data item's index value.   
williamr@2
   202
    * @return @c TPoint co-ordinate values of active item.
williamr@2
   203
    */
williamr@2
   204
    IMPORT_C TPoint PositionAtIndex(TInt aItemIndex) const;
williamr@2
   205
williamr@2
   206
    /**
williamr@2
   207
    * Item drawer. Gets the pointer to the grid class.
williamr@2
   208
    * @return A pointer to @c CFormattedCellListBoxItemDrawer object.
williamr@2
   209
    */
williamr@2
   210
    IMPORT_C CFormattedCellListBoxItemDrawer* ItemDrawer() const;
williamr@2
   211
williamr@2
   212
    /**
williamr@2
   213
    * Function sets a grid text to the data item. If a leave occurs the 
williamr@2
   214
    * framework generates a Symbian Leave code.
williamr@2
   215
    * @since Series S60 3.0
williamr@2
   216
    * @param aText Descriptor parameter.
williamr@2
   217
    */
williamr@2
   218
    IMPORT_C void SetEmptyGridTextL(const TDesC& aText);
williamr@2
   219
    
williamr@2
   220
    /**
williamr@2
   221
    * This function sets the empty grid text.
williamr@2
   222
    * @return A pointer to the grid text descriptor.
williamr@2
   223
    */
williamr@2
   224
    inline const TDesC* EmptyGridText() const;
williamr@2
   225
williamr@2
   226
public:
williamr@2
   227
williamr@2
   228
    /**
williamr@2
   229
    * This function creates a new object and returns pointer to it. If the 
williamr@2
   230
    * leave occurs the framework generates a Symbian Leave code.
williamr@2
   231
    * @return A pointer to @c CListBoxView class.
williamr@2
   232
    */
williamr@2
   233
    IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
williamr@2
   234
williamr@2
   235
    /**
williamr@2
   236
    * This function sets the column width of the grid. Column width cannot be 
williamr@2
   237
    * set in a horizontal grid since the number of columns in the grid is 
williamr@2
   238
    * defined by the initialising call to @c SetLayoutL. The column width 
williamr@2
   239
    * cannot be larger than the width of the viewing rectangle.
williamr@2
   240
    * @param aColumnWidth A parameter defines a width of the column.
williamr@2
   241
    */
williamr@2
   242
    IMPORT_C void SetColumnWidth(TInt aColumnWidth);
williamr@2
   243
    
williamr@2
   244
    /**
williamr@2
   245
    * This function gives a width of the column.
williamr@2
   246
    * @return A width of the column. 
williamr@2
   247
    */
williamr@2
   248
    IMPORT_C TInt ColumnWidth() const;
williamr@2
   249
williamr@2
   250
public: //from CEikListBox
williamr@2
   251
williamr@2
   252
    /**
williamr@2
   253
    * This function updates the scrollbars, including item position. This 
williamr@2
   254
    * function is called when the size of the scrollbars or data changes. If 
williamr@2
   255
    * the leave occurs the framework generates a Symbian Leave code.
williamr@2
   256
    */
williamr@2
   257
    IMPORT_C virtual void UpdateScrollBarsL();
williamr@2
   258
    
williamr@2
   259
    /**
williamr@2
   260
    * This function should be called after one or more items have been added to
williamr@2
   261
    * the grid. If a leave occurs the framework generates a Symbian Leave 
williamr@2
   262
    * code.
williamr@2
   263
    */  
williamr@2
   264
    IMPORT_C void HandleItemAdditionL();
williamr@2
   265
    
williamr@2
   266
    /**
williamr@2
   267
    * This function should be called after one or more items have been removed 
williamr@2
   268
    * from the grid. If a leave occurs the framework generates a Symbian 
williamr@2
   269
    * Leave code.
williamr@2
   270
    */  
williamr@2
   271
    IMPORT_C void HandleItemRemovalL();
williamr@2
   272
    
williamr@2
   273
    /**
williamr@2
   274
    * This function is from @c CEikAppUi, handles key events. If a leave 
williamr@2
   275
    * occurs the framework generates a Symbian Leave code.
williamr@2
   276
    * @param aKeyEvent Event to handled.
williamr@2
   277
    * @param aType of the key event.
williamr@2
   278
    * @return Response code ( @c EKeyWasConsumed, @c EKeyWasNotConsumed )
williamr@2
   279
    */  
williamr@2
   280
    IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
williamr@2
   281
    
williamr@2
   282
    /**
williamr@2
   283
    * This function sets the row height of the grid. Row height cannot be set
williamr@2
   284
    * in a vertical grid since the number of rows in the grid is defined by 
williamr@2
   285
    * the initialising call to @c SetLayoutL. The row height cannot be larger 
williamr@2
   286
    * than the height of the viewing rectangle. If a leave occurs the 
williamr@2
   287
    * framework generates a Symbian Leave code. 
williamr@2
   288
    * @param aHeight The height of the item's rows.
williamr@2
   289
    */  
williamr@2
   290
    IMPORT_C void SetItemHeightL(TInt aHeight);
williamr@2
   291
    
williamr@2
   292
    /**
williamr@2
   293
    * This function handles size changes. This routine assumes that 
williamr@2
   294
    * @c SetLayoutL has been called to set up the grid.
williamr@2
   295
    */  
williamr@2
   296
    IMPORT_C void SizeChanged();
williamr@2
   297
    
williamr@2
   298
    /**
williamr@2
   299
    * This function creates a new object and returns pointer to 
williamr@2
   300
    * @c CTextListBoxModel class.
williamr@2
   301
    * @return A pointer to @c CTextListBoxModel object.
williamr@2
   302
    */  
williamr@2
   303
    IMPORT_C CTextListBoxModel* Model() const;
williamr@2
   304
        
williamr@2
   305
    /**
williamr@2
   306
    * This function handles viewable rectangle.
williamr@2
   307
    * @param aRect Rectangle parameter. 
williamr@2
   308
    */  
williamr@2
   309
    IMPORT_C void SetRect(const TRect& aRect);
williamr@2
   310
    
williamr@2
   311
    /**
williamr@2
   312
    * This function is called when the grid's items, item's data and scroll 
williamr@2
   313
    * bars has been changed. This implementation ensures that the current 
williamr@2
   314
    * item is visible after resize. If a leave occurs the framework generates
williamr@2
   315
    * a Symbian Leave code.
williamr@2
   316
    */  
williamr@2
   317
    IMPORT_C virtual void HandleViewRectSizeChangeL();
williamr@2
   318
    
williamr@2
   319
    /**
williamr@2
   320
    * This function sets top item index.
williamr@2
   321
    * @param aItemIndex Item index value.
williamr@2
   322
    */  
williamr@2
   323
    IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
williamr@2
   324
    
williamr@2
   325
    /**
williamr@2
   326
    * This function handles resource changes.
williamr@2
   327
    * @since Series S60 2.6.
williamr@2
   328
    * @param aType Message type.
williamr@2
   329
    */  
williamr@2
   330
    IMPORT_C virtual void HandleResourceChange(TInt aType);
williamr@2
   331
    
williamr@2
   332
    /**
williamr@2
   333
    * Indicates whether the control should be redrawn now. If @c ENoDrawNow, 
williamr@2
   334
    * the function has no immediately effect. EDrawNow redraw control 
williamr@2
   335
    * immediately.
williamr@2
   336
    * @since Series S60 3.0.
williamr@2
   337
    */
williamr@2
   338
    IMPORT_C void FocusChanged(TDrawNow aDrawNow);
williamr@2
   339
williamr@2
   340
public: // From CCoeControl
williamr@2
   341
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   342
williamr@2
   343
protected: // from CEikListBox
williamr@2
   344
williamr@2
   345
    /**
williamr@2
   346
    * This function scroll horizontal by one column when the left/right scroll
williamr@2
   347
    * arrows (i.e. the nudge buttons) are tapped.
williamr@2
   348
    * @return A nudge value when the buttons are pressed.
williamr@2
   349
    */
williamr@2
   350
    IMPORT_C virtual TInt HorizontalNudgeValue() const;
williamr@2
   351
    
williamr@2
   352
    /**
williamr@2
   353
    * This function gets the granularity for horizontal scrolls. The 
williamr@2
   354
    * granularity is the minimum size of a horizontal move of the client area.
williamr@2
   355
    * @return A grain size for horizontal scrolling in pixels. 
williamr@2
   356
    */  
williamr@2
   357
    IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
williamr@2
   358
    
williamr@2
   359
    /**
williamr@2
   360
    * This function called by various functions of this class to ensure that
williamr@2
   361
    * the top item index is always a sane value. The implementation in 
williamr@2
   362
    * @c CEikListBox tries to ensure the minimum amount of white space at the 
williamr@2
   363
    * bottom of the list box. Note that this function does not affect the 
williamr@2
   364
    * current item index.
williamr@2
   365
    */  
williamr@2
   366
    IMPORT_C virtual void AdjustTopItemIndex() const;
williamr@2
   367
    
williamr@2
   368
    /** 
williamr@2
   369
    * This function handles drag events. If a leave occurs the framework 
williamr@2
   370
    * generates a Symbian Leave code.
williamr@2
   371
    * @param aPointerPos The position of the @c TPointerEvent for which this 
williamr@2
   372
    * handler is invoked.
williamr@2
   373
    */
williamr@2
   374
    IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
williamr@2
   375
williamr@2
   376
    /** 
williamr@2
   377
    * This function calculates the client area. This method is called by 
williamr@2
   378
    * various functions of this class to recalculate the extent of the client
williamr@2
   379
    * area from @c iViewRect. This implementation takes into account any 
williamr@2
   380
    * rounding of the viewing rectangle made to fit a whole number of items.
williamr@2
   381
    * @param aClientRect On return contains a size for the client area in 
williamr@2
   382
    * pixels. 
williamr@2
   383
    */
williamr@2
   384
    IMPORT_C virtual void RestoreClientRectFromViewRect(TRect& aClientRect) const;
williamr@2
   385
williamr@2
   386
    /** 
williamr@2
   387
    * This function rounds down the height of the rectangle (if necessary) so 
williamr@2
   388
    * that only a whole number of items can be displayed inside the list box.
williamr@2
   389
    * @param aRect Rectangle parameter.
williamr@2
   390
    */
williamr@2
   391
    IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems(TRect& aRect) const;
williamr@2
   392
williamr@2
   393
    /**
williamr@2
   394
    * Updates the position of grids scroll bars’ thumbs to reflect the vertical 
williamr@2
   395
    * position of selector.
williamr@2
   396
    */
williamr@2
   397
    IMPORT_C virtual void UpdateScrollBarThumbs() const;
williamr@2
   398
    
williamr@2
   399
    /**
williamr@2
   400
    * Gets a count of the component controls of this grid.
williamr@2
   401
    * @return The number of component controls.
williamr@2
   402
    */
williamr@2
   403
    IMPORT_C virtual TInt CountComponentControls() const;
williamr@2
   404
williamr@2
   405
protected:
williamr@2
   406
williamr@2
   407
    /**
williamr@2
   408
    * Moves to the next or previous item on the grid. If a leave occurs the 
williamr@2
   409
    * framework generates a Symbian Leave code.
williamr@2
   410
    * @param aPoint Co-ordinate object parameter.
williamr@2
   411
    */
williamr@2
   412
    IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint);
williamr@2
   413
    
williamr@2
   414
    /** 
williamr@2
   415
    * This protected function used by functions to check/alter the dimensions
williamr@2
   416
    * of the grid as data items are added or removed or the size of the items
williamr@2
   417
    * are altered. It also assumes that @c SetLayoutL has been called. 
williamr@2
   418
    * This will not leave if scrollbars have both been turned off. If a leave 
williamr@2
   419
    * occurs the framework generates a Symbian Leave code.
williamr@2
   420
    */
williamr@2
   421
    IMPORT_C virtual void CalcGridSizeL();
williamr@2
   422
    
williamr@2
   423
    /**
williamr@2
   424
    * Creates a formatted list item drawer. If a leave occurs the framework 
williamr@2
   425
    * generates a Symbian Leave code.
williamr@2
   426
    */
williamr@2
   427
    IMPORT_C virtual void CreateItemDrawerL();
williamr@2
   428
williamr@2
   429
private:
williamr@2
   430
    __DECLARE_TEST;
williamr@2
   431
williamr@2
   432
    // grid model helper
williamr@2
   433
    inline CAknGridM* GridModel() const;
williamr@2
   434
williamr@2
   435
    // grid view helper
williamr@2
   436
    inline CAknGridView* GridView() const;
williamr@2
   437
williamr@2
   438
    /**
williamr@2
   439
    * This function sets the size and initial layout of items. If a leave 
williamr@2
   440
    * occurs the framework generates a Symbian Leave code.
williamr@2
   441
    * @param aOrientation
williamr@2
   442
    * @param aHorizontal
williamr@2
   443
    * @param aVertical
williamr@2
   444
    * @param aNumOfItemsInPrimaryOrient
williamr@2
   445
    * @param aNumOfItemsInSecondaryOrient
williamr@2
   446
    * @param aSizeOfItems
williamr@2
   447
    * @param aWidthOfSpaceBetweenItems
williamr@2
   448
    * @param aHeightOfSpaceBetweenItems
williamr@2
   449
    */
williamr@2
   450
    void DoSetLayoutL(TInt aOrientation,
williamr@2
   451
                      TInt aHorizontal,
williamr@2
   452
                      TInt aVertical,
williamr@2
   453
                      TInt aNumOfItemsInPrimaryOrient,
williamr@2
   454
                      TInt aNumOfItemsInSecondaryOrient,
williamr@2
   455
                      TSize aSizeOfItems,
williamr@2
   456
                      TInt aWidthOfSpaceBetweenItems=0,
williamr@2
   457
                      TInt aHeightOfSpaceBetweenItems=0);
williamr@2
   458
williamr@2
   459
private:
williamr@2
   460
    /**
williamr@2
   461
    * From CAknControl
williamr@2
   462
    */
williamr@2
   463
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   464
private: // from MListBoxModel
williamr@2
   465
    IMPORT_C virtual TAny* MListBoxModel_Reserved();
williamr@2
   466
    
williamr@2
   467
protected: 
williamr@2
   468
    /**
williamr@2
   469
    * From @c MEikScrollBarObserver
williamr@2
   470
    *
williamr@2
   471
    * This function handles scroll events caused by scroll bar. 
williamr@2
   472
    * It updates grid's view by event and new thumb position. 
williamr@2
   473
    *
williamr@2
   474
    * @param aScrollBar pointer to scroll bar sent this event
williamr@2
   475
    * @param aEventType type of event
williamr@2
   476
    */
williamr@2
   477
    IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
williamr@2
   478
williamr@2
   479
    /**
williamr@2
   480
    * From @c MObjectProvider.
williamr@2
   481
    *
williamr@2
   482
    * Retrieves an object of the same type as that encapsulated in aId. This 
williamr@2
   483
    * function is used to allow controls to ask their owners for access to 
williamr@2
   484
    * other objects that they own.
williamr@2
   485
    * 
williamr@2
   486
    * @param aId An encapsulated object type ID.
williamr@2
   487
    * @return Encapsulates the pointer to the object provided. 
williamr@2
   488
    *         Note that the encapsulated pointer may be NULL.
williamr@2
   489
    */
williamr@2
   490
    IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
williamr@2
   491
    
williamr@2
   492
    
williamr@2
   493
private:
williamr@2
   494
    TInt  iMinColWidth;
williamr@2
   495
    TBool iCurrentIsValid;
williamr@2
   496
    TInt  iNumOfColsInView;
williamr@2
   497
    TInt  iNumOfRowsInView;
williamr@2
   498
    TSize iSpaceBetweenItems;
williamr@2
   499
        TInt  iSpare; // was iNumOfItemsInPrimaryOrient;
williamr@2
   500
    TBitFlags iOrientationFlags;
williamr@2
   501
    TBitFlags iHorizontalFlags;
williamr@2
   502
    TBitFlags iVerticalFlags;
williamr@2
   503
    CAknGridExtension *iExtension; // spare taken to use as extension class
williamr@2
   504
    };
williamr@2
   505
williamr@2
   506
/**
williamr@2
   507
 * Return Model
williamr@2
   508
 */
williamr@2
   509
inline CAknGridM* CAknGrid::GridModel() const
williamr@2
   510
    {
williamr@2
   511
    return STATIC_CAST(CAknGridM*,iModel);
williamr@2
   512
    }
williamr@2
   513
williamr@2
   514
/**
williamr@2
   515
 * Return View 
williamr@2
   516
 */
williamr@2
   517
inline CAknGridView* CAknGrid::GridView() const
williamr@2
   518
    {
williamr@2
   519
    return STATIC_CAST(CAknGridView*,iView);
williamr@2
   520
    }
williamr@2
   521
williamr@2
   522
/**
williamr@2
   523
 * Return text currently in the empty grid text
williamr@2
   524
 */
williamr@2
   525
inline const TDesC* CAknGrid::EmptyGridText() const
williamr@2
   526
    {
williamr@2
   527
    return STATIC_CAST(CAknGridView*,iView)->EmptyListText();
williamr@2
   528
    }
williamr@2
   529
williamr@2
   530
#endif //__AKNGRID_H__
williamr@2
   531