2008-08-15 HÃ¥vard Wall <hwall@trolltech.com>
[WebKit-https.git] / WebKit / qt / Api / qwebpage_p.h
1 /*
2     Copyright (C) 2007 Trolltech ASA
3     Copyright (C) 2008 Holger Hans Peter Freyther
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #ifndef QWEBPAGE_P_H
22 #define QWEBPAGE_P_H
23
24 #include <qbasictimer.h>
25 #include <qnetworkproxy.h>
26 #include <qpointer.h>
27 #include <qevent.h>
28
29 #include "qwebpage.h"
30 #include "qwebhistory.h"
31 #include "qwebframe.h"
32
33 #include "KURL.h"
34 #include "PlatformString.h"
35
36 #include <wtf/RefPtr.h>
37
38 namespace WebCore
39 {
40     class ChromeClientQt;
41     class ContextMenuClientQt;
42     class ContextMenuItem;
43     class ContextMenu;
44     class EditorClientQt;
45     class Element;
46     class Node;
47     class Page;
48
49 #ifndef QT_NO_CURSOR
50     class SetCursorEvent : public QEvent {
51     public:
52         static const int EventType = 724;
53         SetCursorEvent(const QCursor&);
54
55         QCursor cursor() const;
56     private:
57         QCursor m_cursor;
58     };
59 #endif
60 }
61
62 QT_BEGIN_NAMESPACE
63 class QUndoStack;
64 class QMenu;
65 class QBitArray;
66 QT_END_NAMESPACE
67
68 class QWebPagePrivate
69 {
70 public:
71     QWebPagePrivate(QWebPage *);
72     ~QWebPagePrivate();
73     void createMainFrame();
74 #ifndef QT_NO_CONTEXTMENU
75     QMenu *createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions);
76 #endif
77
78     QWebFrame *frameAt(const QPoint &pos) const;
79
80     void _q_onLoadProgressChanged(int);
81     void _q_webActionTriggered(bool checked);
82     void updateAction(QWebPage::WebAction action);
83     void updateNavigationActions();
84     void updateEditorActions();
85
86     void timerEvent(QTimerEvent*);
87
88     void mouseMoveEvent(QMouseEvent*);
89     void mousePressEvent(QMouseEvent*);
90     void mouseDoubleClickEvent(QMouseEvent*);
91     void mouseTripleClickEvent(QMouseEvent*);
92     void mouseReleaseEvent(QMouseEvent*);
93 #ifndef QT_NO_CONTEXTMENU
94     void contextMenuEvent(QContextMenuEvent*);
95 #endif
96 #ifndef QT_NO_WHEELEVENT
97     void wheelEvent(QWheelEvent*);
98 #endif
99     void keyPressEvent(QKeyEvent*);
100     void keyReleaseEvent(QKeyEvent*);
101     void focusInEvent(QFocusEvent*);
102     void focusOutEvent(QFocusEvent*);
103
104     void dragEnterEvent(QDragEnterEvent *);
105     void dragLeaveEvent(QDragLeaveEvent *);
106     void dragMoveEvent(QDragMoveEvent *);
107     void dropEvent(QDropEvent *);
108
109     void inputMethodEvent(QInputMethodEvent*);
110
111     void shortcutOverrideEvent(QKeyEvent*);
112     void leaveEvent(QEvent *);
113     bool handleScrolling(QKeyEvent*);
114
115     WebCore::ChromeClientQt *chromeClient;
116     WebCore::ContextMenuClientQt *contextMenuClient;
117     WebCore::EditorClientQt *editorClient;
118     WebCore::Page *page;
119
120     QPointer<QWebFrame> mainFrame;
121
122     QWebPage *q;
123 #ifndef QT_NO_UNDOSTACK
124     QUndoStack *undoStack;
125 #endif
126     QWidget *view;
127
128     bool insideOpenCall;
129     quint64 m_totalBytes;
130     quint64 m_bytesReceived;
131
132     QPoint tripleClick;
133     QBasicTimer tripleClickTimer;
134
135 #if QT_VERSION < 0x040400
136     bool acceptNavigationRequest(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     bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
145     QNetworkAccessManager *networkManager;
146 #endif
147
148     bool forwardUnsupportedContent;
149     QWebPage::LinkDelegationPolicy linkPolicy;
150
151     QSize viewportSize;
152     QWebHistory history;
153     QWebHitTestResult hitTestResult;
154 #ifndef QT_NO_CONTEXTMENU
155     QPointer<QMenu> currentContextMenu;
156 #endif
157     QWebSettings *settings;
158     QPalette palette;
159     bool editable;
160
161     QAction *actions[QWebPage::WebActionCount];
162
163     QWebPluginFactory *pluginFactory;
164 };
165
166 #endif