QtWebKit/qwebframe.h Source File

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