OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / designercore / include / qmlitemnode.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 QmlItemNode_H
34 #define QmlItemNode_H
35
36 #include <corelib_global.h>
37 #include <modelnode.h>
38 #include "qmlobjectnode.h"
39 #include "qmlstate.h"
40
41 #include <QStringList>
42 #include <QRectF>
43 #include <QTransform>
44
45 namespace QmlDesigner {
46
47 class QmlModelStateGroup;
48 class QmlAnchors;
49
50 class CORESHARED_EXPORT QmlItemNode : public QmlObjectNode
51 {
52     friend class CORESHARED_EXPORT QmlAnchors;
53 public:
54     QmlItemNode() : QmlObjectNode() {}
55     QmlItemNode(const ModelNode &modelNode)  : QmlObjectNode(modelNode) {}
56     bool isValid() const;
57     bool isRootNode() const;
58
59     QmlModelStateGroup states() const;
60     QList<QmlItemNode> children() const;
61     QList<QmlObjectNode> resources() const;
62     QList<QmlObjectNode> defaultPropertyChildren() const;
63     QList<QmlObjectNode> allDirectSubNodes() const;
64     QmlAnchors anchors() const;
65
66     bool hasChildren() const;
67     bool hasResources() const;
68     bool instanceHasAnchors() const;
69     bool hasShowContent() const;
70
71     bool canReparent() const;
72     bool instanceIsAnchoredBySibling() const;
73     bool instanceIsAnchoredByChildren() const;
74     bool instanceIsMovable() const;
75     bool instanceIsResizable() const;
76     bool instanceIsInPositioner() const;
77
78     QRectF instanceBoundingRect() const;
79     QTransform instanceTransform() const;
80     QTransform instanceSceneTransform() const;
81     QPointF instancePosition() const;
82     QSizeF instanceSize() const;
83     int instancePenWidth() const;
84
85
86     void paintInstance(QPainter *painter);
87
88     void selectNode();
89     void deselectNode();
90     bool isSelected() const;
91
92     QString simplifiedTypeName() const;
93
94     const QList<QmlItemNode> allDirectSubModelNodes() const;
95     const QList<QmlItemNode> allSubModelNodes() const;
96     bool hasAnySubModelNodes() const;
97 };
98
99 CORESHARED_EXPORT uint qHash(const QmlItemNode &node);
100
101 class CORESHARED_EXPORT QmlModelStateGroup
102 {
103     friend class QmlItemNode;
104     friend class QmlModelView;
105
106 public:
107
108     QmlModelStateGroup() : m_modelNode(ModelNode()) {}
109
110     ModelNode modelNode() const { return m_modelNode; }
111     QStringList names() const;
112     QList<QmlModelState> allStates() const;
113     QmlModelState state(const QString &name) const;
114     QmlModelState addState(const QString &name);
115     void removeState(const QString &name);
116
117 protected:
118     QmlModelStateGroup(const ModelNode &modelNode) : m_modelNode(modelNode) {}
119
120 private:
121     ModelNode m_modelNode;
122 };
123
124 CORESHARED_EXPORT QList<ModelNode> toModelNodeList(const QList<QmlItemNode> &fxItemNodeList);
125 CORESHARED_EXPORT QList<QmlItemNode> toQmlItemNodeList(const QList<ModelNode> &modelNodeList);
126
127 } //QmlDesigner
128
129
130 #endif // QmlItemNode_H