1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the QtDeclarative 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 QDECLARATIVESTATEOPERATIONS_H
43 #define QDECLARATIVESTATEOPERATIONS_H
45 #include "QtQuick1/private/qdeclarativestate_p.h"
47 #include <QtQuick1/qdeclarativeitem.h>
48 #include <QtQuick1/private/qdeclarativeanchors_p.h>
49 #include <QtDeclarative/qdeclarativescriptstring.h>
56 class QDeclarative1ParentChangePrivate;
57 class Q_AUTOTEST_EXPORT QDeclarative1ParentChange : public QDeclarative1StateOperation, public QDeclarative1ActionEvent
60 Q_DECLARE_PRIVATE(QDeclarative1ParentChange)
62 Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
63 Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent)
64 Q_PROPERTY(QDeclarativeScriptString x READ x WRITE setX)
65 Q_PROPERTY(QDeclarativeScriptString y READ y WRITE setY)
66 Q_PROPERTY(QDeclarativeScriptString width READ width WRITE setWidth)
67 Q_PROPERTY(QDeclarativeScriptString height READ height WRITE setHeight)
68 Q_PROPERTY(QDeclarativeScriptString scale READ scale WRITE setScale)
69 Q_PROPERTY(QDeclarativeScriptString rotation READ rotation WRITE setRotation)
71 QDeclarative1ParentChange(QObject *parent=0);
72 ~QDeclarative1ParentChange();
74 QDeclarativeItem *object() const;
75 void setObject(QDeclarativeItem *);
77 QDeclarativeItem *parent() const;
78 void setParent(QDeclarativeItem *);
80 QDeclarativeItem *originalParent() const;
82 QDeclarativeScriptString x() const;
83 void setX(QDeclarativeScriptString x);
86 QDeclarativeScriptString y() const;
87 void setY(QDeclarativeScriptString y);
90 QDeclarativeScriptString width() const;
91 void setWidth(QDeclarativeScriptString width);
92 bool widthIsSet() const;
94 QDeclarativeScriptString height() const;
95 void setHeight(QDeclarativeScriptString height);
96 bool heightIsSet() const;
98 QDeclarativeScriptString scale() const;
99 void setScale(QDeclarativeScriptString scale);
100 bool scaleIsSet() const;
102 QDeclarativeScriptString rotation() const;
103 void setRotation(QDeclarativeScriptString rotation);
104 bool rotationIsSet() const;
106 virtual ActionList actions();
108 virtual void saveOriginals();
109 //virtual void copyOriginals(QDeclarative1ActionEvent*);
110 virtual void execute(Reason reason = ActualChange);
111 virtual bool isReversable();
112 virtual void reverse(Reason reason = ActualChange);
113 virtual QString typeName() const;
114 virtual bool override(QDeclarative1ActionEvent*other);
115 virtual void rewind();
116 virtual void saveCurrentValues();
119 class QDeclarative1StateChangeScriptPrivate;
120 class Q_AUTOTEST_EXPORT QDeclarative1StateChangeScript : public QDeclarative1StateOperation, public QDeclarative1ActionEvent
123 Q_DECLARE_PRIVATE(QDeclarative1StateChangeScript)
125 Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript)
126 Q_PROPERTY(QString name READ name WRITE setName)
129 QDeclarative1StateChangeScript(QObject *parent=0);
130 ~QDeclarative1StateChangeScript();
132 virtual ActionList actions();
134 virtual QString typeName() const;
136 QDeclarativeScriptString script() const;
137 void setScript(const QDeclarativeScriptString &);
139 QString name() const;
140 void setName(const QString &);
142 virtual void execute(Reason reason = ActualChange);
145 class QDeclarative1AnchorChanges;
146 class QDeclarative1AnchorSetPrivate;
147 class Q_AUTOTEST_EXPORT QDeclarative1AnchorSet : public QObject
151 Q_PROPERTY(QDeclarativeScriptString left READ left WRITE setLeft RESET resetLeft)
152 Q_PROPERTY(QDeclarativeScriptString right READ right WRITE setRight RESET resetRight)
153 Q_PROPERTY(QDeclarativeScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter)
154 Q_PROPERTY(QDeclarativeScriptString top READ top WRITE setTop RESET resetTop)
155 Q_PROPERTY(QDeclarativeScriptString bottom READ bottom WRITE setBottom RESET resetBottom)
156 Q_PROPERTY(QDeclarativeScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter)
157 Q_PROPERTY(QDeclarativeScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline)
158 //Q_PROPERTY(QDeclarativeItem *fill READ fill WRITE setFill RESET resetFill)
159 //Q_PROPERTY(QDeclarativeItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn)
161 /*Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
162 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
163 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
164 Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged())
165 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
166 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
167 Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged())
168 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged())*/
171 QDeclarative1AnchorSet(QObject *parent=0);
172 virtual ~QDeclarative1AnchorSet();
174 QDeclarativeScriptString left() const;
175 void setLeft(const QDeclarativeScriptString &edge);
178 QDeclarativeScriptString right() const;
179 void setRight(const QDeclarativeScriptString &edge);
182 QDeclarativeScriptString horizontalCenter() const;
183 void setHorizontalCenter(const QDeclarativeScriptString &edge);
184 void resetHorizontalCenter();
186 QDeclarativeScriptString top() const;
187 void setTop(const QDeclarativeScriptString &edge);
190 QDeclarativeScriptString bottom() const;
191 void setBottom(const QDeclarativeScriptString &edge);
194 QDeclarativeScriptString verticalCenter() const;
195 void setVerticalCenter(const QDeclarativeScriptString &edge);
196 void resetVerticalCenter();
198 QDeclarativeScriptString baseline() const;
199 void setBaseline(const QDeclarativeScriptString &edge);
200 void resetBaseline();
202 QDeclarativeItem *fill() const;
203 void setFill(QDeclarativeItem *);
206 QDeclarativeItem *centerIn() const;
207 void setCenterIn(QDeclarativeItem *);
208 void resetCenterIn();
210 /*qreal leftMargin() const;
211 void setLeftMargin(qreal);
213 qreal rightMargin() const;
214 void setRightMargin(qreal);
216 qreal horizontalCenterOffset() const;
217 void setHorizontalCenterOffset(qreal);
219 qreal topMargin() const;
220 void setTopMargin(qreal);
222 qreal bottomMargin() const;
223 void setBottomMargin(qreal);
225 qreal margins() const;
226 void setMargins(qreal);
228 qreal verticalCenterOffset() const;
229 void setVerticalCenterOffset(qreal);
231 qreal baselineOffset() const;
232 void setBaselineOffset(qreal);*/
234 QDeclarative1Anchors::Anchors usedAnchors() const;
237 void leftMarginChanged();
238 void rightMarginChanged();
239 void topMarginChanged();
240 void bottomMarginChanged();
241 void marginsChanged();
242 void verticalCenterOffsetChanged();
243 void horizontalCenterOffsetChanged();
244 void baselineOffsetChanged();*/
247 friend class QDeclarative1AnchorChanges;
248 Q_DISABLE_COPY(QDeclarative1AnchorSet)
249 Q_DECLARE_PRIVATE(QDeclarative1AnchorSet)
252 class QDeclarative1AnchorChangesPrivate;
253 class Q_AUTOTEST_EXPORT QDeclarative1AnchorChanges : public QDeclarative1StateOperation, public QDeclarative1ActionEvent
256 Q_DECLARE_PRIVATE(QDeclarative1AnchorChanges)
258 Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
259 Q_PROPERTY(QDeclarative1AnchorSet *anchors READ anchors CONSTANT)
262 QDeclarative1AnchorChanges(QObject *parent=0);
263 ~QDeclarative1AnchorChanges();
265 virtual ActionList actions();
267 QDeclarative1AnchorSet *anchors();
269 QDeclarativeItem *object() const;
270 void setObject(QDeclarativeItem *);
272 virtual void execute(Reason reason = ActualChange);
273 virtual bool isReversable();
274 virtual void reverse(Reason reason = ActualChange);
275 virtual QString typeName() const;
276 virtual bool override(QDeclarative1ActionEvent*other);
277 virtual bool changesBindings();
278 virtual void saveOriginals();
279 virtual bool needsCopy() { return true; }
280 virtual void copyOriginals(QDeclarative1ActionEvent*);
281 virtual void clearBindings();
282 virtual void rewind();
283 virtual void saveCurrentValues();
285 QList<QDeclarative1Action> additionalActions();
286 virtual void saveTargetValues();
291 QML_DECLARE_TYPE(QDeclarative1ParentChange)
292 QML_DECLARE_TYPE(QDeclarative1StateChangeScript)
293 QML_DECLARE_TYPE(QDeclarative1AnchorSet)
294 QML_DECLARE_TYPE(QDeclarative1AnchorChanges)
298 #endif // QDECLARATIVESTATEOPERATIONS_H