EventHandler changes/fixes in QWebPage:
[WebKit-https.git] / WebKit / qt / Api / qwebpage_p.h
1 /*
2     Copyright (C) 2007 Trolltech ASA
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 library 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 library; 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     This class provides all functionality needed for loading images, style sheets and html
20     pages from the web. It has a memory cache for these objects.
21 */
22 #ifndef QWEBPAGE_P_H
23 #define QWEBPAGE_P_H
24
25 #include <qnetworkproxy.h>
26 #include <qpointer.h>
27
28 #include "qwebpage.h"
29 #include "qwebhistory.h"
30 #include "qwebframe.h"
31
32 #include <wtf/RefPtr.h>
33
34 namespace WebCore
35 {
36     class ChromeClientQt;
37     class ContextMenuClientQt;
38     class ContextMenuItem;
39     class ContextMenu;
40     class EditorClientQt;
41     class Node;
42     class Page;
43 }
44
45 class QUndoStack;
46 class QMenu;
47
48 class QWebPageContextPrivate
49 {
50 public:
51     QPoint pos;
52     QString text;
53     QUrl linkUrl;
54     QUrl imageUrl;
55     QPixmap image;
56     QPointer<QWebFrame> targetFrame;
57     RefPtr<WebCore::Node> innerNonSharedNode;
58 };
59
60 class QWebPageContext
61 {
62 public:
63     QWebPageContext();
64     QWebPageContext(const QWebPageContext &other);
65     QWebPageContext &operator=(const QWebPageContext &other);
66     ~QWebPageContext();
67
68     QPoint pos() const;
69     QString text() const;
70     QUrl linkUrl() const;
71     QUrl imageUrl() const;
72     // ### we have a pixmap internally, should this be called pixmap() instead?
73     QPixmap image() const;
74
75     QWebFrame *targetFrame() const;
76
77 private:
78     QWebPageContext(const WebCore::HitTestResult &hitTest);
79     QWebPageContextPrivate *d;
80
81     friend class QWebPage;
82     friend class QWebPagePrivate;
83 };
84
85 class QWebPagePrivate
86 {
87 public:
88     QWebPagePrivate(QWebPage *);
89     ~QWebPagePrivate();
90     void createMainFrame();
91     QMenu *createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items);
92
93     QWebFrame *frameAt(const QPoint &pos) const;
94
95     void _q_onLoadProgressChanged(int);
96     void _q_webActionTriggered(bool checked);
97     void updateAction(QWebPage::WebAction action);
98     void updateNavigationActions();
99     void updateEditorActions();
100
101     void mouseMoveEvent(QMouseEvent*);
102     void mousePressEvent(QMouseEvent*);
103     void mouseDoubleClickEvent(QMouseEvent*);
104     void mouseReleaseEvent(QMouseEvent*);
105     void contextMenuEvent(QContextMenuEvent*);
106     void wheelEvent(QWheelEvent*);
107     void keyPressEvent(QKeyEvent*);
108     void keyReleaseEvent(QKeyEvent*);
109     void focusInEvent(QFocusEvent*);
110     void focusOutEvent(QFocusEvent*);
111
112     void dragEnterEvent(QDragEnterEvent *);
113     void dragLeaveEvent(QDragLeaveEvent *);
114     void dragMoveEvent(QDragMoveEvent *);
115     void dropEvent(QDropEvent *);
116
117
118     WebCore::ChromeClientQt *chromeClient;
119     WebCore::ContextMenuClientQt *contextMenuClient;
120     WebCore::EditorClientQt *editorClient;
121     WebCore::Page *page;
122
123     QPointer<QWebFrame> mainFrame;
124
125     QWebPage *q;
126     QUndoStack *undoStack;
127     QWidget *view;
128
129     bool modified;
130
131     bool insideOpenCall;
132     quint64 m_totalBytes;
133     quint64 m_bytesReceived;
134
135 #if QT_VERSION < 0x040400
136     QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
137
138     QWebNetworkInterface *networkInterface;
139 #ifndef QT_NO_NETWORKPROXY
140     QNetworkProxy networkProxy;
141 #endif
142
143 #else
144     QWebPage::NavigationRequestResponse navigationRequested(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
145     QNetworkAccessManager *networkManager;
146 #endif
147
148     QWebHistory history;
149     QWebPageContext currentContext;
150     QWebSettings *settings;
151
152     QAction *actions[QWebPage::WebActionCount];
153 };
154
155 #endif