OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / instances / qmlpropertychangesnodeinstance.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
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 file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** 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 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
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 #ifndef QMLPROPERTYCHANGESNODEINSTANCE_H
34 #define QMLPROPERTYCHANGESNODEINSTANCE_H
35
36 #include "objectnodeinstance.h"
37 #include <private/qdeclarativestateoperations_p.h>
38 #include <private/qdeclarativepropertychanges_p.h>
39
40 #include <QPair>
41 #include <QWeakPointer>
42
43 QT_BEGIN_NAMESPACE
44 class QDeclarativeProperty;
45 QT_END_NAMESPACE
46
47 namespace QmlDesigner {
48
49 namespace Internal {
50
51 class QmlPropertyChangesNodeInstance;
52
53 // Original QmlPropertyChanges class requires a custom parser
54 // work around this by writing a replacement class
55 //class QmlPropertyChangesObject : public QDeclarativeStateOperation
56 //{
57 //    Q_OBJECT
58 //    Q_PROPERTY(QObject *target READ targetObject WRITE setTargetObject)
59 //    Q_PROPERTY(bool restoreEntryValues READ restoreEntryValues WRITE setRestoreEntryValues)
60 //    Q_PROPERTY(bool explicit READ isExplicit WRITE setIsExplicit)
61
62 //    typedef QPair<QString, QWeakPointer<QDeclarativeBinding> >  ExpressionPair;
63 //public:
64 //    ~QmlPropertyChangesObject();
65 //    QObject *targetObject() const;
66 //    void setTargetObject(QObject *object);
67
68 //    bool restoreEntryValues() const;
69 //    void setRestoreEntryValues(bool restore);
70
71 //    bool isExplicit() const;
72 //    void setIsExplicit(bool isExplicit);
73
74 //    virtual ActionList actions();
75
76 //    void setVariantValue(const QString &name, const QVariant & value);
77 //    void setExpression(const QString &name, const QString &expression);
78 //    void removeVariantValue(const QString &name);
79 //    void removeExpression(const QString &name);
80
81 //    void resetProperty(const QString &name);
82
83 //    QVariant variantValue(const QString &name) const;
84 //    QString expression(const QString &name) const;
85
86 //    bool hasVariantValue(const QString &name) const;
87 //    bool hasExpression(const QString &name) const;
88
89 //    QmlPropertyChangesObject();
90
91 //    bool updateStateVariant(const QString &propertyName, const QVariant &value);
92 //    bool updateStateBinding(const QString &propertyName, const QString &expression);
93 //    bool resetStateProperty(const QString &propertyName, const QVariant &resetValue);
94
95 //    QDeclarativeState *state() const;
96 //    void updateRevertValueAndBinding(const QString &name);
97
98 //    void removeFromStateRevertList();
99 //    void addToStateRevertList();
100
101 //private: // functions
102 //    bool isActive() const;
103
104 //    QDeclarativeStatePrivate *statePrivate() const;
105
106 //    QDeclarativeStateGroup *stateGroup() const;
107 //    QDeclarativeProperty createMetaProperty(const QString &property);
108
109 //    QDeclarativeAction &qmlActionForProperty(const QString &propertyName) const;
110 //    bool hasActionForProperty(const QString &propertyName) const;
111 //    void removeActionForProperty(const QString &propertyName);
112
113 //    QDeclarativeAction createQDeclarativeAction(const QString &propertyName);
114
115 //private: // variables
116 //    QWeakPointer<QObject> m_targetObject;
117 //    bool m_restoreEntryValues;
118 //    bool m_isExplicit;
119
120 //    mutable ActionList m_qmlActionList;
121 //    QHash<QString, ExpressionPair> m_expressionHash;
122 //};
123
124 class QmlPropertyChangesNodeInstance : public ObjectNodeInstance
125 {
126 public:
127     typedef QSharedPointer<QmlPropertyChangesNodeInstance> Pointer;
128     typedef QWeakPointer<QmlPropertyChangesNodeInstance> WeakPointer;
129
130     static Pointer create(QObject *objectToBeWrapped);
131
132     virtual void setPropertyVariant(const QString &name, const QVariant &value);
133     virtual void setPropertyBinding(const QString &name, const QString &expression);
134     virtual QVariant property(const QString &name) const;
135     virtual void resetProperty(const QString &name);
136
137     void reparent(const ServerNodeInstance &oldParentInstance, const QString &oldParentProperty, const ServerNodeInstance &newParentInstance, const QString &newParentProperty);
138
139 protected:
140     QmlPropertyChangesNodeInstance(QDeclarativePropertyChanges *object);
141     QDeclarativePropertyChanges *changesObject() const;
142 };
143
144 } // namespace Internal
145 } // namespace QmlDesigner
146
147 //QML_DECLARE_TYPE(QmlDesigner::Internal::QmlPropertyChangesObject)
148
149 #endif // QMLPROPERTYCHANGESNODEINSTANCE_H