taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h
branchRCL_3
changeset 35 3321d3e205b6
parent 34 5456b4e8b3a8
equal deleted inserted replaced
34:5456b4e8b3a8 35:3321d3e205b6
    32 class CAknStylusPopUpMenu;
    32 class CAknStylusPopUpMenu;
    33 class CAknQueryDialog;
    33 class CAknQueryDialog;
    34 class CTsEventControler;
    34 class CTsEventControler;
    35 class MTsDataChangeObserver;
    35 class MTsDataChangeObserver;
    36 class CAknLongTapAnimation;
    36 class CAknLongTapAnimation;
       
    37 class CTsFastSwapAreaExtension;
       
    38 class CAknPointerEventSuppressor;
    37 
    39 
    38 /**
    40 /**
    39  * Taskswitcher Fast Swap area UI.
    41  * Taskswitcher Fast Swap area UI.
    40  */
    42  */
    41 class CTsFastSwapArea: public CCoeControl,
    43 class CTsFastSwapArea: public CCoeControl,
   178     
   180     
   179     // From MEikListBoxObserver
   181     // From MEikListBoxObserver
   180     void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
   182     void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
   181     
   183     
   182 public:
   184 public:
       
   185     
       
   186     enum TsFastSwapAreaGridData {
       
   187         EMaxItemsOnScreen = 1,
       
   188         EGridItemWidth,
       
   189         EGridItemGap
       
   190     };
       
   191     
   183     /**
   192     /**
   184      * Implements drag gesture handling
   193      * Implements drag gesture handling
   185      * @see MTsEventControlerObserver
   194      * @see MTsEventControlerObserver
   186      */
   195      */
   187     void MoveOffset(const TPoint&, TBool);
   196     void MoveOffset(const TPoint&, TBool);
   226     /**
   235     /**
   227      * Checks if app with the given window group id is present on taskswitcher
   236      * Checks if app with the given window group id is present on taskswitcher
   228      * list.
   237      * list.
   229      */
   238      */
   230     TBool WgOnTaskList( TInt aWgId );
   239     TBool WgOnTaskList( TInt aWgId );
       
   240     
       
   241     /**
       
   242      * Returns full grid view size.
       
   243      */
       
   244     TSize GridWorldSize();
       
   245     
       
   246     /**
       
   247      * Retrieves number of items in grid
       
   248      */
       
   249     TInt GridItemCount();
       
   250     
       
   251     /**
       
   252      * Returnes value of the requested grid data
       
   253      */
       
   254     TInt GetGridItemData( TsFastSwapAreaGridData aDataType );
   231     
   255     
   232 public:    
   256 public:    
   233     // from CCoeControl    
   257     // from CCoeControl    
   234     TInt CountComponentControls() const;
   258     TInt CountComponentControls() const;
   235     CCoeControl* ComponentControl(TInt aIndex) const;
   259     CCoeControl* ComponentControl(TInt aIndex) const;
   260 
   284 
   261     /**
   285     /**
   262      * Switches to another application.
   286      * Switches to another application.
   263      */
   287      */
   264     void SwitchToApp( TInt aWgId, const TUid& aUid );
   288     void SwitchToApp( TInt aWgId, const TUid& aUid );
   265     
   289 
   266     /**
   290     /**
   267      * Makes a copy of the given bitmap.
   291      * Update and prepare data for grid.
   268      * Also scaled to the given size, but maintains aspect ratio,
       
   269      * so the size of the returned bitmap may be less then aSize.
       
   270      */
       
   271     CFbsBitmap* CopyBitmapL( TInt aFbsHandle, TSize aSize );
       
   272 
       
   273     /**
       
   274      * Called from HandleFswContentChanged.
       
   275      */    
   292      */    
   276     void HandleFswContentChangedL();
   293     void GetContentForGrid();
   277     
   294     
   278     /**
   295     /**
   279      * Shows the content from iArray on the screen.
   296      * Obtain actual data from server.
   280      */
   297      */ 
   281     void RenderContentL( TBool aSuppressAnimation = EFalse );
   298     void GetContentL();
       
   299     
       
   300     /**
       
   301      * Prepare the content from iArray to be shown on the screen.
       
   302      */
       
   303     void RenderContentL( );
   282     
   304     
   283     /**
   305     /**
   284      * Creates the ganes grid control.
   306      * Creates the ganes grid control.
   285      */
   307      */
   286     void ReCreateGridL();
   308     void ReCreateGridL();
   294      * Setup grid layout for view
   316      * Setup grid layout for view
   295      * 
   317      * 
   296      * @param  aItemCount  number of items in grid
   318      * @param  aItemCount  number of items in grid
   297      */
   319      */
   298     void LayoutGridViewL( TInt aItemCount );
   320     void LayoutGridViewL( TInt aItemCount );
   299     
       
   300     /**
       
   301      * Returns rectangles for fast swap area controls
       
   302      */
       
   303     void GetFastSwapAreaRects( RArray<TAknLayoutRect>& aRects );
       
   304 
   321 
   305     /**
   322     /**
   306      * Creates a stylus popup instance (iPopup) if not yet done.
   323      * Creates a stylus popup instance (iPopup) if not yet done.
   307      */
   324      */
   308     void PreCreatePopupL();
   325     void PreCreatePopupL();
   318      * Sends the data-changed notification.
   335      * Sends the data-changed notification.
   319      */   
   336      */   
   320     void NotifyChange();
   337     void NotifyChange();
   321     
   338     
   322     /**
   339     /**
   323      * Retrieves and returns size for image graphics.
       
   324      */
       
   325     TSize PreferredImageSize();
       
   326     
       
   327     /**
       
   328      * Retrieves number of items in grid
       
   329      */
       
   330     TInt GridItemCount();
       
   331     
       
   332     /**
       
   333      * Calculates the correct size if aspect ratio needs to be preserved.
       
   334      */
       
   335     TSize CalculateSizePreserveRatio(const TSize& aTargetAreaSize,
       
   336             const TSize& aSourceSize);
       
   337     
       
   338     /**
       
   339      * Selects next item in grid
   340      * Selects next item in grid
   340      */
   341      */
   341     void SelectNextItem();
   342     void SelectNextItem();
   342     
   343     
   343     /**
   344     /**
   348      * @param aRedrawDelay - animation delay.
   349      * @param aRedrawDelay - animation delay.
   349      */
   350      */
   350     void CenterItem( TInt aRedrawDelay);
   351     void CenterItem( TInt aRedrawDelay);
   351     
   352     
   352     /**
   353     /**
   353      * Returns full grid view size.
       
   354      */
       
   355     TSize GridWorldSize();
       
   356     
       
   357     /**
       
   358      * Updates grid, called for manual grid scroll update
   354      * Updates grid, called for manual grid scroll update
   359      * 
   355      * 
   360      * @param  aForceRedraw    if set to ETrue - redraw will be forced
   356      * @param  aForceRedraw    if set to ETrue - redraw will be forced
   361      * @param  aAnimate        set to ETrue to enable animation
   357      * @param  aAnimate        set to ETrue to enable animation
   362      */
   358      */
   367      * Returns grid view size
   363      * Returns grid view size
   368      */
   364      */
   369     TSize ViewSize();
   365     TSize ViewSize();
   370     
   366     
   371     /**
   367     /**
   372      * Returns the position of the given item inside grid world rect.
       
   373      * Returns point in the middle of the view rectangle.
       
   374      * 
       
   375      * @param  aItemIdx  index of the item for which calculation will be done
       
   376      */
       
   377     TPoint ItemViewPosition( TInt aItemIdx );
       
   378     
       
   379     /**
       
   380      * Returns index of the shown item, based on the logical
       
   381      * position of the grids view. Item that is closest to the
       
   382      * middle of screen is returned.
       
   383      * 
       
   384      * @param  aViewPos  grids view position. This must be point in
       
   385      *                   the middle of the view rectangle
       
   386      * @return  index of the item
       
   387      */
       
   388     TInt ViewToVisibleItem( const TPoint aViewPos );
       
   389     
       
   390     /**
       
   391      * Launches increasing pop-up feedback.
       
   392      */
       
   393     void LaunchPopupFeedback();
       
   394     
       
   395     /**
       
   396      * Show highlight when disabled and 
   368      * Show highlight when disabled and 
   397      * consume EEventKeyUp that follows after event that swiched on the highlight.
   369      * consume EEventKeyUp that follows after event that swiched on the highlight.
   398      */
   370      */
   399     TKeyResponse ShowHighlightOnKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aType);
   371     TKeyResponse ShowHighlightOnKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aType);
   400     
   372     
   401     /**
   373     /**
   402      * Returns current screen orientation:
       
   403      * 
       
   404      * @return  1 if landscape, 0 if portait 
       
   405      */
       
   406     TInt GetCurrentScreenOrientation();
       
   407     
       
   408     /**
       
   409      * Retrieves variety value, based on current screen resolution.
       
   410      * 
       
   411      * @param  aVariety  result of the function, 0 value means portrait
       
   412      *                   value of 1 indicates landscape
       
   413      * @return  ETrue if screen resolution differs from vale returned by
       
   414      *          layout meta data functions.
       
   415      */
       
   416     TBool GetVariety( TInt& aVariety );
       
   417     
       
   418     /**
       
   419      * Cancels long tap animation.
   374      * Cancels long tap animation.
   420      */
   375      */
   421     void CancelLongTapAnimation( TBool aDisablePopup = ETrue );
   376     void CancelLongTapAnimation( TBool aDisablePopup = ETrue );
   422     
   377     
   423     /**
   378     /**
   431     
   386     
   432 private: // Data
   387 private: // Data
   433     
   388     
   434     // parent control
   389     // parent control
   435     CCoeControl& iParent;
   390     CCoeControl& iParent;
       
   391     
       
   392     // utility helper class
       
   393     CTsFastSwapAreaExtension* iFastSwapExt;
   436     
   394     
   437     // device state
   395     // device state
   438     // not own 
   396     // not own 
   439     CTsDeviceState& iDeviceState;
   397     CTsDeviceState& iDeviceState;
   440 
   398 
   483     TBool iIgnoreLayoutSwitch;
   441     TBool iIgnoreLayoutSwitch;
   484     
   442     
   485     // Key event handling
   443     // Key event handling
   486     TBool iConsumeEvent;
   444     TBool iConsumeEvent;
   487     TBool iKeyEvent;
   445     TBool iKeyEvent;
       
   446     CAknPointerEventSuppressor* iEventSupressor;
       
   447     TBool iSupressDrag;
   488     
   448     
   489     // App closing handling
   449     // App closing handling
   490     RArray<TInt> iIsClosing;
   450     RArray<TInt> iIsClosing;
   491     TInt iWidgetClosingCount;
   451     TInt iWidgetClosingCount;
   492     TInt iPrevAppCount;
   452     TInt iPrevAppCount;
   493     
   453     
   494     // Long tap animation
   454     // Long tap animation
   495     CAknLongTapAnimation* iLongTapAnimation;
   455     CAknLongTapAnimation* iLongTapAnimation;
   496     CTsFastSwapTimer* iLongTapAnimationTimer;
   456     CTsFastSwapTimer* iLongTapAnimationTimer;
   497     TBool iLongTapAnimationRunning;
   457     TBool iLongTapAnimationRunning;
       
   458     
       
   459     // Screenshot handling
       
   460     RArray<TInt> iPrevScreenshots;
   498     };
   461     };
   499 
   462 
   500 #endif // TSFASTSWAPAREA_H
   463 #endif // TSFASTSWAPAREA_H