10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: CMmGrid declaration |
14 * Description: CMmGrid declaration |
15 * Version : %version: MM_32.1.23 % << Don't touch! Updated by Synergy at check-out. |
15 * Version : %version: MM_32.1.24 % << Don't touch! Updated by Synergy at check-out. |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 |
19 |
20 #ifndef C_MMGRID_H |
20 #ifndef C_MMGRID_H |
21 #define C_MMGRID_H |
21 #define C_MMGRID_H |
22 |
22 |
23 #include <e32std.h> |
23 #include <e32std.h> |
24 #include <e32base.h> |
24 #include <e32base.h> |
25 #include <AknGrid.h> |
25 #include <AknGrid.h> |
26 |
26 |
27 class CMmGridModel; |
27 class CMmGridModel; |
28 class CMmListBoxItemDrawer; |
28 class CMmListBoxItemDrawer; |
29 class CMmMarqueeAdapter; |
29 class CMmMarqueeAdapter; |
30 class CMmWidgetContainer; |
30 class CMmWidgetContainer; |
31 class CMmTemplateLibrary; |
31 class CMmTemplateLibrary; |
32 |
32 |
33 /** |
33 /** |
34 * Multimedia Menu Grid Widget |
34 * Multimedia Menu Grid Widget |
35 * |
35 * |
36 * @code |
36 * @code |
37 * @endcode |
37 * @endcode |
38 * @lib mmwidgets |
38 * @lib mmwidgets |
39 * @since S60 v3.0 |
39 * @since S60 v3.0 |
40 * @ingroup group_mmwidgets |
40 * @ingroup group_mmwidgets |
41 */ |
41 */ |
42 NONSHARABLE_CLASS( CMmGrid ) : public CAknGrid |
42 NONSHARABLE_CLASS( CMmGrid ) : public CAknGrid |
43 { |
43 { |
44 public: |
44 public: |
45 |
45 |
46 /** |
46 /** |
47 * Two-phased constructor. |
47 * Two-phased constructor. |
48 * |
48 * |
49 * @param aParent Parent control. |
49 * @param aParent Parent control. |
50 * @param aFlags Additional Flags. |
50 * @param aFlags Additional Flags. |
51 * @param aTemplateLibrary Template library for drawer. |
51 * @param aTemplateLibrary Template library for drawer. |
52 */ |
52 */ |
53 static CMmGrid* NewL( const CCoeControl* aParent, TInt aFlags, |
53 static CMmGrid* NewL( const CCoeControl* aParent, TInt aFlags, |
54 CMmTemplateLibrary* aTemplateLibrary ); |
54 CMmTemplateLibrary* aTemplateLibrary ); |
55 |
55 |
56 /** |
56 /** |
57 * Two-phased constructor. |
57 * Two-phased constructor. |
58 * |
58 * |
59 * @param aParent Parent control. |
59 * @param aParent Parent control. |
60 * @param aFlags Additional Flags. |
60 * @param aFlags Additional Flags. |
61 * @param aTemplateLibrary Template library for drawer. |
61 * @param aTemplateLibrary Template library for drawer. |
62 */ |
62 */ |
63 static CMmGrid* NewLC(const CCoeControl* aParent, TInt aFlags, |
63 static CMmGrid* NewLC(const CCoeControl* aParent, TInt aFlags, |
64 CMmTemplateLibrary* aTemplateLibrary ); |
64 CMmTemplateLibrary* aTemplateLibrary ); |
65 |
65 |
66 /** |
66 /** |
67 * Destructor. |
67 * Destructor. |
68 */ |
68 */ |
69 virtual ~CMmGrid(); |
69 virtual ~CMmGrid(); |
70 |
70 |
73 * |
73 * |
74 * @since S60 v3.0 |
74 * @since S60 v3.0 |
75 * @param aRect Rect within which grid should be drawn. |
75 * @param aRect Rect within which grid should be drawn. |
76 */ |
76 */ |
77 void Draw( const TRect& aRect ) const; |
77 void Draw( const TRect& aRect ) const; |
78 |
78 |
79 /** |
79 /** |
80 * Draws the grid view. |
80 * Draws the grid view. |
81 * |
81 * |
82 * @since S60 v5.0 |
82 * @since S60 v5.0 |
83 */ |
83 */ |
84 void DrawView(); |
84 void DrawView(); |
85 |
85 |
86 /** |
86 /** |
87 * Creates the item drawer for grid. |
87 * Creates the item drawer for grid. |
88 * |
88 * |
89 * @since S60 v3.0 |
89 * @since S60 v3.0 |
90 */ |
90 */ |
91 void CreateItemDrawerL(); |
91 void CreateItemDrawerL(); |
92 |
92 |
93 /** |
93 /** |
94 * Creates the item drawer for grid. |
94 * Creates the item drawer for grid. |
95 * |
95 * |
96 * @param aTemplateLibrary Template library for drawer. |
96 * @param aTemplateLibrary Template library for drawer. |
97 * @since S60 v3.0 |
97 * @since S60 v3.0 |
98 */ |
98 */ |
99 void CreateItemDrawerL( CMmTemplateLibrary* aTemplateLibrary ); |
99 void CreateItemDrawerL( CMmTemplateLibrary* aTemplateLibrary ); |
100 |
100 |
101 /** |
101 /** |
102 * Creates the view class instance for grid. |
102 * Creates the view class instance for grid. |
103 * |
103 * |
104 * @since S60 v3.0 |
104 * @since S60 v3.0 |
105 * @return Griv view. |
105 * @return Griv view. |
106 */ |
106 */ |
107 CListBoxView* MakeViewClassInstanceL(); |
107 CListBoxView* MakeViewClassInstanceL(); |
108 |
108 |
109 /** |
109 /** |
110 * Handles scrolling event. |
110 * Handles scrolling event. |
111 * |
111 * |
112 * @since S60 v3.0 |
112 * @since S60 v3.0 |
113 * @param aScrollBar Scrollbar being scrolled. |
113 * @param aScrollBar Scrollbar being scrolled. |
114 * @param aEventType Type of scrollbar event. |
114 * @param aEventType Type of scrollbar event. |
115 */ |
115 */ |
116 void HandleScrollEventL( CEikScrollBar* aScrollBar, |
116 void HandleScrollEventL( CEikScrollBar* aScrollBar, |
117 TEikScrollEvent aEventType ); |
117 TEikScrollEvent aEventType ); |
118 |
118 |
119 /** |
119 /** |
120 * Handles pointer event. |
120 * Handles pointer event. |
121 * |
121 * |
122 * @since S60 v3.0 |
122 * @since S60 v3.0 |
123 * @param aPointerEvent Type of pointer event. |
123 * @param aPointerEvent Type of pointer event. |
124 */ |
124 */ |
125 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
125 void HandlePointerEventL( const TPointerEvent& aPointerEvent ); |
126 |
126 |
127 /** |
127 /** |
128 * Sets item drawer and view background context. |
128 * Sets item drawer and view background context. |
129 * |
129 * |
130 * @since S60 v3.0 |
130 * @since S60 v3.0 |
131 * @param aBgContext Background context to be set in view and item drawer. |
131 * @param aBgContext Background context to be set in view and item drawer. |
132 */ |
132 */ |
133 void SetItemDrawerAndViewBgContext( |
133 void SetItemDrawerAndViewBgContext( |
134 CAknsBasicBackgroundControlContext* aBgContext ); |
134 CAknsBasicBackgroundControlContext* aBgContext ); |
135 |
135 |
136 /** |
136 /** |
137 * Handles changes in scrollbar visibility. |
137 * Handles changes in scrollbar visibility. |
138 * |
138 * |
139 * @since S60 v3.0 |
139 * @since S60 v3.0 |
140 */ |
140 */ |
141 TBool HandleScrollbarVisibilityChangeL(); |
141 TBool HandleScrollbarVisibilityChangeL(); |
142 |
142 |
143 /** |
143 /** |
144 * Checks if all items from model fit in given rectangle. |
144 * Checks if all items from model fit in given rectangle. |
145 * |
145 * |
146 * @since S60 v3.0 |
146 * @since S60 v3.0 |
147 * @return Do items fit in view rectangle. |
147 * @return Do items fit in view rectangle. |
148 */ |
148 */ |
149 TBool AllItemsFitInViewRect(); |
149 TBool AllItemsFitInViewRect(); |
150 |
150 |
151 /** |
151 /** |
152 * Updates scrollbar changes. |
152 * Updates scrollbar changes. |
153 * |
153 * |
154 * @since S60 v3.0 |
154 * @since S60 v3.0 |
155 */ |
155 */ |
156 void UpdateScrollBarsL(); |
156 void UpdateScrollBarsL(); |
157 |
157 |
158 /** |
158 /** |
159 * Sets the marquee adapter. |
159 * Sets the marquee adapter. |
160 * |
160 * |
161 * @since S60 v3.0 |
161 * @since S60 v3.0 |
162 * @param aAdapter Marquee adapter. |
162 * @param aAdapter Marquee adapter. |
163 */ |
163 */ |
164 void SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ); |
164 void SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ); |
165 |
165 |
166 /** |
166 /** |
167 * Sets up the layout (orientation and items' sizes). |
167 * Sets up the layout (orientation and items' sizes). |
168 * |
168 * |
169 * @since S60 v3.0 |
169 * @since S60 v3.0 |
170 */ |
170 */ |
173 /** |
173 /** |
174 * Gets the Grid model. |
174 * Gets the Grid model. |
175 * |
175 * |
176 * @since S60 v3.0 |
176 * @since S60 v3.0 |
177 * @return Grid model. |
177 * @return Grid model. |
178 */ |
178 */ |
179 CMmGridModel * MmModel(); |
179 CMmGridModel * MmModel(); |
180 |
180 |
181 /** |
181 /** |
182 * This function from @c CAknGrid handles key events. |
182 * This function from @c CAknGrid handles key events. |
183 * |
183 * |
184 * It has been overridden to allow for correct handling of |
184 * It has been overridden to allow for correct handling of |
185 * left and right rocker keys when mirrored layout is used. |
185 * left and right rocker keys when mirrored layout is used. |
186 * |
186 * |
187 * @param aKeyEvent event to handle |
187 * @param aKeyEvent event to handle |
188 * @param aType type of the key event |
188 * @param aType type of the key event |
189 * @return response code ( @c EKeyWasConsumed, @c EKeyWasNotConsumed ) |
189 * @return response code ( @c EKeyWasConsumed, @c EKeyWasNotConsumed ) |
190 */ |
190 */ |
191 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
191 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); |
192 |
192 |
193 /** |
193 /** |
194 * This function from CAknGrid is overriden to make grid |
194 * This function from CAknGrid is overriden to make grid |
195 * behavior correct in the mirrored layout. |
195 * behavior correct in the mirrored layout. |
196 * Please note that it is necessary because of the hackish |
196 * Please note that it is necessary because of the hackish |
197 * solution used to draw items in mirrored layout. |
197 * solution used to draw items in mirrored layout. |
198 */ |
198 */ |
199 void HandleViewRectSizeChangeL(); |
199 void HandleViewRectSizeChangeL(); |
200 |
200 |
201 /** |
201 /** |
202 * Overridden function from CAknGrid. |
202 * Overridden function from CAknGrid. |
203 */ |
203 */ |
204 void AdjustTopItemIndex() const; |
204 void AdjustTopItemIndex() const; |
205 |
205 |
206 /** |
206 /** |
207 * Set the vertical item offset; |
207 * Set the vertical item offset; |
208 * @param aOffset The offset to set to the widget. |
208 * @param aOffset The offset to set to the widget. |
209 * |
209 * |
210 * @since S60 v5.0 |
210 * @since S60 v5.0 |
211 */ |
211 */ |
212 void SetVerticalItemOffset( TInt aOffset ); |
212 void SetVerticalItemOffset( TInt aOffset ); |
213 |
213 |
214 /** |
214 /** |
215 * Gets the current widget vertical item offset. |
215 * Gets the current widget vertical item offset. |
216 * |
216 * |
217 * @since S60 v5.0 |
217 * @since S60 v5.0 |
218 * @return The current widget vertical item offset. |
218 * @return The current widget vertical item offset. |
219 */ |
219 */ |
220 TInt VerticalItemOffset() const; |
220 TInt VerticalItemOffset() const; |
221 |
221 |
222 /** |
222 /** |
223 * Simply sets the item height members in widget and view. |
223 * Simply sets the item height members in widget and view. |
224 */ |
224 */ |
225 void SetItemHeight( TInt aItemHeight ); |
225 void SetItemHeight( TInt aItemHeight ); |
226 |
226 |
229 */ |
229 */ |
230 void UpdateScrollBarThumbs(); |
230 void UpdateScrollBarThumbs(); |
231 |
231 |
232 /** |
232 /** |
233 * Counts the number of component controls which this component owns. |
233 * Counts the number of component controls which this component owns. |
234 */ |
234 */ |
235 TInt CountComponentControls() const; |
235 TInt CountComponentControls() const; |
236 |
236 |
237 /** |
237 /** |
238 * Disables/enables child component (scrollbar) drawing. |
238 * Disables/enables child component (scrollbar) drawing. |
239 */ |
239 */ |
240 void SetDisableChildComponentDrawing( TBool aDisable ); |
240 void SetDisableChildComponentDrawing( TBool aDisable ); |
241 |
241 |
242 private: |
242 private: |
243 /** |
243 /** |
244 * Default constructor. |
244 * Default constructor. |
245 * |
245 * |
246 * @since S60 v3.0 |
246 * @since S60 v3.0 |
247 */ |
247 */ |
248 CMmGrid(); |
248 CMmGrid(); |
249 |
249 |
250 /** |
250 /** |
251 * 2nd phase constructor. |
251 * 2nd phase constructor. |
252 * |
252 * |
253 * @since S60 v3.0 |
253 * @since S60 v3.0 |
254 * @param aParent Parent control. |
254 * @param aParent Parent control. |
255 * @param aFlags Additional Flags. |
255 * @param aFlags Additional Flags. |
256 * @param aTemplateLibrary Template library for drawer. |
256 * @param aTemplateLibrary Template library for drawer. |
257 */ |
257 */ |
258 void ConstructL( const CCoeControl* aParent, TInt aFlags, |
258 void ConstructL( const CCoeControl* aParent, TInt aFlags, |
259 CMmTemplateLibrary* aTemplateLibrary ); |
259 CMmTemplateLibrary* aTemplateLibrary ); |
260 |
260 |
261 /** |
261 /** |
262 * Handles changes in resource. |
262 * Handles changes in resource. |
263 * |
263 * |
264 * @since S60 v3.0 |
264 * @since S60 v3.0 |
265 * @param aIsLandscape Is orientation in landscape mode. |
265 * @param aIsLandscape Is orientation in landscape mode. |
266 * @param aCellSize The size of grid cell/item. |
266 * @param aCellSize The size of grid cell/item. |
267 * @param aViewLayout The layout of the grid (e.g. 3x4). |
267 * @param aViewLayout The layout of the grid (e.g. 3x4). |
268 */ |
268 */ |
269 void DoHandleResourceChangeL( TBool aIsLandscape, TSize& aCellSize, |
269 void DoHandleResourceChangeL( TBool aIsLandscape, TSize& aCellSize, |
270 TSize& aViewLayout ); |
270 TSize& aViewLayout ); |
271 |
271 |
272 /** |
272 /** |
273 * Handles changes in resource. |
273 * Handles changes in resource. |
274 * |
274 * |
275 * @since S60 v3.0 |
275 * @since S60 v3.0 |
276 * @param aCellSize The size of grid cell/item. |
276 * @param aCellSize The size of grid cell/item. |
277 * @param aViewLayout The layout of the grid (e.g. 3x4). |
277 * @param aViewLayout The layout of the grid (e.g. 3x4). |
278 */ |
278 */ |
279 void DoHandleResourceChangeL( TSize& aCellSize, |
279 void DoHandleResourceChangeL( TSize& aCellSize, |
280 TSize& aViewLayout ); |
280 TSize& aViewLayout ); |
281 |
281 |
282 /** |
282 /** |
283 * Sets up the layout (for use in non-leaving SetupLayout()) |
283 * Sets up the layout (for use in non-leaving SetupLayout()) |
284 * |
284 * |
285 * @since S60 v3.0 |
285 * @since S60 v3.0 |
286 */ |
286 */ |
287 void DoSetupLayoutL(); |
287 void DoSetupLayoutL(); |
288 |
288 |
289 /** |
289 /** |
290 * Handles pointer events when edit mode is enabled. |
290 * Handles pointer events when edit mode is enabled. |
291 * |
291 * |
292 * This method is only called during edit mode. It selectively passes |
292 * This method is only called during edit mode. It selectively passes |
293 * only some of the pointer events to CAknGrid::HandlePointerEventL |
293 * only some of the pointer events to CAknGrid::HandlePointerEventL |
294 * in order to disable flicking and panning. |
294 * in order to disable flicking and panning. |
295 * |
295 * |
296 * @param aPointerEvent pointer event |
296 * @param aPointerEvent pointer event |
297 */ |
297 */ |
298 void HandlePointerEventInEditModeL( const TPointerEvent& aPointerEvent ); |
298 void HandlePointerEventInEditModeL( const TPointerEvent& aPointerEvent ); |
299 |
299 |
300 /** |
300 /** |
301 * Handles pointer events when edit mode is disabled. |
301 * Handles pointer events when edit mode is disabled. |
302 * |
302 * |
303 * @param aPointerEvent pointer event |
303 * @param aPointerEvent pointer event |
304 */ |
304 */ |
305 void HandlePointerEventInNormalModeL( const TPointerEvent& aPointerEvent ); |
305 void HandlePointerEventInNormalModeL( const TPointerEvent& aPointerEvent ); |
306 |
306 |
307 /** |
|
308 * Handles button repeat event in normal mode. |
|
309 * |
|
310 * Such event is requested when handling button1down event so that |
|
311 * certain actions (i.e. setting highlight visibility) can be made |
|
312 * with a small delay - this improves menu behavior on flicking. |
|
313 * |
|
314 * @param aPointerEvent pointer event |
|
315 */ |
|
316 void HandleButtonRepeatEventInNormalModeL( const TPointerEvent& aPointerEvent ); |
|
317 |
|
318 /** |
307 /** |
319 * Scrolls the view if pointer is close to the top/bottom edge. |
308 * Scrolls the view if pointer is close to the top/bottom edge. |
320 * |
309 * |
321 * This method is used only when edit mode is active. In a way it |
310 * This method is used only when edit mode is active. In a way it |
322 * brings back the focus based scrolling behavior that was present |
311 * brings back the focus based scrolling behavior that was present |
323 * in CAknGrid before ODE scrolling was introduced. |
312 * in CAknGrid before ODE scrolling was introduced. |
324 */ |
313 */ |
325 void HandleScrollingInEditMode( const TPointerEvent& aPointerEvent ); |
314 void HandleScrollingInEditMode( const TPointerEvent& aPointerEvent ); |
326 |
315 |
327 /** |
316 /** |
328 * Checks if pointer position is within the scroll-triggering area. |
317 * Checks if pointer position is within the scroll-triggering area. |
329 * |
318 * |
330 * @param aPointerEvent pointer event |
319 * @param aPointerEvent pointer event |
331 * @return true if pointer above the top scrolling threshold. |
320 * @return true if pointer above the top scrolling threshold. |
332 */ |
321 */ |
333 TBool IsPointerInTopScrollingThreshold( |
322 TBool IsPointerInTopScrollingThreshold( |
334 const TPointerEvent& aPointerEvent ) const; |
323 const TPointerEvent& aPointerEvent ) const; |
335 |
324 |
336 /** |
325 /** |
337 * Checks if pointer position is within the scroll-triggering area. |
326 * Checks if pointer position is within the scroll-triggering area. |
338 * |
327 * |
339 * @param aPointerEvent pointer event |
328 * @param aPointerEvent pointer event |
340 * @return true if pointer below the bottom scrolling threshold. |
329 * @return true if pointer below the bottom scrolling threshold. |
341 */ |
330 */ |
342 TBool IsPointerInBottomScrollingThreshold( |
331 TBool IsPointerInBottomScrollingThreshold( |
343 const TPointerEvent& aPointerEvent ) const; |
332 const TPointerEvent& aPointerEvent ) const; |
344 |
333 |
345 /** |
334 /** |
346 * Scrolls the view if the pointer is near top/bottom edge of the screen. |
335 * Scrolls the view if the pointer is near top/bottom edge of the screen. |
347 * |
336 * |
348 * Assumes that current item index is the index of the item under the |
337 * Assumes that current item index is the index of the item under the |
349 * pointer. The time value returned is based on the distance of the pointer |
338 * pointer. The time value returned is based on the distance of the pointer |
350 * from the top/bottom edge of the grid view (this makes the scrolling speed |
339 * from the top/bottom edge of the grid view (this makes the scrolling speed |
351 * dependent of how close the pointer is to the edge). |
340 * dependent of how close the pointer is to the edge). |
352 * If there is no need to continue scrolling because the beginning/end of |
341 * If there is no need to continue scrolling because the beginning/end of |
353 * the list has already been reached, 0 is returned. |
342 * the list has already been reached, 0 is returned. |
354 * |
343 * |
355 * @param aPointerEvent pointer event |
344 * @param aPointerEvent pointer event |
356 * @return time to wait before calling this method again (in microseconds) |
345 * @return time to wait before calling this method again (in microseconds) |
357 * or 0 if already at the beginning/end of the list |
346 * or 0 if already at the beginning/end of the list |
358 */ |
347 */ |
359 TInt ScrollIfNeeded( const TPointerEvent& aPointerEvent ); |
348 TInt ScrollIfNeeded( const TPointerEvent& aPointerEvent ); |
360 |
349 |
361 /** |
350 /** |
362 * Minimal scrolling (setting top item index and vertical offset) with |
351 * Minimal scrolling (setting top item index and vertical offset) with |
363 * boundary checking and WITHOUT redrawing. |
352 * boundary checking and WITHOUT redrawing. |
364 * |
353 * |
365 * @param aDistanceInPixels Distance to scroll. |
354 * @param aDistanceInPixels Distance to scroll. |
366 */ |
355 */ |
367 void ScrollWithoutRedraw( TInt aDistanceInPixels ); |
356 void ScrollWithoutRedraw( TInt aDistanceInPixels ); |
368 |
357 |
369 /** |
358 /** |
370 * Updates the dispapearing highlight. |
359 * Updates the dispapearing highlight. |
371 * |
360 * |
372 * @since S60 v3.0 |
361 * @since S60 v3.0 |
373 * @param aPointerEvent Type of pointer event. |
362 * @param aPointerEvent Type of pointer event. |
380 * used and scrollbar is visible by shifting ViewRect to the right. |
369 * used and scrollbar is visible by shifting ViewRect to the right. |
381 * Also disabled background drawing for scrollbar as it would not |
370 * Also disabled background drawing for scrollbar as it would not |
382 * be drawn correctly in mirrored layout. |
371 * be drawn correctly in mirrored layout. |
383 */ |
372 */ |
384 void FixViewForMirroredLayout(); |
373 void FixViewForMirroredLayout(); |
385 |
374 |
386 /** |
375 /** |
387 * Gets the offset margin of scrollbar related to view rectangle. |
376 * Gets the offset margin of scrollbar related to view rectangle. |
388 * |
377 * |
389 * @return The distance from view rect side to scrollbar. |
378 * @return The distance from view rect side to scrollbar. |
390 */ |
379 */ |
391 TInt ScrollBarOffset(); |
380 TInt ScrollBarOffset(); |
392 |
381 |
393 /** |
382 /** |
394 * Redraws the background under the vertical scrollbar in mirrored layout. |
383 * Redraws the background under the vertical scrollbar in mirrored layout. |
395 * |
384 * |
396 * The reason such method is needed is that view rectangle is shifted |
385 * The reason such method is needed is that view rectangle is shifted |
397 * to the right in mirrored layout and does not cover the scrollbar |
386 * to the right in mirrored layout and does not cover the scrollbar |
398 * area. In normal (non-mirrored) mode this method does nothing. |
387 * area. In normal (non-mirrored) mode this method does nothing. |
399 */ |
388 */ |
400 void RedrawScrollbarBackground() const; |
389 void RedrawScrollbarBackground() const; |
401 |
390 |
402 /** |
391 /** |
403 * Does actual handling of scroll events. |
392 * Does actual handling of scroll events. |
404 * |
393 * |
405 * @param aScrollBar Scrollbar being scrolled. |
394 * @param aScrollBar Scrollbar being scrolled. |
406 * @param aEventType Type of scrollbar event. |
395 * @param aEventType Type of scrollbar event. |
407 */ |
396 */ |
408 void ProcessScrollEventL( CEikScrollBar* aScrollBar, |
397 void ProcessScrollEventL( CEikScrollBar* aScrollBar, |
409 TEikScrollEvent aEventType ); |
398 TEikScrollEvent aEventType ); |
410 |
399 |
411 /** |
400 /** |
412 * Handles periodic events from @c iRedrawTimer. |
401 * Handles periodic events from @c iRedrawTimer. |
413 * Such events are generated at equal time intervals while |
402 * Such events are generated at equal time intervals while |
414 * the view is being scrolled using the scrollbar. |
403 * the view is being scrolled using the scrollbar. |
415 * This function typically calls @c ProcessScrollEventL, |
404 * This function typically calls @c ProcessScrollEventL, |
416 * which actually scrolls the view and causes a redraw. |
405 * which actually scrolls the view and causes a redraw. |
417 */ |
406 */ |
418 void HandleRedrawTimerEventL(); |
407 void HandleRedrawTimerEventL(); |
419 |
408 |
420 private: |
409 private: |
421 /** |
410 /** |
422 * Callback function for @c iRedrawTimer. |
411 * Callback function for @c iRedrawTimer. |
423 * It simply calls @c HandleRedrawTimerEventL and returns 0. |
412 * It simply calls @c HandleRedrawTimerEventL and returns 0. |
424 * |
413 * |
425 * @param aPtr A pointer to CMmGrid object. |
414 * @param aPtr A pointer to CMmGrid object. |
426 * @return 0 (always). |
415 * @return 0 (always). |
427 */ |
416 */ |
428 static TInt RedrawTimerCallback( TAny* aPtr ); |
417 static TInt RedrawTimerCallback( TAny* aPtr ); |
429 |
418 |
430 private: |
419 private: |
431 /** |
420 /** |
432 * Grid model. |
421 * Grid model. |
433 */ |
422 */ |
434 CMmGridModel* iMmModel; |
423 CMmGridModel* iMmModel; |
435 |
424 |
436 /** |
425 /** |
437 * Item drawer. |
426 * Item drawer. |
438 */ |
427 */ |
439 CMmListBoxItemDrawer* iMmDrawer; |
428 CMmListBoxItemDrawer* iMmDrawer; |
440 |
429 |
441 /** |
430 /** |
442 * Marquee adapter. |
431 * Marquee adapter. |
443 */ |
432 */ |
444 CMmMarqueeAdapter* iMarqueeAdapter; |
433 CMmMarqueeAdapter* iMarqueeAdapter; |
445 |
434 |
446 /** |
435 /** |
447 * Scrollbar visibility flag. |
436 * Scrollbar visibility flag. |
448 */ |
437 */ |
449 TBool iScrollbarVisibilityChanged; |
438 TBool iScrollbarVisibilityChanged; |
450 |
439 |
451 /** |
440 /** |
452 * Item index which is current in grid. |
441 * Item index which is current in grid. |
453 */ |
442 */ |
454 TInt iCurrentItemIndex; |
443 TInt iCurrentItemIndex; |
455 |
444 |
456 /** |
445 /** |
457 * Currently top view item index. |
446 * Currently top view item index. |
458 */ |
447 */ |
459 TInt iCurrentTopItemIndex; |
448 TInt iCurrentTopItemIndex; |
460 |
449 |
461 /** |
450 /** |
462 * Layout of grid. |
451 * Layout of grid. |
463 */ |
452 */ |
464 TSize iViewLayout; |
453 TSize iViewLayout; |
465 |
454 |
466 /** |
455 /** |
467 * A flag that indicates that highlight is visible because |
456 * A flag that indicates that highlight is visible because |
468 * the user is pressing the screen (continuously) and that |
457 * the user is pressing the screen (continuously) and that |
469 * highlight should remain visible only as long as the screen |
458 * highlight should remain visible only as long as the screen |
470 * is being pressed. |
459 * is being pressed. |
471 */ |
460 */ |
472 TBool iHighlightVisibleUntilButton1Up; |
461 TBool iHighlightVisibleUntilButton1Up; |
473 |
462 |
474 /** |
463 /** |
475 * Blocks scrollbar drawing. When this flag is set scrollbars components |
464 * Blocks scrollbar drawing. When this flag is set scrollbars components |
476 * are blocked in the CountComponentControls() method; |
465 * are blocked in the CountComponentControls() method; |
477 */ |
466 */ |
478 TBool iDisableChildComponentDrawing; |
467 TBool iDisableChildComponentDrawing; |
479 |
468 |
480 /** |
469 /** |
481 * This member is only used in edit mode to store the position of the pointer |
470 * This member is only used in edit mode to store the position of the pointer |
482 * during EButton1Down event. |
471 * during EButton1Down event. |
483 */ |
472 */ |
484 TPoint iButton1DownPos; |
473 TPoint iButton1DownPos; |
485 |
474 |
486 /** |
475 /** |
487 * ETrue if the view is being scrolled with the scrollbar. |
476 * ETrue if the view is being scrolled with the scrollbar. |
488 */ |
477 */ |
489 TBool iScrollbarThumbIsBeingDragged; |
478 TBool iScrollbarThumbIsBeingDragged; |
490 |
479 |
491 /** |
480 /** |
492 * Stores the number of scrollbar events that were ignored. |
481 * Stores the number of scrollbar events that were ignored. |
493 * It is only used while scrolling the view using scrollbar, |
482 * It is only used while scrolling the view using scrollbar, |
494 * in such situation the scroll events that this object receives |
483 * in such situation the scroll events that this object receives |
495 * are ignored, and actual scrolling is done only when |
484 * are ignored, and actual scrolling is done only when |
496 * iRedrawTimer completes. |
485 * iRedrawTimer completes. |
497 */ |
486 */ |
498 TInt iSkippedScrollbarEventsCount; |
487 TInt iSkippedScrollbarEventsCount; |
499 |
488 |
500 /** |
489 /** |
501 * A timer that initiates redraws at certain time intervals. |
490 * A timer that initiates redraws at certain time intervals. |
502 * It is used to refresh the view while scrolling with |
491 * It is used to refresh the view while scrolling with |
503 * the scrollbar. |
492 * the scrollbar. |
504 */ |
493 */ |