taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
--- a/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h	Wed Sep 15 12:00:00 2010 +0300
+++ b/taskswitcher/taskswitcherui/taskswitcherapp/inc/tsfastswaparea.h	Wed Oct 13 14:18:30 2010 +0300
@@ -34,8 +34,6 @@
 class CTsEventControler;
 class MTsDataChangeObserver;
 class CAknLongTapAnimation;
-class CTsFastSwapAreaExtension;
-class CAknPointerEventSuppressor;
 
 /**
  * Taskswitcher Fast Swap area UI.
@@ -182,13 +180,6 @@
     void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
     
 public:
-    
-    enum TsFastSwapAreaGridData {
-        EMaxItemsOnScreen = 1,
-        EGridItemWidth,
-        EGridItemGap
-    };
-    
     /**
      * Implements drag gesture handling
      * @see MTsEventControlerObserver
@@ -238,21 +229,6 @@
      */
     TBool WgOnTaskList( TInt aWgId );
     
-    /**
-     * Returns full grid view size.
-     */
-    TSize GridWorldSize();
-    
-    /**
-     * Retrieves number of items in grid
-     */
-    TInt GridItemCount();
-    
-    /**
-     * Returnes value of the requested grid data
-     */
-    TInt GetGridItemData( TsFastSwapAreaGridData aDataType );
-    
 public:    
     // from CCoeControl    
     TInt CountComponentControls() const;
@@ -286,26 +262,23 @@
      * Switches to another application.
      */
     void SwitchToApp( TInt aWgId, const TUid& aUid );
-
-    /**
-     * Update and prepare data for grid.
-     */    
-    void GetContentForGrid();
     
     /**
-     * Obtain actual data from server.
-     */ 
-    void GetContentL();
+     * Makes a copy of the given bitmap.
+     * Also scaled to the given size, but maintains aspect ratio,
+     * so the size of the returned bitmap may be less then aSize.
+     */
+    CFbsBitmap* CopyBitmapL( TInt aFbsHandle, TSize aSize );
+
+    /**
+     * Called from HandleFswContentChanged.
+     */    
+    void HandleFswContentChangedL();
     
     /**
-     * Prepare the content from iArray to be shown on the screen.
+     * Shows the content from iArray on the screen.
      */
-    void RenderContentL( );
-    
-    /**
-     * Prepare bitmap for item.
-     */
-    CGulIcon* CreateItemIconLC( CTsFswEntry* aEntry, TBool aIsScreenshot );
+    void RenderContentL( TBool aSuppressAnimation = EFalse );
     
     /**
      * Creates the ganes grid control.
@@ -323,6 +296,11 @@
      * @param  aItemCount  number of items in grid
      */
     void LayoutGridViewL( TInt aItemCount );
+    
+    /**
+     * Returns rectangles for fast swap area controls
+     */
+    void GetFastSwapAreaRects( RArray<TAknLayoutRect>& aRects );
 
     /**
      * Creates a stylus popup instance (iPopup) if not yet done.
@@ -342,6 +320,22 @@
     void NotifyChange();
     
     /**
+     * Retrieves and returns size for image graphics.
+     */
+    TSize PreferredImageSize();
+    
+    /**
+     * Retrieves number of items in grid
+     */
+    TInt GridItemCount();
+    
+    /**
+     * Calculates the correct size if aspect ratio needs to be preserved.
+     */
+    TSize CalculateSizePreserveRatio(const TSize& aTargetAreaSize,
+            const TSize& aSourceSize);
+    
+    /**
      * Selects next item in grid
      */
     void SelectNextItem();
@@ -356,6 +350,11 @@
     void CenterItem( TInt aRedrawDelay);
     
     /**
+     * Returns full grid view size.
+     */
+    TSize GridWorldSize();
+    
+    /**
      * Updates grid, called for manual grid scroll update
      * 
      * @param  aForceRedraw    if set to ETrue - redraw will be forced
@@ -370,12 +369,53 @@
     TSize ViewSize();
     
     /**
+     * Returns the position of the given item inside grid world rect.
+     * Returns point in the middle of the view rectangle.
+     * 
+     * @param  aItemIdx  index of the item for which calculation will be done
+     */
+    TPoint ItemViewPosition( TInt aItemIdx );
+    
+    /**
+     * Returns index of the shown item, based on the logical
+     * position of the grids view. Item that is closest to the
+     * middle of screen is returned.
+     * 
+     * @param  aViewPos  grids view position. This must be point in
+     *                   the middle of the view rectangle
+     * @return  index of the item
+     */
+    TInt ViewToVisibleItem( const TPoint aViewPos );
+    
+    /**
+     * Launches increasing pop-up feedback.
+     */
+    void LaunchPopupFeedback();
+    
+    /**
      * Show highlight when disabled and 
      * consume EEventKeyUp that follows after event that swiched on the highlight.
      */
     TKeyResponse ShowHighlightOnKeyEvent(const TKeyEvent& aKeyEvent, TEventCode aType);
     
     /**
+     * Returns current screen orientation:
+     * 
+     * @return  1 if landscape, 0 if portait 
+     */
+    TInt GetCurrentScreenOrientation();
+    
+    /**
+     * Retrieves variety value, based on current screen resolution.
+     * 
+     * @param  aVariety  result of the function, 0 value means portrait
+     *                   value of 1 indicates landscape
+     * @return  ETrue if screen resolution differs from vale returned by
+     *          layout meta data functions.
+     */
+    TBool GetVariety( TInt& aVariety );
+    
+    /**
      * Cancels long tap animation.
      */
     void CancelLongTapAnimation( TBool aDisablePopup = ETrue );
@@ -389,19 +429,11 @@
      */
     TBool LongTapAnimForPos( const TPoint& aHitPoint );
     
-    /**
-     * Count grid rectangle based on given item position
-     */
-    TRect CountCenteredGridRect( TPoint aItemPosition);
-    
 private: // Data
     
     // parent control
     CCoeControl& iParent;
     
-    // utility helper class
-    CTsFastSwapAreaExtension* iFastSwapExt;
-    
     // device state
     // not own 
     CTsDeviceState& iDeviceState;
@@ -453,8 +485,6 @@
     // Key event handling
     TBool iConsumeEvent;
     TBool iKeyEvent;
-    CAknPointerEventSuppressor* iEventSupressor;
-    TBool iSupressDrag;
     
     // App closing handling
     RArray<TInt> iIsClosing;
@@ -465,10 +495,6 @@
     CAknLongTapAnimation* iLongTapAnimation;
     CTsFastSwapTimer* iLongTapAnimationTimer;
     TBool iLongTapAnimationRunning;
-    
-    // Screenshot handling
-    RArray<TInt> iPrevScreenshots;
-    RArray<TInt> iPrevWgIds;
     };
 
 #endif // TSFASTSWAPAREA_H