~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit/qt/Api/qwebframe.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

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