Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoKeyboardEvent.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOKEYBOARDEVENT_H
00021 #define COIN_SOKEYBOARDEVENT_H
00022 
00023 #include <Inventor/events/SoButtonEvent.h>
00024 
00025 
00026 // Avoid problem with Microsoft Win32 API headers (yes, they actually
00027 // #define DELETE somewhere in their header files).
00028 #if defined(DELETE)
00029 #define SOKEYBOARDEVENT_STORE_DELETE_DEF DELETE
00030 #undef DELETE
00031 #endif /* DELETE */
00032 
00033 
00034 #define SO_KEY_PRESS_EVENT(EVENT, KEY) \
00035  (SoKeyboardEvent::isKeyPressEvent(EVENT, SoKeyboardEvent::KEY))
00036 
00037 #define SO_KEY_RELEASE_EVENT(EVENT, KEY) \
00038  (SoKeyboardEvent::isKeyReleaseEvent(EVENT, SoKeyboardEvent::KEY))
00039 
00040 
00041 class COIN_DLL_API SoKeyboardEvent : public SoButtonEvent {
00042   typedef SoButtonEvent inherited;
00043 
00044   SO_EVENT_HEADER();
00045 
00046 public:
00047   enum Key {
00048     ANY = 0,
00049     UNDEFINED = 1,
00050 
00051     LEFT_SHIFT = 0xffe1, RIGHT_SHIFT, LEFT_CONTROL, RIGHT_CONTROL,
00052     LEFT_ALT = 0xffe9, RIGHT_ALT,
00053 
00054     NUMBER_0 = 0x0030, NUMBER_1, NUMBER_2, NUMBER_3, NUMBER_4, NUMBER_5,
00055     NUMBER_6, NUMBER_7, NUMBER_8, NUMBER_9,
00056 
00057     A = 0x0061, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T,
00058     U, V, W, X, Y, Z,
00059 
00060     HOME = 0xff50, LEFT_ARROW, UP_ARROW, RIGHT_ARROW, DOWN_ARROW,
00061     PAGE_UP, PAGE_DOWN, END,
00062     PRIOR = 0xff55, NEXT,
00063 
00064     PAD_ENTER = 0xff8d,
00065     PAD_F1 = 0xff91, PAD_F2, PAD_F3, PAD_F4,
00066     PAD_0 = 0xff9e, PAD_1 = 0xff9c, PAD_2 = 0xff99, PAD_3 = 0xff9b,
00067     PAD_4 = 0xff96, PAD_5 = 0xff9d, PAD_6 = 0xff98, PAD_7 = 0xff95,
00068     PAD_8 = 0xff97, PAD_9 = 0xff9a,
00069     PAD_ADD = 0xffab, PAD_SUBTRACT = 0xffad,
00070     PAD_MULTIPLY = 0xffaa, PAD_DIVIDE = 0xffaf,
00071     PAD_SPACE = 0xff8d, PAD_TAB = 0xff89,
00072     PAD_INSERT = 0xff9e, PAD_DELETE = 0xff9f, PAD_PERIOD = 0xff9f,
00073 
00074     F1 = 0xffbe, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
00075 
00076     BACKSPACE = 0xff08, TAB = 0xff09,
00077     RETURN = 0xff0d, ENTER = 0xff0d,
00078     PAUSE = 0xff13, SCROLL_LOCK = 0xff14,
00079     ESCAPE = 0xff1b, DELETE = 0xffff, KEY_DELETE = DELETE,
00080     PRINT = 0xff61, INSERT = 0xff63,
00081     NUM_LOCK = 0xff7f, CAPS_LOCK = 0xffe5, SHIFT_LOCK = 0xffe6,
00082 
00083     SPACE = 0x0020, APOSTROPHE = 0x0027,
00084     COMMA = 0x002c, MINUS = 0x002d, PERIOD = 0x002e, SLASH = 0x002f,
00085     SEMICOLON = 0x003b, EQUAL = 0x003d,
00086     BRACKETLEFT = 0x005b, BACKSLASH = 0x005c,
00087     BRACKETRIGHT = 0x005d, GRAVE = 0x0060
00088   };
00089 
00090   SoKeyboardEvent(void);
00091   virtual ~SoKeyboardEvent();
00092 
00093   void setKey(SoKeyboardEvent::Key key);
00094   SoKeyboardEvent::Key getKey(void) const;
00095 
00096   void setPrintableCharacter(const char c);
00097   char getPrintableCharacter(void) const;
00098 
00099   static SbBool isKeyPressEvent(const SoEvent * e,
00100                                 SoKeyboardEvent::Key whichKey);
00101   static SbBool isKeyReleaseEvent(const SoEvent * e,
00102                                   SoKeyboardEvent::Key whichKey);
00103 
00104   static void initClass(void);
00105 
00106 private:
00107   Key key;
00108   char printable;
00109   char isprintableset;
00110 };
00111 
00112 
00113 // Avoid problem with Microsoft Win32 API headers (see above).
00114 #if defined(SOKEYBOARDEVENT_STORE_DELETE_DEF)
00115 #define DELETE SOKEYBOARDEVENT_STORE_DELETE_DEF
00116 #undef SOKEYBOARDEVENT_STORE_DELETE_DEF
00117 #endif /* SOKEYBOARDEVENT_STORE_DELETE_DEF */
00118 
00119 
00120 #endif // !COIN_SOKEYBOARDEVENT_H

Generated at Tue Mar 5 03:31:14 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001