|
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: Implemetation of WebPointerEventHandler |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __WEBPOINTEREVENTHANDLER_H__ |
|
19 #define __WEBPOINTEREVENTHANDLER_H__ |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <w32std.h> |
|
23 #include "Timer.h" |
|
24 #include <rt_gesturehelper.h> |
|
25 |
|
26 namespace WebCore |
|
27 { |
|
28 class Node; |
|
29 class Element; |
|
30 }; |
|
31 |
|
32 class WebView; |
|
33 class CActiveSchedulerWait; |
|
34 |
|
35 class WebPointerEventHandler : public CBase, public RT_GestureHelper::MGestureObserver |
|
36 { |
|
37 public: |
|
38 static WebPointerEventHandler* NewL(WebView* view); |
|
39 void ConstructL(); |
|
40 virtual ~WebPointerEventHandler(); |
|
41 |
|
42 public: |
|
43 void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
44 void HandleHighlightChange(const TPoint &aPoint); |
|
45 |
|
46 virtual void HandleGestureL( const RT_GestureHelper::MGestureEvent& aEvent ); |
|
47 |
|
48 |
|
49 private: |
|
50 bool checkForEventListener(WebCore::Node* node); |
|
51 bool canDehighlight(const TPoint &aPoint); |
|
52 void dehighlight(); |
|
53 |
|
54 bool isHighlitableElement(TBrCtlDefs::TBrCtlElementType& elType); |
|
55 TBrCtlDefs::TBrCtlElementType highlitableElement(); |
|
56 void buttonDownTimerCB(WebCore::Timer<WebPointerEventHandler>* t); |
|
57 void handleTouchDownL(const RT_GestureHelper::MGestureEvent& aEvent); |
|
58 void handleTouchUp(const RT_GestureHelper::MGestureEvent& aEvent); |
|
59 void handleTapL(const RT_GestureHelper::MGestureEvent& aEvent); |
|
60 void handleDoubleTap(const RT_GestureHelper::MGestureEvent& aEvent); |
|
61 void handleMove(const RT_GestureHelper::MGestureEvent& aEvent); |
|
62 void doTapL(); |
|
63 void updateCursor(const TPoint& pos); |
|
64 private: |
|
65 WebPointerEventHandler(WebView* view); |
|
66 WebView* m_webview; |
|
67 |
|
68 |
|
69 TPointerEvent m_buttonDownEvent; |
|
70 TPointerEvent m_lastTapEvent; |
|
71 |
|
72 // Support for link highlight/dehighlight |
|
73 TBool m_isHighlighted; |
|
74 TInt m_offset; |
|
75 TPoint m_highlightPos; |
|
76 WebCore::Node* m_highlightedNode; |
|
77 TPointerEvent m_currentEvent; |
|
78 WebCore::Timer<WebPointerEventHandler> m_buttonDownTimer; |
|
79 |
|
80 RT_GestureHelper::CGestureHelper* m_gestureHelper; |
|
81 TPointerEvent m_lastPointerEvent; |
|
82 bool m_ignoreTap; |
|
83 CActiveSchedulerWait* m_waiter; |
|
84 |
|
85 }; |
|
86 |
|
87 |
|
88 |
|
89 #endif |