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-2019 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_KEYBOARD_ 00027 #define _SO_WIN_KEYBOARD_ 00028 00029 #include <Inventor/Win/SoWinBeginStrict.h> 00030 #include <windows.h> 00031 00032 #include <Inventor/Win/devices/SoWinDevice.h> 00033 #include <Inventor/events/SoKeyboardEvent.h> 00034 00035 #define SO_WIN_ALL_KEYBOARD_EVENTS (KeyPressMask | KeyReleaseMask) 00036 00050 class SoWinKeyboard : public SoWinDevice { 00051 public: 00064 SoWinKeyboard(EventMask mask = SO_WIN_ALL_KEYBOARD_EVENTS); 00068 ~SoWinKeyboard(); 00069 00071 virtual void enable(SoWidget w, XtEventHandler f, 00072 XtPointer data, Window win = NULL); 00073 00075 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data); 00076 00078 virtual const SoEvent * translateEvent(XAnyEvent *xevent); 00079 00080 private: 00081 EventMask eventMask; // X event interest for this device 00082 SoKeyboardEvent *keyEvent; // keyboard press or release 00083 00084 bool setKey(XKeyEvent *ke); // Return true if a WM_CHAR will be send by windows API 00085 void setUnicodeKey(XKeyEvent *ke); 00086 SoKeyboardEvent* translateKeyEvent(XKeyEvent *ke, SoButtonEvent::State s); 00087 00088 // Mapping from _WIN32 virtual keys to SoKeyboardEvent::Key enum 00089 static SoKeyboardEvent::Key keyMap[256]; 00090 static int keyMapInitFlag; 00091 }; 00092 00093 #include <Inventor/Win/SoWinEndStrict.h> 00094 00095 #endif /* _SO_WIN_KEYBOARD_ */ 00096 00097