Open Inventor Reference
|
00001 /* 00002 * 00003 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * Further, this software is distributed without any warranty that it is 00016 * free of the rightful claim of any third person regarding infringement 00017 * or the like. Any license provided herein, whether implied or 00018 * otherwise, applies only to this software file. Patent licenses, if 00019 * any, provided herein do not apply to combinations of this program with 00020 * other software, or any other product whatsoever. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 00027 * Mountain View, CA 94043, or: 00028 * 00029 * http://www.sgi.com 00030 * 00031 * For further information regarding this notice, see: 00032 * 00033 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 00034 * 00035 */ 00036 00037 00038 /* 00039 * Copyright (C) 1990,91,92 Silicon Graphics, Inc. 00040 * 00041 _______________________________________________________________________ 00042 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00043 | 00044 | $Revision: 1.2 $ 00045 | 00046 | Classes: 00047 | SoKeyboardEvent 00048 | 00049 | Author(s): David Mott, Gavin Bell 00050 | 00051 ______________ S I L I C O N G R A P H I C S I N C . ____________ 00052 _______________________________________________________________________ 00053 */ 00054 00055 #ifndef _SO_KEYBOARD_EVENT_ 00056 #define _SO_KEYBOARD_EVENT_ 00057 00058 #include <Inventor/system/SbSystem.h> 00059 #include <Inventor/SbBasic.h> 00060 #include <Inventor/events/SoButtonEvent.h> 00061 00063 00064 #define SO_KEY_PRESS_EVENT(EVENT,KEY) \ 00065 (SoKeyboardEvent::isKeyPressEvent(EVENT,SoKeyboardEvent::KEY)) 00066 00067 #define SO_KEY_RELEASE_EVENT(EVENT,KEY) \ 00068 (SoKeyboardEvent::isKeyReleaseEvent(EVENT,SoKeyboardEvent::KEY)) 00069 00070 00071 00073 #if defined(WIN32) && defined(DELETE) 00074 # define SOKEYBOARDEVENT_DELETE_DEF DELETE 00075 # undef DELETE 00076 #endif 00077 00080 00090 00091 00092 class INVENTOR_API SoKeyboardEvent : public SoButtonEvent { 00093 00094 SO_EVENT_HEADER(); 00095 00096 public: 00097 00099 enum Key { 00101 ANY = 0, 00102 00103 00105 00106 LEFT_SHIFT = 0xffe1, 00107 RIGHT_SHIFT = 0xffe2, 00108 LEFT_CONTROL = 0xffe3, 00109 RIGHT_CONTROL = 0xffe4, 00110 LEFT_ALT = 0xffe9, 00111 RIGHT_ALT = 0xffea, 00112 00113 00115 00116 NUMBER_0 = 0x030, 00117 NUMBER_1 = 0x031, 00118 NUMBER_2 = 0x032, 00119 NUMBER_3 = 0x033, 00120 NUMBER_4 = 0x034, 00121 NUMBER_5 = 0x035, 00122 NUMBER_6 = 0x036, 00123 NUMBER_7 = 0x037, 00124 NUMBER_8 = 0x038, 00125 NUMBER_9 = 0x039, 00126 00127 00129 00130 A = 0x061, 00131 B = 0x062, 00132 C = 0x063, 00133 D = 0x064, 00134 E = 0x065, 00135 F = 0x066, 00136 G = 0x067, 00137 H = 0x068, 00138 I = 0x069, 00139 J = 0x06a, 00140 K = 0x06b, 00141 L = 0x06c, 00142 M = 0x06d, 00143 N = 0x06e, 00144 O = 0x06f, 00145 P = 0x070, 00146 Q = 0x071, 00147 R = 0x072, 00148 S = 0x073, 00149 T = 0x074, 00150 U = 0x075, 00151 V = 0x076, 00152 W = 0x077, 00153 X = 0x078, 00154 Y = 0x079, 00155 Z = 0x07a, 00156 00157 00159 00160 HOME = 0xff50, 00161 LEFT_ARROW = 0xff51, 00162 UP_ARROW = 0xff52, 00163 RIGHT_ARROW = 0xff53, 00164 DOWN_ARROW = 0xff54, 00165 PAGE_UP = 0xff55, 00166 PAGE_DOWN = 0xff56, 00167 PRIOR = 0xff55, 00168 NEXT = 0xff56, 00169 END = 0xff57, 00170 00171 00173 00174 PAD_ENTER = 0xff8d, 00175 PAD_F1 = 0xff91, 00176 PAD_F2 = 0xff92, 00177 PAD_F3 = 0xff93, 00178 PAD_F4 = 0xff94, 00179 00180 PAD_0 = 0xff9e, 00181 PAD_1 = 0xff9c, 00182 PAD_2 = 0xff99, 00183 PAD_3 = 0xff9b, 00184 PAD_4 = 0xff96, 00185 PAD_5 = 0xff9d, 00186 PAD_6 = 0xff98, 00187 PAD_7 = 0xff95, 00188 PAD_8 = 0xff97, 00189 PAD_9 = 0xff9a, 00190 00191 PAD_ADD = 0xffab, 00192 PAD_SUBTRACT = 0xffad, 00193 PAD_MULTIPLY = 0xffaa, 00194 PAD_DIVIDE = 0xffaf, 00195 00196 PAD_SPACE = 0xff8d, 00197 PAD_TAB = 0xff89, 00198 PAD_INSERT = 0xff9e, 00199 PAD_DELETE = 0xff9f, 00200 PAD_PERIOD = 0xff9f, 00201 00203 00204 F1 = 0xffbe, 00205 F2 = 0xffbf, 00206 F3 = 0xffc0, 00207 F4 = 0xffc1, 00208 F5 = 0xffc2, 00209 F6 = 0xffc3, 00210 F7 = 0xffc4, 00211 F8 = 0xffc5, 00212 F9 = 0xffc6, 00213 F10 = 0xffc7, 00214 F11 = 0xffc8, 00215 F12 = 0xffc9, 00216 00217 00219 00220 BACKSPACE = 0xff08, 00221 TAB = 0xff09, 00222 RETURN = 0xff0d, 00223 ENTER = 0xff0d, 00224 PAUSE = 0xff13, 00225 SCROLL_LOCK = 0xff14, 00226 ESCAPE = 0xff1b, 00227 DELETE = 0xffff, 00230 KEY_DELETE = DELETE, 00231 PRINT = 0xff61, 00232 INSERT = 0xff63, 00233 NUM_LOCK = 0xff7f, 00234 CAPS_LOCK = 0xffe5, 00235 SHIFT_LOCK = 0xffe6, 00236 00237 SPACE = 0x020, 00238 APOSTROPHE = 0x027, 00239 COMMA = 0x02c, 00240 MINUS = 0x02d, 00241 PERIOD = 0x02e, 00242 SLASH = 0x02f, 00243 00244 SEMICOLON = 0x03b, 00245 EQUAL = 0x03d, 00246 00247 BRACKETLEFT = 0x05b, 00248 BACKSLASH = 0x05c, 00249 BRACKETRIGHT = 0x05d, 00250 GRAVE = 0x060 00251 }; 00252 00254 SoKeyboardEvent(); 00255 virtual ~SoKeyboardEvent(); 00256 00258 void setKey(SoKeyboardEvent::Key whichKey) { key = whichKey; } 00259 SoKeyboardEvent::Key getKey() const { return key; } 00260 00263 static SbBool isKeyPressEvent( 00264 const SoEvent *e, 00265 SoKeyboardEvent::Key whichKey); 00266 00267 static SbBool isKeyReleaseEvent( 00268 const SoEvent *e, 00269 SoKeyboardEvent::Key whichKey); 00270 00273 char getPrintableCharacter() const; 00274 00275 SoINTERNAL public: 00276 static void initClass(); 00277 00278 private: 00279 Key key; 00280 }; 00281 00282 #ifdef SOKEYBOARDEVENT_DELETE_DEF 00283 # define DELETE SOKEYBOARDEVENT_DELETE_DEF 00284 # undef SOKEYBOARDEVENT_DELETE_DEF 00285 #endif 00286 00287 #endif /* _SO_KEYBOARD_EVENT_ */