summaryrefslogtreecommitdiff
path: root/keysyms.mod/keysyms.bmx
blob: ff3053d2c8b65541b2fcf16fa07cede9aa2683f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Rem
bbdoc: noddybox.keysyms
EndRem
Module noddybox.keysyms

ModuleInfo "Framework: English string symbols for keycodes"
ModuleInfo "Copyright: Public Domain"
ModuleInfo "Author: Ian Cowburn"
ModuleInfo "Version: $Revision$"

' $Id$

Strict

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[KEY_MOUSELEFT] = "Left Mouse button"
			codes[KEY_MOUSERIGHT] = "Right Mouse button"
			codes[KEY_MOUSEMIDDLE] = "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_SHIFT] = "Shift"
			codes[KEY_CONTROL] = "Control"
			codes[KEY_ALT] = "Alt"
			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_NUMSLASH] = "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