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
00420 IMPORT_C virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
00421
00422 protected:
00423
00429 IMPORT_C void MoveToNextOrPreviousItemL(TPoint aPoint);
00430
00438 IMPORT_C virtual void CalcGridSizeL();
00439
00444 IMPORT_C virtual void CreateItemDrawerL();
00445
00446 private:
00447 __DECLARE_TEST;
00448
00449
00450 inline CAknGridM* GridModel() const;
00451
00452
00453 inline CAknGridView* GridView() const;
00454
00467 void DoSetLayoutL(TInt aOrientation,
00468 TInt aHorizontal,
00469 TInt aVertical,
00470 TInt aNumOfItemsInPrimaryOrient,
00471 TInt aNumOfItemsInSecondaryOrient,
00472 TSize aSizeOfItems,
00473 TInt aWidthOfSpaceBetweenItems=0,
00474 TInt aHeightOfSpaceBetweenItems=0);
00475
00476 private:
00480 IMPORT_C void* ExtensionInterface( TUid aInterface );
00481 private:
00482 IMPORT_C virtual TAny* MListBoxModel_Reserved();
00483
00484 protected:
00494 IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
00495
00496 private:
00497 TInt iMinColWidth;
00498 TBool iCurrentIsValid;
00499 TInt iNumOfColsInView;
00500 TInt iNumOfRowsInView;
00501 TSize iSpaceBetweenItems;
00502 TInt iSpare;
00503 TBitFlags iOrientationFlags;
00504 TBitFlags iHorizontalFlags;
00505 TBitFlags iVerticalFlags;
00506 CAknGridExtension *iExtension;
00507 };
00508
00512 inline CAknGridM* CAknGrid::GridModel() const
00513 {
00514 return STATIC_CAST(CAknGridM*,iModel);
00515 }
00516
00520 inline CAknGridView* CAknGrid::GridView() const
00521 {
00522 return STATIC_CAST(CAknGridView*,iView);
00523 }
00524
00528 inline const TDesC* CAknGrid::EmptyGridText() const
00529 {
00530 return STATIC_CAST(CAknGridView*,iView)->EmptyListText();
00531 }
00532
00533
00534 #endif
00535