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-2020 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> 00056 class SoWinSpaceball : public SoWinDevice { 00057 00058 public: 00059 00060 // 00061 // valid event mask values: 00062 // SoWinSpaceball::MOTION - spaceball translation and rotation 00063 // SoWinSpaceball::PRESS - spaceball button press 00064 // SoWinSpaceball::RELEASE - spaceball button release 00065 // SoWinSpaceball::ALL - all spaceball events 00066 // Bitwise OR these to specify whichEvents this device should queue. 00067 // 00068 00073 static SbBool isSpaceMousePresent(); 00074 00078 SoWinSpaceball(SoGuiSpaceball::Mask mask = SoGuiSpaceball::ALL); 00079 00083 ~SoWinSpaceball(); 00084 00086 virtual void enable(SoWidget w, XtEventHandler f, 00087 XtPointer data, Window win = NULL); 00088 00090 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data); 00091 00093 virtual const SoEvent *translateEvent(XAnyEvent *xevent); 00094 00100 void setRotationScaleFactor(float f) { m_guiSpaceball->setRotationScaleFactor( f ); } 00101 00105 float getRotationScaleFactor() const { return m_guiSpaceball->getRotationScaleFactor(); } 00106 00112 void setTranslationScaleFactor(float f) { m_guiSpaceball->setTranslationScaleFactor( f ); } 00113 00117 float getTranslationScaleFactor() const { return m_guiSpaceball->getTranslationScaleFactor(); } 00118 00122 static SbBool exists(); 00123 00128 void setFocusToWindow(SbBool flag) { m_guiSpaceball->setFocusToWindow( flag ); } 00129 00134 SbBool isFocusToWindow() const { return m_guiSpaceball->isFocusToWindow(); } 00135 00136 private: 00137 00138 SoGuiSpaceball* m_guiSpaceball; // Implementation class for SoXxSpaceball 00139 00140 SoMotion3Event *motionEvent; // spaceball rotation/translation 00141 SoSpaceballButtonEvent *buttonEvent; // spball button press/release 00142 00143 // The first widget which registered the space ball object 00144 SoWidget parentWidget; 00145 00146 HWND m_curHwnd; 00147 00148 // event translators! 00149 SoMotion3Event *translateMotionEvent(MSG *me); 00150 SoSpaceballButtonEvent *translateButtonEvent(MSG *be, 00151 SoButtonEvent::State whichState); 00152 SoMotion3Event *translateMotionEventMagellan(MSG *me); 00153 00154 // Magellanstruct _MagellanControl_ Space Mouse data structure 00155 struct _MagellanControl_ *magellanHandle; 00156 }; 00157 00158 #include <Inventor/Win/SoWinEndStrict.h> 00159 00160 #endif /* _SO_WIN_SPACEBALL_ */ 00161 00162