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_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 00056 class SoWinMouse : public SoWinDevice { 00057 public: 00074 SoWinMouse(EventMask mask = SO_WIN_ALL_MOUSE_EVENTS); 00078 ~SoWinMouse(); 00079 00081 virtual void enable(SoWidget w, XtEventHandler f, 00082 XtPointer data, Window win = NULL); 00083 00085 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data); 00086 00088 virtual const SoEvent * translateEvent(XAnyEvent *xevent); 00089 00090 private: 00091 EventMask eventMask; // X event interest for this device 00092 SoLocation2Event *loc2Event; // mouse motion 00093 SoMouseButtonEvent *buttonEvent; // mouse button press 00094 SoMouseWheelEvent *mouseWheelEvent; 00095 00096 // Keep the content of the time entry in the MSG structure for mouse leave/enter events 00097 unsigned long m_lastMoveTime; 00098 int m_lastMoveX; 00099 int m_lastMoveY; 00100 00101 bool m_mouseIsOutside; 00102 00103 SoLocation2Event *translateMotionEvent(XMotionEvent *me, bool isLeaveMotionEvent = false); 00104 00105 SoMouseButtonEvent *translateButtonEvent(XButtonEvent *be, 00106 SoMouseButtonEvent::Button b, 00107 SoButtonEvent::State s); 00108 SoMouseWheelEvent *translateMouseWheelEvent(XMouseWheelEvent *we); 00109 00110 }; 00111 00112 #include <Inventor/Win/SoWinEndStrict.h> 00113 00114 #endif /* _SO_WIN_MOUSE_ */ 00115 00116