[Qt][WK2] Build failure when using --no-touch-events
[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 "QtViewportInteractionEngine.h"
28 #include "WebPageProxy.h"
29 #include <QBasicTimer>
30 #include <QKeyEvent>
31 #include <QInputMethodEvent>
32 #include <QTouchEvent>
33 #include <WKPage.h>
34
35 class QQuickWebPage;
36
37 using namespace WebKit;
38
39 class QtWebPageEventHandler : public QObject {
40     Q_OBJECT
41
42 public:
43     QtWebPageEventHandler(WKPageRef, QQuickWebPage*, QQuickWebView*);
44     ~QtWebPageEventHandler();
45
46     void handleKeyPressEvent(QKeyEvent*);
47     void handleKeyReleaseEvent(QKeyEvent*);
48     void handleFocusInEvent(QFocusEvent*);
49     void handleFocusOutEvent(QFocusEvent*);
50     void handleMouseMoveEvent(QMouseEvent*);
51     void handleMousePressEvent(QMouseEvent*);
52     void handleMouseReleaseEvent(QMouseEvent*);
53     void handleWheelEvent(QWheelEvent*);
54     void handleHoverLeaveEvent(QHoverEvent*);
55     void handleHoverMoveEvent(QHoverEvent*);
56     void handleDragEnterEvent(QDragEnterEvent*);
57     void handleDragLeaveEvent(QDragLeaveEvent*);
58     void handleDragMoveEvent(QDragMoveEvent*);
59     void handleDropEvent(QDropEvent*);
60     void handleInputMethodEvent(QInputMethodEvent*);
61     void handleTouchEvent(QTouchEvent*);
62
63     void setViewportInteractionEngine(QtViewportInteractionEngine*);
64
65     void handlePotentialSingleTapEvent(const QTouchEvent::TouchPoint&);
66     void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
67     void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
68
69     void didFindZoomableArea(const WebCore::IntPoint& target, const WebCore::IntRect& area);
70     void updateTextInputState();
71     void doneWithGestureEvent(const WebGestureEvent& event, bool wasEventHandled);
72 #if ENABLE(TOUCH_EVENTS)
73     void doneWithTouchEvent(const NativeWebTouchEvent&, bool wasEventHandled);
74 #endif
75     void resetGestureRecognizers();
76
77     QtViewportInteractionEngine* interactionEngine() { return m_interactionEngine; }
78
79     void startDrag(const WebCore::DragData&, PassRefPtr<ShareableBitmap> dragImage);
80
81 protected:
82     WebPageProxy* m_webPageProxy;
83     QtViewportInteractionEngine* m_interactionEngine;
84     QtPanGestureRecognizer m_panGestureRecognizer;
85     QtPinchGestureRecognizer m_pinchGestureRecognizer;
86     QtTapGestureRecognizer m_tapGestureRecognizer;
87     QQuickWebPage* m_webPage;
88     QQuickWebView* m_webView;
89
90 private slots:
91     void inputPanelVisibleChanged();
92
93 private:
94     void timerEvent(QTimerEvent*);
95
96     QPointF m_lastClick;
97     QBasicTimer m_clickTimer;
98     Qt::MouseButton m_previousClickButton;
99     int m_clickCount;
100     bool m_postponeTextInputStateChanged;
101 };
102
103 #endif /* QtWebPageEventHandler_h */