diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-10 16:51:06 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-06-10 18:11:18 +0200 |
commit | c373b6ca6c3bc2597a54cecffd409ea84798905f (patch) | |
tree | 09f6067d368eeb8223553b3ac4a5254f4ace6547 /shared/native_view_qt.h | |
parent | 83a2bc6d446387d25fd10164e87627c9d49878eb (diff) |
Fix undefined symbols in debug builds.
process uses the same code as lib and decides at runtime which
code to run. Fix the debug build by making sure that all infrastructure
code is available in both process and lib by building common code
not shared directly through chromium sources in a separate static lib.
Diffstat (limited to 'shared/native_view_qt.h')
-rw-r--r-- | shared/native_view_qt.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/shared/native_view_qt.h b/shared/native_view_qt.h new file mode 100644 index 000000000..80bb24e87 --- /dev/null +++ b/shared/native_view_qt.h @@ -0,0 +1,97 @@ +#ifndef NATIVE_VIEW_QT_H +#define NATIVE_VIEW_QT_H + + +#include <QWidget> +#include <QQuickPaintedItem> + +class BackingStoreQt; +class QWindow; +class QQuickItem; +class QFocusEvent; +class QMouseEvent; +class QKeyEvent; +class QWheelEvent; + +namespace content { + class RenderWidgetHostViewQt; +} + +class NativeViewQt { +public: + virtual ~NativeViewQt() {} + virtual void setBackingStore(BackingStoreQt* backingStore) = 0; + virtual QRectF screenRect() const = 0; + virtual void show() = 0; + virtual void hide() = 0; + virtual bool isVisible() const = 0; + virtual QWindow* window() const = 0; + virtual void update() = 0; +}; + +class QWidgetNativeView : public QWidget, public NativeViewQt +{ +public: + QWidgetNativeView(content::RenderWidgetHostViewQt* view, QWidget *parent = 0); + + virtual void setBackingStore(BackingStoreQt* backingStore); + virtual QRectF screenRect() const; + virtual void show(); + virtual void hide(); + virtual bool isVisible() const; + virtual QWindow* window() const; + virtual void update(); + + QPainter* painter(); + +protected: + void paintEvent(QPaintEvent * event); + bool event(QEvent *event); + void resizeEvent(QResizeEvent *resizeEvent); + +private: + BackingStoreQt* m_backingStore; + QPainter* m_painter; + content::RenderWidgetHostViewQt *m_view; +}; + +class QQuickNativeView : public QQuickPaintedItem, public NativeViewQt +{ + Q_OBJECT +public: + QQuickNativeView(content::RenderWidgetHostViewQt* view, QQuickItem *parent = 0); + + virtual void setBackingStore(BackingStoreQt* backingStore); + virtual QRectF screenRect() const; + virtual void show(); + virtual void hide(); + virtual bool isVisible() const; + virtual QWindow* window() const; + virtual void update(); + + void paint(QPainter *painter); + void resize(int width, int height); + + void focusInEvent(QFocusEvent*); + void focusOutEvent(QFocusEvent*); + void mousePressEvent(QMouseEvent*); + void mouseMoveEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + void mouseDoubleClickEvent(QMouseEvent*); + void keyPressEvent(QKeyEvent*); + void keyReleaseEvent(QKeyEvent*); + void wheelEvent(QWheelEvent*); + +protected Q_SLOTS: + void resizeBackingStore(); + +protected: + QSGNode* updatePaintNode(QSGNode * oldNode, UpdatePaintNodeData * data); + +private: + BackingStoreQt* m_backingStore; + content::RenderWidgetHostViewQt *m_view; + +}; + +#endif |