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 QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #ifndef QDECLARATIVESTATEOPERATIONS_H
43 #define QDECLARATIVESTATEOPERATIONS_H
45 #include "private/qdeclarativestate_p.h"
47 #include <qdeclarativeitem.h>
48 #include <private/qdeclarativeanchors_p.h>
49 #include <qdeclarativescriptstring.h>
55 QT_MODULE(Declarative)
57 class QDeclarativeParentChangePrivate;
58 class Q_AUTOTEST_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
61 Q_DECLARE_PRIVATE(QDeclarativeParentChange)
63 Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
64 Q_PROPERTY(QDeclarativeItem *parent READ parent WRITE setParent)
65 Q_PROPERTY(QDeclarativeScriptString x READ x WRITE setX)
66 Q_PROPERTY(QDeclarativeScriptString y READ y WRITE setY)
67 Q_PROPERTY(QDeclarativeScriptString width READ width WRITE setWidth)
68 Q_PROPERTY(QDeclarativeScriptString height READ height WRITE setHeight)
69 Q_PROPERTY(QDeclarativeScriptString scale READ scale WRITE setScale)
70 Q_PROPERTY(QDeclarativeScriptString rotation READ rotation WRITE setRotation)
72 QDeclarativeParentChange(QObject *parent=0);
73 ~QDeclarativeParentChange();
75 QDeclarativeItem *object() const;
76 void setObject(QDeclarativeItem *);
78 QDeclarativeItem *parent() const;
79 void setParent(QDeclarativeItem *);
81 QDeclarativeItem *originalParent() const;
83 QDeclarativeScriptString x() const;
84 void setX(QDeclarativeScriptString x);
87 QDeclarativeScriptString y() const;
88 void setY(QDeclarativeScriptString y);
91 QDeclarativeScriptString width() const;
92 void setWidth(QDeclarativeScriptString width);
93 bool widthIsSet() const;
95 QDeclarativeScriptString height() const;
96 void setHeight(QDeclarativeScriptString height);
97 bool heightIsSet() const;
99 QDeclarativeScriptString scale() const;
100 void setScale(QDeclarativeScriptString scale);
101 bool scaleIsSet() const;
103 QDeclarativeScriptString rotation() const;
104 void setRotation(QDeclarativeScriptString rotation);
105 bool rotationIsSet() const;
107 virtual ActionList actions();
109 virtual void saveOriginals();
110 //virtual void copyOriginals(QDeclarativeActionEvent*);
111 virtual void execute(Reason reason = ActualChange);
112 virtual bool isReversable();
113 virtual void reverse(Reason reason = ActualChange);
114 virtual QString typeName() const;
115 virtual bool override(QDeclarativeActionEvent*other);
116 virtual void rewind();
117 virtual void saveCurrentValues();
120 class QDeclarativeStateChangeScriptPrivate;
121 class Q_AUTOTEST_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent
124 Q_DECLARE_PRIVATE(QDeclarativeStateChangeScript)
126 Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript)
127 Q_PROPERTY(QString name READ name WRITE setName)
130 QDeclarativeStateChangeScript(QObject *parent=0);
131 ~QDeclarativeStateChangeScript();
133 virtual ActionList actions();
135 virtual QString typeName() const;
137 QDeclarativeScriptString script() const;
138 void setScript(const QDeclarativeScriptString &);
140 QString name() const;
141 void setName(const QString &);
143 virtual void execute(Reason reason = ActualChange);
146 class QDeclarativeAnchorChanges;
147 class QDeclarativeAnchorSetPrivate;
148 class Q_AUTOTEST_EXPORT QDeclarativeAnchorSet : public QObject
152 Q_PROPERTY(QDeclarativeScriptString left READ left WRITE setLeft RESET resetLeft)
153 Q_PROPERTY(QDeclarativeScriptString right READ right WRITE setRight RESET resetRight)
154 Q_PROPERTY(QDeclarativeScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter)
155 Q_PROPERTY(QDeclarativeScriptString top READ top WRITE setTop RESET resetTop)
156 Q_PROPERTY(QDeclarativeScriptString bottom READ bottom WRITE setBottom RESET resetBottom)
157 Q_PROPERTY(QDeclarativeScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter)
158 Q_PROPERTY(QDeclarativeScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline)
159 //Q_PROPERTY(QDeclarativeItem *fill READ fill WRITE setFill RESET resetFill)
160 //Q_PROPERTY(QDeclarativeItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn)
162 /*Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
163 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
164 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
165 Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged())
166 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
167 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
168 Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged())
169 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged())*/
172 QDeclarativeAnchorSet(QObject *parent=0);
173 virtual ~QDeclarativeAnchorSet();
175 QDeclarativeScriptString left() const;
176 void setLeft(const QDeclarativeScriptString &edge);
179 QDeclarativeScriptString right() const;
180 void setRight(const QDeclarativeScriptString &edge);
183 QDeclarativeScriptString horizontalCenter() const;
184 void setHorizontalCenter(const QDeclarativeScriptString &edge);
185 void resetHorizontalCenter();
187 QDeclarativeScriptString top() const;
188 void setTop(const QDeclarativeScriptString &edge);
191 QDeclarativeScriptString bottom() const;
192 void setBottom(const QDeclarativeScriptString &edge);
195 QDeclarativeScriptString verticalCenter() const;
196 void setVerticalCenter(const QDeclarativeScriptString &edge);
197 void resetVerticalCenter();
199 QDeclarativeScriptString baseline() const;
200 void setBaseline(const QDeclarativeScriptString &edge);
201 void resetBaseline();
203 QDeclarativeItem *fill() const;
204 void setFill(QDeclarativeItem *);
207 QDeclarativeItem *centerIn() const;
208 void setCenterIn(QDeclarativeItem *);
209 void resetCenterIn();
211 /*qreal leftMargin() const;
212 void setLeftMargin(qreal);
214 qreal rightMargin() const;
215 void setRightMargin(qreal);
217 qreal horizontalCenterOffset() const;
218 void setHorizontalCenterOffset(qreal);
220 qreal topMargin() const;
221 void setTopMargin(qreal);
223 qreal bottomMargin() const;
224 void setBottomMargin(qreal);
226 qreal margins() const;
227 void setMargins(qreal);
229 qreal verticalCenterOffset() const;
230 void setVerticalCenterOffset(qreal);
232 qreal baselineOffset() const;
233 void setBaselineOffset(qreal);*/
235 QDeclarativeAnchors::Anchors usedAnchors() const;
238 void leftMarginChanged();
239 void rightMarginChanged();
240 void topMarginChanged();
241 void bottomMarginChanged();
242 void marginsChanged();
243 void verticalCenterOffsetChanged();
244 void horizontalCenterOffsetChanged();
245 void baselineOffsetChanged();*/
248 friend class QDeclarativeAnchorChanges;
249 Q_DISABLE_COPY(QDeclarativeAnchorSet)
250 Q_DECLARE_PRIVATE(QDeclarativeAnchorSet)
253 class QDeclarativeAnchorChangesPrivate;
254 class Q_AUTOTEST_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
257 Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges)
259 Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject)
260 Q_PROPERTY(QDeclarativeAnchorSet *anchors READ anchors CONSTANT)
263 QDeclarativeAnchorChanges(QObject *parent=0);
264 ~QDeclarativeAnchorChanges();
266 virtual ActionList actions();
268 QDeclarativeAnchorSet *anchors();
270 QDeclarativeItem *object() const;
271 void setObject(QDeclarativeItem *);
273 virtual void execute(Reason reason = ActualChange);
274 virtual bool isReversable();
275 virtual void reverse(Reason reason = ActualChange);
276 virtual QString typeName() const;
277 virtual bool override(QDeclarativeActionEvent*other);
278 virtual bool changesBindings();
279 virtual void saveOriginals();
280 virtual bool needsCopy() { return true; }
281 virtual void copyOriginals(QDeclarativeActionEvent*);
282 virtual void clearBindings();
283 virtual void rewind();
284 virtual void saveCurrentValues();
286 QList<QDeclarativeAction> additionalActions();
287 virtual void saveTargetValues();
292 QML_DECLARE_TYPE(QDeclarativeParentChange)
293 QML_DECLARE_TYPE(QDeclarativeStateChangeScript)
294 QML_DECLARE_TYPE(QDeclarativeAnchorSet)
295 QML_DECLARE_TYPE(QDeclarativeAnchorChanges)
299 #endif // QDECLARATIVESTATEOPERATIONS_H