inputevent.pas 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. {
  2. This file is part of the Free Pascal run time library.
  3. A file in Amiga system run time library.
  4. Copyright (c) 1998 by Nils Sjoholm
  5. member of the Amiga RTL development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. unit inputevent;
  13. INTERFACE
  14. uses exec, utility, timer;
  15. const
  16. {------ constants -------------------------------------------------}
  17. { --- InputEvent.ie_Class --- }
  18. { A NOP input event }
  19. IECLASS_NULL = $00;
  20. { A raw keycode from the keyboard device }
  21. IECLASS_RAWKEY = $01;
  22. { The raw mouse report from the game port device }
  23. IECLASS_RAWMOUSE = $02;
  24. { A private console event }
  25. IECLASS_EVENT = $03;
  26. { A Pointer Position report }
  27. IECLASS_POINTERPOS = $04;
  28. { A timer event }
  29. IECLASS_TIMER = $06;
  30. { select button pressed down over a Gadget (address in ie_EventAddress) }
  31. IECLASS_GADGETDOWN = $07;
  32. { select button released over the same Gadget (address in ie_EventAddress) }
  33. IECLASS_GADGETUP = $08;
  34. { some Requester activity has taken place. See Codes REQCLEAR and REQSET }
  35. IECLASS_REQUESTER = $09;
  36. { this is a Menu Number transmission (Menu number is in ie_Code) }
  37. IECLASS_MENULIST = $0A;
  38. { User has selected the active Window's Close Gadget }
  39. IECLASS_CLOSEWINDOW = $0B;
  40. { this Window has a new size }
  41. IECLASS_SIZEWINDOW = $0C;
  42. { the Window pointed to by ie_EventAddress needs to be refreshed }
  43. IECLASS_REFRESHWINDOW = $0D;
  44. { new preferences are available }
  45. IECLASS_NEWPREFS = $0E;
  46. { the disk has been removed }
  47. IECLASS_DISKREMOVED = $0F;
  48. { the disk has been inserted }
  49. IECLASS_DISKINSERTED = $10;
  50. { the window is about to be been made active }
  51. IECLASS_ACTIVEWINDOW = $11;
  52. { the window is about to be made inactive }
  53. IECLASS_INACTIVEWINDOW = $12;
  54. { extended-function pointer position report (V36) }
  55. IECLASS_NEWPOINTERPOS = $13;
  56. { Help key report during Menu session (V36) }
  57. IECLASS_MENUHELP = $14;
  58. { the Window has been modified with move, size, zoom, or change (V36) }
  59. IECLASS_CHANGEWINDOW = $15;
  60. { the last class }
  61. IECLASS_MAX = $15;
  62. { --- InputEvent.ie_SubClass --- }
  63. { IECLASS_NEWPOINTERPOS }
  64. { like IECLASS_POINTERPOS }
  65. IESUBCLASS_COMPATIBLE = $00;
  66. { ie_EventAddress points to struct IEPointerPixel }
  67. IESUBCLASS_PIXEL = $01;
  68. { ie_EventAddress points to struct IEPointerTablet }
  69. IESUBCLASS_TABLET = $02;
  70. { pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  71. * and IESUBCLASS_PIXEL.
  72. *
  73. * You specify a screen and pixel coordinates in that screen
  74. * at which you'd like the mouse to be positioned.
  75. * Intuition will try to oblige, but there will be restrictions
  76. * to positioning the pointer over offscreen pixels.
  77. *
  78. * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  79. }
  80. Type
  81. pIEPointerPixel = ^tIEPointerPixel;
  82. tIEPointerPixel = record
  83. iepp_Screen : Pointer; { pointer to an open screen }
  84. iepp_Position : record
  85. x,y : smallint;
  86. end;
  87. END;
  88. { pointed to by ie_EventAddress for IECLASS_NEWPOINTERPOS,
  89. * and IESUBCLASS_TABLET.
  90. *
  91. * You specify a range of values and a value within the range
  92. * independently for each of X and Y (the minimum value of
  93. * the ranges is always normalized to 0).
  94. *
  95. * Intuition will position the mouse proportionally within its
  96. * natural mouse position rectangle limits.
  97. *
  98. * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  99. }
  100. pIEPointerTablet = ^tIEPointerTablet;
  101. tIEPointerTablet = record
  102. iept_Range : record { 0 is min, these are max }
  103. x,y : Word;
  104. end;
  105. iept_Value : record { between 0 AND iept_Range }
  106. x,y : Word;
  107. end;
  108. iept_Pressure : Word; { -128 to 127 (unused, set to 0) }
  109. END;
  110. { The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass
  111. * IESUBCLASS_NEWTABLET points at an IENewTablet structure.
  112. *
  113. *
  114. * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.
  115. }
  116. pIENewTablet = ^tIENewTablet;
  117. tIENewTablet = record
  118. { Pointer to a hook you wish to be called back through, in
  119. * order to handle scaling. You will be provided with the
  120. * width and height you are expected to scale your tablet
  121. * to, perhaps based on some user preferences.
  122. * If NULL, the tablet's specified range will be mapped directly
  123. * to that width and height for you, and you will not be
  124. * called back.
  125. }
  126. ient_CallBack : pHook;
  127. { Post-scaling coordinates and fractional coordinates.
  128. * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
  129. * Your driver will be called back and provided information
  130. * about the width and height of the area to scale the
  131. * tablet into. It should scale the tablet coordinates
  132. * (perhaps based on some preferences controlling aspect
  133. * ratio, etc.) and place the scaled result into these
  134. * fields. The ient_ScaledX and ient_ScaledY fields are
  135. * in screen-pixel resolution, but the origin ( [0,0]-point )
  136. * is not defined. The ient_ScaledXFraction and
  137. * ient_ScaledYFraction fields represent sub-pixel position
  138. * information, and should be scaled to fill a UWORD fraction.
  139. }
  140. ient_ScaledX, ient_ScaledY,
  141. ient_ScaledXFraction, ient_ScaledYFraction : WORD;
  142. { Current tablet coordinates along each axis: }
  143. ient_TabletX, ient_TabletY : ULONG;
  144. { Tablet range along each axis. For example, if ient_TabletX
  145. * can take values 0-999, ient_RangeX should be 1000.
  146. }
  147. ient_RangeX, ient_RangeY : ULONG;
  148. { Pointer to tag-list of additional tablet attributes.
  149. * See <intuition/intuition.h> for the tag values.
  150. }
  151. ient_TagList : pTagItem;
  152. end;
  153. CONST
  154. { --- InputEvent.ie_Code --- }
  155. { IECLASS_RAWKEY }
  156. IECODE_UP_PREFIX = $80;
  157. IECODE_KEY_CODE_FIRST = $00;
  158. IECODE_KEY_CODE_LAST = $77;
  159. IECODE_COMM_CODE_FIRST = $78;
  160. IECODE_COMM_CODE_LAST = $7F;
  161. { IECLASS_ANSI }
  162. IECODE_C0_FIRST = $00;
  163. IECODE_C0_LAST = $1F;
  164. IECODE_ASCII_FIRST = $20;
  165. IECODE_ASCII_LAST = $7E;
  166. IECODE_ASCII_DEL = $7F;
  167. IECODE_C1_FIRST = $80;
  168. IECODE_C1_LAST = $9F;
  169. IECODE_LATIN1_FIRST = $A0;
  170. IECODE_LATIN1_LAST = $FF;
  171. { IECLASS_RAWMOUSE }
  172. IECODE_LBUTTON = $68; { also uses IECODE_UP_PREFIX }
  173. IECODE_RBUTTON = $69;
  174. IECODE_MBUTTON = $6A;
  175. IECODE_NOBUTTON = $FF;
  176. { IECLASS_EVENT }
  177. IECODE_NEWACTIVE = $01; { active input window changed }
  178. IECODE_NEWSIZE = $02; { resize of window }
  179. IECODE_REFRESH = $03; { refresh of window }
  180. { IECLASS_REQUESTER Codes }
  181. { REQSET is broadcast when the first Requester (not subsequent ones) opens
  182. * in the Window
  183. }
  184. IECODE_REQSET = $01;
  185. { REQCLEAR is broadcast when the last Requester clears out of the Window }
  186. IECODE_REQCLEAR = $00;
  187. { --- InputEvent.ie_Qualifier --- }
  188. IEQUALIFIER_LSHIFT = $0001;
  189. IEQUALIFIER_RSHIFT = $0002;
  190. IEQUALIFIER_CAPSLOCK = $0004;
  191. IEQUALIFIER_CONTROL = $0008;
  192. IEQUALIFIER_LALT = $0010;
  193. IEQUALIFIER_RALT = $0020;
  194. IEQUALIFIER_LCOMMAND = $0040;
  195. IEQUALIFIER_RCOMMAND = $0080;
  196. IEQUALIFIER_NUMERICPAD = $0100;
  197. IEQUALIFIER_REPEAT = $0200;
  198. IEQUALIFIER_INTERRUPT = $0400;
  199. IEQUALIFIER_MULTIBROADCAST = $0800;
  200. IEQUALIFIER_MIDBUTTON = $1000;
  201. IEQUALIFIER_RBUTTON = $2000;
  202. IEQUALIFIER_LEFTBUTTON = $4000;
  203. IEQUALIFIER_RELATIVEMOUSE = $8000;
  204. IEQUALIFIERB_LSHIFT = 0;
  205. IEQUALIFIERB_RSHIFT = 1;
  206. IEQUALIFIERB_CAPSLOCK = 2;
  207. IEQUALIFIERB_CONTROL = 3;
  208. IEQUALIFIERB_LALT = 4;
  209. IEQUALIFIERB_RALT = 5;
  210. IEQUALIFIERB_LCOMMAND = 6;
  211. IEQUALIFIERB_RCOMMAND = 7;
  212. IEQUALIFIERB_NUMERICPAD = 8;
  213. IEQUALIFIERB_REPEAT = 9;
  214. IEQUALIFIERB_INTERRUPT = 10;
  215. IEQUALIFIERB_MULTIBROADCAST = 11;
  216. IEQUALIFIERB_MIDBUTTON = 12;
  217. IEQUALIFIERB_RBUTTON = 13;
  218. IEQUALIFIERB_LEFTBUTTON = 14;
  219. IEQUALIFIERB_RELATIVEMOUSE = 15;
  220. {------ InputEvent ------------------------------------------------}
  221. type
  222. pInputEvent = ^tInputEvent;
  223. tInputEvent = record
  224. ie_NextEvent : pInputEvent;
  225. ie_Class : BYTE;
  226. ie_SubClass : BYTE;
  227. ie_Code : WORD;
  228. ie_Qualifier : WORD;
  229. ie_position : record
  230. case longint of
  231. 0 : ( ie_xy : record
  232. ie_x : smallint;
  233. ie_y : smallint;
  234. end );
  235. 1 : ( ie_addr : APTR );
  236. 2 : ( ie_dead : record
  237. ie_prev1DownCode : BYTE;
  238. ie_prev1DownQual : BYTE;
  239. ie_prev2DownCode : BYTE;
  240. ie_prev2DownQual : BYTE;
  241. end );
  242. end;
  243. ie_TimeStamp : tTimeVal;
  244. end;
  245. IMPLEMENTATION
  246. end.