00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #if !defined(__AKNGRID_H__)
00026 #define __AKNGRID_H__
00027
00028
00029 #include <eiktxlbx.h>
00030 #include <eiklbv.h>
00031 #include <eikfrlbd.h>
00032 #include <eikfrlb.h>
00033
00034 #include <AknGridM.h>
00035 #include <AknGridView.h>
00036 #include <Aknappui.h>
00037
00038
00039 class CAknGridExtension;
00040
00041
00042
00049 class CAknGrid : public CEikListBox
00050 {
00051 private:
00052 enum TIndicatorEvent
00053 {
00054 EMove,
00055 EChangeNumOfItems,
00056 EResize
00057 };
00058 public:
00059
00064 IMPORT_C CAknGrid();
00065
00069 IMPORT_C virtual ~CAknGrid();
00070
00081 IMPORT_C void SetModel(CAknGridM* aModel);
00082
00091 IMPORT_C void ConstructL(const CCoeControl* aParent, TInt aFlags = 0);
00092
00105 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
00106
00123 IMPORT_C void SetLayoutL(TBool aVerticalOrientation,
00124 TBool aLeftToRight,
00125 TBool aTopToBottom,
00126 TInt aNumOfItemsInPrimaryOrient,
00127 TInt aNumOfItemsInSecondaryOrient,
00128 TSize aSizeOfItems,
00129 TInt aWidthOfSpaceBetweenItems=0,
00130 TInt aHeightOfSpaceBetweenItems=0);
00131
00140 IMPORT_C void SetLayoutFromResourceL(TResourceReader& aReader);
00141
00150 IMPORT_C void SetPrimaryScrollingType(CAknGridView::TScrollingType aScrollingType);
00151
00159 IMPORT_C void SetSecondaryScrollingType(CAknGridView::TScrollingType aSecondaryScrolling);
00160
00171 IMPORT_C void SetStartPositionL(TPoint aGridStartPosition);
00172
00183 IMPORT_C TInt CurrentDataIndex() const;
00184
00189 IMPORT_C void SetCurrentDataIndex(TInt aDataIndex);
00190
00198 IMPORT_C TInt IndexOfPosition(TPoint aGridPosition) const;
00199
00206 IMPORT_C TPoint PositionAtIndex(TInt aItemIndex) const;
00207
00212 IMPORT_C CFormattedCellListBoxItemDrawer* ItemDrawer() const;
00213
00220 IMPORT_C void SetEmptyGridTextL(const TDesC& aText);
00221
00226 inline const TDesC* EmptyGridText() const;
00227
00228 public:
00229
00235 IMPORT_C virtual CListBoxView* MakeViewClassInstanceL();
00236
00244 IMPORT_C void SetColumnWidth(TInt aColumnWidth);
00245
00250 IMPORT_C TInt ColumnWidth() const;
00251
00252 public:
00253
00259 IMPORT_C virtual void UpdateScrollBarsL();
00260
00266 IMPORT_C void HandleItemAdditionL();
00267
00273 IMPORT_C void HandleItemRemovalL();
00274
00282 IMPORT_C virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00283
00292 IMPORT_C void SetItemHeightL(TInt aHeight);
00293
00298 IMPORT_C void SizeChanged();
00299
00305 IMPORT_C CTextListBoxModel* Model() const;
00306
00311 IMPORT_C void SetRect(const TRect& aRect);
00312
00319 IMPORT_C virtual void HandleViewRectSizeChangeL();
00320
00325 IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex) const;
00326
00332 IMPORT_C virtual void HandleResourceChange(TInt aType);
00333
00340 IMPORT_C void FocusChanged(TDrawNow aDrawNow);
00341
00342 public:
00343 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00344
00345 protected:
00346
00352 IMPORT_C virtual TInt HorizontalNudgeValue() const;
00353
00359 IMPORT_C virtual TInt HorizScrollGranularityInPixels() const;
00360
00368 IMPORT_C virtual void AdjustTopItemIndex() const;
00369
00376 IMPORT_C virtual void HandleDragEventL(TPoint aPointerPos);
00377
00386 IMPORT_C virtual void RestoreClientRectFromViewRect(TRect& aClientRect) const;
00387
00393 IMPORT_C virtual TInt AdjustRectHeightToWholeNumberOfItems(TRect& aRect) const;
00394
00399 IMPORT_C virtual void UpdateScrollBarThumbs() const;
00400
00405 IMPORT_C virtual TInt CountComponentControls() const;
00406
00407 protected:
00408
00414 IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint);
00415
00423 IMPORT_C virtual void CalcGridSizeL();
00424
00429 IMPORT_C virtual void CreateItemDrawerL();
00430
00431 private:
00432 __DECLARE_TEST;
00433
00434
00435 inline CAknGridM* GridModel() const;
00436
00437
00438 inline CAknGridView* GridView() const;
00439
00452 void DoSetLayoutL(TInt aOrientation,
00453 TInt aHorizontal,
00454 TInt aVertical,
00455 TInt aNumOfItemsInPrimaryOrient,
00456 TInt aNumOfItemsInSecondaryOrient,
00457 TSize aSizeOfItems,
00458 TInt aWidthOfSpaceBetweenItems=0,
00459 TInt aHeightOfSpaceBetweenItems=0);
00460
00461 private:
00465 IMPORT_C void* ExtensionInterface( TUid aInterface );
00466 private:
00467 IMPORT_C virtual TAny* MListBoxModel_Reserved();
00468
00469 protected:
00479 IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
00480
00492 IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00493
00494
00495 private:
00496 TInt iMinColWidth;
00497 TBool iCurrentIsValid;
00498 TInt iNumOfColsInView;
00499 TInt iNumOfRowsInView;
00500 TSize iSpaceBetweenItems;
00501 TInt iSpare;
00502 TBitFlags iOrientationFlags;
00503 TBitFlags iHorizontalFlags;
00504 TBitFlags iVerticalFlags;
00505 CAknGridExtension *iExtension;
00506 };
00507
00511 inline CAknGridM* CAknGrid::GridModel() const
00512 {
00513 return STATIC_CAST(CAknGridM*,iModel);
00514 }
00515
00519 inline CAknGridView* CAknGrid::GridView() const
00520 {
00521 return STATIC_CAST(CAknGridView*,iView);
00522 }
00523
00527 inline const TDesC* CAknGrid::EmptyGridText() const
00528 {
00529 return STATIC_CAST(CAknGridView*,iView)->EmptyListText();
00530 }
00531
00532 #endif //__AKNGRID_H__
00533