|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: Handles Web Scrolling Deceleration |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WEBSCROLLINGDECELERATORGH_H |
|
20 #define WEBSCROLLINGDECELERATORGH_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <coedef.h> |
|
25 #include <w32std.h> |
|
26 #include <rt_gestureobserver.h> |
|
27 |
|
28 // MACROS |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class WebView; |
|
32 class WebScrollbarDrawer; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 class WebScrollingDeceleratorGH: public CBase |
|
36 { |
|
37 public: // Constructor and destructor |
|
38 |
|
39 /** |
|
40 * Two-phased constructor. |
|
41 */ |
|
42 static WebScrollingDeceleratorGH* NewL(WebView& webView); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~WebScrollingDeceleratorGH(); |
|
48 |
|
49 private: |
|
50 |
|
51 /** |
|
52 * C++ default constructor. |
|
53 */ |
|
54 WebScrollingDeceleratorGH(WebView& webView); |
|
55 |
|
56 /** |
|
57 * By default Symbian 2nd phase constructor is private. |
|
58 */ |
|
59 void ConstructL(); |
|
60 |
|
61 public: // Main functions |
|
62 |
|
63 void startDecel(RT_GestureHelper::TRealPoint& speed, WebScrollbarDrawer* scrollbarDrawer); |
|
64 |
|
65 void cancelDecel(); |
|
66 |
|
67 void scroll(); |
|
68 |
|
69 int getDecceleration(); |
|
70 |
|
71 private: // Data |
|
72 |
|
73 // Pointer to owning view |
|
74 WebView& m_webView; // not owned |
|
75 |
|
76 // scroll delta |
|
77 TPoint m_scrolldelta; |
|
78 |
|
79 // count of number of scoll steps |
|
80 TUint m_numscrollsteps; |
|
81 |
|
82 // decelator status flag |
|
83 bool m_decelelatorSwitch; |
|
84 |
|
85 //normalized current position to minimize rounding error |
|
86 TPoint m_normalizedCurrentPosition; |
|
87 |
|
88 RT_GestureHelper::TRealPoint m_initSpeed; |
|
89 |
|
90 CPeriodic* m_decelTimer; |
|
91 |
|
92 TPoint m_lastPos; |
|
93 |
|
94 TPoint m_startPos; |
|
95 |
|
96 WebScrollbarDrawer* m_scrollbarDrawer; |
|
97 }; |
|
98 |
|
99 |
|
100 |
|
101 #endif // WEBSCROLLINGDECELERATOR_GH_H |
|
102 |
|
103 // End of File |