Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoWinKeyboard.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25
26#ifndef _SO_WIN_KEYBOARD_
27#define _SO_WIN_KEYBOARD_
28
29#include <Inventor/Win/SoWinBeginStrict.h>
30#include <windows.h>
31
32#include <Inventor/Win/devices/SoWinDevice.h>
33#include <Inventor/events/SoKeyboardEvent.h>
34
35#define SO_WIN_ALL_KEYBOARD_EVENTS (KeyPressMask | KeyReleaseMask)
36
50class SoWinKeyboard : public SoWinDevice {
51 public:
64 SoWinKeyboard(EventMask mask = SO_WIN_ALL_KEYBOARD_EVENTS);
69
71 virtual void enable(SoWidget w, XtEventHandler f,
72 XtPointer data, Window win = NULL);
73
75 virtual void disable(SoWidget w, XtEventHandler f, XtPointer data);
76
78 virtual const SoEvent * translateEvent(XAnyEvent *xevent);
79
80 private:
81 EventMask eventMask; // X event interest for this device
82 SoKeyboardEvent *keyEvent; // keyboard press or release
83
84 bool setKey(XKeyEvent *ke); // Return true if a WM_CHAR will be send by windows API
85 void setUnicodeKey(XKeyEvent *ke);
86 SoKeyboardEvent* translateKeyEvent(XKeyEvent *ke, SoButtonEvent::State s);
87
88 // Mapping from _WIN32 virtual keys to SoKeyboardEvent::Key enum
89 static SoKeyboardEvent::Key keyMap[256];
90 static int keyMapInitFlag;
91};
92
93#include <Inventor/Win/SoWinEndStrict.h>
94
95#endif /* _SO_WIN_KEYBOARD_ */
96
Base class for all events.
Definition SoEvent.h:116
Keyboard key press and release events.
Key
The keyboard keys.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Abstract base cl...
Definition SoWinDevice.h:58
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Translates and r...
SoWinKeyboard(EventMask mask=SO_WIN_ALL_KEYBOARD_EVENTS)
Constructor.
virtual void disable(SoWidget w, XtEventHandler f, XtPointer data)
Disables the device.
~SoWinKeyboard()
Destructor.
virtual void enable(SoWidget w, XtEventHandler f, XtPointer data, Window win=NULL)
Enables the device for the passed window handle.
virtual const SoEvent * translateEvent(XAnyEvent *xevent)
Attempts to convert the passed message into an SoEvent.
void * XtPointer
Definition SoQtDef.h:122