Open Inventor Reference
SoKeyboardEvent.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91,92 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.2 $
45 |
46 | Classes:
47 | SoKeyboardEvent
48 |
49 | Author(s): David Mott, Gavin Bell
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_KEYBOARD_EVENT_
56#define _SO_KEYBOARD_EVENT_
57
59#include <Inventor/SbBasic.h>
61
63
64#define SO_KEY_PRESS_EVENT(EVENT,KEY) \
65 (SoKeyboardEvent::isKeyPressEvent(EVENT,SoKeyboardEvent::KEY))
66
67#define SO_KEY_RELEASE_EVENT(EVENT,KEY) \
68 (SoKeyboardEvent::isKeyReleaseEvent(EVENT,SoKeyboardEvent::KEY))
69
70
73
84
86
88
89 public:
90
92 enum Key {
94 ANY = 0,
95
96
98
99 LEFT_SHIFT = 0xffe1,
100 RIGHT_SHIFT = 0xffe2,
101 LEFT_CONTROL = 0xffe3,
102 RIGHT_CONTROL = 0xffe4,
103 LEFT_ALT = 0xffe9,
104 RIGHT_ALT = 0xffea,
105
106
108
109 NUMBER_0 = 0x030,
110 NUMBER_1 = 0x031,
111 NUMBER_2 = 0x032,
112 NUMBER_3 = 0x033,
113 NUMBER_4 = 0x034,
114 NUMBER_5 = 0x035,
115 NUMBER_6 = 0x036,
116 NUMBER_7 = 0x037,
117 NUMBER_8 = 0x038,
118 NUMBER_9 = 0x039,
119
120
122
123 A = 0x061,
124 B = 0x062,
125 C = 0x063,
126 D = 0x064,
127 E = 0x065,
128 F = 0x066,
129 G = 0x067,
130 H = 0x068,
131 I = 0x069,
132 J = 0x06a,
133 K = 0x06b,
134 L = 0x06c,
135 M = 0x06d,
136 N = 0x06e,
137 O = 0x06f,
138 P = 0x070,
139 Q = 0x071,
140 R = 0x072,
141 S = 0x073,
142 T = 0x074,
143 U = 0x075,
144 V = 0x076,
145 W = 0x077,
146 X = 0x078,
147 Y = 0x079,
148 Z = 0x07a,
149
150
152
153 HOME = 0xff50,
154 LEFT_ARROW = 0xff51,
155 UP_ARROW = 0xff52,
156 RIGHT_ARROW = 0xff53,
157 DOWN_ARROW = 0xff54,
158 PAGE_UP = 0xff55,
159 PAGE_DOWN = 0xff56,
160 PRIOR = 0xff55,
161 NEXT = 0xff56,
162 END = 0xff57,
163
164
166
167 PAD_ENTER = 0xff8d,
168 PAD_F1 = 0xff91,
169 PAD_F2 = 0xff92,
170 PAD_F3 = 0xff93,
171 PAD_F4 = 0xff94,
172
173 PAD_0 = 0xff9e,
174 PAD_1 = 0xff9c,
175 PAD_2 = 0xff99,
176 PAD_3 = 0xff9b,
177 PAD_4 = 0xff96,
178 PAD_5 = 0xff9d,
179 PAD_6 = 0xff98,
180 PAD_7 = 0xff95,
181 PAD_8 = 0xff97,
182 PAD_9 = 0xff9a,
183
184 PAD_ADD = 0xffab,
185 PAD_SUBTRACT = 0xffad,
186 PAD_MULTIPLY = 0xffaa,
187 PAD_DIVIDE = 0xffaf,
188
189 PAD_SPACE = 0xff8d,
190 PAD_TAB = 0xff89,
191 PAD_INSERT = 0xff9e,
192 PAD_DELETE = 0xff9f,
193 PAD_PERIOD = 0xff9f,
194
196
197 F1 = 0xffbe,
198 F2 = 0xffbf,
199 F3 = 0xffc0,
200 F4 = 0xffc1,
201 F5 = 0xffc2,
202 F6 = 0xffc3,
203 F7 = 0xffc4,
204 F8 = 0xffc5,
205 F9 = 0xffc6,
206 F10 = 0xffc7,
207 F11 = 0xffc8,
208 F12 = 0xffc9,
209
210
212
213 BACKSPACE = 0xff08,
214 TAB = 0xff09,
215 RETURN = 0xff0d,
216 ENTER = 0xff0d,
217 PAUSE = 0xff13,
218 SCROLL_LOCK = 0xff14,
219 ESCAPE = 0xff1b,
220 // We do not support the legacy "DELETE" value anymore,
221 // since it can't be supported on Windows.
222 KEY_DELETE = 0xffff,
223 PRINT = 0xff61,
224 INSERT = 0xff63,
225 NUM_LOCK = 0xff7f,
226 CAPS_LOCK = 0xffe5,
227 SHIFT_LOCK = 0xffe6,
228
229 SPACE = 0x020,
230 EXCLAM = 0x021,
231 QUOTEDBL = 0x022,
232 NUMBERSIGN = 0x023,
233 DOLLAR = 0x024,
234 PERCENT = 0x025,
235 AMPERSAND = 0x026,
236 APOSTROPHE = 0x027,
237 PARENLEFT = 0x028,
238 PARENRIGHT = 0x029,
239 ASTERISK = 0x02a,
240 PLUS = 0x02b,
241 COMMA = 0x02c,
242 MINUS = 0x02d,
243 PERIOD = 0x02e,
244 SLASH = 0x02f,
245
246 COLON = 0x03a,
247 SEMICOLON = 0x03b,
248 LESS = 0x03c,
249 EQUAL = 0x03d,
250 GREATER = 0x03e,
251 QUESTION = 0x03f,
252 AT = 0x040,
253
254 BRACKETLEFT = 0x05b,
255 BACKSLASH = 0x05c,
256 BRACKETRIGHT= 0x05d,
257 ASCIICIRCUM = 0x05e,
258 UNDERSCORE = 0x05f,
259 GRAVE = 0x060,
260
261 BRACELEFT = 0x07b,
262 BAR = 0x07c,
263 BRACERIGHT = 0x07d,
264 ASCIITILDE = 0x07e
265
266 };
267
271
273 void setKey(SoKeyboardEvent::Key whichKey) { key = whichKey; }
274 SoKeyboardEvent::Key getKey() const { return key; }
275
278 void setIsAutoRepeat(bool b) { autoRepeat = b; }
279
281 bool isAutoRepeat() const { return autoRepeat; }
282
285 static bool isKeyPressEvent(
286 const SoEvent *e,
287 SoKeyboardEvent::Key whichKey);
288
289 static bool isKeyReleaseEvent(
290 const SoEvent *e,
291 SoKeyboardEvent::Key whichKey);
292
296
297 SoINTERNAL public:
298 static void initClass();
299
300 private:
301 Key key;
302
303 bool autoRepeat;
304};
305
306#endif /* _SO_KEYBOARD_EVENT_ */
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
#define SO_EVENT_HEADER()
*** note: many of the macros use the "do { ... } while(0)" *** hack to define multiline blocks as a s...
Definition SoSubEvent.h:97
Base class for all button events.
Base class for all events.
Definition SoEvent.h:84
Keyboard key press and release events.
void setKey(SoKeyboardEvent::Key whichKey)
set/get which key generated the event (e.g. SoKeyboardEvent::A)
virtual ~SoKeyboardEvent()
bool isAutoRepeat() const
get auto-repeat flag (see notes for setIsAutoRepeat); MEVIS Inventor only
SoKeyboardEvent::Key getKey() const
static bool isKeyPressEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)
convenience routines to see if an SoEvent is a press or release of the passed keyboard key
static bool isKeyReleaseEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)
char getPrintableCharacter() const
Convenience routine that returns the character representing the key, if it's printable.
void setIsAutoRepeat(bool b)
set auto-repeat flag; isAutoRepeat should be set for every auto-generated release/press pair,...
static void initClass()
Key
the keyboard keys...
SoKeyboardEvent()
Constructor.