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

« back to all changes in this revision

Viewing changes to Source/WebKit/qt/Api/qgraphicswebview.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) 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
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 
27
#include <QtWidgets/qgraphicswidget.h>
 
28
#else
 
29
#include <QtGui/qgraphicswidget.h>
 
30
#endif
 
31
#include <QtGui/qevent.h>
 
32
#include <QtGui/qicon.h>
 
33
#include <QtGui/qpainter.h>
 
34
#include <QtNetwork/qnetworkaccessmanager.h>
 
35
 
 
36
#if !defined(QT_NO_GRAPHICSVIEW)
 
37
 
 
38
class QWebPage;
 
39
class QWebHistory;
 
40
class QWebSettings;
 
41
 
 
42
class QGraphicsWebViewPrivate;
 
43
 
 
44
class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
 
45
    Q_OBJECT
 
46
 
 
47
    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
 
48
    Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
 
49
    Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
 
50
 
 
51
    Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
 
52
 
 
53
    Q_PROPERTY(bool modified READ isModified)
 
54
    Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents)
 
55
    Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen)
 
56
 
 
57
    Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
 
58
    Q_FLAGS(QPainter::RenderHints)
 
59
 
 
60
public:
 
61
    explicit QGraphicsWebView(QGraphicsItem* parent = 0);
 
62
    ~QGraphicsWebView();
 
63
 
 
64
    QWebPage* page() const;
 
65
    void setPage(QWebPage*);
 
66
 
 
67
    QUrl url() const;
 
68
    void setUrl(const QUrl&);
 
69
 
 
70
    QString title() const;
 
71
    QIcon icon() const;
 
72
 
 
73
    qreal zoomFactor() const;
 
74
    void setZoomFactor(qreal);
 
75
 
 
76
    bool isModified() const;
 
77
 
 
78
    void load(const QUrl& url);
 
79
    void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
 
80
 
 
81
    void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
 
82
    // FIXME: Consider rename to setHtml?
 
83
    void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
 
84
 
 
85
    QWebHistory* history() const;
 
86
    QWebSettings* settings() const;
 
87
 
 
88
    QAction* pageAction(QWebPage::WebAction action) const;
 
89
    void triggerPageAction(QWebPage::WebAction action, bool checked = false);
 
90
 
 
91
    bool findText(const QString& subString, QWebPage::FindFlags options = 0);
 
92
 
 
93
    bool resizesToContents() const;
 
94
    void setResizesToContents(bool enabled);
 
95
    
 
96
    bool isTiledBackingStoreFrozen() const;
 
97
    void setTiledBackingStoreFrozen(bool frozen);
 
98
 
 
99
    virtual void setGeometry(const QRectF& rect);
 
100
    virtual void updateGeometry();
 
101
    virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
 
102
    virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
 
103
    virtual bool event(QEvent*);
 
104
 
 
105
    virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const;
 
106
 
 
107
    virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
 
108
 
 
109
    QPainter::RenderHints renderHints() const;
 
110
    void setRenderHints(QPainter::RenderHints);
 
111
    void setRenderHint(QPainter::RenderHint, bool enabled = true);
 
112
 
 
113
public Q_SLOTS:
 
114
    void stop();
 
115
    void back();
 
116
    void forward();
 
117
    void reload();
 
118
 
 
119
Q_SIGNALS:
 
120
    void loadStarted();
 
121
    void loadFinished(bool);
 
122
 
 
123
    void loadProgress(int progress);
 
124
    void urlChanged(const QUrl&);
 
125
    void titleChanged(const QString&);
 
126
    void iconChanged();
 
127
    void statusBarMessage(const QString& message);
 
128
    void linkClicked(const QUrl&);
 
129
 
 
130
protected:
 
131
    virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
 
132
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
 
133
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
 
134
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
 
135
    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
 
136
    virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
 
137
#ifndef QT_NO_WHEELEVENT
 
138
    virtual void wheelEvent(QGraphicsSceneWheelEvent*);
 
139
#endif
 
140
    virtual void keyPressEvent(QKeyEvent*);
 
141
    virtual void keyReleaseEvent(QKeyEvent*);
 
142
#ifndef QT_NO_CONTEXTMENU
 
143
    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
 
144
#endif
 
145
    virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*);
 
146
    virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
 
147
    virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*);
 
148
    virtual void dropEvent(QGraphicsSceneDragDropEvent*);
 
149
    virtual void focusInEvent(QFocusEvent*);
 
150
    virtual void focusOutEvent(QFocusEvent*);
 
151
    virtual void inputMethodEvent(QInputMethodEvent*);
 
152
    virtual bool focusNextPrevChild(bool next);
 
153
 
 
154
    virtual bool sceneEvent(QEvent*);
 
155
 
 
156
private:
 
157
    Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
 
158
    Q_PRIVATE_SLOT(d, void _q_pageDestroyed())
 
159
    // we don't want to change the moc based on USE() macro, so this function is here
 
160
    // but will be empty if ACCLERATED_COMPOSITING is disabled
 
161
    Q_PRIVATE_SLOT(d, void syncLayers())
 
162
    Q_PRIVATE_SLOT(d, void _q_contentsSizeChanged(const QSize&))
 
163
    Q_PRIVATE_SLOT(d, void _q_scaleChanged())
 
164
 
 
165
    QGraphicsWebViewPrivate* const d;
 
166
    friend class QGraphicsWebViewPrivate;
 
167
};
 
168
 
 
169
#endif // QT_NO_GRAPHICSVIEW
 
170
 
 
171
#endif // QGraphicsWebView_h