Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SVTK_SpaceMouse_h
00030 #define SVTK_SpaceMouse_h
00031
00032 #ifndef WIN32
00033 extern "C"
00034 {
00035 #include <X11/X.h>
00036 #include <X11/Xlib.h>
00037 }
00038 #endif
00039
00040 class SVTK_SpaceMouse
00041 {
00042 public:
00043
00044
00045 static SVTK_SpaceMouse* getInstance();
00046
00047 enum MoveData { x, y, z, a, b, c };
00048 enum EventType { SpaceMouseMove = 1, SpaceButtonPress, SpaceButtonRelease };
00049
00050 typedef struct {
00051 int type;
00052 int button;
00053 double data[6];
00054 int period;
00055 } MoveEvent;
00056
00057 bool isSpaceMouseOn() const { return spaceMouseOn != 0; }
00058
00059 #ifndef WIN32
00060 int initialize ( Display*, Window );
00061 int setWindow ( Display*, Window );
00062 int translateEvent ( Display*, XEvent*, MoveEvent*, double, double );
00063 int close ( Display* );
00064 #endif
00065
00066 private:
00067 SVTK_SpaceMouse();
00068 static SVTK_SpaceMouse* myInstance;
00069
00070 #ifndef WIN32
00071 Atom XMotionEvent;
00072 Atom XButtonPressEvent;
00073 Atom XButtonReleaseEvent;
00074 Atom XCommandEvent;
00075
00076 Window win;
00077 #endif
00078 int spaceMouseOn;
00079 };
00080
00081 #endif