2008-08-12 Urs Wolfer <uwolfer@kde.org>
[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     QMenu *createContextMenu(const WebCore::ContextMenu *webcoreMenu, const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions);
75
76     QWebFrame *frameAt(const QPoint &pos) const;
77
78     void _q_onLoadProgressChanged(int);
79     void _q_webActionTriggered(bool checked);
80     void updateAction(QWebPage::WebAction action);
81     void updateNavigationActions();
82     void updateEditorActions();
83
84     void timerEvent(QTimerEvent*);
85     
86     void mouseMoveEvent(QMouseEvent*);
87     void mousePressEvent(QMouseEvent*);
88     void mouseDoubleClickEvent(QMouseEvent*);
89     void mouseTripleClickEvent(QMouseEvent*);
90     void mouseReleaseEvent(QMouseEvent*);
91     void contextMenuEvent(QContextMenuEvent*);
92     void wheelEvent(QWheelEvent*);
93     void keyPressEvent(QKeyEvent*);
94     void keyReleaseEvent(QKeyEvent*);
95     void focusInEvent(QFocusEvent*);
96     void focusOutEvent(QFocusEvent*);
97
98     void dragEnterEvent(QDragEnterEvent *);
99     void dragLeaveEvent(QDragLeaveEvent *);
100     void dragMoveEvent(QDragMoveEvent *);
101     void dropEvent(QDropEvent *);
102
103     void inputMethodEvent(QInputMethodEvent*);
104
105     void shortcutOverrideEvent(QKeyEvent*);
106     void leaveEvent(QEvent *);
107     bool handleScrolling(QKeyEvent*);
108
109     WebCore::ChromeClientQt *chromeClient;
110     WebCore::ContextMenuClientQt *contextMenuClient;
111     WebCore::EditorClientQt *editorClient;
112     WebCore::Page *page;
113
114     QPointer<QWebFrame> mainFrame;
115
116     QWebPage *q;
117     QUndoStack *undoStack;
118     QWidget *view;
119
120     bool modified;
121
122     bool insideOpenCall;
123     quint64 m_totalBytes;
124     quint64 m_bytesReceived;
125     
126     QPoint tripleClick;
127     QBasicTimer tripleClickTimer;
128
129 #if QT_VERSION < 0x040400
130     bool acceptNavigationRequest(QWebFrame *frame, const QWebNetworkRequest &request, QWebPage::NavigationType type);
131
132     QWebNetworkInterface *networkInterface;
133 #ifndef QT_NO_NETWORKPROXY
134     QNetworkProxy networkProxy;
135 #endif
136
137 #else
138     bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type);
139     QNetworkAccessManager *networkManager;
140 #endif
141
142     bool forwardUnsupportedContent;
143     QWebPage::LinkDelegationPolicy linkPolicy;
144
145     QSize viewportSize;
146     QWebHistory history;
147     QWebHitTestResult hitTestResult;
148     QPointer<QMenu> currentContextMenu;
149     QWebSettings *settings;
150     QPalette palette;
151     bool editable;
152
153     QAction *actions[QWebPage::WebActionCount];
154
155     QWebPluginFactory *pluginFactory;
156 };
157
158 #endif