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 #ifndef SOQT_H
00027 #define SOQT_H
00028
00029 #include <Inventor/Qt/SoQtBasic.h>
00030
00031
00032
00033
00034 #ifdef __COIN_SOQT__
00035 #include <qobject.h>
00036 #endif // __COIN_SOQT__
00037 #ifdef __COIN_SOXT__
00038 #include <X11/Intrinsic.h>
00039 #include <Xm/Xm.h>
00040 #endif // __COIN_SOXT__
00041 #ifdef __COIN_SOGTK__
00042
00043
00044
00045 #include <stdlib.h>
00046 #include <gtk/gtk.h>
00047 class SoGtkComponent;
00048 class SbPList;
00049 #endif // __COIN_SOGTK__
00050 #ifdef __COIN_SOWIN__
00051 #include <windows.h>
00052 #endif // __COIN_SOWIN__
00053
00054 #include <Inventor/SbBasic.h>
00055 #include <Inventor/SbLinear.h>
00056 #include <Inventor/SbString.h>
00057 #include <Inventor/SoDB.h>
00058 #include <Inventor/errors/SoDebugError.h>
00059
00060
00061
00062 class SOQT_DLL_API SoQt
00063 {
00064
00065 public:
00066 static QWidget * init(const char * appname, const char * classname = "SoQt");
00067 static QWidget * init(int & argc, char ** argv,
00068 const char * appname, const char * classname = "SoQt");
00069 static void init(QWidget * toplevelwidget);
00070
00071 static void mainLoop(void);
00072 static void exitMainLoop(void);
00073 static void done(void);
00074
00075 static QWidget * getTopLevelWidget(void);
00076 static QWidget * getShellWidget(const QWidget * w);
00077
00078 static void show(QWidget * const widget);
00079 static void hide(QWidget * const widget);
00080
00081 static void setWidgetSize(QWidget * const widget, const SbVec2s size);
00082 static SbVec2s getWidgetSize(const QWidget * widget);
00083
00084 static void createSimpleErrorDialog(QWidget * widget,
00085 const char * title,
00086 const char * string1,
00087 const char * string2 = NULL);
00088
00089 static void getVersionInfo(int * major = NULL,
00090 int * minor = NULL,
00091 int * micro = NULL);
00092 static const char * getVersionString(void);
00093
00094 enum FatalErrors {
00095 UNSPECIFIED_ERROR = 0,
00096 NO_OPENGL_CANVAS,
00097 INTERNAL_ASSERT
00098 };
00099 typedef void FatalErrorCB(const SbString errmsg, SoQt::FatalErrors errcode,
00100 void * userdata);
00101 static FatalErrorCB * setFatalErrorHandler(SoQt::FatalErrorCB * cb,
00102 void * userdata);
00103
00104 static SbBool isDebugLibrary(void);
00105 static SbBool isCompatible(unsigned int major, unsigned int minor);
00106
00107 enum ABIType { DLL, LIB, UNKNOWN };
00108 static ABIType getABIType(void);
00109
00110 private:
00111
00112
00113
00114 SoQt(void);
00115 virtual ~SoQt();
00116
00117 friend class SoGuiP;
00118 friend class SoQtP;
00119
00120
00121
00122
00123
00124 #ifdef __COIN_SOXT__
00125 public:
00126 static void nextEvent(XtAppContext, XEvent *);
00127 static Boolean dispatchEvent(XEvent * event);
00128 static XtAppContext getAppContext(void);
00129 static Display * getDisplay(void);
00130 static XmString encodeString(const char * const str);
00131 static char * decodeString(XmString xstring);
00132 static void getPopupArgs(Display * display, int screen,
00133 ArgList args, int * n);
00134
00135 static void registerColormapLoad(Widget widget, Widget shell);
00136 static void addColormapToShell(Widget widget, Widget shell);
00137 static void removeColormapFromShell(Widget widget, Widget shell);
00138
00139 static void addExtensionEventHandler(Widget widget,
00140 int eventType, XtEventHandler proc,
00141 XtPointer clientData);
00142 static void removeExtensionEventHandler(Widget widget,
00143 int eventType, XtEventHandler proc,
00144 XtPointer clientData);
00145
00146 protected:
00147 static void getExtensionEventHandler(XEvent * event, Widget & widget,
00148 XtEventHandler & proc,
00149 XtPointer & clientData);
00150 #endif // __COIN_SOXT__
00151
00152 #ifdef __COIN_SOGTK__
00153 public:
00154 friend class SoGtkComponent;
00155 enum SoGtkComponentAction { CREATION, DESTRUCTION, CHANGE };
00156 typedef void SoGtkComponentActionCallback(SoGtkComponent *, SoGtk::SoGtkComponentAction, void *);
00157
00158 static void addComponentActionCallback(SoGtkComponentActionCallback *, void *);
00159 static void removeComponentActionCallback(SoGtkComponentActionCallback *, void *);
00160
00161 static int getComponents(SbPList & components);
00162
00163 protected:
00164 static void invokeComponentActionCallbacks(SoGtkComponent * component,
00165 SoGtkComponentAction action);
00166
00167 static gint componentCreation(SoGtkComponent * component);
00168 static gint componentDestruction(SoGtkComponent * component);
00169 static gint componentChange(SoGtkComponent * component);
00170
00171 private:
00172 static gint timerSensorCB(gpointer data);
00173 static gint idleSensorCB(gpointer data);
00174 static gint delaySensorCB(gpointer data);
00175
00176 static GtkWidget * mainWidget;
00177 static SbPList * components;
00178 static SbPList * component_callbacks;
00179 #endif // __COIN_SOGTK__
00180 };
00181
00182
00183
00184 #endif // ! SOQT_H