williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * This class is an extension of the text list williamr@2: * model class. It is designed specifically to be used with williamr@2: * the grid class and the grid view class. williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: // INCLUDES williamr@2: #if !defined(__AKNGRIDM_H__) williamr@2: #define __AKNGRIDM_H__ williamr@2: williamr@2: #include williamr@4: #include williamr@2: // CLASS DECLARATION williamr@2: /** williamr@2: * Model class to @c CAknGrid. williamr@2: * Usually this class object is instantiated automatically during the williamr@2: * construction phase of @c CAknGrid object.If programmer wants to provide williamr@2: * their own model they must instantiate grid model class object of their williamr@2: * own and give it to the @c CAknGrid object using the @c SetModel function williamr@2: * before calling the @c ConstructL/ConstructFromResourceL function of williamr@2: * @c CAknGrid. williamr@2: * williamr@2: * @since Series60 0.9 williamr@2: */ williamr@2: class CAknGridM : public CTextListBoxModel williamr@2: { williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Default C++ constructor. williamr@2: */ williamr@2: IMPORT_C CAknGridM(); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C virtual ~CAknGridM(); williamr@2: williamr@2: /** williamr@2: * Access to the number of items in the arrays. williamr@2: * @return Number of cells within the grid (including empty cells). williamr@2: */ williamr@2: IMPORT_C virtual TInt NumberOfItems() const; williamr@2: williamr@2: /** williamr@2: * Tests if the given cell index has data. williamr@2: * @param aDataIndex Index to the item to be checked. williamr@2: * @return @c ETrue if the data index given is a data cell within the grid williamr@2: * otherwise returns @c EFalse. williamr@2: */ williamr@2: IMPORT_C virtual TBool IndexContainsData(TInt aDataIndex) const; williamr@2: williamr@2: /** williamr@2: * Gives the number of data cells in the grid. williamr@2: * @return Number of the non empty cells in the grid. williamr@2: */ williamr@2: IMPORT_C virtual TInt NumberOfData() const; williamr@2: williamr@2: /** williamr@2: * This function sets the number of empty data cells at the start of the williamr@2: * grid. williamr@2: * @param aNumEmpty Number of empty cells. williamr@2: */ williamr@2: IMPORT_C void SetStartCells(TInt aNumEmpty); williamr@2: williamr@2: /** williamr@2: * Gets the index of the first data item in the model. williamr@2: * @return Index of the first data item if data exists in model. Returns -1 williamr@2: * if no data exists. williamr@2: */ williamr@2: IMPORT_C TInt IndexOfFirstDataItem() const; williamr@2: williamr@2: /** williamr@2: * Gets the index of the last data item in the model. williamr@2: * @return Index of the last data item if data exists in model. Returns -1 williamr@2: * if no data exists. williamr@2: */ williamr@2: IMPORT_C TInt IndexOfLastDataItem() const; williamr@2: williamr@2: /** williamr@2: * Gets the text of given index. No check is made that the item index given williamr@2: * is a valid grid index. A check should be made using @c IndexContainsData williamr@2: * before the function is called. Empty cells at the start should be taken williamr@2: * in account of the index given. williamr@2: * @param aItemIndex Index of the grid. williamr@2: * @return a Pointer descriptor to the associated item text for a cell. williamr@2: */ williamr@2: IMPORT_C virtual TPtrC ItemText(TInt aItemIndex) const; williamr@2: private: williamr@2: TInt iEmptyCellsAtStart; williamr@2: TInt iEmptyCellsAtEnd; williamr@2: williamr@2: TInt iSpare[2]; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif