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_MOUSE_ 00027 #define _SO_WIN_MOUSE_ 00028 00029 #include <Inventor/Win/SoWinBeginStrict.h> 00030 #include <windows.h> 00031 00032 #include <Inventor/Win/devices/SoWinDevice.h> 00033 #include <Inventor/events/SoLocation2Event.h> 00034 #include <Inventor/events/SoMouseButtonEvent.h> 00035 #include <Inventor/events/SoMouseWheelEvent.h> 00036 00037 #define SO_WIN_ALL_MOUSE_EVENTS \ 00038 (ButtonPressMask | ButtonReleaseMask | \ 00039 PointerMotionMask | ButtonMotionMask) 00040 00057 class SoWinMouse : public SoWinDevice { 00058 public: 00075 SoWinMouse(EventMask mask = SO_WIN_ALL_MOUSE_EVENTS); 00079 ~SoWinMouse(); 00080 00082 virtual void enable(SoWidget w, XtEventHandler f, 00083 XtPointer data, Window win = NULL); 00084 00086 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data); 00087 00089 virtual const SoEvent * translateEvent(XAnyEvent *xevent); 00090 00091 private: 00092 EventMask eventMask; // X event interest for this device 00093 SoLocation2Event *loc2Event; // mouse motion 00094 SoMouseButtonEvent *buttonEvent; // mouse button press 00095 SoMouseWheelEvent *mouseWheelEvent; 00096 00097 // Keep the content of the time entry in the MSG structure for mouse leave/enter events 00098 unsigned long m_lastMoveTime; 00099 int m_lastMoveX; 00100 int m_lastMoveY; 00101 00102 bool m_mouseIsOutside; 00103 00104 SoLocation2Event *translateMotionEvent(XMotionEvent *me, bool isLeaveMotionEvent = false); 00105 00106 SoMouseButtonEvent *translateButtonEvent(XButtonEvent *be, 00107 SoMouseButtonEvent::Button b, 00108 SoButtonEvent::State s); 00109 SoMouseWheelEvent *translateMouseWheelEvent(XMouseWheelEvent *we); 00110 00111 }; 00112 00113 #include <Inventor/Win/SoWinEndStrict.h> 00114 00115 #endif /* _SO_WIN_MOUSE_ */ 00116 00117