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
00098 class SoKeyboardEvent : public SoButtonEvent {
00099
00100 SO_EVENT_HEADER();
00101
00102 public:
00103
00105 enum Key {
00107 ANY = 0,
00108
00110 LEFT_SHIFT = 0xFFE1,
00112 RIGHT_SHIFT = 0xFFE2,
00114 LEFT_CONTROL = 0xFFE3,
00116 RIGHT_CONTROL = 0xFFE4,
00118 LEFT_ALT = 0xFFE9,
00120 RIGHT_ALT = 0xFFEA,
00124 LEFT_META = 0xFFEB,
00130 RIGHT_META = 0xFFEC,
00131
00133 NUMBER_0 = 0x030,
00135 NUMBER_1 = 0x031,
00137 NUMBER_2 = 0x032,
00139 NUMBER_3 = 0x033,
00141 NUMBER_4 = 0x034,
00143 NUMBER_5 = 0x035,
00145 NUMBER_6 = 0x036,
00147 NUMBER_7 = 0x037,
00149 NUMBER_8 = 0x038,
00151 NUMBER_9 = 0x039,
00152
00154 A = 0x061,
00156 B = 0x062,
00158 C = 0x063,
00160 D = 0x064,
00162 E = 0x065,
00164 F = 0x066,
00166 G = 0x067,
00168 H = 0x068,
00170 I = 0x069,
00172 J = 0x06A,
00174 K = 0x06B,
00176 L = 0x06C,
00178 M = 0x06D,
00180 N = 0x06E,
00182 O = 0x06F,
00184 P = 0x070,
00186 Q = 0x071,
00188 R = 0x072,
00190 S = 0x073,
00192 T = 0x074,
00194 U = 0x075,
00196 V = 0x076,
00198 W = 0x077,
00200 X = 0x078,
00202 Y = 0x079,
00204 Z = 0x07A,
00205
00207 HOME = 0xFF50,
00209 LEFT_ARROW = 0xFF51,
00211 UP_ARROW = 0xFF52,
00213 RIGHT_ARROW = 0xFF53,
00215 DOWN_ARROW = 0xFF54,
00217 PAGE_UP = 0xFF55,
00219 PAGE_DOWN = 0xFF56,
00221 PRIOR = 0xFF55,
00223 NEXT = 0xFF56,
00225 END = 0xFF57,
00226
00228 PAD_ENTER = 0xFF8D,
00230 PAD_F1 = 0xFF91,
00232 PAD_F2 = 0xFF92,
00234 PAD_F3 = 0xFF93,
00236 PAD_F4 = 0xFF94,
00237
00239 PAD_0 = 0xFF9E,
00241 PAD_1 = 0xFF9C,
00243 PAD_2 = 0xFF99,
00245 PAD_3 = 0xFF9B,
00247 PAD_4 = 0xFF96,
00249 PAD_5 = 0xFF9D,
00251 PAD_6 = 0xFF98,
00253 PAD_7 = 0xFF95,
00255 PAD_8 = 0xFF97,
00257 PAD_9 = 0xFF9A,
00258
00260 PAD_ADD = 0xFFAB,
00262 PAD_SUBTRACT = 0xFFAD,
00264 PAD_MULTIPLY = 0xFFAA,
00266 PAD_DIVIDE = 0xFFAF,
00267
00269 PAD_SPACE = 0xFF8D,
00271 PAD_TAB = 0xFF89,
00273 PAD_INSERT = 0xFF9E,
00275 PAD_DELETE = 0xFF9F,
00277 PAD_PERIOD = 0xFF9F,
00278
00280 F1 = 0xFFBE,
00282 F2 = 0xFFBF,
00284 F3 = 0xFFC0,
00286 F4 = 0xFFC1,
00288 F5 = 0xFFC2,
00290 F6 = 0xFFC3,
00292 F7 = 0xFFC4,
00294 F8 = 0xFFC5,
00296 F9 = 0xFFC6,
00298 F10 = 0xFFC7,
00300 F11 = 0xFFC8,
00302 F12 = 0xFFC9,
00303
00305 BACKSPACE = 0xFF08,
00307 TAB = 0xFF09,
00309 RETURN = 0xFF0D,
00311 ENTER = 0xFF0D,
00313 PAUSE = 0xFF13,
00315 SCROLL_LOCK = 0xFF14,
00317 ESCAPE = 0xFF1B,
00319 KEY_DELETE = 0xFFFF,
00320 #if !defined(_WIN32) && !defined(__NUTC__)
00321
00325 DELETE = 0xFFFF,
00326 #endif
00327
00328 PRINT = 0xFF61,
00330 INSERT = 0xFF63,
00332 NUM_LOCK = 0xFF7F,
00334 CAPS_LOCK = 0xFFE5,
00336 SHIFT_LOCK = 0xFFE6,
00337
00339 SPACE = 0x020,
00341 APOSTROPHE = 0x027,
00343 COMMA = 0x02C,
00345 MINUS = 0x02D,
00347 PERIOD = 0x02E,
00349 SLASH = 0x02F,
00350
00352 SEMICOLON = 0x03B,
00354 EQUAL = 0x03D,
00355
00357 BRACKETLEFT = 0x05B,
00359 BACKSLASH = 0x05C,
00361 BRACKETRIGHT = 0x05D,
00363 GRAVE = 0x060
00364 };
00365
00369 SoKeyboardEvent();
00370
00371 #ifndef HIDDEN_FROM_DOC
00372 virtual ~SoKeyboardEvent();
00373 #endif // HIDDEN_FROM_DOC
00374
00378 void setKey(SoKeyboardEvent::Key whichKey);
00379
00383 SoKeyboardEvent::Key getKey() const;
00384
00390 static SbBool isKeyPressEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey);
00391
00397 static SbBool isKeyReleaseEvent(const SoEvent *e,
00398 SoKeyboardEvent::Key whichKey);
00399
00404 char getPrintableCharacter() const;
00405
00410 void setUnicode(wchar_t unicode);
00411
00415 wchar_t getUnicode() const;
00416
00417 private:
00418 static void initClass();
00419 static void exitClass();
00420
00421 private:
00422
00423 Key m_key;
00424 wchar_t m_unicode;
00425 };
00426
00427 #endif
00428
00429