Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
SoKeyboardEvent.h
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : David Mott (MMM yyyy)
25** Modified by : Gavin Bell (MMM yyyy)
26**=======================================================================*/
27/*=======================================================================
28 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
29 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
30 *** ***
31 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
32 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
33 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
34 *** ***
35 *** RESTRICTED RIGHTS LEGEND ***
36 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
37 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
38 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
39 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
40 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
41 *** ***
42 *** COPYRIGHT (C) 1996-2019 BY FEI S.A.S, ***
43 *** BORDEAUX, FRANCE ***
44 *** ALL RIGHTS RESERVED ***
45**=======================================================================*/
46/*=======================================================================
47** Modified by : VSG (MMM YYYY)
48**=======================================================================*/
49
50
51#ifndef _SO_KEYBOARD_EVENT_
52#define _SO_KEYBOARD_EVENT_
53
54#include <Inventor/SbBasic.h>
55#include <Inventor/events/SoButtonEvent.h>
56
57// some convenience macros for determining if an event matches
58
59#define SO_KEY_PRESS_EVENT(EVENT,KEY) \
60 (SoKeyboardEvent::isKeyPressEvent(EVENT,SoKeyboardEvent::KEY))
61
62#define SO_KEY_RELEASE_EVENT(EVENT,KEY) \
63 (SoKeyboardEvent::isKeyReleaseEvent(EVENT,SoKeyboardEvent::KEY))
64
98
99 SO_EVENT_HEADER();
100
101 public:
102
104 enum Key {
106 ANY = 0,
107
109 LEFT_SHIFT = 0xFFE1,
111 RIGHT_SHIFT = 0xFFE2,
113 LEFT_CONTROL = 0xFFE3,
115 RIGHT_CONTROL = 0xFFE4,
117 LEFT_ALT = 0xFFE9,
119 RIGHT_ALT = 0xFFEA,
123 LEFT_META = 0xFFEB,
129 RIGHT_META = 0xFFEC,
130
132 NUMBER_0 = 0x030,
134 NUMBER_1 = 0x031,
136 NUMBER_2 = 0x032,
138 NUMBER_3 = 0x033,
140 NUMBER_4 = 0x034,
142 NUMBER_5 = 0x035,
144 NUMBER_6 = 0x036,
146 NUMBER_7 = 0x037,
148 NUMBER_8 = 0x038,
150 NUMBER_9 = 0x039,
151
153 A = 0x061,
155 B = 0x062,
157 C = 0x063,
159 D = 0x064,
161 E = 0x065,
163 F = 0x066,
165 G = 0x067,
167 H = 0x068,
169 I = 0x069,
171 J = 0x06A,
173 K = 0x06B,
175 L = 0x06C,
177 M = 0x06D,
179 N = 0x06E,
181 O = 0x06F,
183 P = 0x070,
185 Q = 0x071,
187 R = 0x072,
189 S = 0x073,
191 T = 0x074,
193 U = 0x075,
195 V = 0x076,
197 W = 0x077,
199 X = 0x078,
201 Y = 0x079,
203 Z = 0x07A,
204
206 HOME = 0xFF50,
208 LEFT_ARROW = 0xFF51,
210 UP_ARROW = 0xFF52,
212 RIGHT_ARROW = 0xFF53,
214 DOWN_ARROW = 0xFF54,
216 PAGE_UP = 0xFF55,
218 PAGE_DOWN = 0xFF56,
220 PRIOR = 0xFF55,
222 NEXT = 0xFF56,
224 END = 0xFF57,
225
227 PAD_ENTER = 0xFF8D,
229 PAD_F1 = 0xFF91,
231 PAD_F2 = 0xFF92,
233 PAD_F3 = 0xFF93,
235 PAD_F4 = 0xFF94,
236
238 PAD_0 = 0xFF9E,
240 PAD_1 = 0xFF9C,
242 PAD_2 = 0xFF99,
244 PAD_3 = 0xFF9B,
246 PAD_4 = 0xFF96,
248 PAD_5 = 0xFF9D,
250 PAD_6 = 0xFF98,
252 PAD_7 = 0xFF95,
254 PAD_8 = 0xFF97,
256 PAD_9 = 0xFF9A,
257
259 PAD_ADD = 0xFFAB,
261 PAD_SUBTRACT = 0xFFAD,
263 PAD_MULTIPLY = 0xFFAA,
265 PAD_DIVIDE = 0xFFAF,
266
268 PAD_SPACE = 0xFF8D,
270 PAD_TAB = 0xFF89,
272 PAD_INSERT = 0xFF9E,
274 PAD_DELETE = 0xFF9F,
276 PAD_PERIOD = 0xFF9F,
277
279 F1 = 0xFFBE,
281 F2 = 0xFFBF,
283 F3 = 0xFFC0,
285 F4 = 0xFFC1,
287 F5 = 0xFFC2,
289 F6 = 0xFFC3,
291 F7 = 0xFFC4,
293 F8 = 0xFFC5,
295 F9 = 0xFFC6,
297 F10 = 0xFFC7,
299 F11 = 0xFFC8,
301 F12 = 0xFFC9,
302
304 BACKSPACE = 0xFF08,
306 TAB = 0xFF09,
308 RETURN = 0xFF0D,
310 ENTER = 0xFF0D,
312 PAUSE = 0xFF13,
314 SCROLL_LOCK = 0xFF14,
316 ESCAPE = 0xFF1B,
318 KEY_DELETE = 0xFFFF,
319#if !defined(_WIN32)
324 DELETE = 0xFFFF,
325#endif
327 PRINT = 0xFF61,
329 INSERT = 0xFF63,
331 NUM_LOCK = 0xFF7F,
333 CAPS_LOCK = 0xFFE5,
335 SHIFT_LOCK = 0xFFE6,
336
338 SPACE = 0x020,
340 APOSTROPHE = 0x027,
342 COMMA = 0x02C,
344 MINUS = 0x02D,
346 PERIOD = 0x02E,
348 SLASH = 0x02F,
349
351 SEMICOLON = 0x03B,
353 EQUAL = 0x03D,
354
356 BRACKETLEFT = 0x05B,
358 BACKSLASH = 0x05C,
360 BRACKETRIGHT = 0x05D,
362 GRAVE = 0x060,
366 TILDE = 0x7E
367 };
368
373
374#ifndef HIDDEN_FROM_DOC
375 virtual ~SoKeyboardEvent();
376#endif // HIDDEN_FROM_DOC
377
382
387
394
401 SoKeyboardEvent::Key whichKey);
402
408
413 void setUnicode(wchar_t unicode);
414
418 wchar_t getUnicode() const;
419
420 private:
421 static void initClass();
422 static void exitClass();
423
424 private:
425 // which key
426 Key m_key;
427 wchar_t m_unicode;
428};
429
430#endif /* _SO_KEYBOARD_EVENT_ */
431
Base class for all button events.
Base class for all events.
Definition SoEvent.h:116
Keyboard key press and release events.
void setKey(SoKeyboardEvent::Key whichKey)
Sets which key generated the event.
SoKeyboardEvent::Key getKey() const
Gets which key generated the event.
static SbBool isKeyPressEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)
Returns whether the passed event is a keyboard press event of the passed key.
static SbBool isKeyReleaseEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)
Returns whether the passed event is a keyboard release event of the passed key.
char getPrintableCharacter() const
Convenience routine that returns the character representing the key, if it's printable.
void setUnicode(wchar_t unicode)
Call this function to set the unicode value of the pressed key.
wchar_t getUnicode() const
Return the unicode value of the pressed key, or 0 if setUnicode() wasn't call before.
Key
The keyboard keys.
@ BRACKETLEFT
Bracket left.
@ TWO_SUPERIOR
Power of two key.
@ PAGE_DOWN
Page down.
@ PAD_SPACE
Pad space.
@ PAD_MULTIPLY
Pad multiply.
@ BACKSLASH
Back slash.
@ LEFT_CONTROL
Left control.
@ PAD_INSERT
Pad insert.
@ LEFT_SHIFT
Left shift.
@ RIGHT_CONTROL
Right control.
@ PAD_ENTER
Pad enter.
@ RIGHT_ALT
Right alt.
@ LEFT_META
Left Windows Logo key also known as Super_L.
@ ANY
Special constant for any key.
@ BRACKETRIGHT
Bracket right.
@ PAD_DELETE
Pad delete.
@ SHIFT_LOCK
Shift lock.
@ DELETE
SoKeyboardEvent::DELETE is deprecated Use KEY_DELETE instead of DELETE.
@ PAD_DIVIDE
Pad divide.
@ SCROLL_LOCK
Scroll lock.
@ PAD_SUBTRACT
Pad substract.
@ BACKSPACE
Backspace.
@ SEMICOLON
Semicolon.
@ APOSTROPHE
Apostrophe.
@ RIGHT_SHIFT
Right shift.
@ CAPS_LOCK
Caps lock.
@ RIGHT_META
Right Windows Logo key also known as Super_R.
@ PAD_PERIOD
Pad period.
SoKeyboardEvent()
Constructor.
int SbBool
Boolean type.
Definition SbBase.h:87