Coin Logo http://www.sim.no
http://www.coin3d.org

SoQt.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2005 by Systems in Motion.  All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  ("GPL") version 2 as published by the Free Software Foundation.
00009  *  See the file LICENSE.GPL at the root directory of this source
00010  *  distribution for additional information about the GNU GPL.
00011  *
00012  *  For using Coin with software that can not be combined with the GNU
00013  *  GPL, and for taking advantage of the additional benefits of our
00014  *  support services, please contact Systems in Motion about acquiring
00015  *  a Coin Professional Edition License.
00016  *
00017  *  See <URL:http://www.coin3d.org/> for more information.
00018  *
00019  *  Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
00020  *  <URL:http://www.sim.no/>.
00021  *
00022 \**************************************************************************/
00023 
00024 // src/Inventor/Qt/SoQt.h.  Generated from SoGui.h.in by configure.
00025 
00026 #ifndef SOQT_H
00027 #define SOQT_H
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 
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   // Since the class consists solely of static functions, hide the
00112   // default constructor and the destructor so nobody can instantiate
00113   // it.
00114   SoQt(void);
00115   virtual ~SoQt();
00116 
00117   friend class SoGuiP;
00118   friend class SoQtP;
00119 
00120 
00121   // FIXME!: audit and remove as much as possible of the remaining
00122   // toolkit specific parts below. 20020117 mortene.
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

Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.

Generated on Wed May 9 11:46:57 2007 for SoQt by Doxygen. 1.5.1