|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the QtDeclarative module of the Qt Toolkit. |
|
8 ** |
|
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 |
|
14 ** this package. |
|
15 ** |
|
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. |
|
23 ** |
|
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. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #ifndef QDECLARATIVESTATEOPERATIONS_H |
|
43 #define QDECLARATIVESTATEOPERATIONS_H |
|
44 |
|
45 #include "private/qdeclarativestate_p.h" |
|
46 |
|
47 #include <qdeclarativeitem.h> |
|
48 #include <private/qdeclarativeanchors_p.h> |
|
49 #include <qdeclarativescriptstring.h> |
|
50 |
|
51 QT_BEGIN_HEADER |
|
52 |
|
53 QT_BEGIN_NAMESPACE |
|
54 |
|
55 QT_MODULE(Declarative) |
|
56 |
|
57 class QDeclarativeParentChangePrivate; |
|
58 class Q_DECLARATIVE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent |
|
59 { |
|
60 Q_OBJECT |
|
61 Q_DECLARE_PRIVATE(QDeclarativeParentChange) |
|
62 |
|
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) |
|
71 public: |
|
72 QDeclarativeParentChange(QObject *parent=0); |
|
73 ~QDeclarativeParentChange(); |
|
74 |
|
75 QDeclarativeItem *object() const; |
|
76 void setObject(QDeclarativeItem *); |
|
77 |
|
78 QDeclarativeItem *parent() const; |
|
79 void setParent(QDeclarativeItem *); |
|
80 |
|
81 QDeclarativeItem *originalParent() const; |
|
82 |
|
83 QDeclarativeScriptString x() const; |
|
84 void setX(QDeclarativeScriptString x); |
|
85 bool xIsSet() const; |
|
86 |
|
87 QDeclarativeScriptString y() const; |
|
88 void setY(QDeclarativeScriptString y); |
|
89 bool yIsSet() const; |
|
90 |
|
91 QDeclarativeScriptString width() const; |
|
92 void setWidth(QDeclarativeScriptString width); |
|
93 bool widthIsSet() const; |
|
94 |
|
95 QDeclarativeScriptString height() const; |
|
96 void setHeight(QDeclarativeScriptString height); |
|
97 bool heightIsSet() const; |
|
98 |
|
99 QDeclarativeScriptString scale() const; |
|
100 void setScale(QDeclarativeScriptString scale); |
|
101 bool scaleIsSet() const; |
|
102 |
|
103 QDeclarativeScriptString rotation() const; |
|
104 void setRotation(QDeclarativeScriptString rotation); |
|
105 bool rotationIsSet() const; |
|
106 |
|
107 virtual ActionList actions(); |
|
108 |
|
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(); |
|
118 }; |
|
119 |
|
120 class QDeclarativeStateChangeScriptPrivate; |
|
121 class Q_DECLARATIVE_EXPORT QDeclarativeStateChangeScript : public QDeclarativeStateOperation, public QDeclarativeActionEvent |
|
122 { |
|
123 Q_OBJECT |
|
124 Q_DECLARE_PRIVATE(QDeclarativeStateChangeScript) |
|
125 |
|
126 Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript) |
|
127 Q_PROPERTY(QString name READ name WRITE setName) |
|
128 |
|
129 public: |
|
130 QDeclarativeStateChangeScript(QObject *parent=0); |
|
131 ~QDeclarativeStateChangeScript(); |
|
132 |
|
133 virtual ActionList actions(); |
|
134 |
|
135 virtual QString typeName() const; |
|
136 |
|
137 QDeclarativeScriptString script() const; |
|
138 void setScript(const QDeclarativeScriptString &); |
|
139 |
|
140 QString name() const; |
|
141 void setName(const QString &); |
|
142 |
|
143 virtual void execute(Reason reason = ActualChange); |
|
144 }; |
|
145 |
|
146 class QDeclarativeAnchorChanges; |
|
147 class QDeclarativeAnchorSetPrivate; |
|
148 class Q_AUTOTEST_EXPORT QDeclarativeAnchorSet : public QObject |
|
149 { |
|
150 Q_OBJECT |
|
151 |
|
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) |
|
161 |
|
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())*/ |
|
170 |
|
171 public: |
|
172 QDeclarativeAnchorSet(QObject *parent=0); |
|
173 virtual ~QDeclarativeAnchorSet(); |
|
174 |
|
175 QDeclarativeScriptString left() const; |
|
176 void setLeft(const QDeclarativeScriptString &edge); |
|
177 void resetLeft(); |
|
178 |
|
179 QDeclarativeScriptString right() const; |
|
180 void setRight(const QDeclarativeScriptString &edge); |
|
181 void resetRight(); |
|
182 |
|
183 QDeclarativeScriptString horizontalCenter() const; |
|
184 void setHorizontalCenter(const QDeclarativeScriptString &edge); |
|
185 void resetHorizontalCenter(); |
|
186 |
|
187 QDeclarativeScriptString top() const; |
|
188 void setTop(const QDeclarativeScriptString &edge); |
|
189 void resetTop(); |
|
190 |
|
191 QDeclarativeScriptString bottom() const; |
|
192 void setBottom(const QDeclarativeScriptString &edge); |
|
193 void resetBottom(); |
|
194 |
|
195 QDeclarativeScriptString verticalCenter() const; |
|
196 void setVerticalCenter(const QDeclarativeScriptString &edge); |
|
197 void resetVerticalCenter(); |
|
198 |
|
199 QDeclarativeScriptString baseline() const; |
|
200 void setBaseline(const QDeclarativeScriptString &edge); |
|
201 void resetBaseline(); |
|
202 |
|
203 QDeclarativeItem *fill() const; |
|
204 void setFill(QDeclarativeItem *); |
|
205 void resetFill(); |
|
206 |
|
207 QDeclarativeItem *centerIn() const; |
|
208 void setCenterIn(QDeclarativeItem *); |
|
209 void resetCenterIn(); |
|
210 |
|
211 /*qreal leftMargin() const; |
|
212 void setLeftMargin(qreal); |
|
213 |
|
214 qreal rightMargin() const; |
|
215 void setRightMargin(qreal); |
|
216 |
|
217 qreal horizontalCenterOffset() const; |
|
218 void setHorizontalCenterOffset(qreal); |
|
219 |
|
220 qreal topMargin() const; |
|
221 void setTopMargin(qreal); |
|
222 |
|
223 qreal bottomMargin() const; |
|
224 void setBottomMargin(qreal); |
|
225 |
|
226 qreal margins() const; |
|
227 void setMargins(qreal); |
|
228 |
|
229 qreal verticalCenterOffset() const; |
|
230 void setVerticalCenterOffset(qreal); |
|
231 |
|
232 qreal baselineOffset() const; |
|
233 void setBaselineOffset(qreal);*/ |
|
234 |
|
235 QDeclarativeAnchors::Anchors usedAnchors() const; |
|
236 |
|
237 /*Q_SIGNALS: |
|
238 void leftMarginChanged(); |
|
239 void rightMarginChanged(); |
|
240 void topMarginChanged(); |
|
241 void bottomMarginChanged(); |
|
242 void marginsChanged(); |
|
243 void verticalCenterOffsetChanged(); |
|
244 void horizontalCenterOffsetChanged(); |
|
245 void baselineOffsetChanged();*/ |
|
246 |
|
247 private: |
|
248 friend class QDeclarativeAnchorChanges; |
|
249 Q_DISABLE_COPY(QDeclarativeAnchorSet) |
|
250 Q_DECLARE_PRIVATE(QDeclarativeAnchorSet) |
|
251 }; |
|
252 |
|
253 class QDeclarativeAnchorChangesPrivate; |
|
254 class Q_DECLARATIVE_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent |
|
255 { |
|
256 Q_OBJECT |
|
257 Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges) |
|
258 |
|
259 Q_PROPERTY(QDeclarativeItem *target READ object WRITE setObject) |
|
260 Q_PROPERTY(QDeclarativeAnchorSet *anchors READ anchors CONSTANT) |
|
261 |
|
262 public: |
|
263 QDeclarativeAnchorChanges(QObject *parent=0); |
|
264 ~QDeclarativeAnchorChanges(); |
|
265 |
|
266 virtual ActionList actions(); |
|
267 |
|
268 QDeclarativeAnchorSet *anchors(); |
|
269 |
|
270 QDeclarativeItem *object() const; |
|
271 void setObject(QDeclarativeItem *); |
|
272 |
|
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(); |
|
285 |
|
286 QList<QDeclarativeAction> additionalActions(); |
|
287 virtual void saveTargetValues(); |
|
288 }; |
|
289 |
|
290 QT_END_NAMESPACE |
|
291 |
|
292 QML_DECLARE_TYPE(QDeclarativeParentChange) |
|
293 QML_DECLARE_TYPE(QDeclarativeStateChangeScript) |
|
294 QML_DECLARE_TYPE(QDeclarativeAnchorSet) |
|
295 QML_DECLARE_TYPE(QDeclarativeAnchorChanges) |
|
296 |
|
297 QT_END_HEADER |
|
298 |
|
299 #endif // QDECLARATIVESTATEOPERATIONS_H |