1e8704d67248e4b6d79361d575e8c67abab49fa6
[profile/ivi/qtdeclarative.git] / src / quick / items / qquickstateoperations_p.h
1 // Commit: 84c47bbb133304d7ef35642fa1fbb17619d4a43d
2 /****************************************************************************
3 **
4 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
5 ** All rights reserved.
6 ** Contact: http://www.qt-project.org/
7 **
8 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 **
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.
18 **
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.
22 **
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.
30 **
31 ** Other Usage
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.
34 **
35 **
36 **
37 **
38 **
39 ** $QT_END_LICENSE$
40 **
41 ****************************************************************************/
42
43 #ifndef QQUICKSTATEOPERATIONS_P_H
44 #define QQUICKSTATEOPERATIONS_P_H
45
46 #include "qquickitem.h"
47 #include "qquickanchors_p.h"
48
49 #include <QtQuick/private/qdeclarativestate_p.h>
50
51 #include <QtDeclarative/qdeclarativescriptstring.h>
52
53 QT_BEGIN_HEADER
54
55 QT_BEGIN_NAMESPACE
56
57 class QQuickParentChangePrivate;
58 class Q_AUTOTEST_EXPORT QQuickParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
59 {
60     Q_OBJECT
61     Q_DECLARE_PRIVATE(QQuickParentChange)
62
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)
71 public:
72     QQuickParentChange(QObject *parent=0);
73     ~QQuickParentChange();
74
75     QQuickItem *object() const;
76     void setObject(QQuickItem *);
77
78     QQuickItem *parent() const;
79     void setParent(QQuickItem *);
80
81     QQuickItem *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 QQuickAnchorChanges;
121 class QQuickAnchorSetPrivate;
122 class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject
123 {
124     Q_OBJECT
125
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)
135
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())*/
144
145 public:
146     QQuickAnchorSet(QObject *parent=0);
147     virtual ~QQuickAnchorSet();
148
149     QDeclarativeScriptString left() const;
150     void setLeft(const QDeclarativeScriptString &edge);
151     void resetLeft();
152
153     QDeclarativeScriptString right() const;
154     void setRight(const QDeclarativeScriptString &edge);
155     void resetRight();
156
157     QDeclarativeScriptString horizontalCenter() const;
158     void setHorizontalCenter(const QDeclarativeScriptString &edge);
159     void resetHorizontalCenter();
160
161     QDeclarativeScriptString top() const;
162     void setTop(const QDeclarativeScriptString &edge);
163     void resetTop();
164
165     QDeclarativeScriptString bottom() const;
166     void setBottom(const QDeclarativeScriptString &edge);
167     void resetBottom();
168
169     QDeclarativeScriptString verticalCenter() const;
170     void setVerticalCenter(const QDeclarativeScriptString &edge);
171     void resetVerticalCenter();
172
173     QDeclarativeScriptString baseline() const;
174     void setBaseline(const QDeclarativeScriptString &edge);
175     void resetBaseline();
176
177     QQuickItem *fill() const;
178     void setFill(QQuickItem *);
179     void resetFill();
180
181     QQuickItem *centerIn() const;
182     void setCenterIn(QQuickItem *);
183     void resetCenterIn();
184
185     /*qreal leftMargin() const;
186     void setLeftMargin(qreal);
187
188     qreal rightMargin() const;
189     void setRightMargin(qreal);
190
191     qreal horizontalCenterOffset() const;
192     void setHorizontalCenterOffset(qreal);
193
194     qreal topMargin() const;
195     void setTopMargin(qreal);
196
197     qreal bottomMargin() const;
198     void setBottomMargin(qreal);
199
200     qreal margins() const;
201     void setMargins(qreal);
202
203     qreal verticalCenterOffset() const;
204     void setVerticalCenterOffset(qreal);
205
206     qreal baselineOffset() const;
207     void setBaselineOffset(qreal);*/
208
209     QQuickAnchors::Anchors usedAnchors() const;
210
211 /*Q_SIGNALS:
212     void leftMarginChanged();
213     void rightMarginChanged();
214     void topMarginChanged();
215     void bottomMarginChanged();
216     void marginsChanged();
217     void verticalCenterOffsetChanged();
218     void horizontalCenterOffsetChanged();
219     void baselineOffsetChanged();*/
220
221 private:
222     friend class QQuickAnchorChanges;
223     Q_DISABLE_COPY(QQuickAnchorSet)
224     Q_DECLARE_PRIVATE(QQuickAnchorSet)
225 };
226
227 class QQuickAnchorChangesPrivate;
228 class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
229 {
230     Q_OBJECT
231     Q_DECLARE_PRIVATE(QQuickAnchorChanges)
232
233     Q_PROPERTY(QQuickItem *target READ object WRITE setObject)
234     Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT)
235
236 public:
237     QQuickAnchorChanges(QObject *parent=0);
238     ~QQuickAnchorChanges();
239
240     virtual ActionList actions();
241
242     QQuickAnchorSet *anchors();
243
244     QQuickItem *object() const;
245     void setObject(QQuickItem *);
246
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();
259
260     QList<QDeclarativeAction> additionalActions();
261     virtual void saveTargetValues();
262 };
263
264 QT_END_NAMESPACE
265
266 QML_DECLARE_TYPE(QQuickParentChange)
267 QML_DECLARE_TYPE(QQuickAnchorSet)
268 QML_DECLARE_TYPE(QQuickAnchorChanges)
269
270 QT_END_HEADER
271
272 #endif // QQUICKSTATEOPERATIONS_P_H
273