williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* CAknGridView handles the drawing, the mapping
|
williamr@2
|
16 |
* of the grid data index to the underlying listbox index (and
|
williamr@2
|
17 |
* visa versa) as well as the movement around the grid.
|
williamr@2
|
18 |
*
|
williamr@2
|
19 |
*/
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#ifndef __AKNGRIDVIEW_H__
|
williamr@2
|
22 |
#define __AKNGRIDVIEW_H__
|
williamr@2
|
23 |
|
williamr@2
|
24 |
// INCLUDES
|
williamr@2
|
25 |
#include <eiklbv.h>
|
williamr@4
|
26 |
#include <AknGridM.h>
|
williamr@2
|
27 |
#include <eiklabel.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
// CLASS DECLARATION
|
williamr@2
|
30 |
|
williamr@2
|
31 |
/**
|
williamr@2
|
32 |
* @c CAknGridView handles the drawing, the mapping of the grid data index
|
williamr@2
|
33 |
* to the underlying listbox index (and vice versa) as well as the movement
|
williamr@2
|
34 |
* around the grid. Differentiation is needed between a data index and the
|
williamr@2
|
35 |
* list box index since the inherited list box code handles the top, bottom
|
williamr@2
|
36 |
* and current indexes as though everything is order topdown and left to
|
williamr@2
|
37 |
* right. This is no good for grid that maybe order in 8 different
|
williamr@2
|
38 |
* ways so need conversion between list box index and actual data
|
williamr@2
|
39 |
* index.
|
williamr@2
|
40 |
* List box index is the index for the data item according to the
|
williamr@2
|
41 |
* snaking list box format of numbering data items.
|
williamr@2
|
42 |
* Data index is the actual index in the grid according to the
|
williamr@2
|
43 |
* ordering applied to the data by the user.
|
williamr@2
|
44 |
* Note: the logical position is the intermediate form used to map
|
williamr@2
|
45 |
* from a list box index to a data index or vi sa versa. It is
|
williamr@2
|
46 |
* essentialy the position of the item in relation to the top left
|
williamr@2
|
47 |
* corner of the grid. I.e. the top left position has logical
|
williamr@2
|
48 |
* position 0,0.
|
williamr@2
|
49 |
*
|
williamr@2
|
50 |
* @since 0.9
|
williamr@2
|
51 |
* @lib avkon.lib
|
williamr@2
|
52 |
*/
|
williamr@2
|
53 |
class CAknGridView : public CListBoxView
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
public:
|
williamr@2
|
56 |
/** Enumeration flags for grid.*/
|
williamr@2
|
57 |
enum TGridFlags
|
williamr@2
|
58 |
{
|
williamr@2
|
59 |
/** Vertical is primary direction.*/
|
williamr@2
|
60 |
EPrimaryIsVertical = 0x0001,
|
williamr@2
|
61 |
/** From top to bottom.*/
|
williamr@2
|
62 |
ETopToBottom = 0x0002,
|
williamr@2
|
63 |
/** From left to right.*/
|
williamr@2
|
64 |
ELeftToRight = 0x0004
|
williamr@2
|
65 |
};
|
williamr@2
|
66 |
/** Enumeration for different scrolling types.*/
|
williamr@2
|
67 |
enum TScrollingType
|
williamr@2
|
68 |
{
|
williamr@2
|
69 |
/** Scrolling follows items and stops.*/
|
williamr@2
|
70 |
EScrollFollowsItemsAndStops,
|
williamr@2
|
71 |
/** Scrolling follows items and loops.*/
|
williamr@2
|
72 |
EScrollFollowsItemsAndLoops,
|
williamr@2
|
73 |
/** Scrolling follows grid. */
|
williamr@2
|
74 |
EScrollFollowsGrid,
|
williamr@2
|
75 |
/** Scrolling stops. */
|
williamr@2
|
76 |
EScrollStops,
|
williamr@2
|
77 |
/** Scrolls one line and stops.*/
|
williamr@2
|
78 |
EScrollIncrementLineAndStops,
|
williamr@2
|
79 |
/** Scrolls one line and loops.*/
|
williamr@2
|
80 |
EScrollIncrementLineAndLoops
|
williamr@2
|
81 |
};
|
williamr@2
|
82 |
/** Enumeration flags for different layouts.*/
|
williamr@2
|
83 |
struct SGrid
|
williamr@2
|
84 |
{
|
williamr@2
|
85 |
/** Current size of entire grid. */
|
williamr@2
|
86 |
TSize iGridDimensions;
|
williamr@2
|
87 |
/** Flags. */
|
williamr@2
|
88 |
TInt iGridFlags;
|
williamr@2
|
89 |
/** Size of the viewable area ( iColsInView * iRowsInView ). */
|
williamr@2
|
90 |
TInt iPageSize;
|
williamr@2
|
91 |
/** The number of columns in the viewable area. */
|
williamr@2
|
92 |
TInt iColsInView;
|
williamr@2
|
93 |
/** The number of rows in the viewable area. */
|
williamr@2
|
94 |
TInt iRowsInView;
|
williamr@2
|
95 |
/** The size of gap between items (height and width). */
|
williamr@2
|
96 |
TSize iSizeBetweenItems;
|
williamr@2
|
97 |
/** The size of an item. */
|
williamr@2
|
98 |
TSize iSizeOfItems;
|
williamr@2
|
99 |
};
|
williamr@2
|
100 |
|
williamr@2
|
101 |
protected:
|
williamr@2
|
102 |
/** Enumeration flags for pages.*/
|
williamr@2
|
103 |
enum TPageIndex
|
williamr@2
|
104 |
{
|
williamr@2
|
105 |
/** Previous page.*/
|
williamr@2
|
106 |
EPreviousPage,
|
williamr@2
|
107 |
/** Next page.*/
|
williamr@2
|
108 |
ENextPage,
|
williamr@2
|
109 |
/** First page. */
|
williamr@2
|
110 |
EHome,
|
williamr@2
|
111 |
/** Last page.*/
|
williamr@2
|
112 |
EEnd
|
williamr@2
|
113 |
};
|
williamr@2
|
114 |
/* Enumeration of position of current index.*/
|
williamr@2
|
115 |
enum TPositionCurrentIndex
|
williamr@2
|
116 |
{
|
williamr@2
|
117 |
/** Page. */
|
williamr@2
|
118 |
EPage,
|
williamr@2
|
119 |
/** Column.*/
|
williamr@2
|
120 |
EColumn,
|
williamr@2
|
121 |
/** Opposite corner.*/
|
williamr@2
|
122 |
EOppositeCorner
|
williamr@2
|
123 |
};
|
williamr@2
|
124 |
|
williamr@2
|
125 |
public:
|
williamr@2
|
126 |
/**
|
williamr@2
|
127 |
* Default C++ constructor.
|
williamr@2
|
128 |
*/
|
williamr@2
|
129 |
IMPORT_C CAknGridView();
|
williamr@2
|
130 |
|
williamr@2
|
131 |
/**
|
williamr@2
|
132 |
* Destructor.
|
williamr@2
|
133 |
*/
|
williamr@2
|
134 |
IMPORT_C virtual ~CAknGridView();
|
williamr@2
|
135 |
|
williamr@2
|
136 |
// actual <-> listbox index conversion routines
|
williamr@2
|
137 |
/**
|
williamr@2
|
138 |
* Returns the actual index of given listbox index.
|
williamr@2
|
139 |
* @param aListBoxIndex The index of the listbox.
|
williamr@2
|
140 |
* @return The actual data index.
|
williamr@2
|
141 |
*/
|
williamr@2
|
142 |
IMPORT_C TInt ActualDataIndex(TInt aListBoxIndex) const;
|
williamr@2
|
143 |
|
williamr@2
|
144 |
/**
|
williamr@2
|
145 |
* Returns the listbox index of given data index.
|
williamr@2
|
146 |
* @param aDataIndex The index of the actual data.
|
williamr@2
|
147 |
* @return The index in listbox.
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
IMPORT_C TInt ListBoxIndex(TInt aDataIndex) const;
|
williamr@2
|
150 |
|
williamr@2
|
151 |
/**
|
williamr@2
|
152 |
* Returns the current data index with respect to the ordering of the cells
|
williamr@2
|
153 |
* in the grid.
|
williamr@2
|
154 |
* @return Current data index.
|
williamr@2
|
155 |
*/
|
williamr@2
|
156 |
IMPORT_C TInt CurrentDataIndex() const;
|
williamr@2
|
157 |
|
williamr@2
|
158 |
/**
|
williamr@2
|
159 |
* Sets the current data index with a value given with respect to the
|
williamr@2
|
160 |
* ordering of the cells in the grid.
|
williamr@2
|
161 |
* @param aDataIndex The index to be set.
|
williamr@2
|
162 |
*/
|
williamr@2
|
163 |
IMPORT_C void SetCurrentDataIndex(TInt aDataIndex);
|
williamr@2
|
164 |
|
williamr@2
|
165 |
/**
|
williamr@2
|
166 |
* Sets the form of scroll to activate upon reaching the limit when moving
|
williamr@2
|
167 |
* in the primary direction of grid, primary meaning whether the items are
|
williamr@2
|
168 |
* organised vertically or horizontally.
|
williamr@2
|
169 |
* @param aScrollingType The primary scrolling type.
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
IMPORT_C void SetPrimaryScrollingType(TScrollingType aScrollingType);
|
williamr@2
|
172 |
/**
|
williamr@2
|
173 |
* Sets the form of scroll to activate upon reaching the limit when moving
|
williamr@2
|
174 |
* in the secondary direction of grid.
|
williamr@2
|
175 |
* @param aSecondaryScrolling The secondary scrolling type.
|
williamr@2
|
176 |
*/
|
williamr@2
|
177 |
IMPORT_C void SetSecondaryScrollingType(TScrollingType aSecondaryScrolling);
|
williamr@2
|
178 |
|
williamr@2
|
179 |
/**
|
williamr@2
|
180 |
* Checks that number of cells in the grid is always enough to fill the
|
williamr@2
|
181 |
* current grid dimensions. This method should be called after any method
|
williamr@2
|
182 |
* that may alter the amount of data within the grid.
|
williamr@2
|
183 |
* @param aGridDimensions Grid diemnsions.
|
williamr@2
|
184 |
*/
|
williamr@2
|
185 |
IMPORT_C void SetGridCellDimensions(TSize aGridDimensions);
|
williamr@2
|
186 |
|
williamr@2
|
187 |
/**
|
williamr@2
|
188 |
* Returns the current grid dimensions.
|
williamr@2
|
189 |
* @return The size of the current grid.
|
williamr@2
|
190 |
*/
|
williamr@2
|
191 |
IMPORT_C TSize GridCellDimensions() const;
|
williamr@2
|
192 |
/**
|
williamr@2
|
193 |
* Sets the size of the spaces between items.
|
williamr@2
|
194 |
* @param aSizeOfSpaceBetweenItems The size of the spaces between items.
|
williamr@2
|
195 |
*/
|
williamr@2
|
196 |
IMPORT_C void SetSpacesBetweenItems(TSize aSizeOfSpaceBetweenItems);
|
williamr@2
|
197 |
|
williamr@2
|
198 |
/**
|
williamr@2
|
199 |
* Returns @c ETrue if the primary dimension of the grid is vertical.
|
williamr@2
|
200 |
* @return @ETrue if vertical is set as primary, otherwise @c EFalse.
|
williamr@2
|
201 |
*/
|
williamr@2
|
202 |
IMPORT_C TBool IsPrimaryVertical() const;
|
williamr@2
|
203 |
|
williamr@2
|
204 |
/**
|
williamr@2
|
205 |
* Converts a logical position on the grid, where the co-ordinates are with
|
williamr@2
|
206 |
* respect to the top left hand corner of the grid, to an index for the cell
|
williamr@2
|
207 |
* with respect to the ordering of the cells in the grid.
|
williamr@2
|
208 |
* @param aItemIndex Reference to the index for the cell in the grid.
|
williamr@2
|
209 |
* @param aRowIndex The row in the grid.
|
williamr@2
|
210 |
* @param aColIndex The column in the grid.
|
williamr@2
|
211 |
*/
|
williamr@2
|
212 |
IMPORT_C void DataIndexFromLogicalPos(
|
williamr@2
|
213 |
TInt& aItemIndex,
|
williamr@2
|
214 |
TInt aRowIndex,
|
williamr@2
|
215 |
TInt aColIndex) const;
|
williamr@2
|
216 |
|
williamr@2
|
217 |
/**
|
williamr@2
|
218 |
* Converts an index for a cell in the grid, given with respect to the
|
williamr@2
|
219 |
* ordering of the cells in the grid, to a logical position on the grid,
|
williamr@2
|
220 |
* where the co-ordinates are with respect to the top left hand corner of
|
williamr@2
|
221 |
* the grid.
|
williamr@2
|
222 |
* @param aItemIndex The index for the cell in the grid.
|
williamr@2
|
223 |
* @param aRowIndex Reference to the row in the grid.
|
williamr@2
|
224 |
* @param aColIndex Reference to the column in the grid.
|
williamr@2
|
225 |
*/
|
williamr@2
|
226 |
IMPORT_C void LogicalPosFromDataIndex(
|
williamr@2
|
227 |
TInt aItemIndex,
|
williamr@2
|
228 |
TInt& aRowIndex,
|
williamr@2
|
229 |
TInt& aColIndex) const;
|
williamr@2
|
230 |
|
williamr@2
|
231 |
/**
|
williamr@2
|
232 |
* Converts a CEikListBox index for a cell in the grid, given with respect
|
williamr@2
|
233 |
* to the snaking listbox top down, left to right structure underlying the
|
williamr@2
|
234 |
* grid structure, to a logical position on the grid, where the co-ordinates
|
williamr@2
|
235 |
* are with respect to the top left hand corner of the grid.
|
williamr@2
|
236 |
* @param aItemIndex Reference to the index for the cell in the grid.
|
williamr@2
|
237 |
* @param aRowIndex The row in the grid.
|
williamr@2
|
238 |
* @param aColIndex The column in the grid.
|
williamr@2
|
239 |
*/
|
williamr@2
|
240 |
IMPORT_C void ListBoxIndexFromLogicalPos(
|
williamr@2
|
241 |
TInt& aItemIndex,
|
williamr@2
|
242 |
TInt aRowIndex,
|
williamr@2
|
243 |
TInt aColIndex) const;
|
williamr@2
|
244 |
/**
|
williamr@2
|
245 |
* Converts a logical position on the grid, where the co-ordinates are with
|
williamr@2
|
246 |
* respect to the top left hand corner of the grid, to a CEikListBox index
|
williamr@2
|
247 |
* for the cell with respect to the snaking listbox top down, left to right
|
williamr@2
|
248 |
* structure underlying the grid structure.
|
williamr@2
|
249 |
* @param aItemIndex The index for the cell in the grid.
|
williamr@2
|
250 |
* @param aRowIndex Reference to the row in the grid.
|
williamr@2
|
251 |
* @param aColIndex Reference to the column in the grid.
|
williamr@2
|
252 |
*/
|
williamr@2
|
253 |
IMPORT_C void LogicalPosFromListBoxIndex(
|
williamr@2
|
254 |
TInt aItemIndex,
|
williamr@2
|
255 |
TInt& aRowIndex,
|
williamr@2
|
256 |
TInt& aColIndex) const;
|
williamr@2
|
257 |
|
williamr@2
|
258 |
/**
|
williamr@2
|
259 |
* Draws empty grid list.
|
williamr@2
|
260 |
*/
|
williamr@2
|
261 |
IMPORT_C virtual void DrawEmptyList() const;
|
williamr@2
|
262 |
|
williamr@2
|
263 |
/**
|
williamr@2
|
264 |
* Grid initialisation function.
|
williamr@2
|
265 |
* @param aGridDetails Struct of grid details.
|
williamr@2
|
266 |
*/
|
williamr@2
|
267 |
IMPORT_C void SetGridDetails(SGrid aGridDetails);
|
williamr@2
|
268 |
|
williamr@2
|
269 |
/**
|
williamr@2
|
270 |
* This moves to the item and draws the grid in the right place.
|
williamr@2
|
271 |
* @param aItemIndex The wanted item index.
|
williamr@2
|
272 |
* @param aSelectionMode Mode for modifying the selection.
|
williamr@2
|
273 |
*/
|
williamr@2
|
274 |
IMPORT_C void MoveToItemIndexL(TInt aItemIndex, TSelectionMode aSelectionMode);
|
williamr@2
|
275 |
|
williamr@2
|
276 |
/**
|
williamr@2
|
277 |
* This function returns the number of visible columns.
|
williamr@2
|
278 |
* @return The number of visible columns in view.
|
williamr@2
|
279 |
*/
|
williamr@2
|
280 |
IMPORT_C TInt NumberOfColsInView() const;
|
williamr@2
|
281 |
|
williamr@2
|
282 |
/**
|
williamr@2
|
283 |
* This function returns the number of visible rows.
|
williamr@2
|
284 |
* @return The number of visible rows in view.
|
williamr@2
|
285 |
*/
|
williamr@2
|
286 |
IMPORT_C TInt NumberOfRowsInView() const;
|
williamr@2
|
287 |
|
williamr@2
|
288 |
/**
|
williamr@2
|
289 |
* Moves cursor with repeats.
|
williamr@2
|
290 |
* @param aNext ETrue if next, EFalse if previous.
|
williamr@2
|
291 |
* @param aSelectionMode selection mode.
|
williamr@2
|
292 |
* @param aAmount Amount of steps to move.
|
williamr@2
|
293 |
* @since S60 3.2
|
williamr@2
|
294 |
*/
|
williamr@2
|
295 |
void MoveCursorWithRepeatsL(
|
williamr@2
|
296 |
TBool aNextOrPrev,
|
williamr@2
|
297 |
TSelectionMode aSelectionMode,
|
williamr@2
|
298 |
TInt aAmount );
|
williamr@2
|
299 |
|
williamr@2
|
300 |
public: // from CListBoxView
|
williamr@2
|
301 |
/**
|
williamr@2
|
302 |
* From @c CListBoxView. Basically empty implementation of
|
williamr@2
|
303 |
* @c CListBoxView::DrawMatcherCursor.
|
williamr@2
|
304 |
*/
|
williamr@2
|
305 |
IMPORT_C virtual void DrawMatcherCursor();
|
williamr@2
|
306 |
|
williamr@2
|
307 |
/**
|
williamr@2
|
308 |
* From @c CListBoxView. This function returns the current item in the grid
|
williamr@2
|
309 |
* and -1 if there is no current item,
|
williamr@2
|
310 |
* @return The current item.
|
williamr@2
|
311 |
*/
|
williamr@2
|
312 |
IMPORT_C TInt CurrentItemIndex() const;
|
williamr@2
|
313 |
|
williamr@2
|
314 |
protected:
|
williamr@2
|
315 |
/**
|
williamr@2
|
316 |
* This function tests whether an item exists.
|
williamr@2
|
317 |
* @param aListBoxIndex Index to test.
|
williamr@2
|
318 |
* @return @c ETrue if the specified item exists, @c EFalse otherwise.
|
williamr@2
|
319 |
*/
|
williamr@2
|
320 |
IMPORT_C TBool ItemExists(TInt aListBoxIndex) const;
|
williamr@2
|
321 |
|
williamr@2
|
322 |
public: // code moved from CSnakingListBoxView
|
williamr@2
|
323 |
/**
|
williamr@2
|
324 |
* This function sets the width of the grid column. This should only be
|
williamr@2
|
325 |
* called via the selection box class's @c SetColumnWidth method.
|
williamr@2
|
326 |
* @param aColumnWidth The required width of all columns in the view,
|
williamr@2
|
327 |
* in pixels.
|
williamr@2
|
328 |
*/
|
williamr@2
|
329 |
IMPORT_C void SetColumnWidth(TInt aColumnWidth);
|
williamr@2
|
330 |
|
williamr@2
|
331 |
/**
|
williamr@2
|
332 |
* Overloaded @c MoveCursorL method to process cursor movement according to
|
williamr@2
|
333 |
* orientation of the grid.
|
williamr@2
|
334 |
* @param aCursorMovement The cursor movement to apply
|
williamr@2
|
335 |
* etc. @c ECursorNextItem and @c ECursorPreviousItem.
|
williamr@2
|
336 |
* @param aSelectionMode The selection mode of the calling list box.
|
williamr@2
|
337 |
*/
|
williamr@2
|
338 |
IMPORT_C virtual void MoveCursorL(
|
williamr@2
|
339 |
TCursorMovement aCursorMovement,
|
williamr@2
|
340 |
TSelectionMode aSelectionMode);
|
williamr@2
|
341 |
|
williamr@2
|
342 |
/**
|
williamr@2
|
343 |
* This function draws every visible item into the specified rectangle.
|
williamr@2
|
344 |
* As implemented in @c CListBoxView, this function's argument is ignored
|
williamr@2
|
345 |
* and the internal viewing rectangle is used. See @c SetViewRect().
|
williamr@2
|
346 |
* @param @c TRect* @c aClipRect = @c NULL The rectangle to draw into.
|
williamr@2
|
347 |
*/
|
williamr@2
|
348 |
IMPORT_C virtual void Draw(const TRect* aClipRect = NULL) const;
|
williamr@2
|
349 |
|
williamr@2
|
350 |
/**
|
williamr@2
|
351 |
* This has been overloaded to ensure that only valid cells are drawn and
|
williamr@2
|
352 |
* not the empty cells.
|
williamr@2
|
353 |
* @param aItemIndex Index number of the item to draw.
|
williamr@2
|
354 |
*/
|
williamr@2
|
355 |
IMPORT_C virtual void DrawItem(TInt aItemIndex) const;
|
williamr@2
|
356 |
|
williamr@2
|
357 |
/**
|
williamr@2
|
358 |
* This function gets the position of the top left corner of the specified
|
williamr@2
|
359 |
* item, in pixels.
|
williamr@2
|
360 |
* @param aItemIndex An item in the model.
|
williamr@2
|
361 |
* @return @c TPoint position of the top left corner of the item, in pixels.
|
williamr@2
|
362 |
*/
|
williamr@2
|
363 |
IMPORT_C virtual TPoint ItemPos(TInt aItemIndex) const;
|
williamr@2
|
364 |
|
williamr@2
|
365 |
/**
|
williamr@2
|
366 |
* This function has been overloaded to draw items correctly. Recalculates
|
williamr@2
|
367 |
* the bottom item’s index. This is called by the list box control when
|
williamr@2
|
368 |
* either the size or the number of items in its model changes.
|
williamr@2
|
369 |
*/
|
williamr@2
|
370 |
IMPORT_C virtual void CalcBottomItemIndex();
|
williamr@2
|
371 |
|
williamr@2
|
372 |
/**
|
williamr@2
|
373 |
* This function gets the item the view would need to be moved to in order
|
williamr@2
|
374 |
* to make the specified item visible.
|
williamr@2
|
375 |
* @param aItemIndex The item to make visible.
|
williamr@2
|
376 |
* @return The item to scroll to to make @c aItemIndex visible.
|
williamr@2
|
377 |
*/
|
williamr@2
|
378 |
IMPORT_C virtual TInt CalcNewTopItemIndexSoItemIsVisible(TInt aItemIndex) const;
|
williamr@2
|
379 |
|
williamr@2
|
380 |
/**
|
williamr@2
|
381 |
* This function draws every item between the start and end indices
|
williamr@2
|
382 |
* inclusively.
|
williamr@2
|
383 |
* @param aStartItemIndex The first item to draw.
|
williamr@2
|
384 |
* @param aEndItemIndex The final item to draw.
|
williamr@2
|
385 |
*/
|
williamr@2
|
386 |
IMPORT_C virtual void DrawItemRange(TInt aStartItemIndex, TInt aEndItemIndex) const;
|
williamr@2
|
387 |
|
williamr@2
|
388 |
/**
|
williamr@2
|
389 |
* This function gets the width of all columns in the view.
|
williamr@2
|
390 |
* @return The width of all columns in the view, in pixels.
|
williamr@2
|
391 |
*/
|
williamr@2
|
392 |
inline TInt ColumnWidth() const;
|
williamr@2
|
393 |
|
williamr@2
|
394 |
/**
|
williamr@2
|
395 |
* Sets which item appears at the top left corner of the view. The function
|
williamr@2
|
396 |
* changes items displayed in the view appropriately.
|
williamr@2
|
397 |
* @param aItemIndex Index of the item to set at the top left.
|
williamr@2
|
398 |
*/
|
williamr@2
|
399 |
IMPORT_C virtual void SetTopItemIndex(TInt aItemIndex);
|
williamr@2
|
400 |
|
williamr@2
|
401 |
/**
|
williamr@2
|
402 |
* This function sets item height in pixels.
|
williamr@2
|
403 |
* @param aItemHeight New height in pixels for this view’s items.
|
williamr@2
|
404 |
*/
|
williamr@2
|
405 |
IMPORT_C virtual void SetItemHeight(TInt aItemHeight);
|
williamr@2
|
406 |
|
williamr@2
|
407 |
/*
|
williamr@2
|
408 |
* This function converts an (x, y) pixel position to an item index.
|
williamr@2
|
409 |
* @param aPosition Pixel position in the viewing rectangle.
|
williamr@2
|
410 |
* @param aItemIndex Reference to the item index.
|
williamr@2
|
411 |
* @return Whether there was an item at aPosition.
|
williamr@2
|
412 |
*/
|
williamr@2
|
413 |
IMPORT_C virtual TBool XYPosToItemIndex(TPoint aPosition, TInt& aItemIndex) const;
|
williamr@2
|
414 |
|
williamr@2
|
415 |
/**
|
williamr@2
|
416 |
* Calculates the data width in columns. @c iDataWidth is calculated based on
|
williamr@2
|
417 |
* model and drawer information.
|
williamr@2
|
418 |
*/
|
williamr@2
|
419 |
IMPORT_C virtual void CalcDataWidth();
|
williamr@2
|
420 |
|
williamr@2
|
421 |
/**
|
williamr@2
|
422 |
* Gets the visible width of the specified rectangle in pixels.
|
williamr@2
|
423 |
* @param aRect Reference to the rectangle for which to get the visible
|
williamr@2
|
424 |
* width.
|
williamr@2
|
425 |
* @return Visible width of aRect in pixels.
|
williamr@2
|
426 |
*/
|
williamr@2
|
427 |
IMPORT_C virtual TInt VisibleWidth(const TRect& aRect) const;
|
williamr@2
|
428 |
|
williamr@2
|
429 |
/**
|
williamr@2
|
430 |
* Makes the specified item visible by moving the view location and
|
williamr@2
|
431 |
* redrawing the control. Index of the item to make visible.
|
williamr@2
|
432 |
* @param aItemIndex Index of the item to make visible.
|
williamr@2
|
433 |
* @return @c ETrue if the control was redrawn, @c EFalse if no redraw
|
williamr@2
|
434 |
* happened (i.e. the item was already visible, or redraw was disabled).
|
williamr@2
|
435 |
*/
|
williamr@2
|
436 |
IMPORT_C virtual TBool ScrollToMakeItemVisible(TInt aItemIndex);
|
williamr@2
|
437 |
|
williamr@2
|
438 |
/**
|
williamr@2
|
439 |
* Gets the number of columns that this view would need to be scrolled by
|
williamr@2
|
440 |
* to make the specified item visible. The function returns 0 if no
|
williamr@2
|
441 |
* scrolling is needed. @c ScrollToMakeItemVisible() uses this function.
|
williamr@2
|
442 |
* @param aItemIndex Item to make visible.
|
williamr@2
|
443 |
* @return The number of columns to scroll, or zero if no scrolling is
|
williamr@2
|
444 |
* needed.
|
williamr@2
|
445 |
*/
|
williamr@2
|
446 |
IMPORT_C virtual TInt CalculateHScrollOffsetSoItemIsVisible(TInt aItemIndex);
|
williamr@2
|
447 |
|
williamr@2
|
448 |
/**
|
williamr@2
|
449 |
* Gets the size of the specified item.
|
williamr@2
|
450 |
* @param aItemIndex=0 The index of the item whose size this call is to get.
|
williamr@2
|
451 |
* @return @c TSize The size of the item in pixels.
|
williamr@2
|
452 |
*/
|
williamr@2
|
453 |
IMPORT_C virtual TSize ItemSize(TInt aItemIndex=0) const;
|
williamr@2
|
454 |
|
williamr@2
|
455 |
/**
|
williamr@2
|
456 |
* Converts an item index into the (row, column) pair describing that item.
|
williamr@2
|
457 |
* @param aItemIndex The item index.
|
williamr@2
|
458 |
* @param aRowIndex Reference to the row index.
|
williamr@2
|
459 |
* @param aColIndex Reference the column index.
|
williamr@2
|
460 |
*/
|
williamr@2
|
461 |
IMPORT_C void CalcRowAndColIndexesFromItemIndex(TInt aItemIndex, TInt& aRowIndex, TInt& aColIndex) const;
|
williamr@2
|
462 |
|
williamr@2
|
463 |
/**
|
williamr@2
|
464 |
* This function converts a row/column pair into the item index for that
|
williamr@2
|
465 |
* item.
|
williamr@2
|
466 |
* @param aItemIndex Reference to the item index.
|
williamr@2
|
467 |
* @param aRowIndex Row index of the item.
|
williamr@2
|
468 |
* @param aColIndex Column index of the item.
|
williamr@2
|
469 |
*/
|
williamr@2
|
470 |
IMPORT_C void CalcItemIndexFromRowAndColIndexes(TInt& aItemIndex, TInt aRowIndex, TInt aColIndex) const;
|
williamr@2
|
471 |
|
williamr@2
|
472 |
protected: // code moved from CSnakingListBoxView
|
williamr@2
|
473 |
/**
|
williamr@2
|
474 |
* This function draws every item in every column between the start and end
|
williamr@2
|
475 |
* columns inclusively.
|
williamr@2
|
476 |
* @param aStartColIndex The first column to draw.
|
williamr@2
|
477 |
* @param aEndColIndex The last column to draw.
|
williamr@2
|
478 |
*/
|
williamr@2
|
479 |
IMPORT_C void DrawColumnRange(TInt aStartColIndex, TInt aEndColIndex) const;
|
williamr@2
|
480 |
|
williamr@2
|
481 |
/**
|
williamr@2
|
482 |
* This function clears each item’s rectangle between the specified start
|
williamr@2
|
483 |
* and finish item’s indexes.
|
williamr@2
|
484 |
* @param aStartItemIndex The first item to clear.
|
williamr@2
|
485 |
* @param aEndItemIndex The last item to clear.
|
williamr@2
|
486 |
*/
|
williamr@2
|
487 |
IMPORT_C void ClearUnusedItemSpace(TInt aStartItemIndex, TInt aEndItemIndex) const;
|
williamr@2
|
488 |
|
williamr@2
|
489 |
/**
|
williamr@2
|
490 |
* This function updates the horizontal scroll offset (iHScrollOffset)
|
williamr@2
|
491 |
* based on the top item’s index. This function is called internally by
|
williamr@2
|
492 |
* @c CEikSnakingListBoxes when needed.
|
williamr@2
|
493 |
*/
|
williamr@2
|
494 |
IMPORT_C void UpdateHScrollOffsetBasedOnTopItemIndex();
|
williamr@2
|
495 |
|
williamr@2
|
496 |
protected:
|
williamr@2
|
497 |
/**
|
williamr@2
|
498 |
* This inline function is grid model helper.
|
williamr@2
|
499 |
* @return A pointer to @c CAknGridM object.
|
williamr@2
|
500 |
*/
|
williamr@2
|
501 |
inline CAknGridM* GridModel() const;
|
williamr@2
|
502 |
|
williamr@2
|
503 |
/**
|
williamr@2
|
504 |
* This function handles movement routines.
|
williamr@2
|
505 |
* @param aCursorMovement Handles cursor movements etc. @c ECursorNextItem
|
williamr@2
|
506 |
* and @c ECursorPreviousItem.
|
williamr@2
|
507 |
* @param aSelectionMode Modes for modifying the selection.
|
williamr@2
|
508 |
*/
|
williamr@2
|
509 |
IMPORT_C void DoMoveL(TCursorMovement aCursorMovement, TSelectionMode aSelectionMode);
|
williamr@2
|
510 |
|
williamr@2
|
511 |
private:
|
williamr@2
|
512 |
// movement handling routines
|
williamr@2
|
513 |
IMPORT_C TInt SearchByLines(TInt aX, TInt aY, TCursorMovement aCursorMovement, TBool aBeginSearchOnIndex = EFalse);
|
williamr@2
|
514 |
IMPORT_C TInt FindNextItem(TInt aItemIndex, TBool aLookDown, TBool aLookRight, TBool aFirstLookHorizontal, TBool aBeginSearchOnIndex = EFalse);
|
williamr@2
|
515 |
TBool IsEdgePassed(TInt aItemIndex, TBool aLookDown, TBool aLookRight, TBool aFirstLookHorizontal, TBool aBeginSearchOnIndex, TInt& aNewIndex);
|
williamr@2
|
516 |
|
williamr@2
|
517 |
TBool IsMoveRight(TCursorMovement aCursorMovement);
|
williamr@2
|
518 |
TBool IsMoveDown(TCursorMovement aCursorMovement);
|
williamr@2
|
519 |
private: // overridden from CListBoxView
|
williamr@2
|
520 |
IMPORT_C virtual TAny* Reserved_1();
|
williamr@2
|
521 |
|
williamr@2
|
522 |
private:
|
williamr@2
|
523 |
|
williamr@2
|
524 |
/**
|
williamr@2
|
525 |
* Draws the portion of the grid view rectangle that contains no items.
|
williamr@2
|
526 |
*/
|
williamr@2
|
527 |
void DrawUnusedViewPortion() const;
|
williamr@2
|
528 |
|
williamr@2
|
529 |
private:
|
williamr@2
|
530 |
TScrollingType iScrollingType;
|
williamr@2
|
531 |
TScrollingType iScrollInSecondaryDimension;
|
williamr@2
|
532 |
|
williamr@2
|
533 |
SGrid iGridDetails;
|
williamr@2
|
534 |
TInt iSpare[2];
|
williamr@2
|
535 |
};
|
williamr@2
|
536 |
|
williamr@2
|
537 |
inline CAknGridM* CAknGridView::GridModel() const
|
williamr@2
|
538 |
{
|
williamr@2
|
539 |
return STATIC_CAST(CAknGridM*,iModel);
|
williamr@2
|
540 |
}
|
williamr@2
|
541 |
|
williamr@2
|
542 |
inline TInt CAknGridView::ColumnWidth() const
|
williamr@2
|
543 |
{ return iGridDetails.iSizeOfItems.iWidth; }
|
williamr@2
|
544 |
|
williamr@2
|
545 |
#endif // __AKNGRIDVIEW_H__
|