00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __AKNGRIDVIEW_H__
00022 #define __AKNGRIDVIEW_H__
00023
00024
00025 #include <eiklbv.h>
00026 #include <akngridm.h>
00027 #include <eiklabel.h>
00028
00029
00030
00053 class CAknGridView : public CListBoxView
00054 {
00055 public:
00057 enum TGridFlags
00058 {
00060 EPrimaryIsVertical = 0x0001,
00062 ETopToBottom = 0x0002,
00064 ELeftToRight = 0x0004
00065 };
00067 enum TScrollingType
00068 {
00070 EScrollFollowsItemsAndStops,
00072 EScrollFollowsItemsAndLoops,
00074 EScrollFollowsGrid,
00076 EScrollStops,
00078 EScrollIncrementLineAndStops,
00080 EScrollIncrementLineAndLoops
00081 };
00083 struct SGrid
00084 {
00086 TSize iGridDimensions;
00088 TInt iGridFlags;
00090 TInt iPageSize;
00092 TInt iColsInView;
00094 TInt iRowsInView;
00096 TSize iSizeBetweenItems;
00098 TSize iSizeOfItems;
00099 };
00100
00101 protected:
00103 enum TPageIndex
00104 {
00106 EPreviousPage,
00108 ENextPage,
00110 EHome,
00112 EEnd
00113 };
00114
00115 enum TPositionCurrentIndex
00116 {
00118 EPage,
00120 EColumn,
00122 EOppositeCorner
00123 };
00124
00125 public:
00129 IMPORT_C CAknGridView();
00130
00134 IMPORT_C virtual ~CAknGridView();
00135
00136
00142 IMPORT_C TInt ActualDataIndex(TInt aListBoxIndex) const;
00143
00149 IMPORT_C TInt ListBoxIndex(TInt aDataIndex) const;
00150
00156 IMPORT_C TInt CurrentDataIndex() const;
00157
00163 IMPORT_C void SetCurrentDataIndex(TInt aDataIndex);
00164
00171 IMPORT_C void SetPrimaryScrollingType(TScrollingType aScrollingType);
00177 IMPORT_C void SetSecondaryScrollingType(TScrollingType aSecondaryScrolling);
00178
00185 IMPORT_C void SetGridCellDimensions(TSize aGridDimensions);
00186
00191 IMPORT_C TSize GridCellDimensions() const;
00196 IMPORT_C void SetSpacesBetweenItems(TSize aSizeOfSpaceBetweenItems);
00197
00202 IMPORT_C TBool IsPrimaryVertical() const;
00203
00212 IMPORT_C void DataIndexFromLogicalPos(
00213 TInt& aItemIndex,
00214 TInt aRowIndex,
00215 TInt aColIndex) const;
00216
00226 IMPORT_C void LogicalPosFromDataIndex(
00227 TInt aItemIndex,
00228 TInt& aRowIndex,
00229 TInt& aColIndex) const;
00230
00240 IMPORT_C void ListBoxIndexFromLogicalPos(
00241 TInt& aItemIndex,
00242 TInt aRowIndex,
00243 TInt aColIndex) const;
00253 IMPORT_C void LogicalPosFromListBoxIndex(
00254 TInt aItemIndex,
00255 TInt& aRowIndex,
00256 TInt& aColIndex) const;
00257
00261 IMPORT_C virtual void DrawEmptyList() const;
00262
00267 IMPORT_C void SetGridDetails(SGrid aGridDetails);
00268
00274 IMPORT_C void MoveToItemIndexL(TInt aItemIndex, TSelectionMode aSelectionMode);
00275
00280 IMPORT_C TInt NumberOfColsInView() const;
00281
00286 IMPORT_C TInt NumberOfRowsInView() const;
00287
00295 void MoveCursorWithRepeatsL(
00296 TBool aNextOrPrev,
00297 TSelectionMode aSelectionMode,
00298 TInt aAmount );
00299
00300 public:
00305 IMPORT_C virtual void DrawMatcherCursor();
00306
00312 IMPORT_C TInt CurrentItemIndex() const;
00313
00314 protected:
00320 IMPORT_C TBool ItemExists(TInt aListBoxIndex) const;
00321
00322 public:
00329 IMPORT_C void SetColumnWidth(TInt aColumnWidth);
00330
00338 IMPORT_C virtual void MoveCursorL(
00339 TCursorMovement aCursorMovement,
00340 TSelectionMode aSelectionMode);
00341
00348 IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
00349
00355 IMPORT_C virtual void DrawItem(TInt aItemIndex) const;
00356
00363 IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
00364
00370 IMPORT_C virtual void CalcBottomItemIndex();
00371
00378 IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const;
00379
00386 IMPORT_C virtual void DrawItemRange(TInt aStartItemIndex, TInt aEndItemIndex) const;
00387
00392 inline TInt ColumnWidth() const;
00393
00399 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
00400
00405 IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
00406
00407
00408
00409
00410
00411
00412
00413 IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
00414
00419 IMPORT_C virtual void CalcDataWidth();
00420
00427 IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
00428
00436 IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
00437
00446 IMPORT_C virtual TInt CalculateHScrollOffsetSoItemIsVisible(TInt aItemIndex);
00447
00453 IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
00454
00461 IMPORT_C void CalcRowAndColIndexesFromItemIndex(TInt aItemIndex, TInt& aRowIndex, TInt& aColIndex) const;
00462
00470 IMPORT_C void CalcItemIndexFromRowAndColIndexes(TInt& aItemIndex, TInt aRowIndex, TInt aColIndex) const;
00471
00472 protected:
00479 IMPORT_C void DrawColumnRange(TInt aStartColIndex, TInt aEndColIndex) const;
00480
00487 IMPORT_C void ClearUnusedItemSpace(TInt aStartItemIndex, TInt aEndItemIndex) const;
00488
00494 IMPORT_C void UpdateHScrollOffsetBasedOnTopItemIndex();
00495
00496 protected:
00501 inline CAknGridM* GridModel() const;
00502
00509 IMPORT_C void DoMoveL(TCursorMovement aCursorMovement, TSelectionMode aSelectionMode);
00510
00511 private:
00512
00513 IMPORT_C TInt SearchByLines(TInt aX, TInt aY, TCursorMovement aCursorMovement, TBool aBeginSearchOnIndex = EFalse);
00514 IMPORT_C TInt FindNextItem(TInt aItemIndex, TBool aLookDown, TBool aLookRight, TBool aFirstLookHorizontal, TBool aBeginSearchOnIndex = EFalse);
00515 TBool IsEdgePassed(TInt aItemIndex, TBool aLookDown, TBool aLookRight, TBool aFirstLookHorizontal, TBool aBeginSearchOnIndex, TInt& aNewIndex);
00516
00517 TBool IsMoveRight(TCursorMovement aCursorMovement);
00518 TBool IsMoveDown(TCursorMovement aCursorMovement);
00519
00520 private:
00521 IMPORT_C virtual TAny* Reserved_1();
00522
00523 private:
00524
00528 void DrawUnusedViewPortion() const;
00529
00530 private:
00531 TScrollingType iScrollingType;
00532 TScrollingType iScrollInSecondaryDimension;
00533
00534 SGrid iGridDetails;
00535 TInt iSpare[2];
00536 };
00537
00538 inline CAknGridM* CAknGridView::GridModel() const
00539 {
00540 return STATIC_CAST(CAknGridM*,iModel);
00541 }
00542
00543 inline TInt CAknGridView::ColumnWidth() const
00544 { return iGridDetails.iSizeOfItems.iWidth; }
00545
00546 #endif // __AKNGRIDVIEW_H__