Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGQTWindow.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include <OSGConfig.h>
00047 
00048 #define OSG_COMPILEWINDOWQTINST
00049 
00050 #include "OSGQTWindow.h"
00051 
00052 
00053 OSG_USING_NAMESPACE
00054 
00061 /*----------------------- constructors & destructors ----------------------*/
00062 
00064 
00065 QTWindow::QTWindow(void) :
00066     Inherited()
00067 {
00068 }
00069 
00071 
00072 QTWindow::QTWindow(const QTWindow &source) :
00073     Inherited(source)
00074 {
00075 }
00076 
00078 
00079 QTWindow::~QTWindow(void)
00080 {
00081 }
00082 
00083 /*----------------------------- class specific ----------------------------*/
00084 
00086 
00087 bool qtVersionCheckWrapper(void)
00088 {
00089     if(strcmp(qVersion(), QT_VERSION_STR))
00090     {
00091         FWARNING(("WindowQTLib was compiled against QT version %s, but "
00092                   "the application is using %s!", QT_VERSION_STR, qVersion()));
00093         FWARNING(("This might result in problems. It usually doesn't, but be"
00094                   " warned."));
00095     }
00096     return true;
00097 }
00098 
00099 static StaticInitFuncWrapper qtVersionCheck(qtVersionCheckWrapper);
00100 
00102 
00103 void QTWindow::initMethod (void)
00104 {
00105 }
00106 
00108 
00109 void QTWindow::changed(BitVector whichField, UInt32 origin)
00110 {
00111     Inherited::changed(whichField, origin);
00112 }
00113 
00115 
00116 void QTWindow::dump(      UInt32    ,
00117                          const BitVector ) const
00118 {
00119     SLOG << "Dump QTWindow NI" << std::endl;
00120 }
00121 
00122 
00123 /*-------------------------- your_category---------------------------------*/
00124 
00125 
00127 void QTWindow::init( void )
00128 {
00129 #ifdef WIN32
00130     if(getGlWidget() != NULL)
00131     {
00132         setHwnd(getGlWidget()->winId());
00133 
00134         Inherited::init();
00135     }
00136 #else
00137     XVisualInfo *vi;
00138 
00140     setDisplay(XOpenDisplay(NULL));
00141     setWindow(((QWidget*)getGlWidget())->winId());
00142 
00143     // get the existing glWidget's visual-id and a visual for the new context
00144     XVisualInfo visInfo;
00145     memset(&visInfo, 0, sizeof(XVisualInfo));
00146     visInfo.visualid = XVisualIDFromVisual(
00147                        ((Visual*)getGlWidget()->context()->device()->x11Visual()));
00148     int nvis;
00149     vi = XGetVisualInfo( getDisplay(), VisualIDMask, &visInfo, &nvis );
00150 
00151     // is the visual GL-capable ?
00152     int useGL;
00153     glXGetConfig( getDisplay(),
00154                   vi,
00155                   GLX_USE_GL,
00156                   &useGL );
00157     if (!useGL)
00158     {
00159         SFATAL << "Visual is not OpenGL-capable!" << endLog;
00160     }
00161 
00162     // create the new context
00163     setContext(glXCreateContext(getDisplay(), vi, None, GL_TRUE));
00164 #endif
00165 
00166     activate();
00167     setupGL();
00168 }
00169 
00170 
00171 #include <OSGMFieldTypeDef.inl>
00172 #include <OSGSFieldTypeDef.inl>
00173 
00174 OSG_BEGIN_NAMESPACE
00175 
00176 // doxygen can't find this
00177 #ifndef OSG_DO_DOC
00178 
00179 DataType FieldDataTraits<OSGQGLWidgetP>::_type("OSGQGLWidgetP", NULL);
00180 
00181 #endif
00182 
00183 OSG_DLLEXPORT_SFIELD_DEF1(OSGQGLWidgetP, OSG_WINDOWQTLIB_DLLTMPLMAPPING);
00184 OSG_DLLEXPORT_MFIELD_DEF1(OSGQGLWidgetP, OSG_WINDOWQTLIB_DLLTMPLMAPPING);
00185 
00186 OSG_END_NAMESPACE
00187 
00188 /*-------------------------------------------------------------------------*/
00189 /*                              cvs id's                                   */
00190 
00191 #ifdef __sgi
00192 #pragma set woff 1174
00193 #endif
00194 
00195 #ifdef OSG_LINUX_ICC
00196 #pragma warning( disable : 177 )
00197 #endif
00198 
00199 namespace
00200 {
00201     static char cvsid_cpp[] = "@(#)$Id: $";
00202     static char cvsid_hpp[] = OSGQTWINDOW_HEADER_CVSID;
00203     static char cvsid_inl[] = OSGQTWINDOW_INLINE_CVSID;
00204 
00205     static Char8 cvsid_fields_hpp[] = OSGQTWINDOWFIELDS_HEADER_CVSID;
00206     static Char8 cvsid_datafields_hpp[] = OSGQTWINDOWDATAFIELDS_HEADER_CVSID;
00207 }

Generated on Thu Aug 25 04:08:59 2005 for OpenSG by  doxygen 1.4.3