1 /**
2  * @namespace   biewlib
3  * @file        biewlib/sysdep/ia32/win32/kbd_code.h
4  * @brief       This file contains definitions of Win32s keyboard codes.
5  * @version     -
6  * @remark      this source file is part of Binary vIEW project (BIEW).
7  *              The Binary vIEW (BIEW) is copyright (C) 1995 Nickols_K.
8  *              All rights reserved. This software is redistributable under the
9  *              licence given in the file "Licence.en" ("Licence.ru" in russian
10  *              translation) distributed in the BIEW archive.
11  * @note        Requires POSIX compatible development system
12  *
13  * @author      Nickols_K
14  * @since       1999
15  * @note        Development, fixes and improvements
16 **/
17 #ifndef __KBD_CODES_H
18 #define __KBD_CODES_H
19 
20 /** This codes describe shift keys state */
21 
22 #define KS_SHIFT           3
23 #define KS_CTRL            4
24 #define KS_ALT             8
25 #define KS_CTRL_MASK       15
26 #define KS_SCRLOCK         16
27 #define KS_NUMLOCK         32
28 #define KS_CAPSLOCK        64
29 #define KS_INSERT          128
30 
31 /**
32     not real keys, for internal use only
33 */
34 
35 #define KE_SUPERKEY	0xFFFF
36 #define KE_JUSTFIND	0xFFFE
37 
38 /**
39    This code describes mouse event
40 */
41 
42 #define KE_MOUSE        0xFFFB
43 
44 /**
45    This code describes shift keys event
46 */
47 
48 #define KE_SHIFTKEYS    0xFFFA
49 
50 /**
51    This section describes real key code
52 */
53 
54 #define KE_ESCAPE            0x011B
55 #define KE_ENTER             0x1C0D
56 
57 #define KE_SPACE             0x3920
58 #define KE_BKSPACE           0x0E08
59 #define KE_TAB               0x0F09
60 
61 #define KE_DOWNARROW         0x5000
62 #define KE_UPARROW           0x4800
63 #define KE_LEFTARROW         0x4b00
64 #define KE_RIGHTARROW        0x4d00
65 
66 #define KE_HOME              0x4700
67 #define KE_END               0x4f00
68 #define KE_PGUP              0x4900
69 #define KE_PGDN              0x5100
70 #define KE_INS               0x5200
71 #define KE_DEL               0x5300
72 
73 #define KE_F(x)		((0x3A+(x))<<8)
74 
75 /**
76     do not change below
77 */
78 
79 #define ADD_CONTROL	0x010000
80 #define ADD_ALT		0x020000
81 #define ADD_SHIFT	0x040000
82 
83 #define KE_CTL_LEFTARROW	(KE_LEFTARROW | ADD_CONTROL)
84 #define KE_CTL_RIGHTARROW	(KE_RIGHTARROW | ADD_CONTROL)
85 
86 #define KE_SHIFT_TAB	(KE_TAB | ADD_SHIFT)
87 #define KE_CTL_BKSPACE	(KE_BKSPACE | ADD_CONTROL)
88 #define KE_CTL_ENTER	(KE_ENTER | ADD_CONTROL)
89 
90 #define KE_CTL_PGDN	(KE_PGDN | ADD_CONTROL)
91 #define KE_CTL_PGUP	(KE_PGUP | ADD_CONTROL)
92 #define KE_CTL_HOME	(KE_HOME | ADD_CONTROL)
93 #define KE_CTL_END	(KE_END | ADD_CONTROL)
94 
95 #define KE_SHIFT_F(x)	(KE_F(x) | ADD_SHIFT)
96 #define KE_CTL_F(x)	(KE_F(x) | ADD_CONTROL)
97 #define KE_ALT_F(x)	(KE_F(x) | ADD_ALT)
98 
99 #define SCAN_A  0x1e
100 #define SCAN_B  0x30
101 #define SCAN_C  0x2e
102 #define SCAN_D  0x20
103 #define SCAN_E  0x12
104 #define SCAN_F  0x21
105 #define SCAN_G  0x22
106 #define SCAN_H  0x23
107 #define SCAN_I  0x17
108 #define SCAN_J  0x24
109 #define SCAN_K  0x25
110 #define SCAN_L  0x26
111 #define SCAN_M  0x31
112 #define SCAN_N  0x32
113 #define SCAN_O  0x18
114 #define SCAN_P  0x19
115 #define SCAN_Q  0x10
116 #define SCAN_R  0x13
117 #define SCAN_S  0x1f
118 #define SCAN_T  0x14
119 #define SCAN_U  0x16
120 #define SCAN_V  0x2f
121 #define SCAN_W  0x11
122 #define SCAN_X  0x2d
123 #define SCAN_Y  0x15
124 #define SCAN_Z  0x2c
125 
126 #define ENUM_A  0x01
127 #define ENUM_B  0x02
128 #define ENUM_C  0x03
129 #define ENUM_D  0x04
130 #define ENUM_E  0x05
131 #define ENUM_F  0x06
132 #define ENUM_G  0x07
133 #define ENUM_H  0x08
134 #define ENUM_I  0x09
135 #define ENUM_J  0x0a
136 #define ENUM_K  0x0b
137 #define ENUM_L  0x0c
138 #define ENUM_M  0x0d
139 #define ENUM_N  0x0e
140 #define ENUM_O  0x0f
141 #define ENUM_P  0x10
142 #define ENUM_Q  0x11
143 #define ENUM_R  0x12
144 #define ENUM_S  0x13
145 #define ENUM_T  0x14
146 #define ENUM_U  0x15
147 #define ENUM_V  0x16
148 #define ENUM_W  0x17
149 #define ENUM_X  0x18
150 #define ENUM_Y  0x19
151 #define ENUM_Z  0x1a
152 
153 #define __SCAN_(x) (SCAN_##x)
154 #define __ENUM_(x) (ENUM_##x)
155 
156 #define KE_CTL_(x) ((((__SCAN_(x) << 8) & 0xFF00) | ((__ENUM_(x)-__ENUM_(A)+1) & 0x00FF)) | ADD_CONTROL)
157 #define KE_ALT_(x) ((((__SCAN_(x) << 8) & 0xFF00) | ADD_ALT)
158 
159 #endif
160