OSDN Git Service

60843b7706119154669987b2486e2930f9503869
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / include / qmlobjectnode.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 (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
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 **
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.
24 **
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.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef FXOBJECTNODE_H
35 #define FXOBJECTNODE_H
36
37 #include <corelib_global.h>
38 #include "qmlmodelnodefacade.h"
39 #include "qmlstate.h"
40 #include "qmlchangeset.h"
41
42 #include <nodeinstance.h>
43
44 namespace QmlDesigner {
45
46 class QmlItemNode;
47 class QmlPropertyChanges;
48
49 class CORESHARED_EXPORT QmlObjectNode : public QmlModelNodeFacade
50 {
51 public:
52     QmlObjectNode() : QmlModelNodeFacade() {}
53     QmlObjectNode(const ModelNode &modelNode)  : QmlModelNodeFacade(modelNode) {}
54
55     bool hasNodeParent() const;
56     bool hasInstanceParent() const;
57     void setParentProperty(const NodeAbstractProperty &parentProeprty);
58     QmlObjectNode instanceParent() const;
59
60     void setId(const QString &id);
61     QString id() const;
62     QString validId();
63
64     QmlModelState currentState() const;
65     void setVariantProperty(const QString &name, const QVariant &value);
66     void setBindingProperty(const QString &name, const QString &expression);
67     NodeAbstractProperty nodeAbstractProperty(const QString &name) const;
68     NodeProperty nodeProperty(const QString &name) const;
69     NodeListProperty nodeListProperty(const QString &name) const;
70
71     QVariant instanceValue(const QString &name) const;
72     QString instanceType(const QString &name) const;
73
74     bool hasProperty(const QString &name) const;
75     bool hasBindingProperty(const QString &name) const;
76     bool instanceHasBinding(const QString &name) const;
77     bool propertyAffectedByCurrentState(const QString &name) const;
78     QVariant modelValue(const QString &name) const;
79     QString expression(const QString &name) const;
80     bool isInBaseState() const;
81     QmlPropertyChanges propertyChangeForCurrentState() const;
82
83     virtual bool canReparent() const;
84
85     bool isRootModelNode() const;
86
87     void destroy();
88
89     QList<QmlModelState> allAffectingStates() const;
90     QList<QmlModelStateOperation> allAffectingStatesOperations() const;
91
92     void removeVariantProperty(const QString &name);
93
94     void setParent(QmlObjectNode newParent);
95
96     QmlItemNode toQmlItemNode() const;
97
98     bool isAncestorOf(const QmlObjectNode &objectNode) const;
99
100     bool hasDefaultProperty() const;
101     QString defaultProperty() const;
102
103     static  QVariant instanceValue(const ModelNode &modelNode, const QString &name);
104
105 protected:
106     NodeInstance nodeInstance() const;
107     QmlObjectNode nodeForInstance(const NodeInstance &instance) const;
108
109 protected:
110     QList<QmlModelState> allDefinedStates() const;
111 };
112
113 CORESHARED_EXPORT uint qHash(const QmlObjectNode &node);
114 CORESHARED_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlObjectNode> &fxObjectNodeList);
115 CORESHARED_EXPORT QList<QmlObjectNode> toQmlObjectNodeList(const QList<ModelNode> &modelNodeList);
116 }// QmlDesigner
117
118 #endif // FXOBJECTNODE_H