Fix test fails related to QTBUG-22237
[profile/ivi/qtdeclarative.git] / src / declarative / items / qquickcanvas.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QQUICKCANVAS_H
43 #define QQUICKCANVAS_H
44
45 #include <QtCore/qmetatype.h>
46 #include <QtGui/qopengl.h>
47 #include <QtGui/qwindow.h>
48
49 QT_BEGIN_HEADER
50
51 QT_BEGIN_NAMESPACE
52
53 QT_MODULE(Declarative)
54
55 class QQuickItem;
56 class QSGEngine;
57 class QQuickCanvasPrivate;
58 class QOpenGLFramebufferObject;
59 class QDeclarativeIncubationController;
60
61 class Q_DECLARATIVE_EXPORT QQuickCanvas : public QWindow
62 {
63 Q_OBJECT
64 Q_DECLARE_PRIVATE(QQuickCanvas)
65 public:
66     QQuickCanvas(QWindow *parent = 0);
67
68     virtual ~QQuickCanvas();
69
70     QQuickItem *rootItem() const;
71     QQuickItem *activeFocusItem() const;
72
73     QQuickItem *mouseGrabberItem() const;
74
75     bool sendEvent(QQuickItem *, QEvent *);
76
77     QVariant inputMethodQuery(Qt::InputMethodQuery query) const;
78
79     QSGEngine *sceneGraphEngine() const;
80
81     void setVSyncAnimations(bool enabled);
82     bool vsyncAnimations() const;
83
84     QImage grabFrameBuffer();
85
86     void setRenderTarget(QOpenGLFramebufferObject *fbo);
87     QOpenGLFramebufferObject *renderTarget() const;
88
89     QDeclarativeIncubationController *incubationController() const;
90
91 Q_SIGNALS:
92     void frameSwapped();
93     void sceneGraphInitialized();
94
95 protected:
96     QQuickCanvas(QQuickCanvasPrivate &dd, QWindow *parent = 0);
97
98     virtual void exposeEvent(QExposeEvent *);
99     virtual void resizeEvent(QResizeEvent *);
100
101     virtual void showEvent(QShowEvent *);
102     virtual void hideEvent(QHideEvent *);
103
104     virtual bool event(QEvent *);
105     virtual void keyPressEvent(QKeyEvent *);
106     virtual void keyReleaseEvent(QKeyEvent *);
107     virtual void inputMethodEvent(QInputMethodEvent *);
108     virtual void mousePressEvent(QMouseEvent *);
109     virtual void mouseReleaseEvent(QMouseEvent *);
110     virtual void mouseDoubleClickEvent(QMouseEvent *);
111     virtual void mouseMoveEvent(QMouseEvent *);
112 #ifndef QT_NO_WHEELEVENT
113     virtual void wheelEvent(QWheelEvent *);
114 #endif
115
116 private Q_SLOTS:
117     void sceneGraphChanged();
118     void maybeUpdate();
119     void animationStarted();
120     void animationStopped();
121
122 private:
123     friend class QQuickItem;
124     friend class QQuickCanvasRenderLoop;
125     Q_DISABLE_COPY(QQuickCanvas)
126 };
127
128 QT_END_NAMESPACE
129
130 Q_DECLARE_METATYPE(QQuickCanvas *)
131
132 QT_END_HEADER
133
134 #endif // QQUICKCANVAS_H
135