1 // Commit: 84c47bbb133304d7ef35642fa1fbb17619d4a43d
2 /****************************************************************************
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
10 ** $QT_BEGIN_LICENSE:LGPL$
11 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this
15 ** file. Please review the following information to ensure the GNU Lesser
16 ** General Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
23 ** GNU General Public License Usage
24 ** Alternatively, this file may be used under the terms of the GNU General
25 ** Public License version 3.0 as published by the Free Software Foundation
26 ** and appearing in the file LICENSE.GPL included in the packaging of this
27 ** file. Please review the following information to ensure the GNU General
28 ** Public License version 3.0 requirements will be met:
29 ** http://www.gnu.org/copyleft/gpl.html.
32 ** Alternatively, this file may be used in accordance with the terms and
33 ** conditions contained in a signed written agreement between you and Nokia.
41 ****************************************************************************/
43 #ifndef QQUICKSTATEOPERATIONS_P_H
44 #define QQUICKSTATEOPERATIONS_P_H
46 #include "qquickitem.h"
47 #include "qquickanchors_p.h"
49 #include <QtQuick/private/qdeclarativestate_p.h>
51 #include <QtDeclarative/qdeclarativescriptstring.h>
57 class QQuickParentChangePrivate;
58 class Q_AUTOTEST_EXPORT QQuickParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
61 Q_DECLARE_PRIVATE(QQuickParentChange)
63 Q_PROPERTY(QQuickItem *target READ object WRITE setObject)
64 Q_PROPERTY(QQuickItem *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 QQuickParentChange(QObject *parent=0);
73 ~QQuickParentChange();
75 QQuickItem *object() const;
76 void setObject(QQuickItem *);
78 QQuickItem *parent() const;
79 void setParent(QQuickItem *);
81 QQuickItem *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 QQuickAnchorChanges;
121 class QQuickAnchorSetPrivate;
122 class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject
126 Q_PROPERTY(QDeclarativeScriptString left READ left WRITE setLeft RESET resetLeft)
127 Q_PROPERTY(QDeclarativeScriptString right READ right WRITE setRight RESET resetRight)
128 Q_PROPERTY(QDeclarativeScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter)
129 Q_PROPERTY(QDeclarativeScriptString top READ top WRITE setTop RESET resetTop)
130 Q_PROPERTY(QDeclarativeScriptString bottom READ bottom WRITE setBottom RESET resetBottom)
131 Q_PROPERTY(QDeclarativeScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter)
132 Q_PROPERTY(QDeclarativeScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline)
133 //Q_PROPERTY(QQuickItem *fill READ fill WRITE setFill RESET resetFill)
134 //Q_PROPERTY(QQuickItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn)
136 /*Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
137 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
138 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
139 Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged())
140 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
141 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
142 Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged())
143 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged())*/
146 QQuickAnchorSet(QObject *parent=0);
147 virtual ~QQuickAnchorSet();
149 QDeclarativeScriptString left() const;
150 void setLeft(const QDeclarativeScriptString &edge);
153 QDeclarativeScriptString right() const;
154 void setRight(const QDeclarativeScriptString &edge);
157 QDeclarativeScriptString horizontalCenter() const;
158 void setHorizontalCenter(const QDeclarativeScriptString &edge);
159 void resetHorizontalCenter();
161 QDeclarativeScriptString top() const;
162 void setTop(const QDeclarativeScriptString &edge);
165 QDeclarativeScriptString bottom() const;
166 void setBottom(const QDeclarativeScriptString &edge);
169 QDeclarativeScriptString verticalCenter() const;
170 void setVerticalCenter(const QDeclarativeScriptString &edge);
171 void resetVerticalCenter();
173 QDeclarativeScriptString baseline() const;
174 void setBaseline(const QDeclarativeScriptString &edge);
175 void resetBaseline();
177 QQuickItem *fill() const;
178 void setFill(QQuickItem *);
181 QQuickItem *centerIn() const;
182 void setCenterIn(QQuickItem *);
183 void resetCenterIn();
185 /*qreal leftMargin() const;
186 void setLeftMargin(qreal);
188 qreal rightMargin() const;
189 void setRightMargin(qreal);
191 qreal horizontalCenterOffset() const;
192 void setHorizontalCenterOffset(qreal);
194 qreal topMargin() const;
195 void setTopMargin(qreal);
197 qreal bottomMargin() const;
198 void setBottomMargin(qreal);
200 qreal margins() const;
201 void setMargins(qreal);
203 qreal verticalCenterOffset() const;
204 void setVerticalCenterOffset(qreal);
206 qreal baselineOffset() const;
207 void setBaselineOffset(qreal);*/
209 QQuickAnchors::Anchors usedAnchors() const;
212 void leftMarginChanged();
213 void rightMarginChanged();
214 void topMarginChanged();
215 void bottomMarginChanged();
216 void marginsChanged();
217 void verticalCenterOffsetChanged();
218 void horizontalCenterOffsetChanged();
219 void baselineOffsetChanged();*/
222 friend class QQuickAnchorChanges;
223 Q_DISABLE_COPY(QQuickAnchorSet)
224 Q_DECLARE_PRIVATE(QQuickAnchorSet)
227 class QQuickAnchorChangesPrivate;
228 class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
231 Q_DECLARE_PRIVATE(QQuickAnchorChanges)
233 Q_PROPERTY(QQuickItem *target READ object WRITE setObject)
234 Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT)
237 QQuickAnchorChanges(QObject *parent=0);
238 ~QQuickAnchorChanges();
240 virtual ActionList actions();
242 QQuickAnchorSet *anchors();
244 QQuickItem *object() const;
245 void setObject(QQuickItem *);
247 virtual void execute(Reason reason = ActualChange);
248 virtual bool isReversable();
249 virtual void reverse(Reason reason = ActualChange);
250 virtual QString typeName() const;
251 virtual bool override(QDeclarativeActionEvent*other);
252 virtual bool changesBindings();
253 virtual void saveOriginals();
254 virtual bool needsCopy() { return true; }
255 virtual void copyOriginals(QDeclarativeActionEvent*);
256 virtual void clearBindings();
257 virtual void rewind();
258 virtual void saveCurrentValues();
260 QList<QDeclarativeAction> additionalActions();
261 virtual void saveTargetValues();
266 QML_DECLARE_TYPE(QQuickParentChange)
267 QML_DECLARE_TYPE(QQuickAnchorSet)
268 QML_DECLARE_TYPE(QQuickAnchorChanges)
272 #endif // QQUICKSTATEOPERATIONS_P_H