S60 3rd Edition API Reference: akngrid.h Source File

akngrid.h

Go to the documentation of this file.
00001 /*
00002 * =============================================================================
00003 *  Name        : AknGrid.h
00004 *  Part of     : Avkon
00005 *
00006 *  Description : 
00007 *     This is a concrete class for the handling of a grid. The class handles a
00008 *     rectangular grid arrangement of items held in any linear ordering i.e 
00009 *     cells ordered top to bottom and left, left to right and down etc.
00010 *
00011 *  Version     : 
00012 *
00013 *  Copyright © 2002-2004 Nokia. All rights reserved.
00014 *  This material, including documentation and any related 
00015 *  computer programs, is protected by copyright controlled by 
00016 *  Nokia. All rights are reserved. Copying, including 
00017 *  reproducing, storing, adapting or translating, any 
00018 *  or all of this material requires the prior written consent of 
00019 *  Nokia. This material also contains confidential 
00020 *  information which may not be disclosed to others without the 
00021 *  prior written consent of Nokia.
00022 * =============================================================================
00023 */
00024 
00025 #if !defined(__AKNGRID_H__)
00026 #define __AKNGRID_H__
00027 
00028 // INCLUDES
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 // CLASS PREDEFINITIONS
00039 class CAknGridExtension;
00040 
00041 // CLASS DECLARATION
00042 
00049 class CAknGrid : public CEikListBox
00050         {
00051 private:// enums
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: //from CEikListBox
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: // From CCoeControl
00343     IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00344 
00345 protected: // from CEikListBox
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         // grid model helper
00435         inline CAknGridM* GridModel() const;
00436 
00437         // grid view helper
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: // from MListBoxModel
00467         IMPORT_C virtual TAny* MListBoxModel_Reserved();
00468         
00469 protected: 
00479         IMPORT_C virtual void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
00480         
00481 private:
00482         TInt  iMinColWidth;
00483         TBool iCurrentIsValid;
00484         TInt  iNumOfColsInView;
00485         TInt  iNumOfRowsInView;
00486         TSize iSpaceBetweenItems;
00487         TInt  iSpare; // was iNumOfItemsInPrimaryOrient;
00488         TBitFlags iOrientationFlags;
00489         TBitFlags iHorizontalFlags;
00490         TBitFlags iVerticalFlags;
00491         CAknGridExtension *iExtension; // spare taken to use as extension class
00492         };
00493 
00497 inline CAknGridM* CAknGrid::GridModel() const
00498         {
00499         return STATIC_CAST(CAknGridM*,iModel);
00500         }
00501 
00505 inline CAknGridView* CAknGrid::GridView() const
00506         {
00507         return STATIC_CAST(CAknGridView*,iView);
00508         }
00509 
00513 inline const TDesC* CAknGrid::EmptyGridText() const
00514         {
00515         return STATIC_CAST(CAknGridView*,iView)->EmptyListText();
00516         }
00517 
00518 //__AKNGRID_H__
00519 #endif
00520 

Copyright © Nokia Corporation 2001-2007
Back to top