00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 00025 00026 #ifndef _SO_WIN_SPACEBALL_ 00027 #define _SO_WIN_SPACEBALL_ 00028 00029 #include <Inventor/Win/SoWinBeginStrict.h> 00030 00031 #include <windows.h> 00032 #include <Inventor/Win/SoWin.h> 00033 #include <Inventor/Win/devices/SoWinDevice.h> 00034 00035 #include <Inventor/events/SoMotion3Event.h> 00036 #include <Inventor/events/SoSpaceballButtonEvent.h> 00037 #include <Inventor/Win/SoWinRenderArea.h> 00038 00039 #include <Inventor/Gui/devices/SoGuiSpaceball.h> 00055 class SoWinSpaceball : public SoWinDevice { 00056 00057 public: 00058 00059 // 00060 // valid event mask values: 00061 // SoWinSpaceball::MOTION - spaceball translation and rotation 00062 // SoWinSpaceball::PRESS - spaceball button press 00063 // SoWinSpaceball::RELEASE - spaceball button release 00064 // SoWinSpaceball::ALL - all spaceball events 00065 // Bitwise OR these to specify whichEvents this device should queue. 00066 // 00067 00072 static SbBool isSpaceMousePresent(); 00073 00077 SoWinSpaceball(SoGuiSpaceball::Mask mask = SoGuiSpaceball::ALL); 00078 00082 ~SoWinSpaceball(); 00083 00085 virtual void enable(SoWidget w, XtEventHandler f, 00086 XtPointer data, Window win = NULL); 00087 00089 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data); 00090 00092 virtual const SoEvent *translateEvent(XAnyEvent *xevent); 00093 00099 void setRotationScaleFactor(float f) { m_guiSpaceball->setRotationScaleFactor( f ); } 00100 00104 float getRotationScaleFactor() const { return m_guiSpaceball->getRotationScaleFactor(); } 00105 00111 void setTranslationScaleFactor(float f) { m_guiSpaceball->setTranslationScaleFactor( f ); } 00112 00116 float getTranslationScaleFactor() const { return m_guiSpaceball->getTranslationScaleFactor(); } 00117 00121 static SbBool exists(); 00122 00127 void setFocusToWindow(SbBool flag) { m_guiSpaceball->setFocusToWindow( flag ); } 00128 00133 SbBool isFocusToWindow() const { return m_guiSpaceball->isFocusToWindow(); } 00134 00135 private: 00136 00137 SoGuiSpaceball* m_guiSpaceball; // Implementation class for SoXxSpaceball 00138 00139 SoMotion3Event *motionEvent; // spaceball rotation/translation 00140 SoSpaceballButtonEvent *buttonEvent; // spball button press/release 00141 00142 // The first widget which registered the space ball object 00143 SoWidget parentWidget; 00144 00145 HWND m_curHwnd; 00146 00147 // event translators! 00148 SoMotion3Event *translateMotionEvent(MSG *me); 00149 SoSpaceballButtonEvent *translateButtonEvent(MSG *be, 00150 SoButtonEvent::State whichState); 00151 SoMotion3Event *translateMotionEventMagellan(MSG *me); 00152 00153 // Magellanstruct _MagellanControl_ Space Mouse data structure 00154 struct _MagellanControl_ *magellanHandle; 00155 }; 00156 00157 #include <Inventor/Win/SoWinEndStrict.h> 00158 00159 #endif /* _SO_WIN_SPACEBALL_ */ 00160 00161