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 (Jul 2007) 00022 **=======================================================================*/ 00023 00024 #ifndef SO_WX_MOUSE 00025 #define SO_WX_MOUSE 00026 00028 // 00029 // Class: SoWxMouse 00030 // 00032 00033 #include <Inventor/Wx/devices/SoWxDevice.h> 00034 00035 #include <wx/event.h> 00036 #include <Inventor/events/SoLocation2Event.h> 00037 #include <Inventor/events/SoMouseButtonEvent.h> 00038 #include <Inventor/events/SoMouseWheelEvent.h> 00039 00040 #define SO_WX_ALL_MOUSE_EVENTS \ 00041 (ButtonPressMask | ButtonReleaseMask | \ 00042 PointerMotionMask | ButtonMotionMask) 00043 00044 class wxMouseEvent; 00045 00065 class SoWxMouse : public SoWxDevice 00066 { 00067 00068 public: 00084 SoWxMouse( EventMask mask = SO_WX_ALL_MOUSE_EVENTS ); 00085 00089 ~SoWxMouse(); 00090 00091 // These functions enable/disable this device for the passed widget. 00092 // The callback function f will be invoked when events occur in w. 00093 // data is the clientData which will be passed. 00094 virtual void enable( wxWindow* w, XtEventHandler f, void* data, 00095 void* unused=NULL); 00096 virtual void disable( wxWindow* w, XtEventHandler f, void* data ); 00097 00098 // 00099 // Converts a wxEvent into an SoEvent, 00100 // returning NULL if the event is not from this device. 00101 // 00102 virtual const SoEvent* translateEvent( wxEvent& event ); 00103 00104 private: 00105 EventMask m_eventMask; // wxEvent interest for this device 00106 SoLocation2Event* m_loc2Event; // mouse motion 00107 SoMouseButtonEvent* m_buttonEvent; // mouse button press 00108 SoMouseWheelEvent* m_mouseWheelEvent; 00109 00110 SoLocation2Event* translateMotionEvent( wxMouseEvent& me ); 00111 SoMouseButtonEvent* translateButtonEvent( wxMouseEvent& be, SoButtonEvent::State s ); 00112 SoMouseWheelEvent* translateMouseWheelEvent( wxMouseEvent& we ); 00113 }; 00114 00115 #endif // SO_WX_MOUSE 00116 00117 00118