Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qobjectdefs.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Macros and definitions related to QObject 00005 ** 00006 ** Created : 930419 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the kernel module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QOBJECTDEFS_H 00039 #define QOBJECTDEFS_H 00040 00041 #ifndef QT_H 00042 #include "qglobal.h" 00043 #endif // QT_H 00044 00045 00046 #ifndef QT_NO_TRANSLATION 00047 # ifndef QT_NO_TEXTCODEC 00048 // full set of tr functions 00049 # define QT_TR_FUNCTIONS \ 00050 static QString tr( const char *, const char * = 0 ); \ 00051 static QString trUtf8( const char *, const char * = 0 ); 00052 # else 00053 // no QTextCodec, no utf8 00054 # define QT_TR_FUNCTIONS \ 00055 static QString tr( const char *, const char * = 0 ); 00056 # endif 00057 #else 00058 // inherit the ones from QObject 00059 # define QT_TR_FUNCTIONS 00060 #endif 00061 00062 #ifndef QT_NO_PROPERTIES 00063 # define QT_PROP_FUNCTIONS \ 00064 virtual bool qt_property( int id, int f, QVariant* v); \ 00065 static bool qt_static_property( QObject* , int, int, QVariant* ); 00066 #else 00067 # define QT_PROP_FUNCTIONS 00068 #endif 00069 00070 // The following macros are our "extensions" to C++ 00071 // They are used, strictly speaking, only by the moc. 00072 struct QUObject; 00073 00074 #ifdef QT_MOC_CPP 00075 #define slots slots 00076 #define signals signals 00077 #define Q_CLASSINFO( name, value ) Q_CLASSINFO( name, value ) 00078 #define Q_PROPERTY( text ) Q_PROPERTY( text ) 00079 #define Q_OVERRIDE( text ) Q_OVERRIDE( text ) 00080 #define Q_ENUMS( x ) Q_ENUMS( x ) 00081 #define Q_SETS( x ) Q_SETS( x ) 00082 /* tmake ignore Q_OBJECT */ 00083 #define Q_OBJECT Q_OBJECT 00084 /* tmake ignore Q_OBJECT */ 00085 #define Q_OBJECT_FAKE Q_OBJECT_FAKE 00086 00087 #else 00088 #define slots // slots: in class 00089 #define signals protected // signals: in class 00090 #ifndef QT_NO_EMIT 00091 #define emit // emit signal 00092 #endif 00093 #define Q_CLASSINFO( name, value ) // class info 00094 #define Q_PROPERTY( text ) // property 00095 #define Q_OVERRIDE( text ) // override property 00096 #define Q_ENUMS( x ) 00097 #define Q_SETS( x ) 00098 00099 /* tmake ignore Q_OBJECT */ 00100 #define Q_OBJECT \ 00101 public: \ 00102 virtual QMetaObject *metaObject() const { \ 00103 return staticMetaObject(); \ 00104 } \ 00105 virtual const char *className() const; \ 00106 virtual void* qt_cast( const char* ); \ 00107 virtual bool qt_invoke( int, QUObject* ); \ 00108 virtual bool qt_emit( int, QUObject* ); \ 00109 QT_PROP_FUNCTIONS \ 00110 static QMetaObject* staticMetaObject(); \ 00111 QObject* qObject() { return (QObject*)this; } \ 00112 QT_TR_FUNCTIONS \ 00113 private: \ 00114 static QMetaObject *metaObj; 00115 00116 /* tmake ignore Q_OBJECT */ 00117 #define Q_OBJECT_FAKE Q_OBJECT 00118 00119 #endif 00120 00121 // macro for naming members 00122 #ifdef METHOD 00123 #undef METHOD 00124 #endif 00125 #ifdef SLOT 00126 #undef SLOT 00127 #endif 00128 #ifdef SIGNAL 00129 #undef SIGNAL 00130 #endif 00131 00132 #if defined(_OLD_CPP_) 00133 #define METHOD(a) "0""a" 00134 #define SLOT(a) "1""a" 00135 #define SIGNAL(a) "2""a" 00136 #else 00137 #define METHOD(a) "0"#a 00138 #define SLOT(a) "1"#a 00139 #define SIGNAL(a) "2"#a 00140 #endif 00141 00142 #ifndef QT_CLEAN_NAMESPACE 00143 #define METHOD_CODE 0 // member type codes 00144 #define SLOT_CODE 1 00145 #define SIGNAL_CODE 2 00146 #endif 00147 00148 #define QMETHOD_CODE 0 // member type codes 00149 #define QSLOT_CODE 1 00150 #define QSIGNAL_CODE 2 00151 00152 class QObject; 00153 class QMetaObject; 00154 class QSignal; 00155 class QConnection; 00156 class QEvent; 00157 struct QMetaData; 00158 class QConnectionList; 00159 class QConnectionListIt; 00160 class QSignalVec; 00161 class QObjectList; 00162 class QObjectListIt; 00163 class QMemberDict; 00164 00165 Q_EXPORT void *qt_find_obj_child( QObject *, const char *, const char * ); 00166 #define Q_CHILD(parent,type,name) \ 00167 ((type*)qt_find_obj_child(parent,#type,name)) 00168 00169 Q_EXPORT void *qt_inheritedBy( QMetaObject *super, const QObject *cls ); 00170 00171 template <typename T> 00172 Q_INLINE_TEMPLATES T qt_cast(const QObject *object) 00173 { return (T)qt_inheritedBy( ((T)0)->staticMetaObject(), object ); } 00174 #endif // QOBJECTDEFS_H