00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef _SO_KEYBOARD_EVENT_
00052 #define _SO_KEYBOARD_EVENT_
00053
00054 #include <Inventor/SbBasic.h>
00055 #include <Inventor/events/SoButtonEvent.h>
00056
00057
00058
00059 #define SO_KEY_PRESS_EVENT(EVENT,KEY) \
00060 (SoKeyboardEvent::isKeyPressEvent(EVENT,SoKeyboardEvent::KEY))
00061
00062 #define SO_KEY_RELEASE_EVENT(EVENT,KEY) \
00063 (SoKeyboardEvent::isKeyReleaseEvent(EVENT,SoKeyboardEvent::KEY))
00064
00097 class SoKeyboardEvent : public SoButtonEvent {
00098
00099 SO_EVENT_HEADER();
00100
00101 public:
00102
00104 enum Key {
00106 ANY = 0,
00107
00109 LEFT_SHIFT = 0xFFE1,
00111 RIGHT_SHIFT = 0xFFE2,
00113 LEFT_CONTROL = 0xFFE3,
00115 RIGHT_CONTROL = 0xFFE4,
00117 LEFT_ALT = 0xFFE9,
00119 RIGHT_ALT = 0xFFEA,
00123 LEFT_META = 0xFFEB,
00129 RIGHT_META = 0xFFEC,
00130
00132 NUMBER_0 = 0x030,
00134 NUMBER_1 = 0x031,
00136 NUMBER_2 = 0x032,
00138 NUMBER_3 = 0x033,
00140 NUMBER_4 = 0x034,
00142 NUMBER_5 = 0x035,
00144 NUMBER_6 = 0x036,
00146 NUMBER_7 = 0x037,
00148 NUMBER_8 = 0x038,
00150 NUMBER_9 = 0x039,
00151
00153 A = 0x061,
00155 B = 0x062,
00157 C = 0x063,
00159 D = 0x064,
00161 E = 0x065,
00163 F = 0x066,
00165 G = 0x067,
00167 H = 0x068,
00169 I = 0x069,
00171 J = 0x06A,
00173 K = 0x06B,
00175 L = 0x06C,
00177 M = 0x06D,
00179 N = 0x06E,
00181 O = 0x06F,
00183 P = 0x070,
00185 Q = 0x071,
00187 R = 0x072,
00189 S = 0x073,
00191 T = 0x074,
00193 U = 0x075,
00195 V = 0x076,
00197 W = 0x077,
00199 X = 0x078,
00201 Y = 0x079,
00203 Z = 0x07A,
00204
00206 HOME = 0xFF50,
00208 LEFT_ARROW = 0xFF51,
00210 UP_ARROW = 0xFF52,
00212 RIGHT_ARROW = 0xFF53,
00214 DOWN_ARROW = 0xFF54,
00216 PAGE_UP = 0xFF55,
00218 PAGE_DOWN = 0xFF56,
00220 PRIOR = 0xFF55,
00222 NEXT = 0xFF56,
00224 END = 0xFF57,
00225
00227 PAD_ENTER = 0xFF8D,
00229 PAD_F1 = 0xFF91,
00231 PAD_F2 = 0xFF92,
00233 PAD_F3 = 0xFF93,
00235 PAD_F4 = 0xFF94,
00236
00238 PAD_0 = 0xFF9E,
00240 PAD_1 = 0xFF9C,
00242 PAD_2 = 0xFF99,
00244 PAD_3 = 0xFF9B,
00246 PAD_4 = 0xFF96,
00248 PAD_5 = 0xFF9D,
00250 PAD_6 = 0xFF98,
00252 PAD_7 = 0xFF95,
00254 PAD_8 = 0xFF97,
00256 PAD_9 = 0xFF9A,
00257
00259 PAD_ADD = 0xFFAB,
00261 PAD_SUBTRACT = 0xFFAD,
00263 PAD_MULTIPLY = 0xFFAA,
00265 PAD_DIVIDE = 0xFFAF,
00266
00268 PAD_SPACE = 0xFF8D,
00270 PAD_TAB = 0xFF89,
00272 PAD_INSERT = 0xFF9E,
00274 PAD_DELETE = 0xFF9F,
00276 PAD_PERIOD = 0xFF9F,
00277
00279 F1 = 0xFFBE,
00281 F2 = 0xFFBF,
00283 F3 = 0xFFC0,
00285 F4 = 0xFFC1,
00287 F5 = 0xFFC2,
00289 F6 = 0xFFC3,
00291 F7 = 0xFFC4,
00293 F8 = 0xFFC5,
00295 F9 = 0xFFC6,
00297 F10 = 0xFFC7,
00299 F11 = 0xFFC8,
00301 F12 = 0xFFC9,
00302
00304 BACKSPACE = 0xFF08,
00306 TAB = 0xFF09,
00308 RETURN = 0xFF0D,
00310 ENTER = 0xFF0D,
00312 PAUSE = 0xFF13,
00314 SCROLL_LOCK = 0xFF14,
00316 ESCAPE = 0xFF1B,
00318 KEY_DELETE = 0xFFFF,
00319 #if !defined(_WIN32)
00320
00324 DELETE = 0xFFFF,
00325 #endif
00326
00327 PRINT = 0xFF61,
00329 INSERT = 0xFF63,
00331 NUM_LOCK = 0xFF7F,
00333 CAPS_LOCK = 0xFFE5,
00335 SHIFT_LOCK = 0xFFE6,
00336
00338 SPACE = 0x020,
00340 APOSTROPHE = 0x027,
00342 COMMA = 0x02C,
00344 MINUS = 0x02D,
00346 PERIOD = 0x02E,
00348 SLASH = 0x02F,
00349
00351 SEMICOLON = 0x03B,
00353 EQUAL = 0x03D,
00354
00356 BRACKETLEFT = 0x05B,
00358 BACKSLASH = 0x05C,
00360 BRACKETRIGHT = 0x05D,
00362 GRAVE = 0x060,
00364 TWO_SUPERIOR = 0xB2,
00366 TILDE = 0x7E
00367 };
00368
00372 SoKeyboardEvent();
00373
00374 #ifndef HIDDEN_FROM_DOC
00375 virtual ~SoKeyboardEvent();
00376 #endif // HIDDEN_FROM_DOC
00377
00381 void setKey(SoKeyboardEvent::Key whichKey);
00382
00386 SoKeyboardEvent::Key getKey() const;
00387
00393 static SbBool isKeyPressEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey);
00394
00400 static SbBool isKeyReleaseEvent(const SoEvent *e,
00401 SoKeyboardEvent::Key whichKey);
00402
00407 char getPrintableCharacter() const;
00408
00413 void setUnicode(wchar_t unicode);
00414
00418 wchar_t getUnicode() const;
00419
00420 private:
00421 static void initClass();
00422 static void exitClass();
00423
00424 private:
00425
00426 Key m_key;
00427 wchar_t m_unicode;
00428 };
00429
00430 #endif
00431
00432