| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QQUICKSTATEOPERATIONS_P_H |
| 5 | #define QQUICKSTATEOPERATIONS_P_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include "qquickitem.h" |
| 19 | #include "qquickanchors_p.h" |
| 20 | |
| 21 | #include <QtQuick/private/qquickstate_p.h> |
| 22 | |
| 23 | #include <QtQml/qqmlscriptstring.h> |
| 24 | |
| 25 | QT_BEGIN_NAMESPACE |
| 26 | |
| 27 | class QQuickParentChangePrivate; |
| 28 | class Q_QUICK_EXPORT QQuickParentChange : public QQuickStateOperation, public QQuickStateActionEvent |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | Q_DECLARE_PRIVATE(QQuickParentChange) |
| 32 | |
| 33 | Q_PROPERTY(QQuickItem *target READ object WRITE setObject) |
| 34 | Q_PROPERTY(QQuickItem *parent READ parent WRITE setParent) |
| 35 | Q_PROPERTY(QQmlScriptString x READ x WRITE setX) |
| 36 | Q_PROPERTY(QQmlScriptString y READ y WRITE setY) |
| 37 | Q_PROPERTY(QQmlScriptString width READ width WRITE setWidth) |
| 38 | Q_PROPERTY(QQmlScriptString height READ height WRITE setHeight) |
| 39 | Q_PROPERTY(QQmlScriptString scale READ scale WRITE setScale) |
| 40 | Q_PROPERTY(QQmlScriptString rotation READ rotation WRITE setRotation) |
| 41 | Q_CLASSINFO("ParentProperty", "parent") |
| 42 | QML_NAMED_ELEMENT(ParentChange) |
| 43 | QML_ADDED_IN_VERSION(2, 0) |
| 44 | public: |
| 45 | QQuickParentChange(QObject *parent=nullptr); |
| 46 | |
| 47 | QQuickItem *object() const; |
| 48 | void setObject(QQuickItem *); |
| 49 | |
| 50 | QQuickItem *parent() const; |
| 51 | void setParent(QQuickItem *); |
| 52 | |
| 53 | QQuickItem *originalParent() const; |
| 54 | |
| 55 | QQmlScriptString x() const; |
| 56 | void setX(const QQmlScriptString &x); |
| 57 | bool xIsSet() const; |
| 58 | |
| 59 | QQmlScriptString y() const; |
| 60 | void setY(const QQmlScriptString &y); |
| 61 | bool yIsSet() const; |
| 62 | |
| 63 | QQmlScriptString width() const; |
| 64 | void setWidth(const QQmlScriptString &width); |
| 65 | bool widthIsSet() const; |
| 66 | |
| 67 | QQmlScriptString height() const; |
| 68 | void setHeight(const QQmlScriptString &height); |
| 69 | bool heightIsSet() const; |
| 70 | |
| 71 | QQmlScriptString scale() const; |
| 72 | void setScale(const QQmlScriptString &scale); |
| 73 | bool scaleIsSet() const; |
| 74 | |
| 75 | QQmlScriptString rotation() const; |
| 76 | void setRotation(const QQmlScriptString &rotation); |
| 77 | bool rotationIsSet() const; |
| 78 | |
| 79 | ActionList actions() override; |
| 80 | |
| 81 | void saveOriginals() override; |
| 82 | //virtual void copyOriginals(QQuickStateActionEvent*); |
| 83 | void execute() override; |
| 84 | bool isReversable() override; |
| 85 | void reverse() override; |
| 86 | EventType type() const override; |
| 87 | bool mayOverride(QQuickStateActionEvent*other) override; |
| 88 | void rewind() override; |
| 89 | void saveCurrentValues() override; |
| 90 | }; |
| 91 | |
| 92 | class QQuickAnchorChanges; |
| 93 | class QQuickAnchorSetPrivate; |
| 94 | class Q_QUICK_EXPORT QQuickAnchorSet : public QObject |
| 95 | { |
| 96 | Q_OBJECT |
| 97 | |
| 98 | Q_PROPERTY(QQmlScriptString left READ left WRITE setLeft RESET resetLeft FINAL) |
| 99 | Q_PROPERTY(QQmlScriptString right READ right WRITE setRight RESET resetRight FINAL) |
| 100 | Q_PROPERTY(QQmlScriptString horizontalCenter READ horizontalCenter WRITE setHorizontalCenter RESET resetHorizontalCenter FINAL) |
| 101 | Q_PROPERTY(QQmlScriptString top READ top WRITE setTop RESET resetTop FINAL) |
| 102 | Q_PROPERTY(QQmlScriptString bottom READ bottom WRITE setBottom RESET resetBottom FINAL) |
| 103 | Q_PROPERTY(QQmlScriptString verticalCenter READ verticalCenter WRITE setVerticalCenter RESET resetVerticalCenter FINAL) |
| 104 | Q_PROPERTY(QQmlScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline FINAL) |
| 105 | QML_ANONYMOUS |
| 106 | QML_ADDED_IN_VERSION(2, 0) |
| 107 | |
| 108 | public: |
| 109 | QQuickAnchorSet(QObject *parent=nullptr); |
| 110 | virtual ~QQuickAnchorSet(); |
| 111 | |
| 112 | QQmlScriptString left() const; |
| 113 | void setLeft(const QQmlScriptString &edge); |
| 114 | void resetLeft(); |
| 115 | |
| 116 | QQmlScriptString right() const; |
| 117 | void setRight(const QQmlScriptString &edge); |
| 118 | void resetRight(); |
| 119 | |
| 120 | QQmlScriptString horizontalCenter() const; |
| 121 | void setHorizontalCenter(const QQmlScriptString &edge); |
| 122 | void resetHorizontalCenter(); |
| 123 | |
| 124 | QQmlScriptString top() const; |
| 125 | void setTop(const QQmlScriptString &edge); |
| 126 | void resetTop(); |
| 127 | |
| 128 | QQmlScriptString bottom() const; |
| 129 | void setBottom(const QQmlScriptString &edge); |
| 130 | void resetBottom(); |
| 131 | |
| 132 | QQmlScriptString verticalCenter() const; |
| 133 | void setVerticalCenter(const QQmlScriptString &edge); |
| 134 | void resetVerticalCenter(); |
| 135 | |
| 136 | QQmlScriptString baseline() const; |
| 137 | void setBaseline(const QQmlScriptString &edge); |
| 138 | void resetBaseline(); |
| 139 | |
| 140 | QQuickAnchors::Anchors usedAnchors() const; |
| 141 | |
| 142 | private: |
| 143 | friend class QQuickAnchorChanges; |
| 144 | Q_DISABLE_COPY(QQuickAnchorSet) |
| 145 | Q_DECLARE_PRIVATE(QQuickAnchorSet) |
| 146 | }; |
| 147 | |
| 148 | class QQuickAnchorChangesPrivate; |
| 149 | class Q_QUICK_EXPORT QQuickAnchorChanges : public QQuickStateOperation, public QQuickStateActionEvent |
| 150 | { |
| 151 | Q_OBJECT |
| 152 | Q_DECLARE_PRIVATE(QQuickAnchorChanges) |
| 153 | |
| 154 | Q_PROPERTY(QQuickItem *target READ object WRITE setObject) |
| 155 | Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT) |
| 156 | QML_NAMED_ELEMENT(AnchorChanges) |
| 157 | QML_ADDED_IN_VERSION(2, 0) |
| 158 | |
| 159 | public: |
| 160 | QQuickAnchorChanges(QObject *parent=nullptr); |
| 161 | |
| 162 | ActionList actions() override; |
| 163 | |
| 164 | QQuickAnchorSet *anchors() const; |
| 165 | |
| 166 | QQuickItem *object() const; |
| 167 | void setObject(QQuickItem *); |
| 168 | |
| 169 | void execute() override; |
| 170 | bool isReversable() override; |
| 171 | void reverse() override; |
| 172 | EventType type() const override; |
| 173 | bool mayOverride(QQuickStateActionEvent*other) override; |
| 174 | bool changesBindings() override; |
| 175 | void saveOriginals() override; |
| 176 | bool needsCopy() override { return true; } |
| 177 | void copyOriginals(QQuickStateActionEvent*) override; |
| 178 | void clearBindings() override; |
| 179 | void rewind() override; |
| 180 | void saveCurrentValues() override; |
| 181 | |
| 182 | QList<QQuickStateAction> additionalActions() const; |
| 183 | void saveTargetValues() override; |
| 184 | }; |
| 185 | |
| 186 | QT_END_NAMESPACE |
| 187 | |
| 188 | #endif // QQUICKSTATEOPERATIONS_P_H |
| 189 | |
| 190 |
