home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Inc&AD2.1 / includes / devices / inputevent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-11  |  7.2 KB  |  228 lines

  1. #ifndef DEVICES_INPUTEVENT_H
  2. #define DEVICES_INPUTEVENT_H
  3. /*
  4. **    $VER: inputevent.h 36.7 (22.01.91)
  5. **    Includes Release 38.56
  6. **
  7. **    input event definitions
  8. **
  9. **    (C) Copyright 1985-1992 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef DEVICES_TIMER_H
  14. #include "devices/timer.h"
  15. #endif
  16.  
  17. /*----- constants --------------------------------------------------*/
  18.  
  19. /*  --- InputEvent.ie_Class --- */
  20. /* A NOP input event */
  21. #define IECLASS_NULL            0x00
  22. /* A raw keycode from the keyboard device */
  23. #define IECLASS_RAWKEY            0x01
  24. /* The raw mouse report from the game port device */
  25. #define IECLASS_RAWMOUSE        0x02
  26. /* A private console event */
  27. #define IECLASS_EVENT            0x03
  28. /* A Pointer Position report */
  29. #define IECLASS_POINTERPOS        0x04
  30. /* A timer event */
  31. #define IECLASS_TIMER            0x06
  32. /* select button pressed down over a Gadget (address in ie_EventAddress) */
  33. #define IECLASS_GADGETDOWN        0x07
  34. /* select button released over the same Gadget (address in ie_EventAddress) */
  35. #define IECLASS_GADGETUP        0x08
  36. /* some Requester activity has taken place.  See Codes REQCLEAR and REQSET */
  37. #define IECLASS_REQUESTER        0x09
  38. /* this is a Menu Number transmission (Menu number is in ie_Code) */
  39. #define IECLASS_MENULIST        0x0A
  40. /* User has selected the active Window's Close Gadget */
  41. #define IECLASS_CLOSEWINDOW        0x0B
  42. /* this Window has a new size */
  43. #define IECLASS_SIZEWINDOW        0x0C
  44. /* the Window pointed to by ie_EventAddress needs to be refreshed */
  45. #define IECLASS_REFRESHWINDOW        0x0D
  46. /* new preferences are available */
  47. #define IECLASS_NEWPREFS        0x0E
  48. /* the disk has been removed */
  49. #define IECLASS_DISKREMOVED        0x0F
  50. /* the disk has been inserted */
  51. #define IECLASS_DISKINSERTED        0x10
  52. /* the window is about to be been made active */
  53. #define IECLASS_ACTIVEWINDOW        0x11
  54. /* the window is about to be made inactive */
  55. #define IECLASS_INACTIVEWINDOW        0x12
  56. /* extended-function pointer position report (V36) */
  57. #define IECLASS_NEWPOINTERPOS        0x13
  58. /* Help key report during Menu session (V36) */
  59. #define IECLASS_MENUHELP        0x14
  60. /* the Window has been modified with move, size, zoom, or change (V36) */
  61. #define    IECLASS_CHANGEWINDOW        0x15
  62.  
  63. /* the last class */
  64. #define IECLASS_MAX            0x15
  65.  
  66.  
  67. /*  --- InputEvent.ie_SubClass --- */
  68. /*  IECLASS_NEWPOINTERPOS */
  69. /*    like IECLASS_POINTERPOS */
  70. #define IESUBCLASS_COMPATIBLE    0x00
  71. /*    ie_EventAddress points to struct IEPointerPixel */
  72. #define IESUBCLASS_PIXEL    0x01
  73. /*    ie_EventAddress points to struct IEPointerTablet */
  74. #define IESUBCLASS_TABLET    0x02
  75.  
  76. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  77.  * and IESUBCLASS_PIXEL.
  78.  *
  79.  * You specify a screen and pixel coordinates in that screen
  80.  * at which you'd like the mouse to be positioned.
  81.  * Intuition will try to oblige, but there will be restrictions
  82.  * to positioning the pointer over offscreen pixels.
  83.  *
  84.  * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  85.  */
  86. struct IEPointerPixel    {
  87.     struct Screen    *iepp_Screen;    /* pointer to an open screen */
  88.     struct {                /* pixel coordinates in iepp_Screen */
  89.     WORD    X;
  90.     WORD    Y;
  91.     }            iepp_Position;
  92. };
  93.  
  94. /* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  95.  * and IESUBCLASS_TABLET.
  96.  *
  97.  * You specify a range of values and a value within the range
  98.  * independently for each of X and Y (the minimum value of
  99.  * the ranges is always normalized to 0).
  100.  *
  101.  * Intuition will position the mouse proportionally within its
  102.  * natural mouse position rectangle limits.
  103.  *
  104.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  105.  */
  106. struct IEPointerTablet    {
  107.     struct {
  108.     UWORD    X;
  109.     UWORD    Y;
  110.     }            iept_Range;    /* 0 is min, these are max    */
  111.     struct {
  112.     UWORD    X;
  113.     UWORD    Y;
  114.     }            iept_Value;    /* between 0 and iept_Range    */
  115.  
  116.     WORD        iept_Pressure;    /* -128 to 127 (unused, set to 0)  */
  117. };
  118.  
  119.  
  120.  
  121. /*  --- InputEvent.ie_Code --- */
  122. /*  IECLASS_RAWKEY */
  123. #define IECODE_UP_PREFIX        0x80
  124. #define IECODE_KEY_CODE_FIRST        0x00
  125. #define IECODE_KEY_CODE_LAST        0x77
  126. #define IECODE_COMM_CODE_FIRST        0x78
  127. #define IECODE_COMM_CODE_LAST        0x7F
  128.  
  129. /*  IECLASS_ANSI */
  130. #define IECODE_C0_FIRST            0x00
  131. #define IECODE_C0_LAST            0x1F
  132. #define IECODE_ASCII_FIRST        0x20
  133. #define IECODE_ASCII_LAST        0x7E
  134. #define IECODE_ASCII_DEL        0x7F
  135. #define IECODE_C1_FIRST            0x80
  136. #define IECODE_C1_LAST            0x9F
  137. #define IECODE_LATIN1_FIRST        0xA0
  138. #define IECODE_LATIN1_LAST        0xFF
  139.  
  140. /*  IECLASS_RAWMOUSE */
  141. #define IECODE_LBUTTON            0x68    /* also uses IECODE_UP_PREFIX */
  142. #define IECODE_RBUTTON            0x69
  143. #define IECODE_MBUTTON            0x6A
  144. #define IECODE_NOBUTTON            0xFF
  145.  
  146. /*  IECLASS_EVENT (V36) */
  147. #define IECODE_NEWACTIVE        0x01    /* new active input window */
  148. #define IECODE_NEWSIZE            0x02    /* resize of window */
  149. #define IECODE_REFRESH            0x03    /* refresh of window */
  150.  
  151. /*  IECLASS_REQUESTER */
  152. /*    broadcast when the first Requester (not subsequent ones) opens up in */
  153. /*    the Window */
  154. #define IECODE_REQSET            0x01
  155. /*    broadcast when the last Requester clears out of the Window */
  156. #define IECODE_REQCLEAR            0x00
  157.  
  158.  
  159.  
  160. /*  --- InputEvent.ie_Qualifier --- */
  161. #define IEQUALIFIER_LSHIFT        0x0001
  162. #define IEQUALIFIER_RSHIFT        0x0002
  163. #define IEQUALIFIER_CAPSLOCK        0x0004
  164. #define IEQUALIFIER_CONTROL        0x0008
  165. #define IEQUALIFIER_LALT        0x0010
  166. #define IEQUALIFIER_RALT        0x0020
  167. #define IEQUALIFIER_LCOMMAND        0x0040
  168. #define IEQUALIFIER_RCOMMAND        0x0080
  169. #define IEQUALIFIER_NUMERICPAD        0x0100
  170. #define IEQUALIFIER_REPEAT        0x0200
  171. #define IEQUALIFIER_INTERRUPT        0x0400
  172. #define IEQUALIFIER_MULTIBROADCAST    0x0800
  173. #define IEQUALIFIER_MIDBUTTON        0x1000
  174. #define IEQUALIFIER_RBUTTON        0x2000
  175. #define IEQUALIFIER_LEFTBUTTON        0x4000
  176. #define IEQUALIFIER_RELATIVEMOUSE    0x8000
  177.  
  178. #define IEQUALIFIERB_LSHIFT        0
  179. #define IEQUALIFIERB_RSHIFT        1
  180. #define IEQUALIFIERB_CAPSLOCK        2
  181. #define IEQUALIFIERB_CONTROL        3
  182. #define IEQUALIFIERB_LALT        4
  183. #define IEQUALIFIERB_RALT        5
  184. #define IEQUALIFIERB_LCOMMAND        6
  185. #define IEQUALIFIERB_RCOMMAND        7
  186. #define IEQUALIFIERB_NUMERICPAD        8
  187. #define IEQUALIFIERB_REPEAT        9
  188. #define IEQUALIFIERB_INTERRUPT        10
  189. #define IEQUALIFIERB_MULTIBROADCAST    11
  190. #define IEQUALIFIERB_MIDBUTTON        12
  191. #define IEQUALIFIERB_RBUTTON        13
  192. #define IEQUALIFIERB_LEFTBUTTON        14
  193. #define IEQUALIFIERB_RELATIVEMOUSE    15
  194.  
  195. /*----- InputEvent -------------------------------------------------*/
  196.  
  197. struct InputEvent {
  198.     struct  InputEvent *ie_NextEvent;    /* the chronologically next event */
  199.     UBYTE   ie_Class;            /* the input event class */
  200.     UBYTE   ie_SubClass;        /* optional subclass of the class */
  201.     UWORD   ie_Code;            /* the input event code */
  202.     UWORD   ie_Qualifier;        /* qualifiers in effect for the event*/
  203.     union {
  204.     struct {
  205.         WORD    ie_x;        /* the pointer position for the event*/
  206.         WORD    ie_y;
  207.     } ie_xy;
  208.     APTR    ie_addr;        /* the event address */
  209.     struct {
  210.         UBYTE   ie_prev1DownCode;    /* previous down keys for dead */
  211.         UBYTE   ie_prev1DownQual;    /*   key translation: the ie_Code */
  212.         UBYTE   ie_prev2DownCode;    /*   & low byte of ie_Qualifier for */
  213.         UBYTE   ie_prev2DownQual;    /*   last & second last down keys */
  214.     } ie_dead;
  215.     } ie_position;
  216.     struct timeval ie_TimeStamp;    /* the system tick at the event */
  217. };
  218.  
  219. #define    ie_X            ie_position.ie_xy.ie_x
  220. #define    ie_Y            ie_position.ie_xy.ie_y
  221. #define    ie_EventAddress        ie_position.ie_addr
  222. #define    ie_Prev1DownCode    ie_position.ie_dead.ie_prev1DownCode
  223. #define    ie_Prev1DownQual    ie_position.ie_dead.ie_prev1DownQual
  224. #define    ie_Prev2DownCode    ie_position.ie_dead.ie_prev2DownCode
  225. #define    ie_Prev2DownQual    ie_position.ie_dead.ie_prev2DownQual
  226.  
  227. #endif    /* DEVICES_INPUTEVENT_H */
  228.