![]() |
http://www.coin3d.org/ http://www.kongsberg.com/kogt/ |
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 * Copyright (c) Kongsberg Oil & Gas Technologies AS 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions are 00012 * met: 00013 * 00014 * Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 00017 * Redistributions in binary form must reproduce the above copyright 00018 * notice, this list of conditions and the following disclaimer in the 00019 * documentation and/or other materials provided with the distribution. 00020 * 00021 * Neither the name of the copyright holder nor the names of its 00022 * contributors may be used to endorse or promote products derived from 00023 * this software without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00028 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00029 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00030 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00031 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00032 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00033 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00034 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00035 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 \**************************************************************************/ 00037 00038 #include <Inventor/Qt/SoQtBasic.h> 00039 00040 // FIXME: use configure defines for the header files. 00041 // 20020613 mortene. 00042 00043 #ifdef __COIN_SOQT__ 00044 00045 #if QT_VERSION >= 0x040000 00046 #include <QtCore/QObject> 00047 #else 00048 #include <qobject.h> 00049 #endif 00050 00051 #endif // __COIN_SOQT__ 00052 #ifdef __COIN_SOXT__ 00053 #include <X11/Intrinsic.h> 00054 #include <Xm/Xm.h> 00055 #endif // __COIN_SOXT__ 00056 #ifdef __COIN_SOGTK__ 00057 // Fetch stdlib.h, so NULL is defined before glib.h is (indirectly) 00058 // included. Otherwise we get a compile error with KCC on some 00059 // systems. 00060 #include <stdlib.h> 00061 #include <gtk/gtk.h> 00062 class SoGtkComponent; 00063 class SbPList; 00064 #endif // __COIN_SOGTK__ 00065 #ifdef __COIN_SOWIN__ 00066 #include <windows.h> 00067 #endif // __COIN_SOWIN__ 00068 00069 #include <Inventor/SbBasic.h> 00070 #include <Inventor/SbLinear.h> 00071 #include <Inventor/SbString.h> 00072 #include <Inventor/SoDB.h> 00073 #include <Inventor/errors/SoDebugError.h> 00074 00075 // ************************************************************************* 00076 00077 class SOQT_DLL_API SoQt 00078 { 00079 00080 public: 00081 static QWidget * init(const char * appname, const char * classname = "SoQt"); 00082 static QWidget * init(int & argc, char ** argv, 00083 const char * appname, const char * classname = "SoQt"); 00084 static void init(QWidget * toplevelwidget); 00085 00086 static void mainLoop(void); 00087 static void exitMainLoop(void); 00088 static void done(void); 00089 00090 static QWidget * getTopLevelWidget(void); 00091 static QWidget * getShellWidget(const QWidget * w); 00092 00093 static void show(QWidget * const widget); 00094 static void hide(QWidget * const widget); 00095 00096 static void setWidgetSize(QWidget * const widget, const SbVec2s size); 00097 static SbVec2s getWidgetSize(const QWidget * widget); 00098 00099 static void createSimpleErrorDialog(QWidget * widget, 00100 const char * title, 00101 const char * string1, 00102 const char * string2 = NULL); 00103 00104 static void getVersionInfo(int * major = NULL, 00105 int * minor = NULL, 00106 int * micro = NULL); 00107 static const char * getVersionString(void); 00108 static const char * getVersionToolkitString(void); 00109 00110 enum FatalErrors { 00111 UNSPECIFIED_ERROR = 0, 00112 NO_OPENGL_CANVAS, 00113 INTERNAL_ASSERT 00114 }; 00115 typedef void FatalErrorCB(const SbString errmsg, SoQt::FatalErrors errcode, 00116 void * userdata); 00117 static FatalErrorCB * setFatalErrorHandler(SoQt::FatalErrorCB * cb, 00118 void * userdata); 00119 00120 static SbBool isDebugLibrary(void); 00121 static SbBool isCompatible(unsigned int major, unsigned int minor); 00122 00123 enum ABIType { DLL, LIB, UNKNOWN }; 00124 static ABIType getABIType(void); 00125 00126 static void lockGL(void); 00127 static void unlockGL(void); 00128 00129 private: 00130 // Since the class consists solely of static functions, hide the 00131 // default constructor and the destructor so nobody can instantiate 00132 // it. 00133 SoQt(void); 00134 virtual ~SoQt(); 00135 00136 friend class SoGuiP; 00137 friend class SoQtP; 00138 00139 00140 // FIXME!: audit and remove as much as possible of the remaining 00141 // toolkit specific parts below. 20020117 mortene. 00142 00143 #ifdef __COIN_SOWIN__ 00144 public: 00145 static void doIdleTasks(void); 00146 #endif // __COIN_SOWIN__ 00147 00148 #ifdef __COIN_SOXT__ 00149 public: 00150 static void nextEvent(XtAppContext, XEvent *); 00151 static Boolean dispatchEvent(XEvent * event); 00152 static XtAppContext getAppContext(void); 00153 static Display * getDisplay(void); 00154 static XmString encodeString(const char * const str); 00155 static char * decodeString(XmString xstring); 00156 static void getPopupArgs(Display * display, int screen, 00157 ArgList args, int * n); 00158 00159 static void registerColormapLoad(Widget widget, Widget shell); 00160 static void addColormapToShell(Widget widget, Widget shell); 00161 static void removeColormapFromShell(Widget widget, Widget shell); 00162 00163 static void addExtensionEventHandler(Widget widget, 00164 int eventType, XtEventHandler proc, 00165 XtPointer clientData); 00166 static void removeExtensionEventHandler(Widget widget, 00167 int eventType, XtEventHandler proc, 00168 XtPointer clientData); 00169 00170 protected: 00171 static void getExtensionEventHandler(XEvent * event, Widget & widget, 00172 XtEventHandler & proc, 00173 XtPointer & clientData); 00174 #endif // __COIN_SOXT__ 00175 00176 #ifdef __COIN_SOGTK__ 00177 public: 00178 friend class SoGtkComponent; 00179 enum SoGtkComponentAction { CREATION, DESTRUCTION, CHANGE }; 00180 typedef void SoGtkComponentActionCallback(SoGtkComponent *, SoGtk::SoGtkComponentAction, void *); 00181 00182 static void addComponentActionCallback(SoGtkComponentActionCallback *, void *); 00183 static void removeComponentActionCallback(SoGtkComponentActionCallback *, void *); 00184 00185 static int getComponents(SbPList & components); 00186 00187 protected: 00188 static void invokeComponentActionCallbacks(SoGtkComponent * component, 00189 SoGtkComponentAction action); 00190 00191 static gint componentCreation(SoGtkComponent * component); 00192 static gint componentDestruction(SoGtkComponent * component); 00193 static gint componentChange(SoGtkComponent * component); 00194 00195 private: 00196 static gint timerSensorCB(gpointer data); 00197 static gint idleSensorCB(gpointer data); 00198 static gint delaySensorCB(gpointer data); 00199 00200 static GtkWidget * mainWidget; 00201 static SbPList * components; 00202 static SbPList * component_callbacks; 00203 #endif // __COIN_SOGTK__ 00204 }; 00205 00206 // ************************************************************************* 00207 // Here's something InventorWin provides for convenience. Belongs more 00208 // in the application code domain, imo, but we provide these macros 00209 // for better compile time compatibility with InventorWin. -mortene 00210 00211 #define SOQT_ENTER_GL_SECTION() do { SoQt::lockGL(); } while(FALSE) 00212 #define SOQT_LEAVE_GL_SECTION() do { SoQt::unlockGL(); } while(FALSE) 00213 00214 // ************************************************************************* 00215 00216 #endif // ! SOQT_H
Copyright © by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Wed Mar 2 2016 19:40:11 for SoQt by Doxygen 1.7.3.