|
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 WEBSCROLLINGDECELERATOR_H |
|
20 #define WEBSCROLLINGDECELERATOR_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include <coedef.h> |
|
25 #include <w32std.h> |
|
26 |
|
27 // MACROS |
|
28 |
|
29 // FORWARD DECLARATIONS |
|
30 class WebView; |
|
31 |
|
32 // CLASS DECLARATION |
|
33 class WebScrollingDecelerator: public CTimer |
|
34 { |
|
35 public: // Constructor and destructor |
|
36 |
|
37 /** |
|
38 * Two-phased constructor. |
|
39 */ |
|
40 static WebScrollingDecelerator* NewL(WebView& webView); |
|
41 |
|
42 /** |
|
43 * Destructor. |
|
44 */ |
|
45 virtual ~WebScrollingDecelerator(); |
|
46 |
|
47 private: |
|
48 |
|
49 /** |
|
50 * C++ default constructor. |
|
51 */ |
|
52 WebScrollingDecelerator(WebView& webView); |
|
53 |
|
54 /** |
|
55 * By default Symbian 2nd phase constructor is private. |
|
56 */ |
|
57 void ConstructL(); |
|
58 |
|
59 public: // Main functions |
|
60 /** |
|
61 * @since 5.0 |
|
62 * param pointerEvent |
|
63 * return void |
|
64 */ |
|
65 void updatePos(); |
|
66 |
|
67 /** |
|
68 * @since 5.0 |
|
69 * param none |
|
70 * return void |
|
71 */ |
|
72 void startDecelL(); |
|
73 |
|
74 /** |
|
75 * @since 5.0 |
|
76 * param none |
|
77 * return void |
|
78 */ |
|
79 void stopDecelL() { m_decelelatorSwitch = false; Cancel(); } |
|
80 |
|
81 /** |
|
82 * @since 5.0 |
|
83 * param none |
|
84 * return void |
|
85 */ |
|
86 void RunL(); |
|
87 |
|
88 private: // Data |
|
89 |
|
90 // Pointer to owning view |
|
91 WebView& m_webView; // not owned |
|
92 |
|
93 // Track pointer drag events |
|
94 RArray<const TPoint> m_dragPosition; |
|
95 |
|
96 // scroll delta |
|
97 TPoint m_scrolldelta; |
|
98 |
|
99 // count of number of scoll steps |
|
100 TUint m_numscrollsteps; |
|
101 |
|
102 // decelator status flag |
|
103 bool m_decelelatorSwitch; |
|
104 |
|
105 //normalized current position to minimize rounding error |
|
106 TPoint m_normalizedCurrentPosition; |
|
107 |
|
108 }; |
|
109 |
|
110 #endif // WEBSCROLLINGDECELERATOR_H |
|
111 |
|
112 // End of File |