tools/designer/src/lib/sdk/abstractintrospection_p.h
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Designer of the Qt Toolkit.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    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 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    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 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    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 
       
    60 QT_BEGIN_HEADER
       
    61 
       
    62 QT_BEGIN_NAMESPACE
       
    63 
       
    64 class QDESIGNER_SDK_EXPORT QDesignerMetaEnumInterface
       
    65 {
       
    66 public:
       
    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 
       
    82 class QDESIGNER_SDK_EXPORT QDesignerMetaPropertyInterface
       
    83 {
       
    84 public:
       
    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 
       
   111 Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::AccessFlags)
       
   112 Q_DECLARE_OPERATORS_FOR_FLAGS(QDesignerMetaPropertyInterface::Attributes)
       
   113 
       
   114 class QDESIGNER_SDK_EXPORT QDesignerMetaMethodInterface
       
   115 {
       
   116 public:
       
   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 
       
   133 class QDESIGNER_SDK_EXPORT QDesignerMetaObjectInterface {
       
   134 public:
       
   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
       
   162 class QDESIGNER_SDK_EXPORT QDesignerIntrospectionInterface {
       
   163 public:
       
   164     QDesignerIntrospectionInterface();
       
   165     virtual ~QDesignerIntrospectionInterface();
       
   166 
       
   167     virtual const QDesignerMetaObjectInterface* metaObject(const QObject *object) const = 0;
       
   168 };
       
   169 
       
   170 QT_END_NAMESPACE
       
   171 
       
   172 QT_END_HEADER
       
   173 
       
   174 #endif // ABSTRACTMETAOBJECT_H