2 Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
3 Copyright (C) 2007 Staikos Computing Services Inc.
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.
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.
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.
24 #include "qwebkitglobal.h"
26 #include <QtGui/qwidget.h>
27 #include <QtGui/qicon.h>
28 #include <QtGui/qpainter.h>
29 #include <QtCore/qurl.h>
30 #include <QtNetwork/qnetworkaccessmanager.h>
33 class QNetworkRequest;
38 class QWebViewPrivate;
39 class QWebNetworkRequest;
41 class QWEBKIT_EXPORT QWebView : public QWidget {
43 Q_PROPERTY(QString title READ title)
44 Q_PROPERTY(QUrl url READ url WRITE setUrl)
45 Q_PROPERTY(QIcon icon READ icon)
46 Q_PROPERTY(QString selectedText READ selectedText)
47 Q_PROPERTY(QString selectedHtml READ selectedHtml)
48 Q_PROPERTY(bool hasSelection READ hasSelection)
49 Q_PROPERTY(bool modified READ isModified)
50 //Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
51 Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false)
52 Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
54 Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
55 Q_FLAGS(QPainter::RenderHints)
57 explicit QWebView(QWidget* parent = 0);
60 QWebPage* page() const;
61 void setPage(QWebPage* page);
63 void load(const QUrl& url);
64 void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray &body = QByteArray());
65 void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
66 void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
68 QWebHistory* history() const;
69 QWebSettings* settings() const;
71 QString title() const;
72 void setUrl(const QUrl &url);
76 bool hasSelection() const;
77 QString selectedText() const;
78 QString selectedHtml() const;
81 QAction* pageAction(QWebPage::WebAction action) const;
83 void triggerPageAction(QWebPage::WebAction action, bool checked = false);
85 bool isModified() const;
88 Qt::TextInteractionFlags textInteractionFlags() const;
89 void setTextInteractionFlags(Qt::TextInteractionFlags flags);
90 void setTextInteractionFlag(Qt::TextInteractionFlag flag);
93 QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
95 QSize sizeHint() const;
97 qreal zoomFactor() const;
98 void setZoomFactor(qreal factor);
100 void setTextSizeMultiplier(qreal factor);
101 qreal textSizeMultiplier() const;
103 QPainter::RenderHints renderHints() const;
104 void setRenderHints(QPainter::RenderHints hints);
105 void setRenderHint(QPainter::RenderHint hint, bool enabled = true);
107 bool findText(const QString& subString, QWebPage::FindFlags options = 0);
109 virtual bool event(QEvent*);
117 void print(QPrinter*) const;
121 void loadProgress(int progress);
122 void loadFinished(bool);
123 void titleChanged(const QString& title);
124 void statusBarMessage(const QString& text);
125 void linkClicked(const QUrl&);
126 void selectionChanged();
128 void urlChanged(const QUrl&);
131 void resizeEvent(QResizeEvent*);
132 void paintEvent(QPaintEvent*);
134 virtual QWebView *createWindow(QWebPage::WebWindowType type);
136 virtual void changeEvent(QEvent*);
137 virtual void mouseMoveEvent(QMouseEvent*);
138 virtual void mousePressEvent(QMouseEvent*);
139 virtual void mouseDoubleClickEvent(QMouseEvent*);
140 virtual void mouseReleaseEvent(QMouseEvent*);
141 #ifndef QT_NO_CONTEXTMENU
142 virtual void contextMenuEvent(QContextMenuEvent*);
144 #ifndef QT_NO_WHEELEVENT
145 virtual void wheelEvent(QWheelEvent*);
147 virtual void keyPressEvent(QKeyEvent*);
148 virtual void keyReleaseEvent(QKeyEvent*);
149 virtual void dragEnterEvent(QDragEnterEvent*);
150 virtual void dragLeaveEvent(QDragLeaveEvent*);
151 virtual void dragMoveEvent(QDragMoveEvent*);
152 virtual void dropEvent(QDropEvent*);
153 virtual void focusInEvent(QFocusEvent*);
154 virtual void focusOutEvent(QFocusEvent*);
155 virtual void inputMethodEvent(QInputMethodEvent*);
157 virtual bool focusNextPrevChild(bool next);
160 friend class QWebPage;
162 Q_PRIVATE_SLOT(d, void _q_pageDestroyed())