taskswitcher/taskswitcherui/taskswitcherapp/inc/tsphysicsengine.h
branchRCL_3
changeset 83 5456b4e8b3a8
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Taskswitcher physic engine
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef TSPHYSICSENGINE_H_
       
    20 #define TSPHYSICSENGINE_H_
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <akntouchgesturefw.h>
       
    24 // CLASS DECLARATION
       
    25 class CAknPhysics;
       
    26 class CTsPhysics;
       
    27 /**
       
    28  * Taskswitcher physic engine implementation
       
    29  */
       
    30 class CTsPhysicsEngine: public CBase
       
    31     {
       
    32 public:
       
    33     // Constructors and destructor
       
    34 
       
    35     /**
       
    36      * Destructor.
       
    37      */
       
    38     ~CTsPhysicsEngine();
       
    39 
       
    40     /**
       
    41      * Two-phased constructor.
       
    42      */
       
    43     static CTsPhysicsEngine* NewL(MAknPhysicsObserver& aPhysicObserver,
       
    44             CCoeControl& aViewControl);
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      */
       
    49     static CTsPhysicsEngine* NewLC(MAknPhysicsObserver& aPhysicObserver,
       
    50             CCoeControl& aViewControl);
       
    51 
       
    52 private:
       
    53 
       
    54     /**
       
    55      * Constructor for performing 1st stage construction
       
    56      */
       
    57     CTsPhysicsEngine();
       
    58 
       
    59     /**
       
    60      * EPOC default constructor for performing 2nd stage construction
       
    61      */
       
    62     void ConstructL(MAknPhysicsObserver& aPhysicObserver,
       
    63             CCoeControl& aViewControl);
       
    64     
       
    65     
       
    66 public:
       
    67     /**
       
    68      * Implements drag gesture handling
       
    69      * @param aEvent - drag event
       
    70      */
       
    71     void HandleDragEvent(AknTouchGestureFw::MAknTouchGestureFwDragEvent& aEvent);
       
    72     
       
    73     /**
       
    74      * Checks if the physics is running
       
    75      */
       
    76     TBool IsRunning() const;
       
    77     
       
    78     /**
       
    79      * Stops physics
       
    80      */
       
    81     void Stop();
       
    82     
       
    83     /**
       
    84      * Initialize animation between current position and destination point
       
    85      * @param aPoint - destination point 
       
    86      */
       
    87     void AnimateToTarget(const TPoint& aPoint);
       
    88     
       
    89     /**
       
    90      * 
       
    91      * @param aWorldSize Physics world size.
       
    92      * @param aViewSize Physics (visible) view size.
       
    93      * @param aLandscape ETrue if physics should work in landscape.     
       
    94      **/
       
    95     void ReInitPhysicsL(const TSize& aWorldSize, 
       
    96                         const TSize& aViewSize,
       
    97                         TBool aLandscape);
       
    98     
       
    99 private:
       
   100     /**
       
   101      * Physics. 
       
   102      * Own.
       
   103      */
       
   104     CAknPhysics* iPhysics;
       
   105 
       
   106     /**
       
   107      * Drag start time
       
   108      */
       
   109     TTime iStartTime;
       
   110     
       
   111     /**
       
   112      * Drag start position
       
   113      */
       
   114     TPoint iStartPosition;
       
   115     
       
   116     /**
       
   117      * Taskswitcher physics for item switch animation
       
   118      */
       
   119     CTsPhysics* iTaskswitcherPhysics;
       
   120     
       
   121     /**
       
   122      * Marks direction in which drag events are made:
       
   123      * Values: 0 - uninitialized
       
   124      *         1 - drag right
       
   125      *        -1 - drag left 
       
   126      */
       
   127     TInt iDragDirection;
       
   128 
       
   129     };
       
   130 
       
   131 #endif /* TSPHYSICSENGINE_H_*/