![]() |
http://www.sim.no http://www.coin3d.org |
00001 #ifndef SOQT_H 00002 #define SOQT_H 00003 00004 // src/Inventor/Qt/SoQt.h. Generated from SoGui.h.in by configure. 00005 00006 /**************************************************************************\ 00007 * 00008 * This file is part of the Coin 3D visualization library. 00009 * Copyright (C) 1998-2005 by Systems in Motion. All rights reserved. 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU General Public License 00013 * ("GPL") version 2 as published by the Free Software Foundation. 00014 * See the file LICENSE.GPL at the root directory of this source 00015 * distribution for additional information about the GNU GPL. 00016 * 00017 * For using Coin with software that can not be combined with the GNU 00018 * GPL, and for taking advantage of the additional benefits of our 00019 * support services, please contact Systems in Motion about acquiring 00020 * a Coin Professional Edition License. 00021 * 00022 * See <URL:http://www.coin3d.org/> for more information. 00023 * 00024 * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY. 00025 * <URL:http://www.sim.no/>. 00026 * 00027 \**************************************************************************/ 00028 00029 #include <Inventor/Qt/SoQtBasic.h> 00030 00031 // FIXME: use configure defines for the header files. 00032 // 20020613 mortene. 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 // Fetch stdlib.h, so NULL is defined before glib.h is (indirectly) 00043 // included. Otherwise we get a compile error with KCC on some 00044 // systems. 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 static const char * getVersionToolkitString(void); 00094 00095 enum FatalErrors { 00096 UNSPECIFIED_ERROR = 0, 00097 NO_OPENGL_CANVAS, 00098 INTERNAL_ASSERT 00099 }; 00100 typedef void FatalErrorCB(const SbString errmsg, SoQt::FatalErrors errcode, 00101 void * userdata); 00102 static FatalErrorCB * setFatalErrorHandler(SoQt::FatalErrorCB * cb, 00103 void * userdata); 00104 00105 static SbBool isDebugLibrary(void); 00106 static SbBool isCompatible(unsigned int major, unsigned int minor); 00107 00108 enum ABIType { DLL, LIB, UNKNOWN }; 00109 static ABIType getABIType(void); 00110 00111 static void lockGL(void); 00112 static void unlockGL(void); 00113 00114 private: 00115 // Since the class consists solely of static functions, hide the 00116 // default constructor and the destructor so nobody can instantiate 00117 // it. 00118 SoQt(void); 00119 virtual ~SoQt(); 00120 00121 friend class SoGuiP; 00122 friend class SoQtP; 00123 00124 00125 // FIXME!: audit and remove as much as possible of the remaining 00126 // toolkit specific parts below. 20020117 mortene. 00127 00128 #ifdef __COIN_SOXT__ 00129 public: 00130 static void nextEvent(XtAppContext, XEvent *); 00131 static Boolean dispatchEvent(XEvent * event); 00132 static XtAppContext getAppContext(void); 00133 static Display * getDisplay(void); 00134 static XmString encodeString(const char * const str); 00135 static char * decodeString(XmString xstring); 00136 static void getPopupArgs(Display * display, int screen, 00137 ArgList args, int * n); 00138 00139 static void registerColormapLoad(Widget widget, Widget shell); 00140 static void addColormapToShell(Widget widget, Widget shell); 00141 static void removeColormapFromShell(Widget widget, Widget shell); 00142 00143 static void addExtensionEventHandler(Widget widget, 00144 int eventType, XtEventHandler proc, 00145 XtPointer clientData); 00146 static void removeExtensionEventHandler(Widget widget, 00147 int eventType, XtEventHandler proc, 00148 XtPointer clientData); 00149 00150 protected: 00151 static void getExtensionEventHandler(XEvent * event, Widget & widget, 00152 XtEventHandler & proc, 00153 XtPointer & clientData); 00154 #endif // __COIN_SOXT__ 00155 00156 #ifdef __COIN_SOGTK__ 00157 public: 00158 friend class SoGtkComponent; 00159 enum SoGtkComponentAction { CREATION, DESTRUCTION, CHANGE }; 00160 typedef void SoGtkComponentActionCallback(SoGtkComponent *, SoGtk::SoGtkComponentAction, void *); 00161 00162 static void addComponentActionCallback(SoGtkComponentActionCallback *, void *); 00163 static void removeComponentActionCallback(SoGtkComponentActionCallback *, void *); 00164 00165 static int getComponents(SbPList & components); 00166 00167 protected: 00168 static void invokeComponentActionCallbacks(SoGtkComponent * component, 00169 SoGtkComponentAction action); 00170 00171 static gint componentCreation(SoGtkComponent * component); 00172 static gint componentDestruction(SoGtkComponent * component); 00173 static gint componentChange(SoGtkComponent * component); 00174 00175 private: 00176 static gint timerSensorCB(gpointer data); 00177 static gint idleSensorCB(gpointer data); 00178 static gint delaySensorCB(gpointer data); 00179 00180 static GtkWidget * mainWidget; 00181 static SbPList * components; 00182 static SbPList * component_callbacks; 00183 #endif // __COIN_SOGTK__ 00184 }; 00185 00186 // ************************************************************************* 00187 // Here's something InventorWin provides for convenience. Belongs more 00188 // in the application code domain, imo, but we provide these macros 00189 // for better compile time compatibility with InventorWin. -mortene 00190 00191 #define SOQT_ENTER_GL_SECTION() do { SoQt::lockGL(); } while(FALSE) 00192 #define SOQT_LEAVE_GL_SECTION() do { SoQt::unlockGL(); } while(FALSE) 00193 00194 // ************************************************************************* 00195 00196 #endif // ! SOQT_H
Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.
Generated on Fri Aug 27 2010 06:18:18 for SoQt by Doxygen. 1.7.1