source: trunk/src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 5.5 KB
Line 
1/*
2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef QGraphicsWebView_h
21#define QGraphicsWebView_h
22
23#include "qwebkitglobal.h"
24#include "qwebpage.h"
25#include <QtCore/qurl.h>
26#include <QtGui/qevent.h>
27#include <QtGui/qgraphicswidget.h>
28#include <QtGui/qicon.h>
29#include <QtGui/qpainter.h>
30#include <QtNetwork/qnetworkaccessmanager.h>
31
32class QWebPage;
33class QWebHistory;
34class QWebSettings;
35
36class QGraphicsWebViewPrivate;
37
38class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
39 Q_OBJECT
40
41 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
42 Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
43 Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
44
45 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
46
47 Q_PROPERTY(bool modified READ isModified)
48 Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents)
49 Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen)
50
51public:
52 explicit QGraphicsWebView(QGraphicsItem* parent = 0);
53 ~QGraphicsWebView();
54
55 QWebPage* page() const;
56 void setPage(QWebPage*);
57
58 QUrl url() const;
59 void setUrl(const QUrl&);
60
61 QString title() const;
62 QIcon icon() const;
63
64 qreal zoomFactor() const;
65 void setZoomFactor(qreal);
66
67 bool isModified() const;
68
69 void load(const QUrl &url);
70 void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
71
72 void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
73 // FIXME: Consider rename to setHtml?
74 void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
75
76 QWebHistory* history() const;
77 QWebSettings* settings() const;
78
79 QAction* pageAction(QWebPage::WebAction action) const;
80 void triggerPageAction(QWebPage::WebAction action, bool checked = false);
81
82 bool findText(const QString& subString, QWebPage::FindFlags options = 0);
83
84 bool resizesToContents() const;
85 void setResizesToContents(bool enabled);
86
87 bool isTiledBackingStoreFrozen() const;
88 void setTiledBackingStoreFrozen(bool frozen);
89
90 virtual void setGeometry(const QRectF& rect);
91 virtual void updateGeometry();
92 virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
93 virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
94 virtual bool event(QEvent*);
95
96 virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const;
97
98 virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
99
100public Q_SLOTS:
101 void stop();
102 void back();
103 void forward();
104 void reload();
105
106Q_SIGNALS:
107 void loadStarted();
108 void loadFinished(bool);
109
110 void loadProgress(int progress);
111 void urlChanged(const QUrl&);
112 void titleChanged(const QString&);
113 void iconChanged();
114 void statusBarMessage(const QString& message);
115 void linkClicked(const QUrl&);
116
117protected:
118 virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
119 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
120 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
121 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
122 virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
123 virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
124#ifndef QT_NO_WHEELEVENT
125 virtual void wheelEvent(QGraphicsSceneWheelEvent*);
126#endif
127 virtual void keyPressEvent(QKeyEvent*);
128 virtual void keyReleaseEvent(QKeyEvent*);
129#ifndef QT_NO_CONTEXTMENU
130 virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
131#endif
132 virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*);
133 virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
134 virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*);
135 virtual void dropEvent(QGraphicsSceneDragDropEvent*);
136 virtual void focusInEvent(QFocusEvent*);
137 virtual void focusOutEvent(QFocusEvent*);
138 virtual void inputMethodEvent(QInputMethodEvent*);
139 virtual bool focusNextPrevChild(bool next);
140
141 virtual bool sceneEvent(QEvent*);
142
143private:
144 Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
145 Q_PRIVATE_SLOT(d, void _q_updateMicroFocus())
146 Q_PRIVATE_SLOT(d, void _q_pageDestroyed())
147 // we don't want to change the moc based on USE() macro, so this function is here
148 // but will be empty if ACCLERATED_COMPOSITING is disabled
149 Q_PRIVATE_SLOT(d, void syncLayers())
150 Q_PRIVATE_SLOT(d, void _q_contentsSizeChanged(const QSize&))
151 Q_PRIVATE_SLOT(d, void _q_scaleChanged())
152
153 QGraphicsWebViewPrivate* const d;
154 friend class QGraphicsWebViewPrivate;
155};
156
157#endif // QGraphicsWebView_h
Note: See TracBrowser for help on using the repository browser.