1 // Commit: 84c47bbb133304d7ef35642fa1fbb17619d4a43d
2 /****************************************************************************
4 ** Copyright (C) 2010 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 ** No Commercial Usage
12 ** This file contains pre-release code and may not be distributed.
13 ** You may use this file in accordance with the terms and conditions
14 ** contained in the Technology Preview License Agreement accompanying
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
41 ****************************************************************************/
43 #ifndef QSGSTATEOPERATIONS_H
44 #define QSGSTATEOPERATIONS_H
47 #include "qsganchors_p.h"
49 #include <private/qdeclarativestate_p.h>
51 #include <QtDeclarative/qdeclarativescriptstring.h>
57 QT_MODULE(Declarative)
59 class QSGParentChangePrivate;
60 class Q_AUTOTEST_EXPORT QSGParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
63 Q_DECLARE_PRIVATE(QSGParentChange)
65 Q_PROPERTY(QSGItem *target READ object WRITE setObject)
66 Q_PROPERTY(QSGItem *parent READ parent WRITE setParent)
67 Q_PROPERTY(QDeclarativeScriptString x READ x WRITE setX)
68 Q_PROPERTY(QDeclarativeScriptString y READ y WRITE setY)
69 Q_PROPERTY(QDeclarativeScriptString width READ width WRITE setWidth)
70 Q_PROPERTY(QDeclarativeScriptString height READ height WRITE setHeight)
71 Q_PROPERTY(QDeclarativeScriptString scale READ scale WRITE setScale)
72 Q_PROPERTY(QDeclarativeScriptString rotation READ rotation WRITE setRotation)
74 QSGParentChange(QObject *parent=0);
77 QSGItem *object() const;
78 void setObject(QSGItem *);
80 QSGItem *parent() const;
81 void setParent(QSGItem *);
83 QSGItem *originalParent() const;
85 QDeclarativeScriptString x() const;
86 void setX(QDeclarativeScriptString x);
89 QDeclarativeScriptString y() const;
90 void setY(QDeclarativeScriptString y);
93 QDeclarativeScriptString width() const;
94 void setWidth(QDeclarativeScriptString width);
95 bool widthIsSet() const;
97 QDeclarativeScriptString height() const;
98 void setHeight(QDeclarativeScriptString height);
99 bool heightIsSet() const;
101 QDeclarativeScriptString scale() const;
102 void setScale(QDeclarativeScriptString scale);
103 bool scaleIsSet() const;
105 QDeclarativeScriptString rotation() const;
106 void setRotation(QDeclarativeScriptString rotation);
107 bool rotationIsSet() const;
109 virtual ActionList actions();
111 virtual void saveOriginals();
112 //virtual void copyOriginals(QDeclarativeActionEvent*);
113 virtual void execute(Reason reason = ActualChange);
114 virtual bool isReversable();
115 virtual void reverse(Reason reason = ActualChange);
116 virtual QString typeName() const;
117 virtual bool override(QDeclarativeActionEvent*other);
118 virtual void rewind();
119 virtual void saveCurrentValues();
122 class QSGAnchorChanges;
123 class QSGAnchorSetPrivate;
124 class Q_AUTOTEST_EXPORT QSGAnchorSet : public QObject
128 Q_PROPERTY(QDeclarativeScriptString left READ left WRITE setLeft RESET resetLeft)
129 Q_PROPERTY(QDeclarativeScriptString right READ right WRITE setRight RESET resetRight)
130 Q_PROPERTY(QDeclarativeScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter)
131 Q_PROPERTY(QDeclarativeScriptString top READ top WRITE setTop RESET resetTop)
132 Q_PROPERTY(QDeclarativeScriptString bottom READ bottom WRITE setBottom RESET resetBottom)
133 Q_PROPERTY(QDeclarativeScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter)
134 Q_PROPERTY(QDeclarativeScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline)
135 //Q_PROPERTY(QSGItem *fill READ fill WRITE setFill RESET resetFill)
136 //Q_PROPERTY(QSGItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn)
138 /*Q_PROPERTY(qreal margins READ margins WRITE setMargins NOTIFY marginsChanged)
139 Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin NOTIFY leftMarginChanged)
140 Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin NOTIFY rightMarginChanged)
141 Q_PROPERTY(qreal horizontalCenterOffset READ horizontalCenterOffset WRITE setHorizontalCenterOffset NOTIFY horizontalCenterOffsetChanged())
142 Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin NOTIFY topMarginChanged)
143 Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged)
144 Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged())
145 Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged())*/
148 QSGAnchorSet(QObject *parent=0);
149 virtual ~QSGAnchorSet();
151 QDeclarativeScriptString left() const;
152 void setLeft(const QDeclarativeScriptString &edge);
155 QDeclarativeScriptString right() const;
156 void setRight(const QDeclarativeScriptString &edge);
159 QDeclarativeScriptString horizontalCenter() const;
160 void setHorizontalCenter(const QDeclarativeScriptString &edge);
161 void resetHorizontalCenter();
163 QDeclarativeScriptString top() const;
164 void setTop(const QDeclarativeScriptString &edge);
167 QDeclarativeScriptString bottom() const;
168 void setBottom(const QDeclarativeScriptString &edge);
171 QDeclarativeScriptString verticalCenter() const;
172 void setVerticalCenter(const QDeclarativeScriptString &edge);
173 void resetVerticalCenter();
175 QDeclarativeScriptString baseline() const;
176 void setBaseline(const QDeclarativeScriptString &edge);
177 void resetBaseline();
179 QSGItem *fill() const;
180 void setFill(QSGItem *);
183 QSGItem *centerIn() const;
184 void setCenterIn(QSGItem *);
185 void resetCenterIn();
187 /*qreal leftMargin() const;
188 void setLeftMargin(qreal);
190 qreal rightMargin() const;
191 void setRightMargin(qreal);
193 qreal horizontalCenterOffset() const;
194 void setHorizontalCenterOffset(qreal);
196 qreal topMargin() const;
197 void setTopMargin(qreal);
199 qreal bottomMargin() const;
200 void setBottomMargin(qreal);
202 qreal margins() const;
203 void setMargins(qreal);
205 qreal verticalCenterOffset() const;
206 void setVerticalCenterOffset(qreal);
208 qreal baselineOffset() const;
209 void setBaselineOffset(qreal);*/
211 QSGAnchors::Anchors usedAnchors() const;
214 void leftMarginChanged();
215 void rightMarginChanged();
216 void topMarginChanged();
217 void bottomMarginChanged();
218 void marginsChanged();
219 void verticalCenterOffsetChanged();
220 void horizontalCenterOffsetChanged();
221 void baselineOffsetChanged();*/
224 friend class QSGAnchorChanges;
225 Q_DISABLE_COPY(QSGAnchorSet)
226 Q_DECLARE_PRIVATE(QSGAnchorSet)
229 class QSGAnchorChangesPrivate;
230 class Q_AUTOTEST_EXPORT QSGAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
233 Q_DECLARE_PRIVATE(QSGAnchorChanges)
235 Q_PROPERTY(QSGItem *target READ object WRITE setObject)
236 Q_PROPERTY(QSGAnchorSet *anchors READ anchors CONSTANT)
239 QSGAnchorChanges(QObject *parent=0);
242 virtual ActionList actions();
244 QSGAnchorSet *anchors();
246 QSGItem *object() const;
247 void setObject(QSGItem *);
249 virtual void execute(Reason reason = ActualChange);
250 virtual bool isReversable();
251 virtual void reverse(Reason reason = ActualChange);
252 virtual QString typeName() const;
253 virtual bool override(QDeclarativeActionEvent*other);
254 virtual bool changesBindings();
255 virtual void saveOriginals();
256 virtual bool needsCopy() { return true; }
257 virtual void copyOriginals(QDeclarativeActionEvent*);
258 virtual void clearBindings();
259 virtual void rewind();
260 virtual void saveCurrentValues();
262 QList<QDeclarativeAction> additionalActions();
263 virtual void saveTargetValues();
268 QML_DECLARE_TYPE(QSGParentChange)
269 QML_DECLARE_TYPE(QSGAnchorSet)
270 QML_DECLARE_TYPE(QSGAnchorChanges)
274 #endif // QSGSTATEOPERATIONS_H