~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebKit/qt/Api/qgraphicswebview.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

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 <QtCore/qurl.h>
 
25
#include <QtGui/qevent.h>
 
26
#include <QtGui/qgraphicswidget.h>
 
27
#include <QtGui/qicon.h>
 
28
#include <QtGui/qpainter.h>
 
29
#include <QtNetwork/qnetworkaccessmanager.h>
 
30
 
 
31
class QWebPage;
 
32
class QWebHistory;
 
33
class QWebSettings;
 
34
 
 
35
class QGraphicsWebViewPrivate;
 
36
 
 
37
class QWEBKIT_EXPORT QGraphicsWebView : public QGraphicsWidget {
 
38
    Q_OBJECT
 
39
 
 
40
    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
 
41
    Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged)
 
42
    Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor NOTIFY zoomFactorChanged)
 
43
    Q_PROPERTY(QString status READ status NOTIFY statusChanged)
 
44
 
 
45
    Q_PROPERTY(QString html READ toHtml WRITE setHtml)
 
46
    Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
 
47
    Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
 
48
 
 
49
    Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactivityChanged)
 
50
 
 
51
public:
 
52
    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 isInteractive() const;
 
68
    void setInteractive(bool);
 
69
 
 
70
    qreal progress() const;
 
71
 
 
72
    void load(const QUrl &url);
 
73
    void load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray& body = QByteArray());
 
74
 
 
75
    QString toHtml() const;
 
76
    void setHtml(const QString& html, const QUrl& baseUrl = QUrl());
 
77
    // FIXME: Consider rename to setHtml?
 
78
    void setContent(const QByteArray& data, const QString& mimeType = QString(), const QUrl& baseUrl = QUrl());
 
79
 
 
80
    QWebHistory* history() const;
 
81
    QWebSettings* settings() const;
 
82
 
 
83
    QString status() const;
 
84
 
 
85
    virtual void setGeometry(const QRectF& rect);
 
86
    virtual void updateGeometry();
 
87
    virtual void paint(QPainter*, const QStyleOptionGraphicsItem* options, QWidget* widget = 0);
 
88
    virtual bool event(QEvent*);
 
89
 
 
90
public Q_SLOTS:
 
91
    void stop();
 
92
    void back();
 
93
    void forward();
 
94
    void reload();
 
95
 
 
96
Q_SIGNALS:
 
97
    void loadStarted();
 
98
    void loadFinished();
 
99
    void loadFailed();
 
100
 
 
101
    void progressChanged(qreal);
 
102
    void interactivityChanged();
 
103
    void urlChanged(const QUrl&);
 
104
    void titleChanged(const QString&);
 
105
    void iconChanged();
 
106
    void statusChanged();
 
107
    void zoomFactorChanged();
 
108
 
 
109
protected:
 
110
    virtual void mousePressEvent(QGraphicsSceneMouseEvent*);
 
111
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
 
112
    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
 
113
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*);
 
114
    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
 
115
    virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
 
116
#ifndef QT_NO_WHEELEVENT
 
117
    virtual void wheelEvent(QGraphicsSceneWheelEvent*);
 
118
#endif
 
119
    virtual void keyPressEvent(QKeyEvent*);
 
120
    virtual void keyReleaseEvent(QKeyEvent*);
 
121
#ifndef QT_NO_CONTEXTMENU
 
122
    virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*);
 
123
#endif
 
124
    virtual void dragEnterEvent(QGraphicsSceneDragDropEvent*);
 
125
    virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent*);
 
126
    virtual void dragMoveEvent(QGraphicsSceneDragDropEvent*);
 
127
    virtual void dropEvent(QGraphicsSceneDragDropEvent*);
 
128
    virtual void focusInEvent(QFocusEvent*);
 
129
    virtual void focusOutEvent(QFocusEvent*);
 
130
    virtual void inputMethodEvent(QInputMethodEvent*);
 
131
    virtual bool focusNextPrevChild(bool next);
 
132
 
 
133
    virtual bool sceneEvent(QEvent*);
 
134
 
 
135
private:
 
136
    Q_PRIVATE_SLOT(d, void _q_doLoadProgress(int progress))
 
137
    Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success))
 
138
    Q_PRIVATE_SLOT(d, void _q_setStatusBarMessage(const QString& message))
 
139
 
 
140
    QGraphicsWebViewPrivate* const d;
 
141
    friend class QGraphicsWebViewPrivate;
 
142
};
 
143
 
 
144
#endif // QGraphicsWebView_h