00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _SO_QT_
00029 #define _SO_QT_
00030
00031 #ifndef SOQT
00032 #define SOQT
00033 #endif
00034
00035 #include <Inventor/Qt/SoXt2SoQt.h>
00036
00037 #include <qglobal.h>
00038
00039 #include <QEvent>
00040 #include <QObject>
00041 #include <QWidget>
00042 #include <QToolButton>
00043 #include <QPushButton>
00044 #include <QApplication>
00045 #include <QPointer>
00046
00047 #include <Inventor/SbLinear.h>
00048 #include <Inventor/SbString.h>
00049 #include <Inventor/Qt/SoQtDef.h>
00050 #include <Inventor/Qt/SoInventorQtLibName.h>
00051
00052 #include <Inventor/SoModule.h>
00053 SO_MODULE_HEADER(SoInventorQt, __INVENTORQTDLL)
00054
00055 #ifdef _WIN32
00056 #if !defined(InventorQt_EXPORTS)
00057 #ifndef OIV_DISABLE_AUTOLINK
00058 # pragma comment(lib,__INVENTORQTLIB)
00059 #endif
00060 #endif
00061 #endif //win
00062
00063 class SbPList;
00064 class SoQtSensorHandler;
00065 class SoAction;
00066
00089 class SoQt : public QObject
00090 {
00091 Q_OBJECT
00092
00093
00094 public:
00104 SoNONUNICODE static QWidget *init(const char *appName, const char *className = "Inventor");
00105
00113 static QWidget *init(const SbString& appName, const SbString& className = "Inventor");
00114
00121 static void init( QWidget *topLevelWidget );
00122
00123 #if 1 SoDEPRECATED
00128 SoNONUNICODE static QWidget *threadInit(const char *appName,
00129 const char *className = "Inventor");
00130 SoDEPRECATED
00132 static QWidget *threadInit(const SbString& appName,
00133 const SbString& className = "Inventor");
00134 SoDEPRECATED
00136 static void threadInit(QWidget *topLevelWidget);
00137 #endif
00144 static void show(QWidget *widget);
00145
00150 static void hide(QWidget *widget);
00151
00159 static int mainLoop();
00160
00169 static void exit(int returnCode = 0);
00170
00175 static void nextEvent(XtAppContext appContext, XEvent *event);
00179 static SbGlContextHelper::Display getDisplay();
00184 static SbGlContextHelper::GLContext getAppContext();
00190 static Boolean dispatchEvent(XEvent *);
00195 static QWidget *getTopLevelWidget();
00199 static void setWidgetSize(QWidget *widget, const SbVec2s &size);
00203 static SbVec2s getWidgetSize(QWidget *widget);
00204
00212 SoNONUNICODE static void createSimpleErrorDialog(QWidget *widget, char *dialogTitle,
00213 char *errorStr1, char *errorStr2 = NULL);
00214
00220 static void createSimpleErrorDialog( QWidget *widget, const SbString& sdialogTitle,
00221 const SbString& errorStr1, const SbString& errorStr2 = "" );
00222
00282 static void finish();
00283
00287 static bool isInitialized();
00288
00294 static int getExtensionEventNumber();
00295
00296 private:
00297
00298
00299 static QPointer<QWidget> mainWidget;
00300 static QPointer<QApplication> qapplication;
00301 static QApplication *getQApp() {return qapplication;};
00302
00303
00304
00305
00306 static void addExtensionEventHandler(QWidget *w,
00307 int extensionEventType,
00308 XtEventHandler proc,
00309 XtPointer clientData);
00310 static void removeExtensionEventHandler(QWidget *w,
00311 int extensionEventType,
00312 XtEventHandler proc,
00313 XtPointer clientData);
00314
00315 static void getExtensionEventHandler(XEvent *event, QWidget *w,
00316 XtEventHandler &proc,
00317 XtPointer &clientData);
00318
00319 private:
00320
00321 static SoQtSensorHandler *sensorHandler;
00322
00323 private:
00324
00325
00326
00327 static bool commonInit(const SbString& appName, const SbString& className);
00328
00329 static void setupInventorGLDisplay();
00330
00331 static int s_returnCode;
00332
00333 static SbPList *handlerList;
00334 static int OIVExtensionEventNumber;
00335 static int s_initRefCount;
00336 static const char *s_versionString;
00337 static SbBool s_ownTopLevelWindow;
00338 static SbBool s_ownApplication;
00339 static int s_defaultArgc;
00340 static char** s_defaultArgv;
00341 };
00342
00343 #ifdef __APPLE__
00344 #define SoQtButton QToolButton
00345 #else
00346 #define SoQtButton QPushButton
00347 #endif
00348
00349 #endif // _SO_QT_
00350
00351
00352