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