00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SOQT_DEVICE_H
00025 #define SOQT_DEVICE_H
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <Inventor/Qt/SoQtBasic.h>
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