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_KEYBOARD 00025 #define SO_WX_KEYBOARD 00026 00028 // 00029 // Class: SoWxKeyboard 00030 // 00032 00033 #include <Inventor/Wx/devices/SoWxDevice.h> 00034 #include <Inventor/events/SoKeyboardEvent.h> 00035 00036 #define SO_WX_ALL_KEYBOARD_EVENTS ( KeyPressMask | KeyReleaseMask ) 00037 #define WIN_NUM_KEYS 256 00038 #define WX_EXTRA_KEYS 256 00039 00056 class SoWxKeyboard : public SoWxDevice 00057 { 00058 public: 00071 SoWxKeyboard( EventMask mask = SO_WX_ALL_KEYBOARD_EVENTS ); 00072 00076 ~SoWxKeyboard(); 00077 00078 // These functions enable/disable this device for the passed widget. 00079 // The callback function f will be invoked when events occur in w. 00080 // data is the clientData which will be passed. 00081 virtual void enable( wxWindow* w, XtEventHandler f, void* data, 00082 void* unused=NULL); 00083 virtual void disable( wxWindow* w, XtEventHandler f, void* data ); 00084 00085 // 00086 // Converts a wx event into an SoEvent, 00087 // returning NULL if the event is not from this device. 00088 // 00089 virtual const SoEvent* translateEvent( wxEvent& anEvent ); 00090 00091 private: 00092 EventMask m_eventMask; // wxEvent interest for this device 00093 SoKeyboardEvent* m_keyEvent; // keyboard press or release 00094 SoKeyboardEvent* translateKeyEvent( wxKeyEvent& ke, SoButtonEvent::State s ); 00095 00096 // Mapping from Wx virtual keys to SoKeyboardEvent::Key enum 00097 static SoKeyboardEvent::Key keyMap[WIN_NUM_KEYS]; 00098 static SoKeyboardEvent::Key keyMap2[WX_EXTRA_KEYS]; 00099 static int keyMapInitFlag; 00100 }; 00101 00102 #endif // SO_WX_KEYBOARD 00103 00104 00105