home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qgplugin.h < prev    next >
C/C++ Source or Header  |  2001-10-01  |  2KB  |  99 lines

  1. #ifndef QGPLUGIN_H
  2. #define QGPLUGIN_H
  3.  
  4. #ifndef QT_H
  5. #include "qobject.h"
  6. #endif // QT_H
  7.  
  8. #ifndef QT_NO_COMPONENT
  9.  
  10. #ifndef Q_EXTERN_C
  11. #ifdef __cplusplus
  12. #define Q_EXTERN_C    extern "C"
  13. #else
  14. #define Q_EXTERN_C    extern
  15. #endif
  16. #endif
  17.  
  18. #if defined(QT_THREAD_SUPPORT)
  19. #define QT_THREADED_BUILD 1
  20. #else
  21. #define QT_THREADED_BUILD 0
  22. #endif
  23.  
  24. #if defined(QT_DEBUG)
  25. #define QT_DEBUG_BUILD 1
  26. #else
  27. #define QT_DEBUG_BUILD 0
  28. #endif
  29.  
  30. #ifndef Q_EXPORT_PLUGIN
  31. #define Q_PLUGIN_INITIALIZE \
  32.     { \
  33.     if ( !qApp && theApp ) \
  34.         qt_ucm_initialize( theApp ); \
  35.     if ( mt ) \
  36.         *mt = QT_THREADED_BUILD; \
  37.     if ( debug ) \
  38.         *debug = QT_DEBUG_BUILD; \
  39.     return QT_VERSION; \
  40.     }
  41. #define Q_PLUGIN_INSTANTIATE( IMPLEMENTATION )    \
  42.     { \
  43.     IMPLEMENTATION *i = new IMPLEMENTATION;    \
  44.     return i->iface(); \
  45.     }
  46.  
  47. #    ifdef Q_WS_WIN
  48. #    ifdef Q_CC_BOR
  49. #        define Q_EXPORT_PLUGIN( PLUGIN ) \
  50.         class QApplication;\
  51.         extern Q_EXPORT QApplication *qApp; \
  52.         extern Q_EXPORT void qt_ucm_initialize( QApplication *theApp ); \
  53.         Q_EXTERN_C __declspec(dllexport) int __stdcall ucm_initialize( QApplication *theApp, bool *mt, bool *debug ) \
  54.             Q_PLUGIN_INITIALIZE \
  55.         Q_EXTERN_C __declspec(dllexport) QUnknownInterface* __stdcall ucm_instantiate() \
  56.             Q_PLUGIN_INSTANTIATE( PLUGIN )
  57. #    else
  58. #        define Q_EXPORT_PLUGIN( PLUGIN ) \
  59.         class QApplication;\
  60.         extern Q_EXPORT QApplication *qApp; \
  61.         extern Q_EXPORT void qt_ucm_initialize( QApplication *theApp ); \
  62.         Q_EXTERN_C __declspec(dllexport) int ucm_initialize( QApplication *theApp, bool *mt, bool *debug ) \
  63.             Q_PLUGIN_INITIALIZE \
  64.         Q_EXTERN_C __declspec(dllexport) QUnknownInterface* ucm_instantiate() \
  65.             Q_PLUGIN_INSTANTIATE( PLUGIN )
  66. #    endif
  67. #    else
  68. #    define Q_EXPORT_PLUGIN( PLUGIN ) \
  69.         class QApplication;\
  70.         extern Q_EXPORT QApplication *qApp; \
  71.         extern Q_EXPORT void qt_ucm_initialize( QApplication *theApp ); \
  72.         Q_EXTERN_C int ucm_initialize( QApplication *theApp, bool *mt, bool *debug ) \
  73.         Q_PLUGIN_INITIALIZE \
  74.         Q_EXTERN_C QUnknownInterface* ucm_instantiate() \
  75.         Q_PLUGIN_INSTANTIATE( PLUGIN )
  76. #    endif
  77. #endif
  78.  
  79. struct QUnknownInterface;
  80.  
  81. class Q_EXPORT QGPlugin : public QObject
  82. {
  83.     Q_OBJECT
  84. public:
  85.     QGPlugin( QUnknownInterface *i );
  86.     ~QGPlugin();
  87.  
  88.     QUnknownInterface* iface();
  89.     void setIface( QUnknownInterface *iface );
  90.  
  91. private:
  92.     QGPlugin();
  93.     QUnknownInterface* _iface;
  94. };
  95.  
  96. #endif // QT_NO_COMPONENT
  97.  
  98. #endif // QGPLUGIN_H
  99.