[Qt][WK2] Move non-api classes to WebKit namespace at WebKit2/UiProcess/qt
[WebKit-https.git] / Source / WebKit2 / UIProcess / qt / QtWebPageEventHandler.h
1 /*
2  * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #ifndef QtWebPageEventHandler_h
22 #define QtWebPageEventHandler_h
23
24 #include "QtPanGestureRecognizer.h"
25 #include "QtPinchGestureRecognizer.h"
26 #include "QtTapGestureRecognizer.h"
27 #include <QBasicTimer>
28 #include <QTouchEvent>
29 #include <WKPage.h>
30 #include <wtf/PassRefPtr.h>
31
32 QT_BEGIN_NAMESPACE
33 class QInputMethodEvent;
34 class QKeyEvent;
35 QT_END_NAMESPACE
36
37 class QQuickWebPage;
38 class QQuickWebView;
39
40 namespace WebCore {
41 class DragData;
42 class IntPoint;
43 class IntRect;
44 }
45
46 namespace WebKit {
47
48 class NativeWebTouchEvent;
49 class QtViewportInteractionEngine;
50 class ShareableBitmap;
51 class WebGestureEvent;
52 class WebPageProxy;
53
54 class QtWebPageEventHandler : public QObject {
55     Q_OBJECT
56
57 public:
58     QtWebPageEventHandler(WKPageRef, QQuickWebPage*, QQuickWebView*);
59     ~QtWebPageEventHandler();
60
61     void handleKeyPressEvent(QKeyEvent*);
62     void handleKeyReleaseEvent(QKeyEvent*);
63     void handleFocusInEvent(QFocusEvent*);
64     void handleFocusOutEvent(QFocusEvent*);
65     void handleMouseMoveEvent(QMouseEvent*);
66     void handleMousePressEvent(QMouseEvent*);
67     void handleMouseReleaseEvent(QMouseEvent*);
68     void handleWheelEvent(QWheelEvent*);
69     void handleHoverLeaveEvent(QHoverEvent*);
70     void handleHoverMoveEvent(QHoverEvent*);
71     void handleDragEnterEvent(QDragEnterEvent*);
72     void handleDragLeaveEvent(QDragLeaveEvent*);
73     void handleDragMoveEvent(QDragMoveEvent*);
74     void handleDropEvent(QDropEvent*);
75     void handleInputMethodEvent(QInputMethodEvent*);
76     void handleTouchEvent(QTouchEvent*);
77
78     void setViewportInteractionEngine(QtViewportInteractionEngine*);
79
80     void handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint&);
81     void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
82     void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
83
84     void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area);
85     void updateTextInputState();
86     void doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled);
87 #if ENABLE(TOUCH_EVENTS)
88     void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
89 #endif
90     void resetGestureRecognizers();
91
92     QtViewportInteractionEngine* interactionEngine() { return m_interactionEngine; }
93
94     void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
95
96 protected:
97     WebPageProxy* m_webPageProxy;
98     QtViewportInteractionEngine* m_interactionEngine;
99     QtPanGestureRecognizer m_panGestureRecognizer;
100     QtPinchGestureRecognizer m_pinchGestureRecognizer;
101     QtTapGestureRecognizer m_tapGestureRecognizer;
102     QQuickWebPage* m_webPage;
103     QQuickWebView* m_webView;
104
105 private slots:
106     void inputPanelVisibleChanged();
107
108 private:
109     void timerEvent(QTimerEvent*);
110
111     QPointF m_lastClick;
112     QBasicTimer m_clickTimer;
113     Qt::MouseButton m_previousClickButton;
114     int m_clickCount;
115     bool m_postponeTextInputStateChanged;
116 };
117
118 } // namespace WebKit
119
120 #endif /* QtWebPageEventHandler_h */