]>
Commit | Line | Data |
---|---|---|
c7de829c WD |
1 | /**************************************************************************** |
2 | * | |
3 | * SciTech OS Portability Manager Library | |
4 | * | |
5 | * ======================================================================== | |
6 | * | |
7 | * The contents of this file are subject to the SciTech MGL Public | |
8 | * License Version 1.0 (the "License"); you may not use this file | |
9 | * except in compliance with the License. You may obtain a copy of | |
10 | * the License at http://www.scitechsoft.com/mgl-license.txt | |
11 | * | |
12 | * Software distributed under the License is distributed on an | |
13 | * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or | |
14 | * implied. See the License for the specific language governing | |
15 | * rights and limitations under the License. | |
16 | * | |
17 | * The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc. | |
18 | * | |
19 | * The Initial Developer of the Original Code is SciTech Software, Inc. | |
20 | * All Rights Reserved. | |
21 | * | |
22 | * ======================================================================== | |
23 | * | |
24 | * Language: ANSI C | |
25 | * Environment: Any | |
26 | * | |
27 | * Description: Header file for the SciTech cross platform event library | |
28 | * | |
29 | ****************************************************************************/ | |
30 | ||
31 | #ifndef __EVENT_H | |
32 | #define __EVENT_H | |
33 | ||
34 | #include "scitech.h" | |
35 | ||
36 | /*---------------------- Macros and type definitions ----------------------*/ | |
37 | ||
38 | #pragma pack(1) | |
39 | ||
40 | /* 'C' calling conventions always */ | |
41 | ||
42 | #define EVTAPI _ASMAPI | |
43 | #define EVTAPIP _ASMAPIP | |
44 | ||
45 | /* Event message masks for keyDown events */ | |
46 | ||
47 | #define EVT_ASCIIMASK 0x00FF /* ASCII code of key pressed */ | |
48 | #define EVT_SCANMASK 0xFF00 /* Scan code of key pressed */ | |
49 | #define EVT_COUNTMASK 0x7FFF0000L /* Count for KEYREPEAT's */ | |
50 | ||
51 | /* Macros to extract values from the message fields */ | |
52 | ||
53 | #define EVT_asciiCode(m) ( (uchar) (m & EVT_ASCIIMASK) ) | |
54 | #define EVT_scanCode(m) ( (uchar) ( (m & EVT_SCANMASK) >> 8 ) ) | |
55 | #define EVT_repeatCount(m) ( (short) ( (m & EVT_COUNTMASK) >> 16 ) ) | |
56 | ||
57 | /**************************************************************************** | |
58 | REMARKS: | |
59 | Defines the set of ASCII codes reported by the event library functions | |
60 | in the message field. Use the EVT_asciiCode macro to extract the code | |
61 | from the event structure. | |
62 | ||
63 | HEADER: | |
64 | event.h | |
65 | ****************************************************************************/ | |
66 | typedef enum { | |
67 | ASCII_ctrlA = 0x01, | |
68 | ASCII_ctrlB = 0x02, | |
69 | ASCII_ctrlC = 0x03, | |
70 | ASCII_ctrlD = 0x04, | |
71 | ASCII_ctrlE = 0x05, | |
72 | ASCII_ctrlF = 0x06, | |
73 | ASCII_ctrlG = 0x07, | |
74 | ASCII_backspace = 0x08, | |
75 | ASCII_ctrlH = 0x08, | |
76 | ASCII_tab = 0x09, | |
77 | ASCII_ctrlI = 0x09, | |
78 | ASCII_ctrlJ = 0x0A, | |
79 | ASCII_ctrlK = 0x0B, | |
80 | ASCII_ctrlL = 0x0C, | |
81 | ASCII_enter = 0x0D, | |
82 | ASCII_ctrlM = 0x0D, | |
83 | ASCII_ctrlN = 0x0E, | |
84 | ASCII_ctrlO = 0x0F, | |
85 | ASCII_ctrlP = 0x10, | |
86 | ASCII_ctrlQ = 0x11, | |
87 | ASCII_ctrlR = 0x12, | |
88 | ASCII_ctrlS = 0x13, | |
89 | ASCII_ctrlT = 0x14, | |
90 | ASCII_ctrlU = 0x15, | |
91 | ASCII_ctrlV = 0x16, | |
92 | ASCII_ctrlW = 0x17, | |
93 | ASCII_ctrlX = 0x18, | |
94 | ASCII_ctrlY = 0x19, | |
95 | ASCII_ctrlZ = 0x1A, | |
96 | ASCII_esc = 0x1B, | |
97 | ASCII_space = 0x20, | |
98 | ASCII_exclamation = 0x21, /* ! */ | |
99 | ASCII_quote = 0x22, /* " */ | |
100 | ASCII_pound = 0x23, /* # */ | |
101 | ASCII_dollar = 0x24, /* $ */ | |
102 | ASCII_percent = 0x25, /* % */ | |
103 | ASCII_ampersand = 0x26, /* & */ | |
104 | ASCII_apostrophe = 0x27, /* ' */ | |
105 | ASCII_leftBrace = 0x28, /* ( */ | |
106 | ASCII_rightBrace = 0x29, /* ) */ | |
107 | ASCII_times = 0x2A, /* * */ | |
108 | ASCII_plus = 0x2B, /* + */ | |
109 | ASCII_comma = 0x2C, /* , */ | |
110 | ASCII_minus = 0x2D, /* - */ | |
111 | ASCII_period = 0x2E, /* . */ | |
112 | ASCII_divide = 0x2F, /* / */ | |
113 | ASCII_0 = 0x30, | |
114 | ASCII_1 = 0x31, | |
115 | ASCII_2 = 0x32, | |
116 | ASCII_3 = 0x33, | |
117 | ASCII_4 = 0x34, | |
118 | ASCII_5 = 0x35, | |
119 | ASCII_6 = 0x36, | |
120 | ASCII_7 = 0x37, | |
121 | ASCII_8 = 0x38, | |
122 | ASCII_9 = 0x39, | |
123 | ASCII_colon = 0x3A, /* : */ | |
124 | ASCII_semicolon = 0x3B, /* ; */ | |
125 | ASCII_lessThan = 0x3C, /* < */ | |
126 | ASCII_equals = 0x3D, /* = */ | |
127 | ASCII_greaterThan = 0x3E, /* > */ | |
128 | ASCII_question = 0x3F, /* ? */ | |
129 | ASCII_at = 0x40, /* @ */ | |
130 | ASCII_A = 0x41, | |
131 | ASCII_B = 0x42, | |
132 | ASCII_C = 0x43, | |
133 | ASCII_D = 0x44, | |
134 | ASCII_E = 0x45, | |
135 | ASCII_F = 0x46, | |
136 | ASCII_G = 0x47, | |
137 | ASCII_H = 0x48, | |
138 | ASCII_I = 0x49, | |
139 | ASCII_J = 0x4A, | |
140 | ASCII_K = 0x4B, | |
141 | ASCII_L = 0x4C, | |
142 | ASCII_M = 0x4D, | |
143 | ASCII_N = 0x4E, | |
144 | ASCII_O = 0x4F, | |
145 | ASCII_P = 0x50, | |
146 | ASCII_Q = 0x51, | |
147 | ASCII_R = 0x52, | |
148 | ASCII_S = 0x53, | |
149 | ASCII_T = 0x54, | |
150 | ASCII_U = 0x55, | |
151 | ASCII_V = 0x56, | |
152 | ASCII_W = 0x57, | |
153 | ASCII_X = 0x58, | |
154 | ASCII_Y = 0x59, | |
155 | ASCII_Z = 0x5A, | |
156 | ASCII_leftSquareBrace = 0x5B, /* [ */ | |
157 | ASCII_backSlash = 0x5C, /* \ */ | |
158 | ASCII_rightSquareBrace = 0x5D, /* ] */ | |
159 | ASCII_caret = 0x5E, /* ^ */ | |
160 | ASCII_underscore = 0x5F, /* _ */ | |
161 | ASCII_leftApostrophe = 0x60, /* ` */ | |
162 | ASCII_a = 0x61, | |
163 | ASCII_b = 0x62, | |
164 | ASCII_c = 0x63, | |
165 | ASCII_d = 0x64, | |
166 | ASCII_e = 0x65, | |
167 | ASCII_f = 0x66, | |
168 | ASCII_g = 0x67, | |
169 | ASCII_h = 0x68, | |
170 | ASCII_i = 0x69, | |
171 | ASCII_j = 0x6A, | |
172 | ASCII_k = 0x6B, | |
173 | ASCII_l = 0x6C, | |
174 | ASCII_m = 0x6D, | |
175 | ASCII_n = 0x6E, | |
176 | ASCII_o = 0x6F, | |
177 | ASCII_p = 0x70, | |
178 | ASCII_q = 0x71, | |
179 | ASCII_r = 0x72, | |
180 | ASCII_s = 0x73, | |
181 | ASCII_t = 0x74, | |
182 | ASCII_u = 0x75, | |
183 | ASCII_v = 0x76, | |
184 | ASCII_w = 0x77, | |
185 | ASCII_x = 0x78, | |
186 | ASCII_y = 0x79, | |
187 | ASCII_z = 0x7A, | |
188 | ASCII_leftCurlyBrace = 0x7B, /* { */ | |
189 | ASCII_verticalBar = 0x7C, /* | */ | |
190 | ASCII_rightCurlyBrace = 0x7D, /* } */ | |
191 | ASCII_tilde = 0x7E /* ~ */ | |
192 | } EVT_asciiCodesType; | |
193 | ||
194 | /**************************************************************************** | |
195 | REMARKS: | |
196 | Defines the set of scan codes reported by the event library functions | |
197 | in the message field. Use the EVT_scanCode macro to extract the code | |
198 | from the event structure. Note that the scan codes reported will be the | |
199 | same across all keyboards (assuming the placement of keys on a 101 key US | |
200 | keyboard), but the translated ASCII values may be different depending on | |
201 | the country code pages in use. | |
202 | ||
203 | NOTE: Scan codes in the event library are not really hardware scan codes, | |
8bde7f77 WD |
204 | but rather virtual scan codes as generated by a low level keyboard |
205 | interface driver. All virtual codes begin with scan code 0x60 and | |
206 | range up from there. | |
c7de829c WD |
207 | |
208 | HEADER: | |
209 | event.h | |
210 | ****************************************************************************/ | |
211 | typedef enum { | |
212 | KB_padEnter = 0x60, /* Keypad keys */ | |
213 | KB_padMinus = 0x4A, | |
214 | KB_padPlus = 0x4E, | |
215 | KB_padTimes = 0x37, | |
216 | KB_padDivide = 0x61, | |
217 | KB_padLeft = 0x62, | |
218 | KB_padRight = 0x63, | |
219 | KB_padUp = 0x64, | |
220 | KB_padDown = 0x65, | |
221 | KB_padInsert = 0x66, | |
222 | KB_padDelete = 0x67, | |
223 | KB_padHome = 0x68, | |
224 | KB_padEnd = 0x69, | |
225 | KB_padPageUp = 0x6A, | |
226 | KB_padPageDown = 0x6B, | |
227 | KB_padCenter = 0x4C, | |
228 | KB_F1 = 0x3B, /* Function keys */ | |
229 | KB_F2 = 0x3C, | |
230 | KB_F3 = 0x3D, | |
231 | KB_F4 = 0x3E, | |
232 | KB_F5 = 0x3F, | |
233 | KB_F6 = 0x40, | |
234 | KB_F7 = 0x41, | |
235 | KB_F8 = 0x42, | |
236 | KB_F9 = 0x43, | |
237 | KB_F10 = 0x44, | |
238 | KB_F11 = 0x57, | |
239 | KB_F12 = 0x58, | |
240 | KB_left = 0x4B, /* Cursor control keys */ | |
241 | KB_right = 0x4D, | |
242 | KB_up = 0x48, | |
243 | KB_down = 0x50, | |
244 | KB_insert = 0x52, | |
245 | KB_delete = 0x53, | |
246 | KB_home = 0x47, | |
247 | KB_end = 0x4F, | |
248 | KB_pageUp = 0x49, | |
249 | KB_pageDown = 0x51, | |
250 | KB_capsLock = 0x3A, | |
251 | KB_numLock = 0x45, | |
252 | KB_scrollLock = 0x46, | |
253 | KB_leftShift = 0x2A, | |
254 | KB_rightShift = 0x36, | |
255 | KB_leftCtrl = 0x1D, | |
256 | KB_rightCtrl = 0x6C, | |
257 | KB_leftAlt = 0x38, | |
258 | KB_rightAlt = 0x6D, | |
259 | KB_leftWindows = 0x5B, | |
260 | KB_rightWindows = 0x5C, | |
261 | KB_menu = 0x5D, | |
262 | KB_sysReq = 0x54, | |
263 | KB_esc = 0x01, /* Normal keyboard keys */ | |
264 | KB_1 = 0x02, | |
265 | KB_2 = 0x03, | |
266 | KB_3 = 0x04, | |
267 | KB_4 = 0x05, | |
268 | KB_5 = 0x06, | |
269 | KB_6 = 0x07, | |
270 | KB_7 = 0x08, | |
271 | KB_8 = 0x09, | |
272 | KB_9 = 0x0A, | |
273 | KB_0 = 0x0B, | |
274 | KB_minus = 0x0C, | |
275 | KB_equals = 0x0D, | |
276 | KB_backSlash = 0x2B, | |
277 | KB_backspace = 0x0E, | |
278 | KB_tab = 0x0F, | |
279 | KB_Q = 0x10, | |
280 | KB_W = 0x11, | |
281 | KB_E = 0x12, | |
282 | KB_R = 0x13, | |
283 | KB_T = 0x14, | |
284 | KB_Y = 0x15, | |
285 | KB_U = 0x16, | |
286 | KB_I = 0x17, | |
287 | KB_O = 0x18, | |
288 | KB_P = 0x19, | |
289 | KB_leftSquareBrace = 0x1A, | |
290 | KB_rightSquareBrace = 0x1B, | |
291 | KB_enter = 0x1C, | |
292 | KB_A = 0x1E, | |
293 | KB_S = 0x1F, | |
294 | KB_D = 0x20, | |
295 | KB_F = 0x21, | |
296 | KB_G = 0x22, | |
297 | KB_H = 0x23, | |
298 | KB_J = 0x24, | |
299 | KB_K = 0x25, | |
300 | KB_L = 0x26, | |
301 | KB_semicolon = 0x27, | |
302 | KB_apostrophe = 0x28, | |
303 | KB_Z = 0x2C, | |
304 | KB_X = 0x2D, | |
305 | KB_C = 0x2E, | |
306 | KB_V = 0x2F, | |
307 | KB_B = 0x30, | |
308 | KB_N = 0x31, | |
309 | KB_M = 0x32, | |
310 | KB_comma = 0x33, | |
311 | KB_period = 0x34, | |
312 | KB_divide = 0x35, | |
313 | KB_space = 0x39, | |
314 | KB_tilde = 0x29 | |
315 | } EVT_scanCodesType; | |
316 | ||
317 | /**************************************************************************** | |
318 | REMARKS: | |
319 | Defines the mask for the joystick axes that are present | |
320 | ||
321 | HEADER: | |
322 | event.h | |
323 | ||
324 | MEMBERS: | |
325 | EVT_JOY_AXIS_X1 - Joystick 1, X axis is present | |
326 | EVT_JOY_AXIS_Y1 - Joystick 1, Y axis is present | |
327 | EVT_JOY_AXIS_X2 - Joystick 2, X axis is present | |
328 | EVT_JOY_AXIS_Y2 - Joystick 2, Y axis is present | |
329 | EVT_JOY_AXIS_ALL - Mask for all axes | |
330 | ****************************************************************************/ | |
331 | typedef enum { | |
332 | EVT_JOY_AXIS_X1 = 0x00000001, | |
333 | EVT_JOY_AXIS_Y1 = 0x00000002, | |
334 | EVT_JOY_AXIS_X2 = 0x00000004, | |
335 | EVT_JOY_AXIS_Y2 = 0x00000008, | |
336 | EVT_JOY_AXIS_ALL = 0x0000000F | |
337 | } EVT_eventJoyAxisType; | |
338 | ||
339 | /**************************************************************************** | |
340 | REMARKS: | |
341 | Defines the event message masks for joystick events | |
342 | ||
343 | HEADER: | |
344 | event.h | |
345 | ||
346 | MEMBERS: | |
347 | EVT_JOY1_BUTTONA - Joystick 1, button A is down | |
348 | EVT_JOY1_BUTTONB - Joystick 1, button B is down | |
349 | EVT_JOY2_BUTTONA - Joystick 2, button A is down | |
350 | EVT_JOY2_BUTTONB - Joystick 2, button B is down | |
351 | ****************************************************************************/ | |
352 | typedef enum { | |
353 | EVT_JOY1_BUTTONA = 0x00000001, | |
354 | EVT_JOY1_BUTTONB = 0x00000002, | |
355 | EVT_JOY2_BUTTONA = 0x00000004, | |
356 | EVT_JOY2_BUTTONB = 0x00000008 | |
357 | } EVT_eventJoyMaskType; | |
358 | ||
359 | /**************************************************************************** | |
360 | REMARKS: | |
361 | Defines the event message masks for mouse events | |
362 | ||
363 | HEADER: | |
364 | event.h | |
365 | ||
366 | MEMBERS: | |
367 | EVT_LEFTBMASK - Left button is held down | |
368 | EVT_RIGHTBMASK - Right button is held down | |
369 | EVT_MIDDLEBMASK - Middle button is held down | |
370 | EVT_BOTHBMASK - Both left and right held down together | |
371 | EVT_ALLBMASK - All buttons pressed | |
372 | EVT_DBLCLICK - Set if mouse down event was a double click | |
373 | ****************************************************************************/ | |
374 | typedef enum { | |
375 | EVT_LEFTBMASK = 0x00000001, | |
376 | EVT_RIGHTBMASK = 0x00000002, | |
377 | EVT_MIDDLEBMASK = 0x00000004, | |
378 | EVT_BOTHBMASK = 0x00000007, | |
379 | EVT_ALLBMASK = 0x00000007, | |
380 | EVT_DBLCLICK = 0x00010000 | |
381 | } EVT_eventMouseMaskType; | |
382 | ||
383 | /**************************************************************************** | |
384 | REMARKS: | |
385 | Defines the event modifier masks. These are the masks used to extract | |
386 | the modifier information from the modifiers field of the event_t structure. | |
387 | Note that the values in the modifiers field represent the values of these | |
388 | modifier keys at the time the event occurred, not the time you decided | |
389 | to process the event. | |
390 | ||
391 | HEADER: | |
392 | event.h | |
393 | ||
394 | MEMBERS: | |
395 | EVT_LEFTBUT - Set if left mouse button was down | |
396 | EVT_RIGHTBUT - Set if right mouse button was down | |
397 | EVT_MIDDLEBUT - Set if the middle button was down | |
398 | EVT_RIGHTSHIFT - Set if right shift was down | |
399 | EVT_LEFTSHIFT - Set if left shift was down | |
400 | EVT_RIGHTCTRL - Set if right ctrl key was down | |
401 | EVT_RIGHTALT - Set if right alt key was down | |
402 | EVT_LEFTCTRL - Set if left ctrl key was down | |
403 | EVT_LEFTALT - Set if left alt key was down | |
404 | EVT_SHIFTKEY - Mask for any shift key down | |
405 | EVT_CTRLSTATE - Set if ctrl key was down | |
406 | EVT_ALTSTATE - Set if alt key was down | |
407 | EVT_CAPSLOCK - Caps lock is active | |
408 | EVT_NUMLOCK - Num lock is active | |
409 | EVT_SCROLLLOCK - Scroll lock is active | |
410 | ****************************************************************************/ | |
411 | typedef enum { | |
412 | EVT_LEFTBUT = 0x00000001, | |
413 | EVT_RIGHTBUT = 0x00000002, | |
414 | EVT_MIDDLEBUT = 0x00000004, | |
415 | EVT_RIGHTSHIFT = 0x00000008, | |
416 | EVT_LEFTSHIFT = 0x00000010, | |
417 | EVT_RIGHTCTRL = 0x00000020, | |
418 | EVT_RIGHTALT = 0x00000040, | |
419 | EVT_LEFTCTRL = 0x00000080, | |
420 | EVT_LEFTALT = 0x00000100, | |
421 | EVT_SHIFTKEY = 0x00000018, | |
422 | EVT_CTRLSTATE = 0x000000A0, | |
423 | EVT_ALTSTATE = 0x00000140, | |
424 | EVT_SCROLLLOCK = 0x00000200, | |
425 | EVT_NUMLOCK = 0x00000400, | |
426 | EVT_CAPSLOCK = 0x00000800 | |
427 | } EVT_eventModMaskType; | |
428 | ||
429 | /**************************************************************************** | |
430 | REMARKS: | |
431 | Defines the event codes returned in the event_t structures what field. Note | |
432 | that these are defined as a set of mutually exlusive bit fields, so you | |
433 | can test for multiple event types using the combined event masks defined | |
434 | in the EVT_eventMaskType enumeration. | |
435 | ||
436 | HEADER: | |
437 | event.h | |
438 | ||
439 | MEMBERS: | |
440 | EVT_NULLEVT - A null event | |
441 | EVT_KEYDOWN - Key down event | |
442 | EVT_KEYREPEAT - Key repeat event | |
443 | EVT_KEYUP - Key up event | |
444 | EVT_MOUSEDOWN - Mouse down event | |
445 | EVT_MOUSEAUTO - Mouse down autorepeat event | |
446 | EVT_MOUSEUP - Mouse up event | |
447 | EVT_MOUSEMOVE - Mouse movement event | |
448 | EVT_JOYCLICK - Joystick button state change event | |
449 | EVT_JOYMOVE - Joystick movement event | |
450 | EVT_USEREVT - First user event | |
451 | ****************************************************************************/ | |
452 | typedef enum { | |
453 | EVT_NULLEVT = 0x00000000, | |
454 | EVT_KEYDOWN = 0x00000001, | |
455 | EVT_KEYREPEAT = 0x00000002, | |
456 | EVT_KEYUP = 0x00000004, | |
457 | EVT_MOUSEDOWN = 0x00000008, | |
458 | EVT_MOUSEAUTO = 0x00000010, | |
459 | EVT_MOUSEUP = 0x00000020, | |
460 | EVT_MOUSEMOVE = 0x00000040, | |
461 | EVT_JOYCLICK = 0x00000080, | |
462 | EVT_JOYMOVE = 0x00000100, | |
463 | EVT_USEREVT = 0x00000200 | |
464 | } EVT_eventType; | |
465 | ||
466 | /**************************************************************************** | |
467 | REMARKS: | |
468 | Defines the event code masks you can use to test for multiple types of | |
469 | events, since the event codes are mutually exlusive bit fields. | |
470 | ||
471 | HEADER: | |
472 | event.h | |
473 | ||
474 | MEMBERS: | |
475 | EVT_KEYEVT - Mask for any key event | |
476 | EVT_MOUSEEVT - Mask for any mouse event | |
477 | EVT_MOUSECLICK - Mask for any mouse click event | |
478 | EVT_JOYEVT - Mask for any joystick event | |
479 | EVT_EVERYEVT - Mask for any event | |
480 | ****************************************************************************/ | |
481 | typedef enum { | |
482 | EVT_KEYEVT = (EVT_KEYDOWN | EVT_KEYREPEAT | EVT_KEYUP), | |
483 | EVT_MOUSEEVT = (EVT_MOUSEDOWN | EVT_MOUSEAUTO | EVT_MOUSEUP | EVT_MOUSEMOVE), | |
484 | EVT_MOUSECLICK = (EVT_MOUSEDOWN | EVT_MOUSEUP), | |
485 | EVT_JOYEVT = (EVT_JOYCLICK | EVT_JOYMOVE), | |
486 | EVT_EVERYEVT = 0x7FFFFFFF | |
487 | } EVT_eventMaskType; | |
488 | ||
489 | /**************************************************************************** | |
490 | REMARKS: | |
491 | Structure describing the information contained in an event extracted from | |
492 | the event queue. | |
493 | ||
494 | HEADER: | |
495 | event.h | |
496 | ||
497 | MEMBERS: | |
498 | which - Window identifier for message for use by high level window manager | |
8bde7f77 | 499 | code (i.e. MegaVision GUI or Windows API). |
c7de829c | 500 | what - Type of event that occurred. Will be one of the values defined by |
8bde7f77 | 501 | the EVT_eventType enumeration. |
c7de829c WD |
502 | when - Time that the event occurred in milliseconds since startup |
503 | where_x - X coordinate of the mouse cursor location at the time of the event | |
8bde7f77 WD |
504 | (in screen coordinates). For joystick events this represents |
505 | the position of the first joystick X axis. | |
c7de829c | 506 | where_y - Y coordinate of the mouse cursor location at the time of the event |
8bde7f77 WD |
507 | (in screen coordinates). For joystick events this represents |
508 | the position of the first joystick Y axis. | |
c7de829c | 509 | relative_x - Relative movement of the mouse cursor in the X direction (in |
8bde7f77 WD |
510 | units of mickeys, or 1/200th of an inch). For joystick events |
511 | this represents the position of the second joystick X axis. | |
c7de829c | 512 | relative_y - Relative movement of the mouse cursor in the Y direction (in |
8bde7f77 WD |
513 | units of mickeys, or 1/200th of an inch). For joystick events |
514 | this represents the position of the second joystick Y axis. | |
c7de829c | 515 | message - Event specific message for the event. For use events this can be |
8bde7f77 WD |
516 | any user specific information. For keyboard events this contains |
517 | the ASCII code in bits 0-7, the keyboard scan code in bits 8-15 and | |
518 | the character repeat count in bits 16-30. You can use the | |
519 | EVT_asciiCode, EVT_scanCode and EVT_repeatCount macros to extract | |
520 | this information from the message field. For mouse events this | |
521 | contains information about which button was pressed, and will be a | |
522 | combination of the flags defined by the EVT_eventMouseMaskType | |
523 | enumeration. For joystick events, this conatins information | |
524 | about which buttons were pressed, and will be a combination of | |
525 | the flags defined by the EVT_eventJoyMaskType enumeration. | |
c7de829c | 526 | modifiers - Contains additional information about the state of the keyboard |
8bde7f77 WD |
527 | shift modifiers (Ctrl, Alt and Shift keys) when the event |
528 | occurred. For mouse events it will also contain the state of | |
529 | the mouse buttons. Will be a combination of the values defined | |
530 | by the EVT_eventModMaskType enumeration. | |
c7de829c WD |
531 | next - Internal use; do not use. |
532 | prev - Internal use; do not use. | |
533 | ****************************************************************************/ | |
534 | typedef struct { | |
535 | ulong which; | |
536 | ulong what; | |
537 | ulong when; | |
538 | int where_x; | |
539 | int where_y; | |
540 | int relative_x; | |
541 | int relative_y; | |
542 | ulong message; | |
543 | ulong modifiers; | |
544 | int next; | |
545 | int prev; | |
546 | } event_t; | |
547 | ||
548 | /**************************************************************************** | |
549 | REMARKS: | |
550 | Structure describing an entry in the code page table. A table of translation | |
551 | codes for scan codes to ASCII codes is provided in this table to be used | |
552 | by the keyboard event libraries. On some OS'es the keyboard translation is | |
553 | handled by the OS, but for DOS and embedded systems you must register a | |
554 | different code page translation table if you want to support keyboards | |
555 | other than the US English keyboard (the default). | |
556 | ||
557 | NOTE: Entries in code page tables *must* be in ascending order for the | |
8bde7f77 WD |
558 | scan codes as we do a binary search on the tables for the ASCII |
559 | code equivalents. | |
c7de829c WD |
560 | |
561 | HEADER: | |
562 | event.h | |
563 | ||
564 | MEMBERS: | |
565 | scanCode - Scan code to translate (really the virtual scan code). | |
566 | asciiCode - ASCII code for this scan code. | |
567 | ****************************************************************************/ | |
568 | typedef struct { | |
569 | uchar scanCode; | |
570 | uchar asciiCode; | |
571 | } codepage_entry_t; | |
572 | ||
573 | /**************************************************************************** | |
574 | REMARKS: | |
575 | Structure describing a complete code page translation table. The table | |
576 | contains translation tables for normal keys, shifted keys and ctrl keys. | |
577 | The Ctrl key always has precedence over the shift table, and the shift | |
578 | table is used when the shift key is down or the CAPSLOCK key is down. | |
579 | ||
580 | HEADER: | |
581 | event.h | |
582 | ||
583 | MEMBERS: | |
584 | name - Name of the code page table (ie: "US English") | |
585 | normal - Code page for translating normal keys | |
586 | normalLen - Length of normal translation table | |
587 | caps - Code page for translating keys when CAPSLOCK is down | |
588 | capsLen - Length of CAPSLOCK translation table | |
589 | shift - Code page for shifted keys (ie: shift key is held down) | |
590 | shiftLen - Length of shifted translation table | |
591 | shiftCaps - Code page for shifted keys when CAPSLOCK is down | |
592 | shiftCapsLen - Length of shifted CAPSLOCK translation table | |
593 | ctrl - Code page for ctrl'ed keys (ie: ctrl key is held down) | |
594 | ctrlLen - Length of ctrl'ed translation table | |
595 | numPad - Code page for NUMLOCK'ed keypad keys | |
596 | numPadLen - Length of NUMLOCK'ed translation table | |
597 | ****************************************************************************/ | |
598 | typedef struct { | |
599 | char name[20]; | |
600 | codepage_entry_t *normal; | |
601 | int normalLen; | |
602 | codepage_entry_t *caps; | |
603 | int capsLen; | |
604 | codepage_entry_t *shift; | |
605 | int shiftLen; | |
606 | codepage_entry_t *shiftCaps; | |
607 | int shiftCapsLen; | |
608 | codepage_entry_t *ctrl; | |
609 | int ctrlLen; | |
610 | codepage_entry_t *numPad; | |
611 | int numPadLen; | |
612 | } codepage_t; | |
613 | ||
614 | /* {secret} */ | |
615 | typedef ibool (EVTAPIP _EVT_userEventFilter)(event_t *evt); | |
616 | /* {secret} */ | |
617 | typedef void (EVTAPIP _EVT_mouseMoveHandler)(int x,int y); | |
618 | /* {secret} */ | |
619 | typedef void (EVTAPIP _EVT_heartBeatCallback)(void *params); | |
620 | ||
621 | /* Macro to find the size of a static array */ | |
622 | ||
623 | #define EVT_ARR_SIZE(a) (sizeof(a)/sizeof((a)[0])) | |
624 | ||
625 | #pragma pack() | |
626 | ||
627 | /*--------------------------- Global variables ----------------------------*/ | |
628 | ||
629 | #ifdef __cplusplus | |
630 | extern "C" { /* Use "C" linkage when in C++ mode */ | |
631 | #endif | |
632 | ||
633 | /* Standard code page tables */ | |
634 | ||
635 | extern codepage_t _CP_US_English; | |
636 | ||
637 | /*------------------------- Function Prototypes ---------------------------*/ | |
638 | ||
639 | /* Public API functions for user applications */ | |
640 | ||
641 | ibool EVTAPI EVT_getNext(event_t *evt,ulong mask); | |
642 | ibool EVTAPI EVT_peekNext(event_t *evt,ulong mask); | |
643 | ibool EVTAPI EVT_post(ulong which,ulong what,ulong message,ulong modifiers); | |
644 | void EVTAPI EVT_flush(ulong mask); | |
645 | void EVTAPI EVT_halt(event_t *evt,ulong mask); | |
646 | ibool EVTAPI EVT_isKeyDown(uchar scanCode); | |
647 | void EVTAPI EVT_setMousePos(int x,int y); | |
648 | void EVTAPI EVT_getMousePos(int *x,int *y); | |
649 | ||
650 | /* Function to enable/disable updating of keyboard LED status indicators */ | |
651 | ||
652 | void EVTAPI EVT_allowLEDS(ibool enable); | |
653 | ||
654 | /* Function to install a custom keyboard code page. Default is US English */ | |
655 | ||
656 | codepage_t *EVTAPI EVT_getCodePage(void); | |
657 | void EVTAPI EVT_setCodePage(codepage_t *page); | |
658 | ||
659 | /* Functions for fine grained joystick calibration */ | |
660 | ||
661 | void EVTAPI EVT_pollJoystick(void); | |
662 | int EVTAPI EVT_joyIsPresent(void); | |
663 | void EVTAPI EVT_joySetUpperLeft(void); | |
664 | void EVTAPI EVT_joySetLowerRight(void); | |
665 | void EVTAPI EVT_joySetCenter(void); | |
666 | ||
667 | /* Install user supplied event filter callback */ | |
668 | ||
669 | void EVTAPI EVT_setUserEventFilter(_EVT_userEventFilter filter); | |
670 | ||
671 | /* Install user supplied event heartbeat callback function */ | |
672 | ||
673 | void EVTAPI EVT_setHeartBeatCallback(_EVT_heartBeatCallback callback,void *params); | |
674 | void EVTAPI EVT_getHeartBeatCallback(_EVT_heartBeatCallback *callback,void **params); | |
675 | ||
676 | /* Internal functions to initialise and kill the event manager. MGL | |
677 | * applications should never call these functions directly as the MGL | |
678 | * libraries do it for you. | |
679 | */ | |
680 | ||
681 | /* {secret} */ | |
682 | void EVTAPI EVT_init(_EVT_mouseMoveHandler mouseMove); | |
683 | /* {secret} */ | |
684 | void EVTAPI EVT_setMouseRange(int xRes,int yRes); | |
685 | /* {secret} */ | |
686 | void EVTAPI EVT_suspend(void); | |
687 | /* {secret} */ | |
688 | void EVTAPI EVT_resume(void); | |
689 | /* {secret} */ | |
690 | void EVTAPI EVT_exit(void); | |
691 | ||
692 | #ifdef __cplusplus | |
693 | } /* End of "C" linkage for C++ */ | |
694 | #endif /* __cplusplus */ | |
695 | ||
696 | #endif /* __EVENT_H */ |