' Copyright (c) 2006 Ian Cowburn ' ' Permission is hereby granted, free of charge, to any person obtaining a copy of ' this software and associated documentation files (the "Software"), to deal in ' the Software without restriction, including without limitation the rights to ' use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ' of the Software, and to permit persons to whom the Software is furnished to do ' so, subject to the following conditions: ' ' The above copyright notice and this permission notice shall be included in all ' copies or substantial portions of the Software. ' ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ' SOFTWARE. ' ' $Id$ ' Rem bbdoc: noddybox.keysyms EndRem Module noddybox.keysyms ModuleInfo "Framework: English string symbols for keycodes" ModuleInfo "Copyright: Ian Cowburn -- released under the MIT License" ModuleInfo "Author: Ian Cowburn" ModuleInfo "Version: $Revision$" Import brl.keycodes Rem bbdoc: Get a keysym. returns: The string name of @keycode, or "Unknown" for unknown codes. EndRem Function KeySym:String(keycode:Int) KeySymStatic.Init() If keycode<0 Or keycode>=KeySymStatic.codes.length Return "Unknown" EndIf If KeySymStatic.codes[keycode] Return KeySymStatic.codes[keycode] Else Return "Unknown" EndIf End Function Private Type KeySymStatic Global done:Int=False Global codes:String[] Function Init() If Not done ' TODO: This will break if keycodes are ever above 511 ' codes=New String[512] codes[MOUSE_LEFT] = "Left Mouse button" codes[MOUSE_RIGHT] = "Right Mouse button" codes[MOUSE_MIDDLE] = "Middle Mouse button" codes[KEY_BACKSPACE] = "Backspace" codes[KEY_TAB] = "Tab" codes[KEY_RETURN] = "Return" codes[KEY_CLEAR] = "Clear" codes[KEY_ENTER] = "Enter" 'codes[KEY_PAUSE] = "Pause" 'codes[KEY_CAPSLOCK] = "Caps Lock" codes[KEY_ESCAPE] = "Escape" codes[KEY_SPACE] = "Space" codes[KEY_PAGEUP] = "Page Up" codes[KEY_PAGEDOWN] = "Page Down" codes[KEY_END] = "End" codes[KEY_HOME] = "Home" codes[KEY_LEFT] = "Left" codes[KEY_UP] = "Up" codes[KEY_RIGHT] = "Right" codes[KEY_DOWN] = "Down" codes[KEY_SELECT] = "Select" codes[KEY_PRINT] = "Print" codes[KEY_EXECUTE] = "Execute" codes[KEY_SCREEN] = "Screen" codes[KEY_INSERT] = "Insert" codes[KEY_DELETE] = "Delete" 'codes[KEY_HELP] = "Help" codes[KEY_0] = "0" codes[KEY_1] = "1" codes[KEY_2] = "2" codes[KEY_3] = "3" codes[KEY_4] = "4" codes[KEY_5] = "5" codes[KEY_6] = "6" codes[KEY_7] = "7" codes[KEY_8] = "8" codes[KEY_9] = "9" codes[KEY_A] = "A" codes[KEY_B] = "B" codes[KEY_C] = "C" codes[KEY_D] = "D" codes[KEY_E] = "E" codes[KEY_F] = "F" codes[KEY_G] = "G" codes[KEY_H] = "H" codes[KEY_I] = "I" codes[KEY_J] = "J" codes[KEY_K] = "K" codes[KEY_L] = "L" codes[KEY_M] = "M" codes[KEY_N] = "N" codes[KEY_O] = "O" codes[KEY_P] = "P" codes[KEY_Q] = "Q" codes[KEY_R] = "R" codes[KEY_S] = "S" codes[KEY_T] = "T" codes[KEY_U] = "U" codes[KEY_V] = "V" codes[KEY_W] = "W" codes[KEY_X] = "X" codes[KEY_Y] = "Y" codes[KEY_Z] = "Z" codes[KEY_LSYS] = "Left Sys" codes[KEY_RSYS] = "Right Sys" codes[KEY_NUM0] = "Numpad 0" codes[KEY_NUM1] = "Numpad 1" codes[KEY_NUM2] = "Numpad 2" codes[KEY_NUM3] = "Numpad 3" codes[KEY_NUM4] = "Numpad 4" codes[KEY_NUM5] = "Numpad 5" codes[KEY_NUM6] = "Numpad 6" codes[KEY_NUM7] = "Numpad 7" codes[KEY_NUM8] = "Numpad 8" codes[KEY_NUM9] = "Numpad 9" codes[KEY_NUMMULTIPLY] = "Numpad *" codes[KEY_NUMADD] = "Numpad +" codes[KEY_NUMDIVIDE] = "Numpad /" codes[KEY_NUMSUBTRACT] = "Numpad -" codes[KEY_NUMDECIMAL] = "Numpad ." codes[KEY_NUMDIVIDE] = "Numpad /" codes[KEY_F1] = "F1" codes[KEY_F2] = "F2" codes[KEY_F3] = "F3" codes[KEY_F4] = "F4" codes[KEY_F5] = "F5" codes[KEY_F6] = "F6" codes[KEY_F7] = "F7" codes[KEY_F8] = "F8" codes[KEY_F9] = "F9" codes[KEY_F10] = "F10" codes[KEY_F11] = "F11" codes[KEY_F12] = "F12" 'codes[KEY_NUMLOCK] = "Num Lock" 'codes[KEY_SCROLL] = "Scroll Lock" codes[KEY_LSHIFT] = "Left Shift" codes[KEY_RSHIFT] = "Right Shift" codes[KEY_LCONTROL] = "Left Control" codes[KEY_RCONTROL] = "Right Control" codes[KEY_LALT] = "Left Alt" codes[KEY_RALT] = "Right Alt" codes[KEY_TILDE] = "Tilde" codes[KEY_MINUS] = "Minus" codes[KEY_EQUALS] = "Equals" codes[KEY_OPENBRACKET] = "Open Bracket" codes[KEY_CLOSEBRACKET] = "Close Bracket" codes[KEY_BACKSLASH] = "Backslash" codes[KEY_SEMICOLON] = "Semi-colon" codes[KEY_QUOTES] = "Quote" codes[KEY_COMMA] = "Comma" codes[KEY_PERIOD] = "Period" codes[KEY_SLASH] = "Slash" done=True EndIf End Function End Type