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