/[pearpc]/src/system/keyboard.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /src/system/keyboard.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (hide annotations)
Wed Sep 5 17:11:21 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: text/plain
File size: 4085 byte(s)
import upstream CVS
1 dpavlin 1 /*
2     * PearPC
3     * keyboard.h
4     *
5     * Copyright (C) 2004 Stefan Weyergraf
6     *
7     * This program is free software; you can redistribute it and/or modify
8     * it under the terms of the GNU General Public License version 2 as
9     * published by the Free Software Foundation.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19     */
20    
21     #ifndef __SYSTEM_KEYBOARD_H__
22     #define __SYSTEM_KEYBOARD_H__
23    
24     #include "system/types.h"
25    
26     #include "system/device.h"
27     #include "system/event.h"
28    
29     #include "tools/data.h"
30    
31     #define KEY_a 0
32     #define KEY_s 1
33     #define KEY_d 2
34     #define KEY_f 3
35     #define KEY_h 4
36     #define KEY_g 5
37     #define KEY_z 6
38     #define KEY_x 7
39     #define KEY_c 8
40     #define KEY_v 9
41    
42     #define KEY_b 11
43     #define KEY_q 12
44     #define KEY_w 13
45     #define KEY_e 14
46     #define KEY_r 15
47     #define KEY_y 16
48     #define KEY_t 17
49     #define KEY_1 18
50     #define KEY_2 19
51     #define KEY_3 20
52     #define KEY_4 21
53     #define KEY_6 22
54     #define KEY_5 23
55     #define KEY_EQ 24
56     #define KEY_9 25
57     #define KEY_7 26
58     #define KEY_MINUS 27
59     #define KEY_8 28
60     #define KEY_0 29
61     #define KEY_BRACKET_R 30
62     #define KEY_o 31
63     #define KEY_u 32
64     #define KEY_BRACKET_L 33
65     #define KEY_i 34
66     #define KEY_p 35
67     #define KEY_RETURN 36
68     #define KEY_l 37
69     #define KEY_j 38
70     #define KEY_APOSTROPHE 39
71     #define KEY_k 40
72     #define KEY_SEMICOLON 41
73     #define KEY_BACKSLASH 42
74     #define KEY_COMMA 43
75     #define KEY_SLASH 44
76     #define KEY_n 45
77     #define KEY_m 46
78     #define KEY_PERIOD 47
79     #define KEY_TAB 48
80     #define KEY_SPACE 49
81     #define KEY_GRAVE 50
82     #define KEY_DELETE 51
83    
84     #define KEY_ESCAPE 53
85     #define KEY_CONTROL 54
86     #define KEY_ALT 55
87     #define KEY_SHIFT 56
88     #define KEY_CAPS_LOCK 57
89     #define KEY_ALTGR 58
90     #define KEY_LEFT 59
91     #define KEY_RIGHT 60
92     #define KEY_DOWN 61
93     #define KEY_UP 62
94    
95     #define KEY_KP_PERIOD 65
96     #define KEY_KP_MULTIPLY 67
97     #define KEY_KP_ADD 69
98     #define KEY_NUM_LOCK 71
99     #define KEY_KP_DIVIDE 75
100     #define KEY_KP_ENTER 76
101     #define KEY_KP_SUBTRACT 78
102     #define KEY_KP_0 82
103     #define KEY_KP_1 83
104     #define KEY_KP_2 84
105     #define KEY_KP_3 85
106     #define KEY_KP_4 86
107     #define KEY_KP_5 87
108     #define KEY_KP_6 88
109     #define KEY_KP_7 89
110    
111     #define KEY_KP_8 91
112     #define KEY_KP_9 92
113    
114     #define KEY_F5 96
115     #define KEY_F6 97
116     #define KEY_F7 98
117     #define KEY_F3 99
118     #define KEY_F8 100
119     #define KEY_F9 101
120    
121     #define KEY_F11 103
122    
123     #define KEY_F13 105
124    
125     #define KEY_SCROLL_LOCK 107
126    
127     #define KEY_F10 109
128    
129     #define KEY_F12 111
130    
131     #define KEY_PAUSE 113
132     #define KEY_INSERT 114
133     #define KEY_HOME 115
134     #define KEY_PRIOR 116
135     #define KEY_REMOVE 117
136    
137     #define KEY_F4 118
138     #define KEY_END 119
139     #define KEY_F2 120
140     #define KEY_NEXT 121
141     #define KEY_F1 122
142    
143     //keycode 0x7b = Shift
144     //keycode 0x7c = AltGr
145     //keycode 0x7d = Control
146    
147    
148     #define KEYB_LED_NUM 1
149     #define KEYB_LED_CAPS 2
150     #define KEYB_LED_SCROLL 3
151    
152     #define KEYCODE_CTRL 0x100
153     #define KEYCODE_LALT 0x200
154     #define KEYCODE_RALT 0x400
155     #define KEYCODE_SHIFT 0x800
156    
157     struct KeyboardCharacteristics
158     {
159     int key_compose_dialog;
160     int key_toggle_mouse_grab;
161     int key_toggle_full_screen;
162     };
163    
164     #include "tools/str.h"
165    
166     /* system-dependent (implementation in ui / $MYUI / *.cc) */
167     class SystemKeyboard: public SystemDevice {
168     int mShift;
169     int mLAlt;
170     int mRAlt;
171     int mCtrl;
172     public:
173     SystemKeyboard();
174     virtual int getKeybLEDs() = 0;
175     virtual void setKeybLEDs(int leds) = 0;
176     virtual bool handleEvent(const SystemEvent &ev);
177     virtual void reset();
178     virtual bool adbKeyToAscii(char &chr, int adbcode);
179     static bool convertKeycodeToString(String &result, int keycode);
180     static bool convertStringToKeycode(int &keycode, const String &s);
181     bool setKeyConfig(KeyboardCharacteristics keyConfig);
182     KeyboardCharacteristics &getKeyConfig();
183     private:
184     KeyboardCharacteristics keyConfig;
185     };
186    
187     /* system-independent (implementation in keyboard.cc) */
188     extern SystemKeyboard *gKeyboard;
189    
190    
191    
192     #endif /* __SYSTEM_KEYBOARD_H__ */

  ViewVC Help
Powered by ViewVC 1.1.26