![]() |
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) by Kongsberg Oil & Gas Technologies. 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 Kongsberg Oil & Gas Technologies 00020 * about acquiring a Coin Professional Edition License. 00021 * 00022 * See http://www.coin3d.org/ for more information. 00023 * 00024 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY. 00025 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org 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 00036 #if QT_VERSION >= 0x040000 00037 #include <QtCore/QObject> 00038 #else 00039 #include <qobject.h> 00040 #endif 00041 00042 #endif // __COIN_SOQT__ 00043 #ifdef __COIN_SOXT__ 00044 #include <X11/Intrinsic.h> 00045 #include <Xm/Xm.h> 00046 #endif // __COIN_SOXT__ 00047 #ifdef __COIN_SOGTK__ 00048 // Fetch stdlib.h, so NULL is defined before glib.h is (indirectly) 00049 // included. Otherwise we get a compile error with KCC on some 00050 // systems. 00051 #include <stdlib.h> 00052 #include <gtk/gtk.h> 00053 class SoGtkComponent; 00054 class SbPList; 00055 #endif // __COIN_SOGTK__ 00056 #ifdef __COIN_SOWIN__ 00057 #include <windows.h> 00058 #endif // __COIN_SOWIN__ 00059 00060 #include <Inventor/SbBasic.h> 00061 #include <Inventor/SbLinear.h> 00062 #include <Inventor/SbString.h> 00063 #include <Inventor/SoDB.h> 00064 #include <Inventor/errors/SoDebugError.h> 00065 00066 // ************************************************************************* 00067 00068 class SOQT_DLL_API SoQt 00069 { 00070 00071 public: 00072 static QWidget * init(const char * appname, const char * classname = "SoQt"); 00073 static QWidget * init(int & argc, char ** argv, 00074 const char * appname, const char * classname = "SoQt"); 00075 static void init(QWidget * toplevelwidget); 00076 00077 static void mainLoop(void); 00078 static void exitMainLoop(void); 00079 static void done(void); 00080 00081 static QWidget * getTopLevelWidget(void); 00082 static QWidget * getShellWidget(const QWidget * w); 00083 00084 static void show(QWidget * const widget); 00085 static void hide(QWidget * const widget); 00086 00087 static void setWidgetSize(QWidget * const widget, const SbVec2s size); 00088 static SbVec2s getWidgetSize(const QWidget * widget); 00089 00090 static void createSimpleErrorDialog(QWidget * widget, 00091 const char * title, 00092 const char * string1, 00093 const char * string2 = NULL); 00094 00095 static void getVersionInfo(int * major = NULL, 00096 int * minor = NULL, 00097 int * micro = NULL); 00098 static const char * getVersionString(void); 00099 static const char * getVersionToolkitString(void); 00100 00101 enum FatalErrors { 00102 UNSPECIFIED_ERROR = 0, 00103 NO_OPENGL_CANVAS, 00104 INTERNAL_ASSERT 00105 }; 00106 typedef void FatalErrorCB(const SbString errmsg, SoQt::FatalErrors errcode, 00107 void * userdata); 00108 static FatalErrorCB * setFatalErrorHandler(SoQt::FatalErrorCB * cb, 00109 void * userdata); 00110 00111 static SbBool isDebugLibrary(void); 00112 static SbBool isCompatible(unsigned int major, unsigned int minor); 00113 00114 enum ABIType { DLL, LIB, UNKNOWN }; 00115 static ABIType getABIType(void); 00116 00117 static void lockGL(void); 00118 static void unlockGL(void); 00119 00120 private: 00121 // Since the class consists solely of static functions, hide the 00122 // default constructor and the destructor so nobody can instantiate 00123 // it. 00124 SoQt(void); 00125 virtual ~SoQt(); 00126 00127 friend class SoGuiP; 00128 friend class SoQtP; 00129 00130 00131 // FIXME!: audit and remove as much as possible of the remaining 00132 // toolkit specific parts below. 20020117 mortene. 00133 00134 #ifdef __COIN_SOXT__ 00135 public: 00136 static void nextEvent(XtAppContext, XEvent *); 00137 static Boolean dispatchEvent(XEvent * event); 00138 static XtAppContext getAppContext(void); 00139 static Display * getDisplay(void); 00140 static XmString encodeString(const char * const str); 00141 static char * decodeString(XmString xstring); 00142 static void getPopupArgs(Display * display, int screen, 00143 ArgList args, int * n); 00144 00145 static void registerColormapLoad(Widget widget, Widget shell); 00146 static void addColormapToShell(Widget widget, Widget shell); 00147 static void removeColormapFromShell(Widget widget, Widget shell); 00148 00149 static void addExtensionEventHandler(Widget widget, 00150 int eventType, XtEventHandler proc, 00151 XtPointer clientData); 00152 static void removeExtensionEventHandler(Widget widget, 00153 int eventType, XtEventHandler proc, 00154 XtPointer clientData); 00155 00156 protected: 00157 static void getExtensionEventHandler(XEvent * event, Widget & widget, 00158 XtEventHandler & proc, 00159 XtPointer & clientData); 00160 #endif // __COIN_SOXT__ 00161 00162 #ifdef __COIN_SOGTK__ 00163 public: 00164 friend class SoGtkComponent; 00165 enum SoGtkComponentAction { CREATION, DESTRUCTION, CHANGE }; 00166 typedef void SoGtkComponentActionCallback(SoGtkComponent *, SoGtk::SoGtkComponentAction, void *); 00167 00168 static void addComponentActionCallback(SoGtkComponentActionCallback *, void *); 00169 static void removeComponentActionCallback(SoGtkComponentActionCallback *, void *); 00170 00171 static int getComponents(SbPList & components); 00172 00173 protected: 00174 static void invokeComponentActionCallbacks(SoGtkComponent * component, 00175 SoGtkComponentAction action); 00176 00177 static gint componentCreation(SoGtkComponent * component); 00178 static gint componentDestruction(SoGtkComponent * component); 00179 static gint componentChange(SoGtkComponent * component); 00180 00181 private: 00182 static gint timerSensorCB(gpointer data); 00183 static gint idleSensorCB(gpointer data); 00184 static gint delaySensorCB(gpointer data); 00185 00186 static GtkWidget * mainWidget; 00187 static SbPList * components; 00188 static SbPList * component_callbacks; 00189 #endif // __COIN_SOGTK__ 00190 }; 00191 00192 // ************************************************************************* 00193 // Here's something InventorWin provides for convenience. Belongs more 00194 // in the application code domain, imo, but we provide these macros 00195 // for better compile time compatibility with InventorWin. -mortene 00196 00197 #define SOQT_ENTER_GL_SECTION() do { SoQt::lockGL(); } while(FALSE) 00198 #define SOQT_LEAVE_GL_SECTION() do { SoQt::unlockGL(); } while(FALSE) 00199 00200 // ************************************************************************* 00201 00202 #endif // ! SOQT_H
Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.
Generated on Wed Jan 18 2012 12:58:19 for SoQt by Doxygen 1.7.4.