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 : T.MEHAMLI (Jun 2007) 00022 **=======================================================================*/ 00023 00024 #ifndef SO_GUI_SPACEBALL 00025 #define SO_GUI_SPACEBALL 00026 00027 #include <Inventor/Gui/SoGui.h> 00028 #include <Inventor/events/SoMotion3Event.h> 00029 #include <Inventor/events/SoSpaceballButtonEvent.h> 00030 00031 #include <Inventor/Gui/devices/SoGuiDevice.h> 00032 00034 // 00035 // Class: SoGuiComponent 00036 // 00037 // SoXXSpaceball implementation class 00038 // 00039 // 00041 00042 00043 class SoGuiSpaceball : public SoGuiDevice 00044 { 00045 private: 00046 00047 enum Mask 00048 { 00052 MOTION = 0x01, 00056 PRESS = 0x02, 00060 RELEASE = 0x04, 00064 ALL = 0x07 00065 }; 00066 00067 enum DeviceType 00068 { 00069 SPACE_BALL = 0x01, 00070 MAGELLAN_SPACE_MOUSE = 0x02 00071 }; 00072 00073 // 00074 // valid event mask values: 00075 // SoXtSpaceball::MOTION - spaceball translation and rotation 00076 // SoXtSpaceball::PRESS - spaceball button press 00077 // SoXtSpaceball::RELEASE - spaceball button release 00078 // SoXtSpaceball::ALL - all spaceball events 00079 // Bitwise OR these to specify whichEvents this device should queue. 00080 // 00081 // The second constructor allows the spaceball to be attached 00082 // to a different display than the one used by SoXt::init(). 00083 00087 SoGuiSpaceball( Mask mask = SoGuiSpaceball::ALL ); 00088 00092 ~SoGuiSpaceball(); 00093 00099 void setRotationScaleFactor( float f ); 00100 00104 float getRotationScaleFactor() const ; 00105 00111 void setTranslationScaleFactor( float f ); 00112 00116 float getTranslationScaleFactor() const; 00117 00124 void setFocusToWindow(SbBool flag); 00125 00129 SbBool isFocusToWindow() const; 00130 00131 private: 00132 00133 SbBool m_focusToWindow; 00134 Mask m_eventMask; // X event interest for this device 00135 00136 // scale factors 00137 float m_rotScale; 00138 float m_transScale; 00139 }; 00140 00141 #endif // SO_GUI_SPACEBALL 00142 00143 00144