menufw/menufwui/mmwidgets/inc/mmwidgetcontainer.h
branchRCL_3
changeset 34 5456b4e8b3a8
child 35 3321d3e205b6
equal deleted inserted replaced
33:5f0182e07bfb 34:5456b4e8b3a8
       
     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.43 % << 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 #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;
       
   700 
       
   701 public: // from MMmVisibilityObserver
       
   702 
       
   703     /**
       
   704      *
       
   705      * @since S60 v3.0
       
   706      */
       
   707     IMPORT_C void HandleBackgroundGainedL();
       
   708 
       
   709     /**
       
   710      *
       
   711      * @since S60 v3.0
       
   712      */
       
   713     IMPORT_C void HandleForegroundGainedL();
       
   714 public: // from MEikListBoxObserver
       
   715 
       
   716     /**
       
   717      * Handles list box events.
       
   718      *
       
   719      * @since S60 v5.0
       
   720      */
       
   721     virtual void HandleListBoxEventL(CEikListBox* aListBox,
       
   722             TListBoxEvent aEventType);
       
   723 
       
   724 public:
       
   725     /**
       
   726      * From MAknLongTapDetectorCallBack. Handles long tap events.
       
   727      *
       
   728      * @since S60 v5.0
       
   729      * @param aPenEventLocation Point coordinates relative to container.
       
   730      * @param aPenEventScreenLocation Point coordinates relative to screen.
       
   731      */
       
   732     virtual void HandleLongTapEventL( const TPoint& aPenEventLocation,
       
   733                                       const TPoint& aPenEventScreenLocation );
       
   734 protected:
       
   735 
       
   736     /**
       
   737      * Handles additional contruction tasks.
       
   738      *
       
   739      * @since S60 v3.0
       
   740      */
       
   741   void ConstructL();
       
   742 
       
   743     /**
       
   744      * Sets highlight locally.
       
   745      * Does not modify the avkon behaviur.
       
   746      *
       
   747      * @since S60 v3.0
       
   748      * @param aItemIndex Index of the item.
       
   749      */
       
   750   void SetHighlightL(TInt aItemIndex);
       
   751 
       
   752   /**
       
   753      * Checks whether given point collides with specific item's re-order area.
       
   754      *
       
   755      * This function gets called during drag-and-drop operations to
       
   756      * help determine whether item re-ordering is needed.
       
   757      *
       
   758      * @param aItemIndex index of the item to check
       
   759      * @param aPoint point coordinates
       
   760      * @return ETrue if point is located within item re-order area,
       
   761      *         EFalse otherwise
       
   762      */
       
   763     virtual TBool PointInItemReorderAreaL( TInt aItemIndex, TPoint aPoint );
       
   764 
       
   765     /**
       
   766      * Hides the options menu if it is being displayed.
       
   767      * This has (probably) the same effect as clicking Cancel (RSK) -
       
   768      * the menu just disappears.
       
   769      */
       
   770     void HideOptionsMenuIfDisplayed();
       
   771 
       
   772 protected:
       
   773 
       
   774     /**
       
   775      * Validates the widget current item index so that it is consistent with
       
   776      * the current model.
       
   777      */
       
   778     void ValidateWidgetCurrentItemIndex();
       
   779 
       
   780     /**
       
   781      * Updates current view's scrollbar thumbs.
       
   782      */
       
   783     virtual void UpdateViewScrollBarThumbs();
       
   784 
       
   785     /**
       
   786      * Starts or stops marquee animation based on the current state
       
   787      * of the container.
       
   788      */
       
   789     void StartOrStopMarquee();
       
   790 
       
   791 private:
       
   792 
       
   793    /**
       
   794    * Called when the number of items in widget model changed.
       
   795    * @since S60 v5.0
       
   796    *
       
   797    * @param aChange Type of change
       
   798    */
       
   799   void HandleNumberOfItemsChangedL( TItemsChangeType aChange );
       
   800 
       
   801     /**
       
   802      * Manages zooming of folder.
       
   803      *
       
   804      * @since S60 v3.0
       
   805      * @param aDraggedItemOverIcons Is dragged over icons flag.
       
   806      */
       
   807   void ManageFolderZoomingL( TBool aDraggedItemOverIcons );
       
   808 
       
   809     /**
       
   810      * Cancels gragging of item if relevant( Edit Mode is activated )
       
   811      *
       
   812      * @since S60 v3.0
       
   813      */
       
   814     void CancelDragL();
       
   815 
       
   816     /**
       
   817      * Sets the widget highlight back to place if e.g. item was dragged over an item
       
   818      * where it could not be dropped into.
       
   819      *
       
   820      * @since S60 v3.0
       
   821      */
       
   822     void SetHighlightAfterDrag();
       
   823 
       
   824     /**
       
   825      * Handles key event.
       
   826      *
       
   827      * @since S60 v3.0
       
   828      * @param aKeyEvent Key event.
       
   829      * @param aType Event code.
       
   830      */
       
   831     TKeyResponse HandleKeyEventL(const TKeyEvent &aKeyEvent, TEventCode aType);
       
   832 
       
   833     /**
       
   834      * Handles rocker (select) press.
       
   835      */
       
   836     void HandleRockerPressL();
       
   837 
       
   838     /**
       
   839      * Gets distance between current and previous position.
       
   840      * @param aPos Current position.
       
   841      * @param aTapPoint Point of the tap.
       
   842      * @return Distance between two points in pixels.
       
   843      */
       
   844     TInt DeltaSquare( const TPoint aTapPoint,
       
   845         const TPoint aPos );
       
   846 
       
   847     /**
       
   848      * Checks, whether given item is a folder or root folder.
       
   849      * @param aItemIndex Item index to check.
       
   850      * @returns True, if given item is a folder or root folder, false otherwise.
       
   851      */
       
   852     TBool IsFolderL( TInt aItemIndex );
       
   853 
       
   854     /**
       
   855      * Checks, whether given item has IsDeleteLockedL flag set.
       
   856      * @param aItemIndex Item index to check.
       
   857      * @returns IsDeleteLockedL flag
       
   858      */
       
   859     TBool IsDeleteLocked( TInt aItemIndex );
       
   860 
       
   861   /**
       
   862    * Gets column count in current view.
       
   863    * @returns Column count in current view.
       
   864    */
       
   865   virtual TInt ColumnsInCurrentView();
       
   866 
       
   867     /**
       
   868      * Gets row count in current view.
       
   869      * @returns Row count in current view.
       
   870      */
       
   871     virtual TInt RowsInCurrentView();
       
   872 
       
   873   /**
       
   874    * Scrolls the view move mode non-touch so that move indicators are visible.
       
   875    */
       
   876   void ScrollViewIfNeededL();
       
   877 
       
   878     /**
       
   879      * Scrolls the view in pixels.
       
   880      * @param aPixels THe number of pixels to scroll. If negative, the view is scrolled down.
       
   881      */
       
   882   void ScrollInPixelsL( TInt aPixels );
       
   883 
       
   884     /**
       
   885      * Sets up the scrolling effect movement type.
       
   886      * @param aDown True if scrolling is downwards.
       
   887      */
       
   888   void SetupScrollingEffectsL( TBool aDown );
       
   889 
       
   890 protected:
       
   891 
       
   892 
       
   893     /**
       
   894      * Own.
       
   895      */
       
   896     CEikListBox* iWidget;
       
   897 
       
   898     /**
       
   899      * Key event observer.
       
   900      */
       
   901     MMmKeyEventObserver* iKeyEventObserver;
       
   902 
       
   903     /**
       
   904      * Drag and drop observer.
       
   905      */
       
   906     MMmDragAndDropObserver* iDragAndDropObserver;
       
   907      /**
       
   908       * List box observer.
       
   909       */
       
   910     MEikListBoxObserver* iListBoxObserver;
       
   911 
       
   912     /**
       
   913      * Marquee adapter.
       
   914      * Own.
       
   915      */
       
   916     CMmMarqueeAdapter* iMarqueeAdapter;
       
   917 
       
   918     /**
       
   919      * Item drawer.
       
   920      * Not own.
       
   921      */
       
   922     CMmListBoxItemDrawer* iDrawer;
       
   923 
       
   924 protected:
       
   925 
       
   926     /**
       
   927      * Current Highlight.
       
   928      */
       
   929     TInt iCurrentHighlight;
       
   930 
       
   931     /**
       
   932      * Processed display elelments for better performance.
       
   933      */
       
   934     CMmPostEvaluationProcessor* iPostProcessor;
       
   935 
       
   936     /**
       
   937      * Set when long tap is in progress (stylus popup displayed over container)
       
   938      */
       
   939     TBool iLongTapInProgress;
       
   940 
       
   941 private:
       
   942 
       
   943     /**
       
   944      * Has drag occurred.
       
   945      */
       
   946     TBool iDragOccured;
       
   947 
       
   948     /**
       
   949      * Background context.
       
   950      * Own.
       
   951      */
       
   952   CAknsBasicBackgroundControlContext* iBgContext;
       
   953 
       
   954     /**
       
   955      * Last drag point.
       
   956      */
       
   957   TPoint iLastDragPoint;
       
   958 
       
   959     /**
       
   960      * First tap point.
       
   961      */
       
   962   TPoint iTapPoint;
       
   963 
       
   964     /**
       
   965      * First tap point.
       
   966      */
       
   967   TPoint iItemRelativeTapPoint;
       
   968 
       
   969   /**
       
   970      * Last drag highlight.
       
   971      */
       
   972   TInt iLastDragHighlight;
       
   973 
       
   974     /**
       
   975      * Dragged item index.
       
   976      */
       
   977     TInt iDraggedIndex;
       
   978 
       
   979     /**
       
   980      * Edit mode status.
       
   981      */
       
   982   TBool iIsEditMode;
       
   983 
       
   984   /**
       
   985      * Destination of item index.
       
   986      */
       
   987   TInt iItemIndexDestination;
       
   988 
       
   989   /**
       
   990      * Previous Highlight.
       
   991      */
       
   992   TInt iPreviousHighlight;
       
   993 
       
   994   /**
       
   995    * The current rect of the widget control.
       
   996    */
       
   997     TRect iWidgetRect;
       
   998 
       
   999     /**
       
  1000      * Longpress allowed flag. We only accept long press (EEventKey+iRepeats)
       
  1001      * when there was no highlight visible before EEventKeyDown, otherwise
       
  1002      * we react only to EEventKeyDown
       
  1003      */
       
  1004     TBool iAllowLongPress;
       
  1005 
       
  1006   /**
       
  1007    * Cache for widget position.
       
  1008    */
       
  1009     TMmWidgetPosition iWidgetPositionCache;
       
  1010 
       
  1011     /**
       
  1012      * ETrue if Matrix menu window is faded.
       
  1013      */
       
  1014     TBool iIsFaded;
       
  1015 
       
  1016     /**
       
  1017      * ETrue if Matrix menu has focus (i.e. it is not obscured by any popup
       
  1018      * note).
       
  1019      */
       
  1020     TBool iHasFocus;
       
  1021 
       
  1022     /**
       
  1023      * ETrue if in foreground.
       
  1024      */
       
  1025     TBool iInForeground;
       
  1026 
       
  1027     /**
       
  1028      * Own.
       
  1029      * Detects long tap events.
       
  1030      */
       
  1031     CAknLongTapDetector* iLongTapDetector;
       
  1032 
       
  1033     /**
       
  1034      * Observer to notify about long tap events.
       
  1035      */
       
  1036     MMmLongTapObserver* iLongTapObserver;
       
  1037 
       
  1038     /**
       
  1039      * Stores previously set highlight visibility.
       
  1040      * ETrue - hightlight visible, EFalse - highlight disabled.
       
  1041      * Please note that in most cases it is better to read
       
  1042      * ESingleClickDisabledHighlight flag of itemdrawer than rely
       
  1043      * on this member variable to determine if highlight is visible
       
  1044      * (@c IsHighlightVisible).
       
  1045      */
       
  1046     TBool iPreviousHighlightVisibility;
       
  1047 
       
  1048     /**
       
  1049      * Defines if move item is allowed.
       
  1050      */
       
  1051     TBool iAllowMove;
       
  1052 
       
  1053     /**
       
  1054      * Defines item id to be moved.
       
  1055      */
       
  1056     TInt iRecipientId;
       
  1057 
       
  1058     /**
       
  1059      * Event parameters for move item.
       
  1060      */
       
  1061     CLiwGenericParamList *iEventParameters;
       
  1062 
       
  1063     /*
       
  1064      * Two following flags were added for fix ou1cimx1#344006 error.
       
  1065      * iDialogOpened - it's used to mark if any dialog has been opened.
       
  1066      * iHighlightVisibleBeforeLongTap - it's used to remember if highlight
       
  1067      *          had been visible when dialog has been opened.
       
  1068      */
       
  1069     /**
       
  1070      * ETrue if extension dialog is opend.
       
  1071      */
       
  1072     TBool iDialogOpened;
       
  1073 
       
  1074     /**
       
  1075      * ETrue if highlight was visible before longTap event.
       
  1076      */
       
  1077     TBool iHighlightVisibleBeforeLongTap;
       
  1078 
       
  1079   };
       
  1080 
       
  1081 #endif // MMMWIDGETCONTAINER_H