source: trunk/tools/designer/src/lib/sdk/abstractintrospection_p.h@ 385

Last change on this file since 385 was 2, checked in by Dmitry A. Kuminov, 17 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 6.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the Qt Designer of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42//
43// W A R N I N G
44// -------------
45//
46// This file is not part of the Qt API. It exists for the convenience
47// of Qt Designer. This header
48// file may change from version to version without notice, or even be removed.
49//
50// We mean it.
51//
52
53#ifndef ABSTRACTMETAOBJECT_H
54#define ABSTRACTMETAOBJECT_H
55
56#include <QtDesigner/sdk_global.h>
57#include <QtCore/QVariant>
58#include <QtCore/QFlags>
59
60QT_BEGIN_HEADER
61
62QT_BEGIN_NAMESPACE
63
64class QDESIGNER_SDK_EXPORT QDesignerMetaEnumInterface
65{
66public:
67 QDesignerMetaEnumInterface();
68 virtual ~QDesignerMetaEnumInterface();
69 virtual bool isFlag() const = 0;
70 virtual QString key(int index) const = 0;
71 virtual int keyCount() const = 0;
72 virtual int keyToValue(const QString &key) const = 0;
73 virtual int keysToValue(const QString &keys) const = 0;
74 virtual QString name() const = 0;
75 virtual QString scope() const = 0;
76 virtual QString separator() const = 0;
77 virtual int value(int index) const = 0;
78 virtual QString valueToKey(int value) const = 0;
79 virtual QString valueToKeys(int value) const = 0;
80};
81
82class QDESIGNER_SDK_EXPORT QDesignerMetaPropertyInterface
83{
84public:
85 enum Kind { EnumKind, FlagKind, OtherKind };
86 enum AccessFlag { ReadAccess = 0x0001, WriteAccess = 0x0002, ResetAccess = 0x0004 };
87 enum Attribute { DesignableAttribute = 0x0001, ScriptableAttribute = 0x0002, StoredAttribute = 0x0004, UserAttribute = 0x0008};
88 Q_DECLARE_FLAGS(Attributes, Attribute)
89 Q_DECLARE_FLAGS(AccessFlags, AccessFlag)
90
91 QDesignerMetaPropertyInterface();
92 virtual ~QDesignerMetaPropertyInterface();
93
94 virtual const QDesignerMetaEnumInterface *enumerator() const = 0;
95
96 virtual Kind kind() const = 0;
97 virtual AccessFlags accessFlags() const = 0;
98 virtual Attributes attributes(const QObject *object = 0) const = 0;
99
100 virtual QVariant::Type type() const = 0;
101 virtual QString name() const = 0;
102 virtual QString typeName() const = 0;
103 virtual int userType() const = 0;
104 virtual bool hasSetter() const = 0;
105
106 virtual QVariant read(const QObject *object) const = 0;
107 virtual bool reset(QObject *object) const = 0;
108 virtual bool write(QObject *object, const QVariant &value) const = 0;
109};
110
111Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::AccessFlags)
112Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes)
113
114class QDESIGNER_SDK_EXPORT QDesignerMetaMethodInterface
115{
116public:
117 QDesignerMetaMethodInterface();
118 virtual ~QDesignerMetaMethodInterface();
119
120 enum MethodType { Method, Signal, Slot, Constructor };
121 enum Access { Private, Protected, Public };
122
123 virtual Access access() const = 0;
124 virtual MethodType methodType() const = 0;
125 virtual QStringList parameterNames() const = 0;
126 virtual QStringList parameterTypes() const = 0;
127 virtual QString signature() const = 0;
128 virtual QString normalizedSignature() const = 0;
129 virtual QString tag() const = 0;
130 virtual QString typeName() const = 0;
131};
132
133class QDESIGNER_SDK_EXPORT QDesignerMetaObjectInterface {
134public:
135 QDesignerMetaObjectInterface();
136 virtual ~QDesignerMetaObjectInterface();
137
138 virtual QString className() const = 0;
139 virtual const QDesignerMetaEnumInterface *enumerator(int index) const = 0;
140 virtual int enumeratorCount() const = 0;
141 virtual int enumeratorOffset() const = 0;
142
143 virtual int indexOfEnumerator(const QString &name) const = 0;
144 virtual int indexOfMethod(const QString &method) const = 0;
145 virtual int indexOfProperty(const QString &name) const = 0;
146 virtual int indexOfSignal(const QString &signal) const = 0;
147 virtual int indexOfSlot(const QString &slot) const = 0;
148
149 virtual const QDesignerMetaMethodInterface *method(int index) const = 0;
150 virtual int methodCount() const = 0;
151 virtual int methodOffset() const = 0;
152
153 virtual const QDesignerMetaPropertyInterface *property(int index) const = 0;
154 virtual int propertyCount() const = 0;
155 virtual int propertyOffset() const = 0;
156
157 virtual const QDesignerMetaObjectInterface *superClass() const = 0;
158 virtual const QDesignerMetaPropertyInterface *userProperty() const = 0;
159};
160
161// To be obtained from core
162class QDESIGNER_SDK_EXPORT QDesignerIntrospectionInterface {
163public:
164 QDesignerIntrospectionInterface();
165 virtual ~QDesignerIntrospectionInterface();
166
167 virtual const QDesignerMetaObjectInterface* metaObject(const QObject *object) const = 0;
168};
169
170QT_END_NAMESPACE
171
172QT_END_HEADER
173
174#endif // ABSTRACTMETAOBJECT_H
Note: See TracBrowser for help on using the repository browser.