Version: 6.3.1

src/SVTK/SVTK_SpaceMouse.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME VTKViewer : build VTK viewer into Salome desktop
00024 //  File   : SVTK_SpaceMouse.h
00025 //  Author : Alexander SLADKOV
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/GUI/GUI_SRC/src/SVTK/SVTK_SpaceMouse.h,v 1.5.22.1.12.1 2011-06-01 13:53:41 vsr Exp $
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   // access to SpaceMouse utility class
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
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS