meetingrequest/mrgui/inc/cmrlistpanephysics.h
branchRCL_3
changeset 25 3533d4323edc
parent 12 4ce476e64c59
equal deleted inserted replaced
24:d189ee25cf9d 25:3533d4323edc
       
     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:  ESMR Custom list component physics impl
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CMRLISTPANEPHYSICS_H
       
    19 #define CMRLISTPANEPHYSICS_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <w32std.h>
       
    24 #include <aknphysicsobserveriface.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CAknPhysics;
       
    28 class CMRFieldContainer;
       
    29 class CCoeControl;
       
    30 class MMRPhysicsObserver;
       
    31 
       
    32 // CLASS DECLARATIONS
       
    33 NONSHARABLE_CLASS( CMRListPanePhysics ): 
       
    34     public CBase, 
       
    35     public MAknPhysicsObserver
       
    36     {
       
    37     public: // C'tor and d'tor
       
    38         static CMRListPanePhysics* NewL(
       
    39                 CCoeControl& aParent, 
       
    40                 CMRFieldContainer& aViewControl,
       
    41                 MMRPhysicsObserver& aPhysicsObserver );
       
    42         
       
    43         ~CMRListPanePhysics();
       
    44         
       
    45     public: // Interface
       
    46         /**
       
    47          * Handles the pointer event
       
    48          *
       
    49          * @param aPointerEvent Pointer event to handle.
       
    50          * @param aEventsBlocked ETrue if events are blocked.
       
    51          *          Set by this function.
       
    52          * @return ETrue if the physics has been started, EFalse otherwise.
       
    53          */
       
    54         TBool HandlePointerEventL(
       
    55                 const TPointerEvent& aPointerEvent, TBool& aEventsBlocked );
       
    56         
       
    57         /**
       
    58          * Initializes physics.
       
    59          */
       
    60         void InitPhysics();
       
    61         
       
    62         /**
       
    63          * Sets world height.
       
    64          *
       
    65          * @param aWorldHeight New world height.
       
    66          */
       
    67         void SetWorldHeight( TInt aWorldHeight );
       
    68         
       
    69         /**
       
    70          * Sets the vertical scroll index, which is directly the position 
       
    71          * of the list pane on the Y-axis
       
    72          *
       
    73          * @param aVerScrollIndex New vertical scroll index.
       
    74          */
       
    75         void UpdateVerticalScrollIndex( TInt aVerScrollIndex );
       
    76         
       
    77         /**
       
    78          * Returns the current vertical scroll index.
       
    79          *
       
    80          * @return Current vertical scroll index
       
    81          */
       
    82         TInt VerticalScrollIndex();
       
    83 
       
    84         
       
    85     public:    // from base class MAknPhysicsObserver
       
    86         void ViewPositionChanged( const TPoint& aNewPosition,
       
    87                                   TBool aDrawNow,
       
    88                                   TUint aFlags );            
       
    89         void PhysicEmulationEnded();    
       
    90         TPoint ViewPosition() const;
       
    91         
       
    92     private: // Implementation
       
    93         CMRListPanePhysics( CCoeControl& aParent, 
       
    94                             CMRFieldContainer& aViewControl,
       
    95                             MMRPhysicsObserver& aPhysicsObserver );
       
    96         void ConstructL();
       
    97 
       
    98     private:
       
    99         /// Own: Physics engine handle
       
   100         CAknPhysics* iPhysics;   
       
   101         /// Ref: Parent control
       
   102         CCoeControl& iParent;
       
   103         /// Ref: Reference to field container that should be kinetic
       
   104         CMRFieldContainer& iViewControl;
       
   105         /// Feature enabled
       
   106         TBool iFeatureEnabled;
       
   107         /// Ref: Physics observer
       
   108         MMRPhysicsObserver& iPhysicsObserver;
       
   109         /// Own: Records previous pointer event
       
   110         TPointerEvent iPreviousPointerEvent;
       
   111 
       
   112         /**
       
   113          * Physics world size.
       
   114          */
       
   115         TSize iWorldSize;
       
   116         
       
   117         /**
       
   118          * Physics view size.
       
   119          */
       
   120         TSize iViewSize;
       
   121 
       
   122         /**
       
   123          * Vertical scroll index.
       
   124          */
       
   125         TInt iVerScrollIndex;
       
   126         
       
   127         /**
       
   128          * Pointer event start time.
       
   129          */
       
   130         TTime iStartTime;
       
   131         
       
   132         /**
       
   133          * Pointer event start position.
       
   134          */
       
   135         TPoint iStartPoint;
       
   136 
       
   137         /**
       
   138          * Pointer event drag position.
       
   139          */
       
   140         TPoint iDragPoint;             
       
   141     };
       
   142 
       
   143 #endif // CMRLISTPANEPHYSICS_H
       
   144 // End of file
       
   145