MeVisLab Resolution Independence API
SoKeyGrabber.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2007, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef SO_KEY_GRABBER_H
14
#define SO_KEY_GRABBER_H
15
16
18
19
#include <Inventor/fields/SoFields.h>
20
#include <Inventor/nodes/SoSeparator.h>
21
#include <Inventor/nodes/SoSubNode.h>
22
24
enum
KeyType
{
26
ANY
= 0,
27
29
LEFT_SHIFT
= 0xffe1,
30
RIGHT_SHIFT
= 0xffe2,
31
LEFT_CONTROL
= 0xffe3,
32
RIGHT_CONTROL
= 0xffe4,
33
LEFT_ALT
= 0xffe9,
34
RIGHT_ALT
= 0xffea,
36
38
NUMBER_0
= 0x030,
39
NUMBER_1
= 0x031,
40
NUMBER_2
= 0x032,
41
NUMBER_3
= 0x033,
42
NUMBER_4
= 0x034,
43
NUMBER_5
= 0x035,
44
NUMBER_6
= 0x036,
45
NUMBER_7
= 0x037,
46
NUMBER_8
= 0x038,
47
NUMBER_9
= 0x039,
49
50
52
A
= 0x061,
53
B
= 0x062,
54
C
= 0x063,
55
D
= 0x064,
56
E
= 0x065,
57
F
= 0x066,
58
G
= 0x067,
59
H
= 0x068,
60
I
= 0x069,
61
J
= 0x06a,
62
K
= 0x06b,
63
L
= 0x06c,
64
M
= 0x06d,
65
N
= 0x06e,
66
O
= 0x06f,
67
P
= 0x070,
68
Q
= 0x071,
69
R
= 0x072,
70
S
= 0x073,
71
T
= 0x074,
72
U
= 0x075,
73
V
= 0x076,
74
W
= 0x077,
75
X
= 0x078,
76
Y
= 0x079,
77
Z
= 0x07a,
79
80
82
HOME
= 0xff50,
83
LEFT_ARROW
= 0xff51,
84
UP_ARROW
= 0xff52,
85
RIGHT_ARROW
= 0xff53,
86
DOWN_ARROW
= 0xff54,
87
PAGE_UP
= 0xff55,
88
PAGE_DOWN
= 0xff56,
89
PRIOR
= 0xff55,
90
NEXT
= 0xff56,
91
END
= 0xff57,
93
94
96
PAD_ENTER
= 0xff8d,
97
PAD_F1
= 0xff91,
98
PAD_F2
= 0xff92,
99
PAD_F3
= 0xff93,
100
PAD_F4
= 0xff94,
101
102
PAD_0
= 0xff9e,
103
PAD_1
= 0xff9c,
104
PAD_2
= 0xff99,
105
PAD_3
= 0xff9b,
106
PAD_4
= 0xff96,
107
PAD_5
= 0xff9d,
108
PAD_6
= 0xff98,
109
PAD_7
= 0xff95,
110
PAD_8
= 0xff97,
111
PAD_9
= 0xff9a,
112
113
PAD_ADD
= 0xffab,
114
PAD_SUBTRACT
= 0xffad,
115
PAD_MULTIPLY
= 0xffaa,
116
PAD_DIVIDE
= 0xffaf,
117
118
PAD_SPACE
= 0xff8d,
119
PAD_TAB
= 0xff89,
120
PAD_INSERT
= 0xff9e,
121
PAD_DELETE
= 0xff9f,
122
PAD_PERIOD
= 0xff9f,
124
126
F1
= 0xffbe,
127
F2
= 0xffbf,
128
F3
= 0xffc0,
129
F4
= 0xffc1,
130
F5
= 0xffc2,
131
F6
= 0xffc3,
132
F7
= 0xffc4,
133
F8
= 0xffc5,
134
F9
= 0xffc6,
135
F10
= 0xffc7,
136
F11
= 0xffc8,
137
F12
= 0xffc9,
139
140
142
BACKSPACE
= 0xff08,
143
TAB
= 0xff09,
144
RETURN
= 0xff0d,
145
ENTER
= 0xff0d,
146
PAUSE
= 0xff13,
147
SCROLL_LOCK
= 0xff14,
148
ESCAPE
= 0xff1b,
149
#ifdef WIN32
150
KEY_DELETE
= 0xFFFF,
151
#else
152
DELETE
= 0xffff,
153
KEY_DELETE
=
DELETE
,
154
#endif
155
PRINT
= 0xff61,
156
INSERT
= 0xff63,
157
RIGHT_SUPER
= 0xff67,
158
NUM_LOCK
= 0xff7f,
159
CAPS_LOCK
= 0xffe5,
160
SHIFT_LOCK
= 0xffe6,
161
LEFT_SUPER
= 0xffe7,
162
163
SPACE
= 0x020,
164
EXCLAM
= 0x021,
165
QUOTEDBL
= 0x022,
166
NUMBERSIGN
= 0x023,
167
DOLLAR
= 0x024,
168
PERCENT
= 0x025,
169
AMPERSAND
= 0x026,
170
APOSTROPHE
= 0x027,
171
PARENLEFT
= 0x028,
172
PARENRIGHT
= 0x029,
173
ASTERISK
= 0x02a,
174
PLUS
= 0x02b,
175
COMMA
= 0x02c,
176
MINUS
= 0x02d,
177
PERIOD
= 0x02e,
178
SLASH
= 0x02f,
179
180
COLON
= 0x03a,
181
SEMICOLON
= 0x03b,
182
LESS
= 0x03c,
183
EQUAL
= 0x03d,
184
GREATER
= 0x03e,
185
QUESTION
= 0x03f,
186
AT
= 0x040,
187
188
BRACKETLEFT
= 0x05b,
189
BACKSLASH
= 0x05c,
190
BRACKETRIGHT
= 0x05d,
191
ASCIICIRCUM
= 0x05e,
192
UNDERSCORE
= 0x05f,
193
GRAVE
= 0x060,
194
195
BRACELEFT
= 0x07b,
196
BAR
= 0x07c,
197
BRACERIGHT
= 0x07d,
198
ASCIITILDE
= 0x07e
200
201
};
202
203
//=============================================================
205
206
//=============================================================
207
class
SoKeyGrabber
:
public
SoNode {
208
209
SO_NODE_HEADER(
SoKeyGrabber
);
210
211
public
:
212
SoSFBool
on
;
213
214
SoSFTrigger
keyPressed
;
215
SoSFTrigger
keyReleased
;
216
SoSFBool
shiftPressed
;
217
SoSFBool
ctrlPressed
;
218
SoSFBool
altPressed
;
219
SoSFBool
isAutoRepeat
;
220
221
SoSFEnum
lastKey
;
222
SoSFEnum
key0
;
223
SoSFEnum
key1
;
224
SoSFEnum
key2
;
225
SoSFEnum
key3
;
226
SoSFEnum
key4
;
227
SoSFTrigger
key0Pressed
;
228
SoSFTrigger
key1Pressed
;
229
SoSFTrigger
key2Pressed
;
230
SoSFTrigger
key3Pressed
;
231
SoSFTrigger
key4Pressed
;
232
233
static
void
initClass
();
234
235
// Constructor
236
SoKeyGrabber
();
237
238
void
handleEvent
(SoHandleEventAction *action)
override
;
239
void
GLRender
(SoGLRenderAction *
/* action */
)
override
{};
241
bool
affectsState
()
const override
{
return
false
; }
242
243
protected
:
244
~SoKeyGrabber
()
override
;
245
246
private
:
247
SoSFTrigger *_triggers[5];
248
SoSFEnum *_keys[5];
249
};
250
251
#endif
252
253
254
255
256
KeyType
KeyType
SoKeyGrabber is a general facility to grab keyboard events.
Definition
SoKeyGrabber.h:24
PAD_DIVIDE
@ PAD_DIVIDE
Definition
SoKeyGrabber.h:116
BRACERIGHT
@ BRACERIGHT
Definition
SoKeyGrabber.h:197
ASCIITILDE
@ ASCIITILDE
Definition
SoKeyGrabber.h:198
J
@ J
Definition
SoKeyGrabber.h:61
PAGE_UP
@ PAGE_UP
Definition
SoKeyGrabber.h:87
PAD_F3
@ PAD_F3
Definition
SoKeyGrabber.h:99
RIGHT_SUPER
@ RIGHT_SUPER
Definition
SoKeyGrabber.h:157
ESCAPE
@ ESCAPE
Definition
SoKeyGrabber.h:148
F3
@ F3
Definition
SoKeyGrabber.h:128
GRAVE
@ GRAVE
Definition
SoKeyGrabber.h:193
PAD_8
@ PAD_8
Definition
SoKeyGrabber.h:110
R
@ R
Definition
SoKeyGrabber.h:69
BACKSLASH
@ BACKSLASH
Definition
SoKeyGrabber.h:189
NUM_LOCK
@ NUM_LOCK
Definition
SoKeyGrabber.h:158
NUMBER_9
@ NUMBER_9
Definition
SoKeyGrabber.h:47
NUMBER_5
@ NUMBER_5
Definition
SoKeyGrabber.h:43
APOSTROPHE
@ APOSTROPHE
Definition
SoKeyGrabber.h:170
T
@ T
Definition
SoKeyGrabber.h:71
PAD_0
@ PAD_0
Definition
SoKeyGrabber.h:102
GREATER
@ GREATER
Definition
SoKeyGrabber.h:184
F5
@ F5
Definition
SoKeyGrabber.h:130
PAD_SUBTRACT
@ PAD_SUBTRACT
Definition
SoKeyGrabber.h:114
BRACKETLEFT
@ BRACKETLEFT
Definition
SoKeyGrabber.h:188
V
@ V
Definition
SoKeyGrabber.h:73
COLON
@ COLON
Definition
SoKeyGrabber.h:180
PAD_6
@ PAD_6
Definition
SoKeyGrabber.h:108
N
@ N
Definition
SoKeyGrabber.h:65
G
@ G
Definition
SoKeyGrabber.h:58
PERCENT
@ PERCENT
Definition
SoKeyGrabber.h:168
SHIFT_LOCK
@ SHIFT_LOCK
Definition
SoKeyGrabber.h:160
NUMBER_1
@ NUMBER_1
Definition
SoKeyGrabber.h:39
PAD_5
@ PAD_5
Definition
SoKeyGrabber.h:107
RIGHT_ALT
@ RIGHT_ALT
Definition
SoKeyGrabber.h:34
PAD_F1
@ PAD_F1
Definition
SoKeyGrabber.h:97
B
@ B
Definition
SoKeyGrabber.h:53
PAD_9
@ PAD_9
Definition
SoKeyGrabber.h:111
A
@ A
Letters.
Definition
SoKeyGrabber.h:52
LEFT_CONTROL
@ LEFT_CONTROL
Definition
SoKeyGrabber.h:31
NUMBER_7
@ NUMBER_7
Definition
SoKeyGrabber.h:45
H
@ H
Definition
SoKeyGrabber.h:59
F11
@ F11
Definition
SoKeyGrabber.h:136
M
@ M
Definition
SoKeyGrabber.h:64
RETURN
@ RETURN
Definition
SoKeyGrabber.h:144
Y
@ Y
Definition
SoKeyGrabber.h:76
SEMICOLON
@ SEMICOLON
Definition
SoKeyGrabber.h:181
PAUSE
@ PAUSE
Definition
SoKeyGrabber.h:146
ASCIICIRCUM
@ ASCIICIRCUM
Definition
SoKeyGrabber.h:191
X
@ X
Definition
SoKeyGrabber.h:75
EQUAL
@ EQUAL
Definition
SoKeyGrabber.h:183
F1
@ F1
Function keys.
Definition
SoKeyGrabber.h:126
LEFT_ARROW
@ LEFT_ARROW
Definition
SoKeyGrabber.h:83
PAD_PERIOD
@ PAD_PERIOD
Definition
SoKeyGrabber.h:122
NUMBER_2
@ NUMBER_2
Definition
SoKeyGrabber.h:40
K
@ K
Definition
SoKeyGrabber.h:62
RIGHT_ARROW
@ RIGHT_ARROW
Definition
SoKeyGrabber.h:85
NUMBER_6
@ NUMBER_6
Definition
SoKeyGrabber.h:44
PAD_1
@ PAD_1
Definition
SoKeyGrabber.h:103
SCROLL_LOCK
@ SCROLL_LOCK
Definition
SoKeyGrabber.h:147
F7
@ F7
Definition
SoKeyGrabber.h:132
UNDERSCORE
@ UNDERSCORE
Definition
SoKeyGrabber.h:192
PAGE_DOWN
@ PAGE_DOWN
Definition
SoKeyGrabber.h:88
C
@ C
Definition
SoKeyGrabber.h:54
NUMBER_0
@ NUMBER_0
Numbers.
Definition
SoKeyGrabber.h:38
NUMBER_8
@ NUMBER_8
Definition
SoKeyGrabber.h:46
D
@ D
Definition
SoKeyGrabber.h:55
NUMBER_3
@ NUMBER_3
Definition
SoKeyGrabber.h:41
ASTERISK
@ ASTERISK
Definition
SoKeyGrabber.h:173
AT
@ AT
Definition
SoKeyGrabber.h:186
PAD_ENTER
@ PAD_ENTER
Keypad Functions.
Definition
SoKeyGrabber.h:96
P
@ P
Definition
SoKeyGrabber.h:67
PAD_F4
@ PAD_F4
Definition
SoKeyGrabber.h:100
PLUS
@ PLUS
Definition
SoKeyGrabber.h:174
EXCLAM
@ EXCLAM
Definition
SoKeyGrabber.h:164
DOLLAR
@ DOLLAR
Definition
SoKeyGrabber.h:167
F12
@ F12
Definition
SoKeyGrabber.h:137
F4
@ F4
Definition
SoKeyGrabber.h:129
PAD_TAB
@ PAD_TAB
Definition
SoKeyGrabber.h:119
HOME
@ HOME
Cursor control & motion.
Definition
SoKeyGrabber.h:82
PAD_DELETE
@ PAD_DELETE
Definition
SoKeyGrabber.h:121
PAD_F2
@ PAD_F2
Definition
SoKeyGrabber.h:98
NUMBERSIGN
@ NUMBERSIGN
Definition
SoKeyGrabber.h:166
TAB
@ TAB
Definition
SoKeyGrabber.h:143
LEFT_ALT
@ LEFT_ALT
Definition
SoKeyGrabber.h:33
ENTER
@ ENTER
Definition
SoKeyGrabber.h:145
LESS
@ LESS
Definition
SoKeyGrabber.h:182
AMPERSAND
@ AMPERSAND
Definition
SoKeyGrabber.h:169
QUOTEDBL
@ QUOTEDBL
Definition
SoKeyGrabber.h:165
DELETE
@ DELETE
Definition
SoKeyGrabber.h:152
F9
@ F9
Definition
SoKeyGrabber.h:134
LEFT_SUPER
@ LEFT_SUPER
Definition
SoKeyGrabber.h:161
BAR
@ BAR
Definition
SoKeyGrabber.h:196
ANY
@ ANY
Special constant for any key.
Definition
SoKeyGrabber.h:26
INSERT
@ INSERT
Definition
SoKeyGrabber.h:156
F6
@ F6
Definition
SoKeyGrabber.h:131
F2
@ F2
Definition
SoKeyGrabber.h:127
Q
@ Q
Definition
SoKeyGrabber.h:68
PAD_MULTIPLY
@ PAD_MULTIPLY
Definition
SoKeyGrabber.h:115
LEFT_SHIFT
@ LEFT_SHIFT
Modifiers.
Definition
SoKeyGrabber.h:29
RIGHT_CONTROL
@ RIGHT_CONTROL
Definition
SoKeyGrabber.h:32
PAD_SPACE
@ PAD_SPACE
Definition
SoKeyGrabber.h:118
Z
@ Z
Definition
SoKeyGrabber.h:77
PRIOR
@ PRIOR
Definition
SoKeyGrabber.h:89
SLASH
@ SLASH
Definition
SoKeyGrabber.h:178
PRINT
@ PRINT
Definition
SoKeyGrabber.h:155
NEXT
@ NEXT
Definition
SoKeyGrabber.h:90
E
@ E
Definition
SoKeyGrabber.h:56
PAD_INSERT
@ PAD_INSERT
Definition
SoKeyGrabber.h:120
W
@ W
Definition
SoKeyGrabber.h:74
PAD_2
@ PAD_2
Definition
SoKeyGrabber.h:104
SPACE
@ SPACE
Definition
SoKeyGrabber.h:163
U
@ U
Definition
SoKeyGrabber.h:72
PARENRIGHT
@ PARENRIGHT
Definition
SoKeyGrabber.h:172
PARENLEFT
@ PARENLEFT
Definition
SoKeyGrabber.h:171
F8
@ F8
Definition
SoKeyGrabber.h:133
I
@ I
Definition
SoKeyGrabber.h:60
QUESTION
@ QUESTION
Definition
SoKeyGrabber.h:185
BACKSPACE
@ BACKSPACE
Misc Functions.
Definition
SoKeyGrabber.h:142
CAPS_LOCK
@ CAPS_LOCK
Definition
SoKeyGrabber.h:159
RIGHT_SHIFT
@ RIGHT_SHIFT
Definition
SoKeyGrabber.h:30
PAD_ADD
@ PAD_ADD
Definition
SoKeyGrabber.h:113
NUMBER_4
@ NUMBER_4
Definition
SoKeyGrabber.h:42
DOWN_ARROW
@ DOWN_ARROW
Definition
SoKeyGrabber.h:86
END
@ END
Definition
SoKeyGrabber.h:91
PAD_7
@ PAD_7
Definition
SoKeyGrabber.h:109
BRACKETRIGHT
@ BRACKETRIGHT
Definition
SoKeyGrabber.h:190
F10
@ F10
Definition
SoKeyGrabber.h:135
KEY_DELETE
@ KEY_DELETE
Definition
SoKeyGrabber.h:153
L
@ L
Definition
SoKeyGrabber.h:63
PAD_3
@ PAD_3
Definition
SoKeyGrabber.h:105
UP_ARROW
@ UP_ARROW
Definition
SoKeyGrabber.h:84
S
@ S
Definition
SoKeyGrabber.h:70
F
@ F
Definition
SoKeyGrabber.h:57
O
@ O
Definition
SoKeyGrabber.h:66
MINUS
@ MINUS
Definition
SoKeyGrabber.h:176
PERIOD
@ PERIOD
Definition
SoKeyGrabber.h:177
BRACELEFT
@ BRACELEFT
Definition
SoKeyGrabber.h:195
COMMA
@ COMMA
Definition
SoKeyGrabber.h:175
PAD_4
@ PAD_4
Definition
SoKeyGrabber.h:106
SoKeyGrabber
SoKeyGrabber is a general facility to grab keyboard events.
Definition
SoKeyGrabber.h:207
SoKeyGrabber::on
SoSFBool on
Definition
SoKeyGrabber.h:212
SoKeyGrabber::keyPressed
SoSFTrigger keyPressed
Definition
SoKeyGrabber.h:214
SoKeyGrabber::key0
SoSFEnum key0
Definition
SoKeyGrabber.h:222
SoKeyGrabber::key2
SoSFEnum key2
Definition
SoKeyGrabber.h:224
SoKeyGrabber::SoKeyGrabber
SoKeyGrabber()
SoKeyGrabber::GLRender
void GLRender(SoGLRenderAction *) override
Definition
SoKeyGrabber.h:239
SoKeyGrabber::isAutoRepeat
SoSFBool isAutoRepeat
Definition
SoKeyGrabber.h:219
SoKeyGrabber::~SoKeyGrabber
~SoKeyGrabber() override
SoKeyGrabber::key2Pressed
SoSFTrigger key2Pressed
Definition
SoKeyGrabber.h:229
SoKeyGrabber::keyReleased
SoSFTrigger keyReleased
Definition
SoKeyGrabber.h:215
SoKeyGrabber::altPressed
SoSFBool altPressed
Definition
SoKeyGrabber.h:218
SoKeyGrabber::ctrlPressed
SoSFBool ctrlPressed
Definition
SoKeyGrabber.h:217
SoKeyGrabber::key1Pressed
SoSFTrigger key1Pressed
Definition
SoKeyGrabber.h:228
SoKeyGrabber::initClass
static void initClass()
SoKeyGrabber::key4
SoSFEnum key4
Definition
SoKeyGrabber.h:226
SoKeyGrabber::shiftPressed
SoSFBool shiftPressed
Definition
SoKeyGrabber.h:216
SoKeyGrabber::key0Pressed
SoSFTrigger key0Pressed
Definition
SoKeyGrabber.h:227
SoKeyGrabber::key4Pressed
SoSFTrigger key4Pressed
Definition
SoKeyGrabber.h:231
SoKeyGrabber::lastKey
SoSFEnum lastKey
Definition
SoKeyGrabber.h:221
SoKeyGrabber::handleEvent
void handleEvent(SoHandleEventAction *action) override
SoKeyGrabber::key3
SoSFEnum key3
Definition
SoKeyGrabber.h:225
SoKeyGrabber::affectsState
bool affectsState() const override
this node does not affect the state, so return false!
Definition
SoKeyGrabber.h:241
SoKeyGrabber::key3Pressed
SoSFTrigger key3Pressed
Definition
SoKeyGrabber.h:230
SoKeyGrabber::key1
SoSFEnum key1
Definition
SoKeyGrabber.h:223
MeVisLab
Standard
Sources
Inventor
SoUtils
SoKeyGrabber.h
Generated by
1.10.0