home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / M2V11-1.LHA / modula / amiga / InputEvent.def < prev    next >
Encoding:
Text File  |  1994-09-28  |  9.6 KB  |  273 lines

  1. DEFINITION FOR C MODULE InputEvent ;
  2.  
  3. FROM SYSTEM IMPORT SHORTSET , ADDRESS ;
  4. IMPORT Timer , Utility ;
  5.  
  6. TYPE
  7.   IEPointerPixelPtr    = POINTER TO IEPointerPixel  ;
  8.   IEPointerTabletPtr    = POINTER TO IEPointerTablet ;
  9.   IENewTabletPtr    = POINTER TO IENewTablet     ;
  10.   InputEventPtr        = POINTER TO InputEvent         ;
  11.  
  12. (*----- constants --------------------------------------------------*)
  13.  
  14. (*  --- InputEvent.ie_Class --- *)
  15.  
  16. CONST
  17.   IECLASS_NULL        = 000H ; (* A NOP input event                  *)
  18.   IECLASS_RAWKEY    = 001H ; (* A raw keycode from the keyboard device    *)
  19.  
  20.   IECLASS_RAWMOUSE    = 002H ; (* The raw mouse report from the game port   *)
  21.                    (* device                      *)
  22.  
  23.   IECLASS_EVENT        = 003H ; (* A private console event              *)
  24.   IECLASS_POINTERPOS    = 004H ; (* A Pointer Position report              *)
  25.   IECLASS_TIMER        = 006H ; (* A timer event                  *)
  26.  
  27.   IECLASS_GADGETDOWN    = 007H ; (* select button pressed down over a          *)
  28.                    (* Gadget (address in ie_EventAddress)          *)
  29.  
  30.   IECLASS_GADGETUP    = 008H ; (* select button released over the same      *)
  31.                    (* Gadget (address in ie_EventAddress)          *)
  32.  
  33.   IECLASS_REQUESTER    = 009H ; (* some Requester activity has taken place.  *)
  34.                    (* See Codes REQCLEAR and REQSET          *)
  35.  
  36.   IECLASS_MENULIST    = 00AH ; (* this is a Menu Number transmission        *)
  37.                    (* (Menu number is in ie_Code)              *)
  38.   IECLASS_CLOSEWINDOW    = 00BH ; (* User has selected the active Window's     *)
  39.                    (* Close Gadget                  *)
  40.  
  41.   IECLASS_SIZEWINDOW    = 00CH ; (* this Window has a new size              *)
  42.   IECLASS_REFRESHWINDOW    = 00DH ; (* the Window pointed to by ie_EventAddress  *)
  43.                    (* needs to be refreshed              *)
  44.  
  45.   IECLASS_NEWPREFS    = 00EH ; (* new preferences are available          *)
  46.   IECLASS_DISKREMOVED    = 00FH ; (* the disk has been removed              *)
  47.   IECLASS_DISKINSERTED    = 010H ; (* the disk has been inserted              *)
  48.   IECLASS_ACTIVEWINDOW    = 011H ; (* the window is about to be been made active*)
  49.  
  50.  
  51.   IECLASS_INACTIVEWINDOW = 012H ; (* the window is about to be made inactive  *)
  52.   IECLASS_NEWPOINTERPOS     = 013H ; (* extended-function pointer position report*)
  53.   IECLASS_MENUHELP     = 014H ; (* Help key report during Menu session (V36)*)
  54.  
  55.   IECLASS_CHANGEWINDOW     = 015H ; (* the Window has been modified with move   *)
  56.                     (* size, zoom, or change (V36)          *)
  57.  
  58.   IECLASS_MAX         = 015H ; (* the last class                  *)
  59.  
  60.  
  61. (*  --- InputEvent.ie_SubClass --- *)
  62. (*  IECLASS_NEWPOINTERPOS *)
  63.  
  64.   IESUBCLASS_COMPATIBLE     = 000H ; (* like IECLASS_POINTERPOS              *)
  65.  
  66.   IESUBCLASS_PIXEL     = 001H ; (* ie_EventAddress points to struct          *)
  67.                     (* IEPointerPixel                  *)
  68.  
  69.   IESUBCLASS_TABLET     = 002H ; (* ie_EventAddress points to struct          *)
  70.                     (* IEPointerTablet                  *)
  71.  
  72.   IESUBCLASS_NEWTABLET   = 003H ; (* ie_EventAddress points to IENewTablet    *)
  73.  
  74. (* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,    *)
  75. (* and IESUBCLASS_PIXEL.                    *)
  76. (*                                *)
  77. (* You specify a screen and pixel coordinates in that screen    *)
  78. (* at which you'd like the mouse to be positioned.        *)
  79. (* Intuition will try to oblige, but there will be restrictions    *)
  80. (* to positioning the pointer over offscreen pixels.        *)
  81. (*                                *)
  82. (* IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.    *)
  83.  
  84. TYPE
  85.   IEPointerPixel = RECORD
  86.     iepp_Screen : ADDRESS ; (* pointer to an open screen    *)
  87.     iepp_Position : RECORD X,Y : INTEGER END ;
  88.                     (* pixel coordinates in iepp_Screen *)
  89.   END ;
  90.  
  91. (* pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,        *)
  92. (* and IESUBCLASS_TABLET.                        *)
  93. (*                                    *)
  94. (* You specify a range of values and a value within the range        *)
  95. (* independently for each of X and Y (the minimum value of        *)
  96. (* the ranges is always normalized to 0).                *)
  97. (*                                    *)
  98. (* Intuition will position the mouse proportionally within its        *)
  99. (* natural mouse position rectangle limits.                *)
  100. (*                                    *)
  101. (* IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.    *)
  102.  
  103. TYPE
  104.   IEPointerTablet = RECORD
  105.     iept_Range      : RECORD X,Y : CARDINAL END ; (* 0 is min, these are max  *)
  106.     iept_Value      : RECORD X,Y : CARDINAL END ; (* between 0 and iept_Range *)
  107.     iept_Pressure : INTEGER ;    (* -128 to 127 (unused, set to 0)  *)
  108.   END ;
  109.  
  110.  
  111. (* The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass    *)
  112. (* IESUBCLASS_NEWTABLET points at an IENewTablet structure.        *)
  113. (*                                    *)
  114. (* IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.    *)
  115.  
  116. TYPE
  117.   IENewTablet = RECORD
  118.  
  119.     (* Pointer to a hook you wish to be called back through, in        *)
  120.     (* order to handle scaling.  You will be provided with the        *)
  121.     (* width and height you are expected to scale your tablet        *)
  122.     (* to, perhaps based on some user preferences.            *)
  123.     (* If NULL, the tablet's specified range will be mapped directly    *)
  124.     (* to that width and height for you, and you will not be        *)
  125.     (* called back.                            *)
  126.  
  127.      ient_CallBack : Utility.HookPtr ;
  128.  
  129.     (* Post-scaling coordinates and fractional coordinates.        *)
  130.     (* DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!        *)
  131.     (* Your driver will be called back and provided information        *)
  132.     (* about the width and height of the area to scale the        *)
  133.     (* tablet into.  It should scale the tablet coordinates        *)
  134.     (* (perhaps based on some preferences controlling aspect        *)
  135.     (* ratio, etc.) and place the scaled result into these        *)
  136.     (* fields.    The ient_ScaledX and ient_ScaledY fields are        *)
  137.     (* in screen-pixel resolution, but the origin ( [0,0]-point )    *)
  138.     (* is not defined.    The ient_ScaledXFraction and            *)
  139.     (* ient_ScaledYFraction fields represent sub-pixel position        *)
  140.     (* information, and should be scaled to fill a UWORD fraction.    *)
  141.  
  142.     ient_ScaledX, ient_ScaledY : CARDINAL ;
  143.     ient_ScaledXFraction, ient_ScaledYFraction : CARDINAL ;
  144.  
  145.     (* Current tablet coordinates along each axis: *)
  146.     ient_TabletX, ient_TabletY : LONGINT ;
  147.  
  148.     (* Tablet range along each axis.  For example, if ient_TabletX    *)
  149.     (* can take values 0-999, ient_RangeX should be 1000.        *)
  150.  
  151.     ient_RangeX, ient_RangeY : LONGINT ;
  152.  
  153.     (* Pointer to tag-list of additional tablet attributes.    *)
  154.     (* See <intuition/intuition.h> for the tag values.        *)
  155.  
  156.     ient_TagList : Utility.TagItemPtr ;
  157.   END ;
  158.  
  159.  
  160. (*  --- InputEvent.ie_Code --- *)
  161. (*  IECLASS_RAWKEY *)
  162. CONST
  163.   IECODE_UP_PREFIX      = 080H ;
  164.   IECODE_KEY_CODE_FIRST      = 000H ;
  165.   IECODE_KEY_CODE_LAST      = 077H ;
  166.   IECODE_COMM_CODE_FIRST  = 078H ;
  167.   IECODE_COMM_CODE_LAST      = 07FH ;
  168.  
  169. (*  IECLASS_ANSI *)
  170.   IECODE_C0_FIRST    = 000H ;
  171.   IECODE_C0_LAST    = 01FH ;
  172.   IECODE_ASCII_FIRST    = 020H ;
  173.   IECODE_ASCII_LAST    = 07EH ;
  174.   IECODE_ASCII_DEL    = 07FH ;
  175.   IECODE_C1_FIRST    = 080H ;
  176.   IECODE_C1_LAST    = 09FH ;
  177.   IECODE_LATIN1_FIRST    = 0A0H ;
  178.   IECODE_LATIN1_LAST    = 0FFH ;
  179.  
  180. (*  IECLASS_RAWMOUSE *)
  181.   IECODE_LBUTTON    = 068H ; (* also uses IECODE_UP_PREFIX *)
  182.   IECODE_RBUTTON    = 069H ;
  183.   IECODE_MBUTTON    = 06AH ;
  184.   IECODE_NOBUTTON    = 0FFH ;
  185.  
  186. (*  IECLASS_EVENT (V36) *)
  187.  
  188.   IECODE_NEWACTIVE = 001H ; (* new active input window  *)
  189.   IECODE_NEWSIZE   = 002H ; (* resize of window        *)
  190.   IECODE_REFRESH   = 003H ; (* refresh of window    *)
  191.  
  192. (*  IECLASS_REQUESTER *)
  193. (*   broadcast when the first Requester (not subsequent ones) opens up in *)
  194. (*   the Window                                  *)
  195.   IECODE_REQSET      = 01H ;
  196.  
  197. (*    broadcast when the last Requester clears out of the Window *)
  198.   IECODE_REQCLEAR = 000H ;
  199.  
  200. (*  --- InputEvent.ie_Qualifier --- *)
  201.  
  202.   IEQUALIFIERB_LSHIFT        =  0 ;
  203.   IEQUALIFIERB_RSHIFT        =  1 ;
  204.   IEQUALIFIERB_CAPSLOCK        =  2 ;
  205.   IEQUALIFIERB_CONTROL        =  3 ;
  206.   IEQUALIFIERB_LALT        =  4 ;
  207.   IEQUALIFIERB_RALT        =  5 ;
  208.   IEQUALIFIERB_LCOMMAND        =  6 ;
  209.   IEQUALIFIERB_RCOMMAND        =  7 ;
  210.   IEQUALIFIERB_NUMERICPAD    =  8 ;
  211.   IEQUALIFIERB_REPEAT        =  9 ;
  212.   IEQUALIFIERB_INTERRUPT    = 10 ;
  213.   IEQUALIFIERB_MULTIBROADCAST    = 11 ;
  214.   IEQUALIFIERB_MIDBUTTON    = 12 ;
  215.   IEQUALIFIERB_RBUTTON        = 13 ;
  216.   IEQUALIFIERB_LEFTBUTTON    = 14 ;
  217.   IEQUALIFIERB_RELATIVEMOUSE    = 15 ;
  218.  
  219.   IEQUALIFIER_LSHIFT        =  {0} ;
  220.   IEQUALIFIER_RSHIFT        =  {1} ;
  221.   IEQUALIFIER_CAPSLOCK        =  {2} ;
  222.   IEQUALIFIER_CONTROL        =  {3} ;
  223.   IEQUALIFIER_LALT        =  {4} ;
  224.   IEQUALIFIER_RALT        =  {5} ;
  225.   IEQUALIFIER_LCOMMAND        =  {6} ;
  226.   IEQUALIFIER_RCOMMAND        =  {7} ;
  227.   IEQUALIFIER_NUMERICPAD    =  {8} ;
  228.   IEQUALIFIER_REPEAT        =  {9} ;
  229.   IEQUALIFIER_INTERRUPT        = {10} ;
  230.   IEQUALIFIER_MULTIBROADCAST    = {11} ;
  231.   IEQUALIFIER_MIDBUTTON        = {12} ;
  232.   IEQUALIFIER_RBUTTON        = {13} ;
  233.   IEQUALIFIER_LEFTBUTTON    = {14} ;
  234.   IEQUALIFIER_RELATIVEMOUSE    = {15} ;
  235.  
  236. (*----- InputEvent -------------------------------------------------*)
  237.  
  238. TYPE
  239.   InputEvent = RECORD
  240.     ie_NextEvent : InputEventPtr; (* the chronologically next event    *)
  241.     ie_Class     : SHORTCARD    ; (* the input event class        *)
  242.     ie_SubClass     : SHORTCARD    ; (* optional subclass of the class    *)
  243.     ie_Code     : CARDINAL    ; (* the input event code        *)
  244.     ie_Qualifier : BITSET    ; (* qualifiers in effect for the event    *)
  245.     CASE :LONGINT OF
  246.     |0:
  247.     ie_Position  : RECORD
  248.         CASE :LONGINT OF
  249.         |0: ie_xy   : RECORD ie_x,ie_y : INTEGER END ;
  250.         |1: ie_addr : ADDRESS ; (* the event address *)
  251.         |2: ie_dead : RECORD
  252.         ie_prev1DownCode : SHORTCARD ; (* previous down keys for dead     *)
  253.         ie_prev1DownQual : SHORTSET  ; (*   key translation: the ie_Code  *)
  254.         ie_prev2DownCode : SHORTCARD ; (*   & low byte of ie_Qualifier for*)
  255.         ie_prev2DownQual : SHORTSET  ; (*   last & second last down keys  *)
  256.           END ;
  257.         END ;
  258.       END ;
  259.     |2:
  260.       CASE :LONGINT OF
  261.       |0: ie_X , ie_Y       : INTEGER   ;
  262.       |1: ie_EventAddress  : ADDRESS   ;
  263.       |2: ie_Prev1DownCode : SHORTCARD ;
  264.       ie_Prev1DownQual : SHORTSET  ;
  265.       ie_Prev2DownCode : SHORTCARD ;
  266.       ie_Prev2DownQual : SHORTSET  ;
  267.       END ;
  268.     END ;
  269.     ie_TimeStamp : Timer.TimeVal ;    (* the system tick at the event *)
  270.   END ;
  271.  
  272. END InputEvent.
  273.