1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the Declarative module of the Qt Toolkit.
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.
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.
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.
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.
40 ****************************************************************************/
42 #ifndef QSGTARGETAFFECTOR_H
43 #define QSGTARGETAFFECTOR_H
45 #include "qsgparticleaffector_p.h"
47 class QSGTargetAffector : public QSGParticleAffector
50 Q_PROPERTY(int targetX READ targetX WRITE setTargetX NOTIFY targetXChanged)
51 Q_PROPERTY(int targetY READ targetY WRITE setTargetY NOTIFY targetYChanged)
52 Q_PROPERTY(int targetWidth READ targetWidth WRITE setTargetWidth NOTIFY targetWidthChanged)
53 Q_PROPERTY(int targetHeight READ targetHeight WRITE setTargetHeight NOTIFY targetHeightChanged)
54 Q_PROPERTY(QSGParticleExtruder* targetShape READ targetShape WRITE setTargetShape NOTIFY targetShapeChanged)
55 Q_PROPERTY(int targetTime READ targetTime WRITE setTargetTime NOTIFY targetTimeChanged)
58 explicit QSGTargetAffector(QQuickItem *parent = 0);
70 int targetWidth() const
75 int targetHeight() const
77 return m_targetHeight;
80 QSGParticleExtruder* targetShape() const
85 int targetTime() const
92 void targetXChanged(int arg);
94 void targetYChanged(int arg);
96 void targetWidthChanged(int arg);
98 void targetHeightChanged(int arg);
100 void targetShapeChanged(QSGParticleExtruder* arg);
102 void targetTimeChanged(int arg);
105 void setTargetX(int arg)
107 if (m_targetX != arg) {
109 emit targetXChanged(arg);
113 void setTargetY(int arg)
115 if (m_targetY != arg) {
117 emit targetYChanged(arg);
121 void setTargetWidth(int arg)
123 if (m_targetWidth != arg) {
125 emit targetWidthChanged(arg);
129 void setTargetHeight(int arg)
131 if (m_targetHeight != arg) {
132 m_targetHeight = arg;
133 emit targetHeightChanged(arg);
137 void setTargetShape(QSGParticleExtruder* arg)
139 if (m_targetShape != arg) {
141 emit targetShapeChanged(arg);
145 void setTargetTime(int arg)
147 if (m_targetTime != arg) {
149 emit targetTimeChanged(arg);
154 virtual void reset(QSGParticleData*);
155 virtual bool affectParticle(QSGParticleData *d, qreal dt);
161 QSGParticleExtruder* m_defaultShape;
162 QSGParticleExtruder* m_targetShape;
165 QHash<QPair<int, int>, QPointF> m_targets;
168 #endif // QSGTARGETAFFECTOR_H