|
1 #ifndef qgraphicswkview_h |
|
2 #define qgraphicswkview_h |
|
3 |
|
4 #include "qwebkitglobal.h" |
|
5 |
|
6 #include <WebKit2/WKBase.h> |
|
7 #include <QGraphicsWidget> |
|
8 #include "qwkpage.h" |
|
9 |
|
10 class QGraphicsWKViewPrivate; |
|
11 |
|
12 WKStringRef WKStringCreateWithQString(QString qString); |
|
13 QString WKStringCopyQString(WKStringRef stringRef); |
|
14 |
|
15 class QWEBKIT_EXPORT QGraphicsWKView : public QGraphicsWidget { |
|
16 Q_OBJECT |
|
17 Q_PROPERTY(QString title READ title) |
|
18 Q_PROPERTY(QUrl url READ url WRITE setUrl) |
|
19 |
|
20 public: |
|
21 enum BackingStoreType { Simple, Tiled }; |
|
22 QGraphicsWKView(WKPageNamespaceRef namespaceRef, BackingStoreType backingStoreType = Simple, QGraphicsItem* parent = 0); |
|
23 |
|
24 virtual ~QGraphicsWKView(); |
|
25 |
|
26 QWKPage* page() const; |
|
27 |
|
28 virtual void setGeometry(const QRectF&); |
|
29 |
|
30 void load(const QUrl&); |
|
31 void setUrl(const QUrl&); |
|
32 QUrl url() const; |
|
33 |
|
34 QString title() const; |
|
35 |
|
36 void triggerPageAction(QWKPage::WebAction action, bool checked = false); |
|
37 |
|
38 virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*); |
|
39 virtual QVariant itemChange(GraphicsItemChange, const QVariant&); |
|
40 virtual bool event(QEvent*); |
|
41 virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF&) const; |
|
42 virtual QVariant inputMethodQuery(Qt::InputMethodQuery) const; |
|
43 |
|
44 // FIXME: should not be public |
|
45 virtual QRectF visibleRect() const; |
|
46 |
|
47 public: |
|
48 Q_SIGNAL void titleChanged(const QString& title); |
|
49 Q_SIGNAL void loadStarted(); |
|
50 Q_SIGNAL void loadFinished(bool ok); |
|
51 Q_SIGNAL void loadProgress(int progress); |
|
52 Q_SIGNAL void initialLayoutCompleted(); |
|
53 Q_SIGNAL void urlChanged(const QUrl&); |
|
54 |
|
55 public Q_SLOTS: |
|
56 void back(); |
|
57 void forward(); |
|
58 void reload(); |
|
59 void stop(); |
|
60 |
|
61 protected: |
|
62 virtual void keyPressEvent(QKeyEvent*); |
|
63 virtual void keyReleaseEvent(QKeyEvent*); |
|
64 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent*); |
|
65 virtual void mousePressEvent(QGraphicsSceneMouseEvent*); |
|
66 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*); |
|
67 virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*); |
|
68 virtual void wheelEvent(QGraphicsSceneWheelEvent*); |
|
69 |
|
70 virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*); |
|
71 |
|
72 private: |
|
73 QGraphicsWKViewPrivate* d; |
|
74 friend class QGraphicsWKViewPrivate; |
|
75 }; |
|
76 |
|
77 #endif /* qgraphicswkview_h */ |