|
1 /* |
|
2 * Copyright (c) 2007 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 * Version : %version: MM_48.1.33 % << Don't touch! Updated by Synergy at check-out. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef MMMWIDGETCONTAINER_H |
|
21 #define MMMWIDGETCONTAINER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <AknDef.hrh> |
|
25 #include <e32std.h> |
|
26 #include <e32base.h> |
|
27 #include <eiklbx.h> |
|
28 #include <coecntrl.h> |
|
29 #include <AknsDrawUtils.h> |
|
30 #include <AknsLayeredBackgroundControlContext.h> |
|
31 #include <AknsListBoxBackgroundControlContext.h> |
|
32 #include <aknlongtapdetector.h> |
|
33 |
|
34 #include "hnsuiteobserver.h" |
|
35 #include "mmvisibilityobserver.h" |
|
36 #include "hnglobals.h" |
|
37 |
|
38 // CLASS DECLARATION |
|
39 class CHnSuiteModel; |
|
40 class CMmListBoxModel; |
|
41 class MEikListBoxObserver; |
|
42 class MMmKeyEventObserver; |
|
43 class MMmDragAndDropObserver; |
|
44 class MMmWidgetObserver; |
|
45 class CMatrixMenuAppUi; |
|
46 class CMmHighlightTimer; |
|
47 class CMmMarqueeAdapter; |
|
48 class CMmListBoxItemDrawer; |
|
49 class CMmTemplateLibrary; |
|
50 class CMmPostEvaluationProcessor; |
|
51 class MMmLongTapObserver; |
|
52 /** |
|
53 * Square of the distance the cursor has to be dragged from the current |
|
54 * position to really move the dragged item. |
|
55 */ |
|
56 const TInt KDragDelta( 640 ); |
|
57 |
|
58 /** |
|
59 * Structure used to store cache for widget position. |
|
60 * |
|
61 * @since S60 v5.0 |
|
62 * @ingroup group_mmwidgets |
|
63 */ |
|
64 class TMmWidgetPosition |
|
65 { |
|
66 public: |
|
67 /** |
|
68 * Default constructor. |
|
69 * Initializes member variables with sensible values. |
|
70 */ |
|
71 TMmWidgetPosition(); |
|
72 |
|
73 public: // data |
|
74 /** |
|
75 * The vertical item offset cache. |
|
76 */ |
|
77 TInt iVerticalItemOffset; |
|
78 |
|
79 /** |
|
80 * The top item index cache. |
|
81 */ |
|
82 TInt iTopItemIndex; |
|
83 |
|
84 /** |
|
85 * Tells if the cached values are valid. |
|
86 */ |
|
87 TBool iValid; |
|
88 |
|
89 /** |
|
90 * The mode (portrait/landscape) for which the cache is valid. |
|
91 */ |
|
92 TBool iLandscape; |
|
93 |
|
94 /** |
|
95 * Id from model (not index) of the currently highlighted item. |
|
96 * It should only be set if the currently highlighted item is |
|
97 * visible (fully or partially), otherwise it must remain |
|
98 * initialized to KErrNotFound. |
|
99 */ |
|
100 TInt iHighlightedItemId; |
|
101 }; |
|
102 |
|
103 /** |
|
104 * Interface for widget containers. |
|
105 * |
|
106 * @code |
|
107 * @endcode |
|
108 * @lib mmwidgets |
|
109 * @since S60 v3.0 |
|
110 * @ingroup group_mmwidgets |
|
111 */ |
|
112 |
|
113 NONSHARABLE_CLASS( CMmWidgetContainer ): public CCoeControl, |
|
114 public MMmVisibilityObserver, |
|
115 public MEikListBoxObserver, |
|
116 public MAknLongTapDetectorCallBack |
|
117 { |
|
118 public: |
|
119 |
|
120 /** |
|
121 * Creates a new grid container. |
|
122 * |
|
123 * @since S60 v3.0 |
|
124 * @param aRect Parent rectangle. |
|
125 * @param aObjectProvider Object provider. |
|
126 * @return GridContainer. |
|
127 */ |
|
128 IMPORT_C static CMmWidgetContainer* NewGridContainerL( const TRect& aRect, |
|
129 MObjectProvider* aObjectProvider, CMmTemplateLibrary* aTemplateLibrary ); |
|
130 |
|
131 /** |
|
132 * Creates a new listbox container. |
|
133 * |
|
134 * @since S60 v3.0 |
|
135 * @param aRect Parent rectangle. |
|
136 * @param aObjectProvider Object provider. |
|
137 * @param aTemplateLibrary Template library for drawer. |
|
138 * @return ListboxContainer. |
|
139 */ |
|
140 IMPORT_C static CMmWidgetContainer* NewListBoxContainerL( const TRect& aRect, |
|
141 MObjectProvider* aObjectProvider, CMmTemplateLibrary* aTemplateLibrary ); |
|
142 |
|
143 public: // Highlight related methods |
|
144 |
|
145 /** |
|
146 * Sets the default highlight. |
|
147 * |
|
148 * @since S60 v3.0 |
|
149 * @param aRedraw Is highlight to redraw. |
|
150 */ |
|
151 virtual void SetDefaultHighlightL( TBool aRedraw = ETrue ) = 0; |
|
152 |
|
153 /** |
|
154 * Sets the highlight. |
|
155 * |
|
156 * @since S60 v3.0 |
|
157 * @param aItemIndex Index to set the highlight at. |
|
158 * @param aRedraw Is highlight to redraw. |
|
159 */ |
|
160 IMPORT_C virtual void SetManualHighlightL(TInt aItemIndex, TBool aRedraw = ETrue ); |
|
161 |
|
162 /** |
|
163 * Gets the highlight from the widget. |
|
164 * |
|
165 * @since S60 v3.0 |
|
166 * @return Current Highlight in the widget. |
|
167 */ |
|
168 IMPORT_C virtual TInt GetHighlight(); |
|
169 |
|
170 /** |
|
171 * Gets the highlight from the widget. |
|
172 * |
|
173 * @since S60 v3.0 |
|
174 * @return Previous Highlight in the widget. |
|
175 */ |
|
176 IMPORT_C virtual TInt GetPreviousHighlight(); |
|
177 |
|
178 /** |
|
179 * Set highlight visibility. |
|
180 * |
|
181 * @since S60 v3.0 |
|
182 * @param aVisible Visibility status. |
|
183 */ |
|
184 IMPORT_C virtual void SetHighlightVisibilityL( TBool aVisible ); |
|
185 |
|
186 /** |
|
187 * Set highlight visibility. |
|
188 * |
|
189 * @since S60 v3.0 |
|
190 * @return Visibility status. |
|
191 */ |
|
192 IMPORT_C virtual TBool IsHighlightVisible(); |
|
193 |
|
194 /** |
|
195 * Handle item addition. |
|
196 * |
|
197 * @since S60 v3.0 |
|
198 */ |
|
199 IMPORT_C virtual void HandleItemAdditionL(); |
|
200 |
|
201 |
|
202 /** |
|
203 * Handle item removal. |
|
204 * |
|
205 * @since S60 v3.0 |
|
206 */ |
|
207 IMPORT_C virtual void HandleItemRemovalL(); |
|
208 |
|
209 /** |
|
210 * Handle item removal. |
|
211 * |
|
212 * @since S60 v3.0 |
|
213 */ |
|
214 IMPORT_C CHnSuiteModel* GetSuiteModelL(); |
|
215 |
|
216 /** |
|
217 * Retrieve type of widget. |
|
218 * |
|
219 * @since S60 v3.0 |
|
220 * @return Type of widget. |
|
221 */ |
|
222 IMPORT_C virtual THnSuiteWidgetType WidgetType(); |
|
223 |
|
224 /** |
|
225 * Removes all LIW objects owned by this object. |
|
226 * |
|
227 * LIW objects owned by non-LIW objects that are owned by |
|
228 * this object are also removed. |
|
229 */ |
|
230 virtual void RemoveLiwObjects(); |
|
231 |
|
232 /** |
|
233 * Checks if timer is active. |
|
234 * Calling this method without parameters will cause to return |
|
235 * timer activity state globally (without reference to a specific item index - which tells |
|
236 * if timer is active at all). |
|
237 * |
|
238 * @param aItemIndex Item index for which to check timer activity. Can be not defined. |
|
239 * @return ETrue if timer is active which means highlight is visible. |
|
240 */ |
|
241 TBool IsTimerActive( TInt aItemIndex = KErrNotFound ); |
|
242 |
|
243 /** |
|
244 * Sets the long tap observer. |
|
245 * |
|
246 * @param aObserver Observer to receive long tap events. |
|
247 */ |
|
248 IMPORT_C virtual void SetLongTapObserver( MMmLongTapObserver* aObserver ); |
|
249 |
|
250 /** |
|
251 * Handles top focus notification. This is called when we want to explicitly inform |
|
252 * the container that it is in top focus state (or not). |
|
253 * @param aIsTopFocus ETrue if container is in top focus. |
|
254 */ |
|
255 IMPORT_C virtual void HandleTopFocusL( TBool aIsTopFocus = ETrue ); |
|
256 |
|
257 /** |
|
258 * Is called when options menu visibility changes (hides or pops up) |
|
259 * @param aOptionsMenuVisible ETrue when option menu pops up. |
|
260 */ |
|
261 IMPORT_C virtual void HandleOptionsMenuVisibilityChangeL( |
|
262 TBool aOptionsMenuVisible ); |
|
263 public: |
|
264 |
|
265 /** |
|
266 * Sets suite model. |
|
267 * |
|
268 * @since S60 v3.0 |
|
269 * @param aModel Suite model. |
|
270 */ |
|
271 virtual void SetSuiteModelL( CHnSuiteModel* aModel ); |
|
272 |
|
273 /** |
|
274 * Gets Multimedia Menu model. |
|
275 * |
|
276 * @since S60 v3.0 |
|
277 * @return Model. |
|
278 */ |
|
279 virtual CMmListBoxModel* GetMmModel() = 0; |
|
280 |
|
281 /** |
|
282 * Sets widget observer. |
|
283 * |
|
284 * @since S60 v3.0 |
|
285 * @param aObserver Widget observer. |
|
286 */ |
|
287 IMPORT_C virtual void SetObserver( MMmWidgetObserver* aObserver); |
|
288 |
|
289 /** |
|
290 * Gets item rectangle according to item index. |
|
291 * |
|
292 * @since S60 v3.0 |
|
293 * @param aItemIndex Item index. |
|
294 * @return Item rectangle. |
|
295 */ |
|
296 IMPORT_C TRect GetItemRectL( TInt aItemIndex ); |
|
297 |
|
298 /** |
|
299 * Sets empty text visible when model has no items. |
|
300 * |
|
301 * @since S60 v3.0 |
|
302 * @param aText Text to be shown when view is empty. |
|
303 */ |
|
304 virtual void SetEmptyTextL(const TDesC& aText) = 0 ; |
|
305 |
|
306 /** |
|
307 * Sets flag. |
|
308 * |
|
309 * @since S60 v3.0 |
|
310 * @param Flag Flag. |
|
311 */ |
|
312 virtual void SetFlag(TInt Flag); |
|
313 |
|
314 /** |
|
315 * Gets widget. |
|
316 * |
|
317 * @since S60 v3.0 |
|
318 * @return Widget. |
|
319 */ |
|
320 virtual CEikListBox* Widget(); |
|
321 |
|
322 /** |
|
323 * Sets background context for item drawer and view. |
|
324 * |
|
325 * @since S60 v3.0 |
|
326 * @param aBgContext Background context. |
|
327 */ |
|
328 virtual void SetItemDrawerAndViewBgContext( |
|
329 CAknsBasicBackgroundControlContext * aBgContext ) =0; |
|
330 |
|
331 /** |
|
332 * Sets edit mode so UI is aware. |
|
333 * |
|
334 * @since S60 v3.0 |
|
335 * @param aIsEditMode Is edit mode. |
|
336 */ |
|
337 virtual void SetEditModeL( TBool aIsEditMode ); |
|
338 |
|
339 /** |
|
340 * Tells if UI is aware of edit mode. |
|
341 * |
|
342 * @since S60 v5.0 |
|
343 * @return Edit mode status. |
|
344 */ |
|
345 virtual TBool IsEditMode() const; |
|
346 |
|
347 /** |
|
348 * Sets up widget layout (needed for grid). |
|
349 * |
|
350 * @since S60 v3.0 |
|
351 */ |
|
352 virtual void SetupWidgetLayoutL() =0; |
|
353 |
|
354 /** |
|
355 * Constructor. |
|
356 */ |
|
357 CMmWidgetContainer(); |
|
358 |
|
359 /** |
|
360 * Destructor. |
|
361 */ |
|
362 ~CMmWidgetContainer(); |
|
363 |
|
364 /** |
|
365 * from CCoeControl. |
|
366 * |
|
367 * @since S60 v3.0 |
|
368 */ |
|
369 void SizeChanged(); |
|
370 |
|
371 /** |
|
372 * Draws the widget. |
|
373 * |
|
374 * @since S60 v3.0 |
|
375 * @param aRect Rectangle within the widget shuld be drawn. |
|
376 */ |
|
377 void Draw(const TRect& aRect) const; |
|
378 |
|
379 /** |
|
380 * Draws the widget view. |
|
381 * |
|
382 * @since S60 v5.0 |
|
383 */ |
|
384 virtual void DrawView() = 0; |
|
385 |
|
386 /** |
|
387 * Returns type UID pointer that can be used in MopSupplyObject. |
|
388 * |
|
389 * @since S60 v3.0 |
|
390 * @param aId Type UID, should be the same that was given as aId. |
|
391 * parameter of MopSupplyObject. |
|
392 * @return Type UID pointer. |
|
393 */ |
|
394 TTypeUid::Ptr MopSupplyObject(TTypeUid aId); |
|
395 |
|
396 /** |
|
397 * From CCoeControl. |
|
398 * |
|
399 * @since S60 v3.0 |
|
400 * @param aPointerEvent Pointer event. |
|
401 */ |
|
402 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
403 |
|
404 /** |
|
405 * From CCoeControl. |
|
406 * |
|
407 * @since S60 v5.0 |
|
408 * @param aPointerEvent Pointer event. |
|
409 */ |
|
410 void HandlePointerEventsInEditModeL(const TPointerEvent& aPointerEvent, |
|
411 TBool aAbortAnimations ); |
|
412 |
|
413 /** |
|
414 * Set draggable. |
|
415 * |
|
416 * @since S60 v3.0 |
|
417 * @param aDraggable Is draggable. |
|
418 */ |
|
419 void SetDraggableL( TBool aDraggable ); |
|
420 |
|
421 /** |
|
422 * Gets draggable status. |
|
423 * Draggable status determines if the item has |
|
424 * the capability to be dragged at the momont. |
|
425 * So before threshold is crossed the container |
|
426 * is not draggable in the sense of this method |
|
427 * because the dragged item is not yet drawn. |
|
428 * It becomes draggable when it start to be drawn |
|
429 * |
|
430 * @since S60 v3.0 |
|
431 * @return Is draggable. |
|
432 */ |
|
433 IMPORT_C TBool IsDraggable(); |
|
434 |
|
435 /** |
|
436 * From CCoeControl. |
|
437 * |
|
438 * @since S60 v3.0 |
|
439 * @return count component controls. |
|
440 */ |
|
441 TInt CountComponentControls() const; |
|
442 |
|
443 /** |
|
444 * From CCoeControl. |
|
445 * |
|
446 * @since S60 v3.0 |
|
447 * @param aIndex index of control. |
|
448 * @return component control. |
|
449 */ |
|
450 CCoeControl* ComponentControl(TInt aIndex) const; |
|
451 |
|
452 /** |
|
453 * From CCoeControl. |
|
454 * |
|
455 * @since S60 v3.0 |
|
456 * @param aKeyEvent key event. |
|
457 * @param aType event type. |
|
458 * @return response to key event. |
|
459 */ |
|
460 TKeyResponse OfferKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); |
|
461 |
|
462 /** |
|
463 * Zooms item icon. |
|
464 * |
|
465 * @since S60 v3.0 |
|
466 * @param aItemIndex Item index. |
|
467 */ |
|
468 IMPORT_C void ItemIconZoomL( TInt aItemIndex ); |
|
469 |
|
470 /** |
|
471 * Handle button up event. |
|
472 * |
|
473 * @since S60 v3.0 |
|
474 * @param aPointerEvent Pointer event. |
|
475 */ |
|
476 void HandleButtonDownL(const TPointerEvent& aPointerEvent ); |
|
477 |
|
478 /** |
|
479 * Handle button down event. |
|
480 * |
|
481 * @since S60 v3.0 |
|
482 * @param aPointerEvent Pointer event. |
|
483 */ |
|
484 void HandleButtonUpL(const TPointerEvent& aPointerEvent ); |
|
485 |
|
486 /** |
|
487 * Overridden to invalidate item drawer cache on skin change and |
|
488 * dynamic variant switch. |
|
489 * |
|
490 * @param aType A message UID value. |
|
491 */ |
|
492 void HandleResourceChange( TInt aType ); |
|
493 |
|
494 /** |
|
495 * Handle dragging of item. |
|
496 * |
|
497 * @since S60 v3.0 |
|
498 * @param aPointerEvent Pointer event. |
|
499 * @param aAbortAnimation Should animation be aborted. |
|
500 */ |
|
501 void HandleDragL(const TPointerEvent& aPointerEvent, TBool aAbortAnimation ); |
|
502 |
|
503 /** |
|
504 * Sets marquee adapter. |
|
505 * |
|
506 * @since S60 v3.0 |
|
507 * @param aAdapter A marquee adapter. |
|
508 */ |
|
509 void SetMarqueeAdapter( CMmMarqueeAdapter* aAdapter ); |
|
510 |
|
511 /** |
|
512 * Sets up item drawer. |
|
513 * |
|
514 * @since S60 v3.0 |
|
515 */ |
|
516 void SetupDrawer(); |
|
517 |
|
518 /** |
|
519 * Cancels gragging of item. |
|
520 * |
|
521 * @since S60 v3.0 |
|
522 * @param aAnimate Should dragged item transition be animated. |
|
523 */ |
|
524 IMPORT_C void CancelDragL( TBool aAnimate ); |
|
525 |
|
526 /** |
|
527 * Animates item shifting. |
|
528 * |
|
529 * @since S60 v3.0 |
|
530 * @param aHighlight Highlighted item index. |
|
531 */ |
|
532 void AnimateShiftL(TInt aHighlight); |
|
533 |
|
534 /** |
|
535 * Gest number of items. |
|
536 * |
|
537 * @since S60 v3.0 |
|
538 * @return Number of items. |
|
539 */ |
|
540 IMPORT_C TInt NumberOfItems(); |
|
541 |
|
542 /** |
|
543 * Retrieve information if flip is open. |
|
544 * |
|
545 * @since S60 v5.0 |
|
546 * @return ETrue if flip is open. Other cases returns EFalse. |
|
547 */ |
|
548 TBool FlipOpen(); |
|
549 |
|
550 /** |
|
551 * Sets the flip open state. |
|
552 * |
|
553 * @since S60 v5.0 |
|
554 * @param aIsFlipOpen Is the flip open. |
|
555 */ |
|
556 IMPORT_C void SetFlipOpenL( TBool aIsFlipOpen ); |
|
557 |
|
558 /** |
|
559 * This should be called when flip state was changed |
|
560 * |
|
561 * @since S60 v5.0 |
|
562 */ |
|
563 virtual void FlipStateChangedL(); |
|
564 |
|
565 /** |
|
566 * This should be called at the end of edit mode in non-touch |
|
567 * |
|
568 * @since S60 v5.0 |
|
569 */ |
|
570 IMPORT_C void StopMovingL(); |
|
571 |
|
572 /** |
|
573 * Handle zooming change |
|
574 * |
|
575 * @since S60 v5.0 |
|
576 */ |
|
577 IMPORT_C void HandleZoomChanged( TAknUiZoom aZoom ); |
|
578 |
|
579 /** |
|
580 * Set the zoom |
|
581 * |
|
582 * @since S60 v5.0 |
|
583 */ |
|
584 IMPORT_C void SetZoom( TAknUiZoom aZoom ); |
|
585 |
|
586 /** |
|
587 * Set the vertical item offset; |
|
588 * @param aOffset The offset to set to the widget. |
|
589 * |
|
590 * @since S60 v5.0 |
|
591 */ |
|
592 virtual void SetVerticalItemOffset( TInt aOffset ) = 0; |
|
593 |
|
594 /** |
|
595 * Gets the current vertical item offset for the widget in the container. |
|
596 * @since S60 v5.0 |
|
597 * |
|
598 * @return The current vertical item offset. |
|
599 */ |
|
600 virtual TInt VerticalItemOffset() const = 0; |
|
601 |
|
602 /** |
|
603 * Saves the currents position of the widget. The vertical item offset |
|
604 * and the top item index are cached. |
|
605 * @since S60 v5.0 |
|
606 */ |
|
607 IMPORT_C void CacheWidgetPosition(); |
|
608 |
|
609 /** |
|
610 * Resets the widget position cache to top of view. |
|
611 * Both vartical item offset and top index are set to zero |
|
612 * in cache and widget. |
|
613 * @since S60 v5.0 |
|
614 */ |
|
615 IMPORT_C void ResetWidgetPosition(); |
|
616 |
|
617 /** |
|
618 * Restores the cached widget position values in the widget. |
|
619 * @since S60 v5.0 |
|
620 */ |
|
621 IMPORT_C void RestoreWidgetPosition(); |
|
622 |
|
623 /** |
|
624 * Scrolls to the specified item index so that the item is seen entirely on screen. |
|
625 * @since S60 v5.0 |
|
626 * |
|
627 * @param aIndex The widget item index to scroll to. |
|
628 * @return True if any scrolling was done. |
|
629 */ |
|
630 IMPORT_C TBool ScrollToItemL( TInt aIndex ); |
|
631 |
|
632 /** |
|
633 * Called when the number of items in widget model changed. |
|
634 * @since S60 v5.0 |
|
635 * |
|
636 * @param aChange Type of change |
|
637 */ |
|
638 IMPORT_C void NumberOfItemsChangedL( TItemsChangeType aChange ); |
|
639 |
|
640 /** |
|
641 * Aligns the bottom of view to the last model item bottom edge so that no extra |
|
642 * unused pixels are visible at the bottom of screen. |
|
643 * @since S60 v5.0 |
|
644 * |
|
645 * @return True if the view was scrolled. |
|
646 */ |
|
647 TBool AlignBottomOfViewL( ); |
|
648 |
|
649 /** |
|
650 * Calculate numer of pixels required to scroll when aligning bottom of view. |
|
651 * @since S60 v5.0 |
|
652 */ |
|
653 TInt CalcBottomPixelsToScroll(); |
|
654 |
|
655 /** |
|
656 * Sets visibility of a widget. |
|
657 * |
|
658 * @param aVisible ETrue if widget should be visible, EFalse - otherwise |
|
659 */ |
|
660 void MakeVisible(TBool aVisible); |
|
661 |
|
662 /** |
|
663 * Tells if item is visible (fully or partially). |
|
664 * @param aItemIndex Item index. |
|
665 * @return ETrue if visible, EFalse otherwise. |
|
666 */ |
|
667 virtual TBool ItemIsVisible( TInt aItemIndex ) const; |
|
668 |
|
669 /** |
|
670 * Tells if item is entirely visible. |
|
671 * @param aIndex The index of the item. |
|
672 */ |
|
673 IMPORT_C TBool ItemIsFullyVisible(TInt aIndex); |
|
674 |
|
675 /** |
|
676 * Prepares the container to be set to the garbage collector. |
|
677 */ |
|
678 IMPORT_C void PrepareForGarbage(); |
|
679 |
|
680 /** |
|
681 * Checks, whether the currently dragged item is a draggable item. i.e. parent folder |
|
682 * is not a draggable item. |
|
683 * @returns True, if dragged item is parent folder |
|
684 * or no item is dragged (iDraggedIndex = -1), false otherwise. |
|
685 */ |
|
686 TBool IsNoItemDragged(); |
|
687 |
|
688 /** |
|
689 * Sets the iHasFocus member variable, which is used to determine |
|
690 * if marquee animation can be enabled. |
|
691 */ |
|
692 IMPORT_C void SetHasFocusL( TBool aHasFocus ); |
|
693 |
|
694 /** |
|
695 * Sets the iIsFaded member variable, which is used to determine |
|
696 * if marquee animation can be enabled. |
|
697 */ |
|
698 IMPORT_C void SetIsFaded( TBool aIsFaded ); |
|
699 |
|
700 public: // from MMmVisibilityObserver |
|
701 |
|
702 /** |
|
703 * |
|
704 * @since S60 v3.0 |
|
705 */ |
|
706 IMPORT_C void HandleBackgroundGainedL(); |
|
707 |
|
708 /** |
|
709 * |
|
710 * @since S60 v3.0 |
|
711 */ |
|
712 IMPORT_C void HandleForegroundGainedL(); |
|
713 public: // from MEikListBoxObserver |
|
714 |
|
715 /** |
|
716 * Handles list box events. |
|
717 * |
|
718 * @since S60 v5.0 |
|
719 */ |
|
720 virtual void HandleListBoxEventL(CEikListBox* aListBox, |
|
721 TListBoxEvent aEventType); |
|
722 |
|
723 public: |
|
724 /** |
|
725 * From MAknLongTapDetectorCallBack. Handles long tap events. |
|
726 * |
|
727 * @since S60 v5.0 |
|
728 * @param aPenEventLocation Point coordinates relative to container. |
|
729 * @param aPenEventScreenLocation Point coordinates relative to screen. |
|
730 */ |
|
731 virtual void HandleLongTapEventL( const TPoint& aPenEventLocation, |
|
732 const TPoint& aPenEventScreenLocation ); |
|
733 protected: |
|
734 |
|
735 /** |
|
736 * Handles additional contruction tasks. |
|
737 * |
|
738 * @since S60 v3.0 |
|
739 */ |
|
740 void ConstructL(); |
|
741 |
|
742 /** |
|
743 * Sets highlight locally. |
|
744 * Does not modify the avkon behaviur. |
|
745 * |
|
746 * @since S60 v3.0 |
|
747 * @param aItemIndex Index of the item. |
|
748 */ |
|
749 void SetHighlightL(TInt aItemIndex); |
|
750 |
|
751 /** |
|
752 * Checks whether given point collides with specific item's re-order area. |
|
753 * |
|
754 * This function gets called during drag-and-drop operations to |
|
755 * help determine whether item re-ordering is needed. |
|
756 * |
|
757 * @param aItemIndex index of the item to check |
|
758 * @param aPoint point coordinates |
|
759 * @return ETrue if point is located within item re-order area, |
|
760 * EFalse otherwise |
|
761 */ |
|
762 virtual TBool PointInItemReorderAreaL( TInt aItemIndex, TPoint aPoint ); |
|
763 |
|
764 /** |
|
765 * Hides the options menu if it is being displayed. |
|
766 * This has (probably) the same effect as clicking Cancel (RSK) - |
|
767 * the menu just disappears. |
|
768 */ |
|
769 void HideOptionsMenuIfDisplayed(); |
|
770 |
|
771 protected: |
|
772 |
|
773 /** |
|
774 * Validates the widget current item index so that it is consistent with |
|
775 * the current model. |
|
776 */ |
|
777 void ValidateWidgetCurrentItemIndex(); |
|
778 |
|
779 /** |
|
780 * Updates current view's scrollbar thumbs. |
|
781 */ |
|
782 virtual void UpdateViewScrollBarThumbs(); |
|
783 |
|
784 /** |
|
785 * Starts or stops marquee animation based on the current state |
|
786 * of the container. |
|
787 */ |
|
788 void StartOrStopMarquee(); |
|
789 |
|
790 private: |
|
791 |
|
792 /** |
|
793 * Called when the number of items in widget model changed. |
|
794 * @since S60 v5.0 |
|
795 * |
|
796 * @param aChange Type of change |
|
797 */ |
|
798 void HandleNumberOfItemsChangedL( TItemsChangeType aChange ); |
|
799 |
|
800 /** |
|
801 * Manages zooming of folder. |
|
802 * |
|
803 * @since S60 v3.0 |
|
804 * @param aDraggedItemOverIcons Is dragged over icons flag. |
|
805 */ |
|
806 void ManageFolderZoomingL( TBool aDraggedItemOverIcons ); |
|
807 |
|
808 /** |
|
809 * Cancels gragging of item if relevant( Edit Mode is activated ) |
|
810 * |
|
811 * @since S60 v3.0 |
|
812 */ |
|
813 void CancelDragL(); |
|
814 |
|
815 /** |
|
816 * Sets the widget highlight back to place if e.g. item was dragged over an item |
|
817 * where it could not be dropped into. |
|
818 * |
|
819 * @since S60 v3.0 |
|
820 */ |
|
821 void SetHighlightAfterDrag(); |
|
822 |
|
823 /** |
|
824 * Handles key event. |
|
825 * |
|
826 * @since S60 v3.0 |
|
827 * @param aKeyEvent Key event. |
|
828 * @param aType Event code. |
|
829 */ |
|
830 TKeyResponse HandleKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType); |
|
831 |
|
832 /** |
|
833 * Handles rocker (select) press. |
|
834 */ |
|
835 void HandleRockerPressL(); |
|
836 |
|
837 /** |
|
838 * Gets distance between current and previous position. |
|
839 * @param aPos Current position. |
|
840 * @param aTapPoint Point of the tap. |
|
841 * @return Distance between two points in pixels. |
|
842 */ |
|
843 TInt DeltaSquare( const TPoint aTapPoint, |
|
844 const TPoint aPos ); |
|
845 |
|
846 /** |
|
847 * Checks, whether given item is a folder or root folder. |
|
848 * @param aItemIndex Item index to check. |
|
849 * @returns True, if given item is a folder or root folder, false otherwise. |
|
850 */ |
|
851 TBool IsFolderL( TInt aItemIndex ); |
|
852 |
|
853 /** |
|
854 * Checks, whether given item has IsDeleteLockedL flag set. |
|
855 * @param aItemIndex Item index to check. |
|
856 * @returns IsDeleteLockedL flag |
|
857 */ |
|
858 TBool IsDeleteLockedL( TInt aItemIndex ); |
|
859 |
|
860 /** |
|
861 * Gets column count in current view. |
|
862 * @returns Column count in current view. |
|
863 */ |
|
864 virtual TInt ColumnsInCurrentView(); |
|
865 |
|
866 /** |
|
867 * Gets row count in current view. |
|
868 * @returns Row count in current view. |
|
869 */ |
|
870 virtual TInt RowsInCurrentView(); |
|
871 |
|
872 /** |
|
873 * Scrolls the view move mode non-touch so that move indicators are visible. |
|
874 */ |
|
875 void ScrollViewIfNeededL(); |
|
876 |
|
877 /** |
|
878 * Scrolls the view in pixels. |
|
879 * @param aPixels THe number of pixels to scroll. If negative, the view is scrolled down. |
|
880 */ |
|
881 void ScrollInPixelsL( TInt aPixels ); |
|
882 |
|
883 /** |
|
884 * Sets up the scrolling effect movement type. |
|
885 * @param aDown True if scrolling is downwards. |
|
886 */ |
|
887 void SetupScrollingEffectsL( TBool aDown ); |
|
888 |
|
889 protected: |
|
890 |
|
891 |
|
892 /** |
|
893 * Own. |
|
894 */ |
|
895 CEikListBox* iWidget; |
|
896 |
|
897 /** |
|
898 * Key event observer. |
|
899 */ |
|
900 MMmKeyEventObserver* iKeyEventObserver; |
|
901 |
|
902 /** |
|
903 * Drag and drop observer. |
|
904 */ |
|
905 MMmDragAndDropObserver* iDragAndDropObserver; |
|
906 /** |
|
907 * List box observer. |
|
908 */ |
|
909 MEikListBoxObserver* iListBoxObserver; |
|
910 |
|
911 /** |
|
912 * Notifies about time expiration. |
|
913 * |
|
914 * Owned by descendant. |
|
915 */ |
|
916 CMmHighlightTimer* iTimer; |
|
917 |
|
918 /** |
|
919 * Marquee adapter. |
|
920 * Own. |
|
921 */ |
|
922 CMmMarqueeAdapter* iMarqueeAdapter; |
|
923 |
|
924 /** |
|
925 * Item drawer. |
|
926 * Not own. |
|
927 */ |
|
928 CMmListBoxItemDrawer* iDrawer; |
|
929 |
|
930 protected: |
|
931 |
|
932 /** |
|
933 * Current Highlight. |
|
934 */ |
|
935 TInt iCurrentHighlight; |
|
936 |
|
937 /** |
|
938 * Has drag occurred. |
|
939 */ |
|
940 TBool iDragOccured; |
|
941 |
|
942 /** |
|
943 * Processed display elelments for better performance. |
|
944 */ |
|
945 CMmPostEvaluationProcessor* iPostProcessor; |
|
946 |
|
947 /** |
|
948 * Set when long tap is in progress (stylus popup displayed over container) |
|
949 */ |
|
950 TBool iLongTapInProgress; |
|
951 |
|
952 private: |
|
953 |
|
954 |
|
955 /** |
|
956 * Background context. |
|
957 * Own. |
|
958 */ |
|
959 CAknsBasicBackgroundControlContext* iBgContext; |
|
960 |
|
961 /** |
|
962 * Last drag point. |
|
963 */ |
|
964 TPoint iLastDragPoint; |
|
965 |
|
966 /** |
|
967 * First tap point. |
|
968 */ |
|
969 TPoint iTapPoint; |
|
970 |
|
971 /** |
|
972 * First tap point. |
|
973 */ |
|
974 TPoint iItemRelativeTapPoint; |
|
975 |
|
976 /** |
|
977 * Last drag highlight. |
|
978 */ |
|
979 TInt iLastDragHighlight; |
|
980 |
|
981 /** |
|
982 * Dragged item index. |
|
983 */ |
|
984 TBool iDraggedIndex; |
|
985 |
|
986 /** |
|
987 * Edit mode status. |
|
988 */ |
|
989 TBool iIsEditMode; |
|
990 |
|
991 /** |
|
992 * Destination of item index. |
|
993 */ |
|
994 TInt iItemIndexDestination; |
|
995 |
|
996 /** |
|
997 * Previous Highlight. |
|
998 */ |
|
999 TInt iPreviousHighlight; |
|
1000 |
|
1001 /** |
|
1002 * Is flip open |
|
1003 */ |
|
1004 TBool iFlipOpen; |
|
1005 |
|
1006 /** |
|
1007 * The current rect of the widget control. |
|
1008 */ |
|
1009 TRect iWidgetRect; |
|
1010 |
|
1011 /** |
|
1012 * Longpress allowed flag. We only accept long press (EEventKey+iRepeats) |
|
1013 * when there was no highlight visible before EEventKeyDown, otherwise |
|
1014 * we react only to EEventKeyDown |
|
1015 */ |
|
1016 TBool iAllowLongPress; |
|
1017 |
|
1018 /** |
|
1019 * Cache for widget position. |
|
1020 */ |
|
1021 TMmWidgetPosition iWidgetPositionCache; |
|
1022 |
|
1023 /** |
|
1024 * ETrue if Matrix menu window is faded. |
|
1025 */ |
|
1026 TBool iIsFaded; |
|
1027 |
|
1028 /** |
|
1029 * ETrue if Matrix menu has focus (i.e. it is not obscured by any popup |
|
1030 * note). |
|
1031 */ |
|
1032 TBool iHasFocus; |
|
1033 |
|
1034 /** |
|
1035 * ETrue if in foreground. |
|
1036 */ |
|
1037 TBool iInForeground; |
|
1038 |
|
1039 /** |
|
1040 * Own. |
|
1041 * Detects long tap events. |
|
1042 */ |
|
1043 CAknLongTapDetector* iLongTapDetector; |
|
1044 |
|
1045 /** |
|
1046 * Observer to notify about long tap events. |
|
1047 */ |
|
1048 MMmLongTapObserver* iLongTapObserver; |
|
1049 |
|
1050 }; |
|
1051 |
|
1052 #endif // MMMWIDGETCONTAINER_H |