|
45
|
1 |
/*
|
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
* This component and the accompanying materials are made available
|
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
|
6 |
* which accompanies this distribution, and is available
|
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
|
8 |
*
|
|
|
9 |
* Initial Contributors:
|
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
|
11 |
*
|
|
|
12 |
* Contributors:
|
|
|
13 |
*
|
|
|
14 |
* Description:
|
|
|
15 |
* This class is an extension of the text list
|
|
|
16 |
* model class. It is designed specifically to be used with
|
|
|
17 |
* the grid class and the grid view class.
|
|
|
18 |
*
|
|
|
19 |
*/
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
// INCLUDES
|
|
|
24 |
#if !defined(__AKNGRIDM_H__)
|
|
|
25 |
#define __AKNGRIDM_H__
|
|
|
26 |
|
|
|
27 |
#include <eiktxlbm.h>
|
|
|
28 |
#include <AknUtils.h>
|
|
|
29 |
// CLASS DECLARATION
|
|
|
30 |
/**
|
|
|
31 |
* Model class to @c CAknGrid.
|
|
|
32 |
* Usually this class object is instantiated automatically during the
|
|
|
33 |
* construction phase of @c CAknGrid object.If programmer wants to provide
|
|
|
34 |
* their own model they must instantiate grid model class object of their
|
|
|
35 |
* own and give it to the @c CAknGrid object using the @c SetModel function
|
|
|
36 |
* before calling the @c ConstructL/ConstructFromResourceL function of
|
|
|
37 |
* @c CAknGrid.
|
|
|
38 |
*
|
|
|
39 |
* @since Series60 0.9
|
|
|
40 |
*/
|
|
|
41 |
class CAknGridM : public CTextListBoxModel
|
|
|
42 |
{
|
|
|
43 |
public:
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Default C++ constructor.
|
|
|
47 |
*/
|
|
|
48 |
IMPORT_C CAknGridM();
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* Destructor.
|
|
|
52 |
*/
|
|
|
53 |
IMPORT_C virtual ~CAknGridM();
|
|
|
54 |
|
|
|
55 |
/**
|
|
|
56 |
* Access to the number of items in the arrays.
|
|
|
57 |
* @return Number of cells within the grid (including empty cells).
|
|
|
58 |
*/
|
|
|
59 |
IMPORT_C virtual TInt NumberOfItems() const;
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* Tests if the given cell index has data.
|
|
|
63 |
* @param aDataIndex Index to the item to be checked.
|
|
|
64 |
* @return @c ETrue if the data index given is a data cell within the grid
|
|
|
65 |
* otherwise returns @c EFalse.
|
|
|
66 |
*/
|
|
|
67 |
IMPORT_C virtual TBool IndexContainsData(TInt aDataIndex) const;
|
|
|
68 |
|
|
|
69 |
/**
|
|
|
70 |
* Gives the number of data cells in the grid.
|
|
|
71 |
* @return Number of the non empty cells in the grid.
|
|
|
72 |
*/
|
|
|
73 |
IMPORT_C virtual TInt NumberOfData() const;
|
|
|
74 |
|
|
|
75 |
/**
|
|
|
76 |
* This function sets the number of empty data cells at the start of the
|
|
|
77 |
* grid.
|
|
|
78 |
* @param aNumEmpty Number of empty cells.
|
|
|
79 |
*/
|
|
|
80 |
IMPORT_C void SetStartCells(TInt aNumEmpty);
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* Gets the index of the first data item in the model.
|
|
|
84 |
* @return Index of the first data item if data exists in model. Returns -1
|
|
|
85 |
* if no data exists.
|
|
|
86 |
*/
|
|
|
87 |
IMPORT_C TInt IndexOfFirstDataItem() const;
|
|
|
88 |
|
|
|
89 |
/**
|
|
|
90 |
* Gets the index of the last data item in the model.
|
|
|
91 |
* @return Index of the last data item if data exists in model. Returns -1
|
|
|
92 |
* if no data exists.
|
|
|
93 |
*/
|
|
|
94 |
IMPORT_C TInt IndexOfLastDataItem() const;
|
|
|
95 |
|
|
|
96 |
/**
|
|
|
97 |
* Gets the text of given index. No check is made that the item index given
|
|
|
98 |
* is a valid grid index. A check should be made using @c IndexContainsData
|
|
|
99 |
* before the function is called. Empty cells at the start should be taken
|
|
|
100 |
* in account of the index given.
|
|
|
101 |
* @param aItemIndex Index of the grid.
|
|
|
102 |
* @return a Pointer descriptor to the associated item text for a cell.
|
|
|
103 |
*/
|
|
|
104 |
IMPORT_C virtual TPtrC ItemText(TInt aItemIndex) const;
|
|
|
105 |
private:
|
|
|
106 |
TInt iEmptyCellsAtStart;
|
|
|
107 |
TInt iEmptyCellsAtEnd;
|
|
|
108 |
|
|
|
109 |
TInt iSpare[2];
|
|
|
110 |
};
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
#endif
|