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

SoQtDevice.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 #ifndef SOQT_DEVICE_H
00025 #define SOQT_DEVICE_H
00026 
00027 // *************************************************************************
00028 //
00029 // Toolkit-specific typedef and include(s). Put these before any Coin
00030 // and/or SoQt includes, in case there are any dependency bugs in
00031 // the underlying native toolkit set of include files versus the
00032 // compiler environment's include files.
00033 
00034 #include <Inventor/Qt/SoQtBasic.h> // Contains __COIN_SOQT__ define.
00035 
00036 #ifdef __COIN_SOQT__
00037 #include <qevent.h>
00038 typedef void SoQtEventHandler(QWidget *, void *, QEvent *, bool *);
00039 #endif // __COIN_SOQT__
00040 #ifdef __COIN_SOXT__
00041 #include <X11/Intrinsic.h>
00042 typedef void SoQtEventHandler(QWidget *, XtPointer, XEvent *, Boolean *);
00043 #endif // __COIN_SOXT__
00044 #ifdef __COIN_SOGTK__
00045 #include <gtk/gtk.h>
00046 typedef gint SoQtEventHandler(QWidget *, QEvent *, gpointer);
00047 #endif // __COIN_SOGTK__
00048 #ifdef __COIN_SOWIN__
00049 #include <windows.h>
00050 typedef LRESULT SoQtEventHandler(QWidget *, UINT, WPARAM, LPARAM);
00051 #endif // __COIN_SOWIN__
00052 
00053 // *************************************************************************
00054 
00055 #include <Inventor/SbLinear.h>
00056 #include <Inventor/Qt/SoQtObject.h>
00057 
00058 class SoEvent;
00059 
00060 // *************************************************************************
00061 
00062 class SOQT_DLL_API SoQtDevice : public SoQtObject {
00063   SOQT_OBJECT_ABSTRACT_HEADER(SoQtDevice, SoQtObject);
00064 
00065 public:
00066   virtual ~SoQtDevice();
00067 
00068   virtual void enable(QWidget * w, SoQtEventHandler * handler, void * closure) = 0;
00069   virtual void disable(QWidget * w, SoQtEventHandler * handler, void * closure) = 0;
00070 
00071   virtual const SoEvent * translateEvent(QEvent * event) = 0;
00072 
00073   void setWindowSize(const SbVec2s size);
00074   SbVec2s getWindowSize(void) const;
00075 
00076   static void initClasses(void);
00077 
00078 protected:
00079   SoQtDevice(void);
00080 
00081   void setEventPosition(SoEvent * event, int x, int y) const;
00082   static SbVec2s getLastEventPosition(void);
00083 
00084   void addEventHandler(QWidget *, SoQtEventHandler *, void *);
00085   void removeEventHandler(QWidget *, SoQtEventHandler *, void *);
00086   void invokeHandlers(QEvent * event);
00087 
00088 private:
00089   class SoQtDeviceP * pimpl;
00090   friend class SoQtDeviceP;
00091 };
00092 
00093 // *************************************************************************
00094 
00095 #endif // !SOQT_DEVICE_H

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

Generated on Mon Mar 27 00:38:51 2006 for SoQt by Doxygen. 1.4.6