source: trunk/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h@ 799

Last change on this file since 799 was 561, checked in by Dmitry A. Kuminov, 16 years ago

trunk: Merged in qt 4.6.1 sources.

File size: 6.8 KB
Line 
1/*
2 Copyright (C) 2008,2009 Nokia Corporation and/or its subsidiary(-ies)
3 Copyright (C) 2007 Staikos Computing Services Inc.
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 QWEBFRAME_H
22#define QWEBFRAME_H
23
24#include <QtCore/qobject.h>
25#include <QtCore/qurl.h>
26#include <QtCore/qvariant.h>
27#include <QtGui/qicon.h>
28#include <QtScript/qscriptengine.h>
29#if QT_VERSION >= 0x040400
30#include <QtNetwork/qnetworkaccessmanager.h>
31#endif
32#include "qwebkitglobal.h"
33
34QT_BEGIN_NAMESPACE
35class QRect;
36class QPoint;
37class QPainter;
38class QPixmap;
39class QMouseEvent;
40class QWheelEvent;
41class QNetworkRequest;
42class QRegion;
43class QPrinter;
44QT_END_NAMESPACE
45
46class QWebNetworkRequest;
47class QWebFramePrivate;
48class QWebPage;
49class QWebHitTestResult;
50class QWebHistoryItem;
51class QWebSecurityOrigin;
52class QWebElement;
53class QWebElementCollection;
54
55namespace WebCore {
56 class WidgetPrivate;
57 class FrameLoaderClientQt;
58 class ChromeClientQt;
59}
60class QWebFrameData;
61class QWebHitTestResultPrivate;
62class QWebFrame;
63
64class QWEBKIT_EXPORT QWebHitTestResult {
65public:
66 QWebHitTestResult();
67 QWebHitTestResult(const QWebHitTestResult &other);
68 QWebHitTestResult &operator=(const QWebHitTestResult &other);
69 ~QWebHitTestResult();
70
71 bool isNull() const;
72
73 QPoint pos() const;
74 QRect boundingRect() const;
75 QWebElement enclosingBlockElement() const;
76 QString title() const;
77
78 QString linkText() const;
79 QUrl linkUrl() const;
80 QUrl linkTitle() const;
81 QWebFrame *linkTargetFrame() const;
82 QWebElement linkElement() const;
83
84 QString alternateText() const; // for img, area, input and applet
85
86 QUrl imageUrl() const;
87 QPixmap pixmap() const;
88
89 bool isContentEditable() const;
90 bool isContentSelected() const;
91
92 QWebElement element() const;
93
94 QWebFrame *frame() const;
95
96private:
97 QWebHitTestResult(QWebHitTestResultPrivate *priv);
98 QWebHitTestResultPrivate *d;
99
100 friend class QWebFrame;
101 friend class QWebPagePrivate;
102 friend class QWebPage;
103};
104
105class QWEBKIT_EXPORT QWebFrame : public QObject {
106 Q_OBJECT
107 Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false)
108 Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
109 Q_PROPERTY(QString title READ title)
110 Q_PROPERTY(QUrl url READ url WRITE setUrl)
111 Q_PROPERTY(QUrl requestedUrl READ requestedUrl)
112 Q_PROPERTY(QUrl baseUrl READ baseUrl)
113 Q_PROPERTY(QIcon icon READ icon)
114 Q_PROPERTY(QSize contentsSize READ contentsSize)
115 Q_PROPERTY(QPoint scrollPosition READ scrollPosition WRITE setScrollPosition)
116 Q_PROPERTY(bool focus READ hasFocus)
117private:
118 QWebFrame(QWebPage *parent, QWebFrameData *frameData);
119 QWebFrame(QWebFrame *parent, QWebFrameData *frameData);
120 ~QWebFrame();
121
122public:
123 QWebPage *page() const;
124
125 void load(const QUrl &url);
126#if QT_VERSION < 0x040400
127 void load(const QWebNetworkRequest &request);
128#else
129 void load(const QNetworkRequest &request,
130 QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation,
131 const QByteArray &body = QByteArray());
132#endif
133 void setHtml(const QString &html, const QUrl &baseUrl = QUrl());
134 void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl());
135
136 void addToJavaScriptWindowObject(const QString &name, QObject *object);
137 void addToJavaScriptWindowObject(const QString &name, QObject *object, QScriptEngine::ValueOwnership ownership);
138 QString toHtml() const;
139 QString toPlainText() const;
140 QString renderTreeDump() const;
141
142 QString title() const;
143 void setUrl(const QUrl &url);
144 QUrl url() const;
145 QUrl requestedUrl() const;
146 QUrl baseUrl() const;
147 QIcon icon() const;
148 QMultiMap<QString, QString> metaData() const;
149
150 QString frameName() const;
151
152 QWebFrame *parentFrame() const;
153 QList<QWebFrame*> childFrames() const;
154
155 Qt::ScrollBarPolicy scrollBarPolicy(Qt::Orientation orientation) const;
156 void setScrollBarPolicy(Qt::Orientation orientation, Qt::ScrollBarPolicy policy);
157
158 void setScrollBarValue(Qt::Orientation orientation, int value);
159 int scrollBarValue(Qt::Orientation orientation) const;
160 int scrollBarMinimum(Qt::Orientation orientation) const;
161 int scrollBarMaximum(Qt::Orientation orientation) const;
162 QRect scrollBarGeometry(Qt::Orientation orientation) const;
163
164 void scroll(int, int);
165 QPoint scrollPosition() const;
166 void setScrollPosition(const QPoint &pos);
167
168 enum RenderLayer {
169 ContentsLayer = 0x10,
170 ScrollBarLayer = 0x20,
171 PanIconLayer = 0x40,
172
173 AllLayers = 0xff
174 };
175
176 void render(QPainter*);
177 void render(QPainter*, const QRegion& clip);
178 void render(QPainter*, RenderLayer layer, const QRegion& clip = QRegion());
179
180 void setTextSizeMultiplier(qreal factor);
181 qreal textSizeMultiplier() const;
182
183 qreal zoomFactor() const;
184 void setZoomFactor(qreal factor);
185
186 bool hasFocus() const;
187 void setFocus();
188
189 QPoint pos() const;
190 QRect geometry() const;
191 QSize contentsSize() const;
192
193 QWebElement documentElement() const;
194 QWebElementCollection findAllElements(const QString &selectorQuery) const;
195 QWebElement findFirstElement(const QString &selectorQuery) const;
196
197 QWebHitTestResult hitTestContent(const QPoint &pos) const;
198
199 virtual bool event(QEvent *);
200
201 QWebSecurityOrigin securityOrigin() const;
202
203public Q_SLOTS:
204 QVariant evaluateJavaScript(const QString& scriptSource);
205#ifndef QT_NO_PRINTER
206 void print(QPrinter *printer) const;
207#endif
208
209Q_SIGNALS:
210 void javaScriptWindowObjectCleared();
211
212 void provisionalLoad();
213 void titleChanged(const QString &title);
214 void urlChanged(const QUrl &url);
215
216 void initialLayoutCompleted();
217
218 void iconChanged();
219
220 void contentsSizeChanged(const QSize &size);
221
222 void loadStarted();
223 void loadFinished(bool ok);
224
225private:
226 friend class QWebPage;
227 friend class QWebPagePrivate;
228 friend class QWebFramePrivate;
229 friend class WebCore::WidgetPrivate;
230 friend class WebCore::FrameLoaderClientQt;
231 friend class WebCore::ChromeClientQt;
232 QWebFramePrivate *d;
233};
234
235#endif
Note: See TracBrowser for help on using the repository browser.