moucalls.pas 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. {Set tabsize to 4.}
  2. {****************************************************************************
  3. MOUCALLS interface unit
  4. FPK-Pascal Runtime Library for OS/2
  5. Copyright (c) 1993,94 by Florian Kl„mpfl
  6. Copyright (c) 1997 by Dani‰l Mantione
  7. Copyright (c) 1998 by Tomas Hajny
  8. The FPK-Pascal runtime library is distributed under the Library GNU Public
  9. License v2. So is this unit. The Library GNU Public License requires you to
  10. distribute the source code of this unit with any product that uses it.
  11. Because the EMX library isn't under the LGPL, we grant you an exception to
  12. this, and that is, when you compile a program with the FPK Pascal compiler,
  13. you do not need to ship source code with that program, AS LONG AS YOU ARE
  14. USING UNMODIFIED CODE! If you modify this code, you MUST change the next
  15. line:
  16. <This is an official, unmodified FPK Pascal source code file.>
  17. Send us your modified files, we can work together if you want!
  18. FPK-Pascal is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. Library GNU General Public License for more details.
  22. You should have received a copy of the Library GNU General Public License
  23. along with FPK-Pascal; see the file COPYING.LIB. If not, write to
  24. the Free Software Foundation, 59 Temple Place - Suite 330,
  25. Boston, MA 02111-1307, USA.
  26. ****************************************************************************}
  27. unit MouCalls;
  28. { Interface library to MOUCALLS.DLL (through EMXWRAP.DLL)
  29. Variant records and aliases for some record types created to maintain highest
  30. possible level of compatibility with other existing OS/2 compilers.
  31. Changelog:
  32. People:
  33. TH - Tomas Hajny ([email protected] on Internet)
  34. Date: Description of change: Changed by:
  35. - First released version 1.0 TH
  36. Coding style:
  37. I have tried to use the same coding style as Dani‰l Mantione in unit
  38. DOSCALLS, although I can't say I would write it the same way otherwise
  39. (I would write much more spaces myself, at least). Try to use it as well,
  40. please. Original note by Dani‰l Mantione follows:
  41. It may be well possible that coding style feels a bit strange to you.
  42. Nevertheless I friendly ask you to try to make your changes not look all
  43. to different. To make life easier, set your IDE to use tab characters,
  44. turn optimal fill, autoindent and backspace unindents on and set a
  45. tabsize of 4.}
  46. {***************************************************************************}
  47. interface
  48. {***************************************************************************}
  49. {$ifdef FPK}
  50. {$packrecords 1}
  51. {$endif FPK}
  52. const
  53. {return codes / error constants (those marked with * shouldn't occur under
  54. normal conditions)}
  55. NO_ERROR = 0;
  56. Error_Invalid_Parameter = 87;
  57. ERROR_SEM_TIMEOUT =121;
  58. ERROR_MOUSE_NO_DEVICE =385;
  59. ERROR_MOUSE_INV_HANDLE =386; {*}
  60. ERROR_MOUSE_INV_PARMS =387;
  61. ERROR_MOUSE_CANT_RESET =388; {*}
  62. ERROR_MOUSE_DISPLAY_PARMS =389; {*}
  63. ERROR_MOUSE_INV_MODULE =390;
  64. ERROR_MOUSE_INV_ENTRY_PT =391; {*}
  65. ERROR_MOUSE_INV_MASK =392; {*}
  66. NO_ERROR_MOUSE_NO_DATA =393;
  67. NO_ERROR_MOUSE_PTR_DRAWN =394; {*}
  68. ERROR_MOUSE_SMG_ONLY =412;
  69. ERROR_MOUSE_INVALID_ASCIIZ =413;
  70. ERROR_MOUSE_INVALID_MASK =414;
  71. ERROR_MOUSE_REGISTER =415;
  72. ERROR_MOUSE_DEREGISTER =416;
  73. ERROR_MOUSE_INVALID_IOWAIT =435; {*}
  74. ERROR_MOU_DETACHED =466;
  75. ERROR_MOUSE_NO_CONSOLE =501;
  76. ERROR_MOUSE_INVALID_HANDLE =502; {*}
  77. ERROR_MOU_EXTENDED_SG =505;
  78. ERROR_MOU_NOT_INITIALIZED =530; {*}
  79. ERROR_MOUINITREAL_DONE =531; {*}
  80. ERROR_MOUSE_CALLER_NOT_SUBSYS =533; {*}
  81. {constants for FnMask in MouRegister}
  82. MR_MOUGETNUMBUTTONS =$00000001;
  83. MR_MOUGETNUMMICKEYS =$00000002;
  84. MR_MOUGETDEVSTATUS =$00000004;
  85. MR_MOUGETNUMQUEEL =$00000008;
  86. MR_MOUREADEVENTQUE =$00000010;
  87. MR_MOUGETSCALEFACT =$00000020;
  88. MR_MOUGETEVENTMASK =$00000040;
  89. MR_MOUSETSCALEFACT =$00000080;
  90. MR_MOUSETEVENTMASK =$00000100;
  91. MR_MOUOPEN =$00000800;
  92. MR_MOUCLOSE =$00001000;
  93. MR_MOUGETPTRSHAPE =$00002000;
  94. MR_MOUSETPTRSHAPE =$00004000;
  95. MR_MOUDRAWPTR =$00008000;
  96. MR_MOUREMOVEPTR =$00010000;
  97. MR_MOUGETPTRPOS =$00020000;
  98. MR_MOUSETPTRPOS =$00040000;
  99. MR_MOUINITREAL =$00080000;
  100. MR_MOUSETDEVSTATUS =$00100000;
  101. {constants for mouse hot key bits in MouGetHotKey/MouSetHotKey}
  102. MHK_BUTTON1 =1;
  103. MHK_BUTTON2 =2;
  104. MHK_BUTTON3 =4;
  105. {MouGetDevStatus/MouSetDevStatus device status constants}
  106. MOUSE_QUEUEBUSY =$0001; {event queue busy with I/O}
  107. MOUSE_BLOCKREAD =$0002; {block read in progress}
  108. MOUSE_FLUSH =$0004; {flush in progress}
  109. MOUSE_UNSUPPORTED_MODE =$0008; {pointer draw routine disabled}
  110. {by unsupported mode }
  111. MOUSE_DISABLED =$0100; {drawing operations for pointer}
  112. {draw routine are disabled }
  113. MOUSE_MICKEYS =$0200; {mouse data returned in mickeys, not pels}
  114. {constants for WaitFlag in MouReadEventQue and MouSynch}
  115. MOU_NOWAIT =$0000; {MouReadEventQue: don't wait for data }
  116. { on empty queue (return a null record)}
  117. {MouSynch: control immediately}
  118. { returned to requestor }
  119. MOU_WAIT =$0001; {MouReadEventQue: wait for data on empty queue}
  120. {MouSynch: requestor waits until}
  121. { mouse device driver is free }
  122. {constants for MouGetEventMask/MouSetEventMask events}
  123. MOUSE_MOTION =$0001; {report mouse motion events with}
  124. {no button press/release events }
  125. MOUSE_MOTION_WITH_BN1_DOWN =$0002; {report button 1 press/release}
  126. {events, with mouse motion }
  127. MOUSE_BN1_DOWN =$0004; {report button 1 press/release}
  128. {events, without mouse motion }
  129. MOUSE_MOTION_WITH_BN2_DOWN =$0008; {report button 2 press/release}
  130. {events, with mouse motion }
  131. MOUSE_BN2_DOWN =$0010; {report button 2 press/release}
  132. {events, without mouse motion }
  133. MOUSE_MOTION_WITH_BN3_DOWN =$0020; {report button 3 press/release}
  134. {events, with mouse motion }
  135. MOUSE_BN3_DOWN =$0040; {report button 3 press/release}
  136. {events, without mouse motion }
  137. {constants for Status in MouSetDevStatus}
  138. MOU_DRAW =0;
  139. MOU_NODRAW =1;
  140. MOU_PELS =0;
  141. MOU_MICKEYS =2;
  142. type
  143. {unnecessary, just FYI}
  144. THMOU=word;
  145. PHMOU=^THMOU;
  146. {record type for MouGetPtrPos/MouSetPtrPos}
  147. TPtrLoc=record
  148. Row, {mouse pointer row coordinate (in pels or characters)}
  149. Col:word; {mouse pointer column coordinate (in pels or characters)}
  150. end;
  151. PPtrLoc=^TPtrLoc;
  152. PtrLoc=TPtrLoc;
  153. {record type for MouGetPtrShape/MouSetPtrShape}
  154. TPtrShape=record
  155. cb, {length of image buffer in bytes}
  156. Col, {pointer width in characters (in text}
  157. {modes; always 1) or pixels (>= 1) }
  158. Row, {pointer height in characters (in text}
  159. {modes; always 1) or pixels (>=1) }
  160. ColHot, {hotspot offset from the left}
  161. {side, in characters or pels }
  162. {(must be 0 in text modes) }
  163. RowHot:word; {hotspot offset from the top,}
  164. {in characters or pels }
  165. {(must be 0 in text modes) }
  166. end;
  167. PPtrShape=^TPtrShape;
  168. PtrShape=TPtrShape;
  169. {record type for MouReadEventQue}
  170. (* #pragma pack(2) ??? *)
  171. TMouEventInfo=record
  172. fs:word; {event bits (state of the mouse at the time }
  173. {of the event) - see MOUSE_MOTION, }
  174. {MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN, }
  175. {MOUSE_MOTION_WITH_BN2_DOWN, MOUSE_BN2_DOWN, }
  176. {MOUSE_MOTION_WITH_BN3_DOWN and MOUSE_BN3_DOWN }
  177. {constants (other bits reserved and set to zero)}
  178. Time:cardinal; {event timestamp - unique number of milliseconds}
  179. {(since the system was started }
  180. Row, {pointer current row position (absolute or relative)}
  181. Col:integer; {pointer current column position}
  182. {(absolute or relative) }
  183. end;
  184. PMouEventInfo=^TMouEventInfo;
  185. MouEventInfo=TMouEventInfo;
  186. {record type for MouGetNumQueEl}
  187. TMouQueInfo=record
  188. cEvents, {current number of elements in event}
  189. {queue, between 0 and cmaxEvents }
  190. cmaxEvents:word; {maximum queue size in elements, as specified }
  191. {in the QSIZE=NN parameter in DEVICE=MOUSExxx.SYS}
  192. {statement in CONFIG.SYS }
  193. end;
  194. PMouQueInfo=^TMouQueInfo;
  195. MouQueInfo=TMouQueInfo;
  196. {record type for MouGetScaleFact/MouSetScaleFact}
  197. TScaleFact=record
  198. RowScale, {current row scaling factor}
  199. ColScale:word; {current column scaling factor}
  200. end;
  201. PScaleFact=^TScaleFact;
  202. ScaleFact=TScaleFact;
  203. {record type for MouRemovePtr}
  204. TNoPtrRect=record
  205. Row, {upper row of the rectangle (pels or characters)}
  206. Col, {column of the left edge (pels or characters)}
  207. cRow, {bottom row of the rectangle (pels or characters)}
  208. cCol:word; {column of the right edge (pels or characters)}
  209. end;
  210. PNoPtrRect=^TNoPtrRect;
  211. NoPtrRect=TNoPtrRect;
  212. TThreshold=record
  213. case boolean of
  214. false:(Length:word; {length of data in bytes}
  215. Level1, {first movement level}
  216. Lev1Mult, {first level multiplier}
  217. Level2, {second movement level}
  218. Lev2Mult:word); {second level multiplier}
  219. true:(aLength:word);
  220. end;
  221. PThreshold=^TThreshold;
  222. Threshold=TThreshold;
  223. {Register a mouse subsystem within a session.}
  224. {ModuleName is name of the dynamic link module (the maximum length
  225. is 8 characters - plus the final #0 character in the PChar version of this
  226. call), ProcName is the dynamic link entry point name of a routine that receives
  227. control when any of the registered functions are called (the maximum length
  228. is 32 bytes - plus the final #0 character in the PChar version of this call),
  229. FnMask is a mask of bits, where each bit set to 1 identifies a mouse function
  230. being registered - see MR_MOU* constants.}
  231. {Possible return codes:
  232. 0 NO_ERROR
  233. 385 ERROR_MOUSE_NO_DEVICE
  234. 413 ERROR_MOUSE_INVALID_ASCIIZ
  235. 414 ERROR_MOUSE_INVALID_MASK
  236. 415 ERROR_MOUSE_REGISTER
  237. 466 ERROR_MOU_DETACHED
  238. 505 ERROR_MOU_EXTENDED_SG}
  239. {Remarks:
  240. * The Base Mouse Subsystem is the default mouse subsystem. There can be only
  241. one MouRegister outstanding for each session without an intervening
  242. MouDeRegister. MouDeRegister must be issued by the same process that issued
  243. MouRegister.
  244. * When any registered function is called, control is routed to EntryName.
  245. When this routine is entered, four additional values are pushed onto the
  246. stack. The first is the index number (Word) of the function being called.
  247. The second is a near pointer (Word). The third is the caller's DS register
  248. (Word). The fourth is the return address (DWord) to the mouse router. For
  249. example, if MouGetNumMickeys were called and control routed to EntryName,
  250. the stack would appear as if the following instructions were executed:
  251. PUSH@ WORD MickeyCnt
  252. PUSH WORD MouHandle
  253. CALL FAR MouGetNumMickeys
  254. PUSH WORD Function Code
  255. CALL NEAR Entry point in Mouse Router
  256. PUSH DS
  257. CALL FAR EntryName
  258. * When a registered function returns to the Mouse Router, AX is interpreted
  259. as follows:
  260. AX = 0 - no error, do not invoke the Base Mouse Subsystem routine,
  261. return AX = 0
  262. AX = -1 - invoke the BaseMouse Subsystem routine, return AX = return code
  263. from the Base Mouse Subsystem
  264. AX = error (if not 0 or -1) - do not invoke the Base Mouse Subsystem
  265. Routine, return AX = error
  266. * When the mouse router receives a mouse call, it routes it to the Base Mouse
  267. Subsystem unless an application or other mouse subsystem has previously
  268. issued MouRegister for that call. If the call was registered, the subsystem
  269. is entered at the EntryName specified, and provided with the applicable
  270. function code.
  271. * The registered function mask is used to determine whether a requested
  272. function is performed by the registered mouse subsystem or default to the
  273. Base Mouse Subsystem.
  274. * The following list shows the relationship of the mouse API calls and the
  275. Function Code passed to either the Base Mouse Subsystem or a registered
  276. mouse subsystem.
  277. MOU API calls Function Code
  278. MouGetNumButtons 00h
  279. MouGetNumMickeys 01h
  280. MouGetDevStatus 02h
  281. MouGetNumQueEl 03h
  282. MouReadEventQue 04h
  283. MouGetScaleFact 05h
  284. MouGetEventMask 06h
  285. MouSetScaleFact 07h
  286. MouSetEventMask 08h
  287. Reserved 09h
  288. Reserved 0Ah
  289. MouOpen 0Bh
  290. MouClose 0Ch
  291. MouGetPtrShape 0Dh
  292. MouSetPtrShape 0Eh
  293. MouDrawPtr 0Fh
  294. MouRemovePtr 10h
  295. MouGetPtrPos 11h
  296. MouSetPtrPos 12h
  297. MouInitReal 13h
  298. MouFlushQue 14h
  299. MouSetDevStatus 15h
  300. * A registered mouse sybsystem must leave the stack, on exit, in the exact
  301. state it was received.}
  302. function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word;
  303. function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
  304. {Deregister a mouse subsystem previously registered within a session.}
  305. {Possible return codes:
  306. 0 NO_ERROR
  307. 385 ERROR_MOUSE_NO_DEVICE
  308. 416 ERROR_MOUSE_DEREGISTER
  309. 466 ERROR_MOU_DETACHED
  310. 505 ERROR_MOU_EXTENDED_SG}
  311. {Remarks:
  312. * The process that issued the MouRegister must release the session
  313. (by a MouDeRegister call) from the registered subsystem before another PID
  314. may issue MouRegister.
  315. * The process that issued the MouRegister is the only process that may
  316. issue MouDeRegister against the currently registered subsystem.
  317. * After the owning process has released the subsystem with a MouDeRegister
  318. call, any other process in the session may issue a MouRegister and therefore
  319. modify the mouse support for the entire session.}
  320. function MouDeRegister:word;
  321. {Direct the mouse driver to flush (empty) the mouse event queue and the monitor
  322. chain data for the session.}
  323. {MouHandle is the mouse device handle from a previous MouOpen call.}
  324. {Possible return codes:
  325. 0 NO_ERROR
  326. 385 ERROR_MOUSE_NO_DEVICE
  327. 466 ERROR_MOU_DETACHED
  328. 501 ERROR_MOUSE_NO_CONSOLE
  329. 505 ERROR_MOU_EXTENDED_SG}
  330. function MouFlushQue(MouHandle:word):word;
  331. {Query the mouse driver to determine the current row and column coordinate
  332. position of the mouse pointer.}
  333. {Mouse pointer position returned in MouPtr, MouHandle is the mouse device
  334. handle from a previous MouOpen call.}
  335. {Possible return codes:
  336. 0 NO_ERROR
  337. 385 ERROR_MOUSE_NO_DEVICE
  338. 466 ERROR_MOU_DETACHED
  339. 501 ERROR_MOUSE_NO_CONSOLE
  340. 505 ERROR_MOU_EXTENDED_SG}
  341. {Remarks:
  342. * For a text window (VIO) application, the text window is a view on the
  343. larger logical video buffer (LVB). The mouse pointer can be outside that
  344. view and still be within the extent of the LVB. MouGetPtrPos then returns
  345. the coordinates of the cell under the mouse pointer. If the pointer is
  346. outside the LVB image extent, the coordinates of the nearest LVB cell are
  347. returned. In either case, the LVB is scrolled until the reported LVB cell
  348. appears within the view window.}
  349. function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
  350. {Direct the mouse driver to set a new row and column coordinate position for
  351. the mouse pointer.}
  352. {MouPtr contains the new pointer coordinates, MouHandle is the mouse device
  353. handle from a previous MouOpen call.}
  354. {Possible return codes:
  355. 0 NO_ERROR
  356. 385 ERROR_MOUSE_NO_DEVICE
  357. 387 ERROR_MOUSE_INV_PARMS
  358. 466 ERROR_MOU_DETACHED
  359. 501 ERROR_MOUSE_NO_CONSOLE
  360. 505 ERROR_MOU_EXTENDED_SG}
  361. {Remarks:
  362. * The application must ensure that the coordinate position specified conforms
  363. to the current display mode orientation for the session. Pel values must
  364. be used for graphics modes and character values for text modes.
  365. * This function has no effect on the display's current collision area
  366. definition as specified by the MouDrawPtr call. If the mouse pointer image
  367. is directed into a defined collision area, the pointer image is not drawn
  368. until either the pointer is moved outside the collision area or the collision
  369. area is released by the MouDrawPtr call.}
  370. function MouSetPtrPos(const MouPtr:TPtrLoc;MouHandle:word):word;
  371. {Set the pointer shape and size to be used as the mouse device pointer image
  372. for all applications in a session.}
  373. {ImageBuf contains the bit image used by the mouse device driver as the pointer
  374. shape for that session. The buffer consists of AND and XOR pointer masks
  375. in a format meaningful to the pointer draw device driver (see remarks bellow),
  376. ImageInfo contains the necessary data for the pointer draw device driver to
  377. build a row-by-column image for each bit plan for the current display mode,
  378. MouHandle is the mouse device handle from a previous MouOpen call.}
  379. {Possible return codes:
  380. 0 NO_ERROR
  381. 385 ERROR_MOUSE_NO_DEVICE
  382. 387 ERROR_MOUSE_INV_PARMS
  383. 466 ERROR_MOU_DETACHED
  384. 501 ERROR_MOUSE_NO_CONSOLE
  385. 505 ERROR_MOU_EXTENDED_SG}
  386. {Remarks:
  387. * An application passes a data image to the mouse device driver that the mouse
  388. driver applies to the screen whenever the logical pointer position is not
  389. located in the application-defined collision area. The application
  390. synchronizes use of the screen with the mouse driver by way of MouRemovePtr
  391. and MouDrawPtr.
  392. * The pointer shape is dependent on the display device driver used to support
  393. the display device. OS/2 supports text and graphics modes. These modes are
  394. restricted to modes 0 through 7, depending on the display device. Character
  395. modes (modes 0, 1, 2, 3, and 7) support the pointer cursor only as a reverse
  396. block character. This reverse block character has a character height
  397. and width equal to 1.
  398. * The pointer shape is mapped by the Pointer Draw Device Driver and determined
  399. completely by the application. The height and width may vary from 1 through
  400. the pel size of the display screen. For restrictions concerning the Pointer
  401. Draw Device Driver, see IBM Operating System/2 Version 1.2 I/O Subsystems And
  402. Device Support Volume 1.
  403. * For CGA compatible text modes (0, 1, 2, and 3) the following describes
  404. the AND and XOR pointer mask bit definitions for each character cell
  405. of the masks. Bit values are:
  406. Bit Description
  407. 15 Blinking
  408. 14-12 Background color
  409. 11 Intensity
  410. 10-8 Foreground color
  411. 7-0 Character
  412. * For other custom displays and for the extended modes of the EGA attachment,
  413. it is possible to set the display to modes that require multiple bit planes.
  414. In these cases, the area sized by the row and column limits must be repeated
  415. for each bit plane supported in that mode. Consequently, the calling process
  416. must supply enough data to allow the mouse device driver to draw the pointer
  417. shape on all currently supported bit planes in that session. For text modes,
  418. row and column offset must equal 0.}
  419. function MouSetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
  420. MouHandle:word):word;
  421. function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
  422. MouHandle:word):word;
  423. {Get (copy) the mouse pointer shape for the session.}
  424. {The pointer bit image is returned in ImageBuf (see MouSetPtrShape description
  425. for information about the resulting content of this buffer), the size of the
  426. pointer image buffer must be supplied in ImageInfo.cb (if the value is too
  427. small, the true length is placed in this field and an error is returned),
  428. on return, ImageInfo is filled with mouse pointer information, MouHandle is
  429. the mouse device handle from a previous MouOpen call.}
  430. {Possible return codes:
  431. 0 NO_ERROR
  432. 385 ERROR_MOUSE_NO_DEVICE
  433. 387 ERROR_MOUSE_INV_PARMS
  434. 466 ERROR_MOU_DETACHED
  435. 501 ERROR_MOUSE_NO_CONSOLE
  436. 505 ERROR_MOU_EXTENDED_SG}
  437. {Remarks:
  438. * The application passes a parameter list with the same meaning as defined
  439. for MouSetPtrShape to the mouse device driver. The mouse device driver
  440. copies the parameters that describe the pointer shape and attributes into
  441. the pointer definition control block pointed to by the PtrDefRec parameter.
  442. The word 0 (buffer length = cb) pointer definition record parameter field
  443. must contain the size in bytes of the application buffer where the device
  444. driver is to insert the session's pointer image. All other words in
  445. the parameter list are returned to the application by MouGetPtrShape.
  446. * For all OS/2 system-supported modes, size of the pointer image buffer
  447. is specified in bytes and is equal to:
  448. 1) Mono & Text Modes:
  449. For text mode, height and width must be 1, so length is always 4.
  450. size = (height in chars) * (width in chars) * 2 * 2 = 1 * 1 * 2 * 2 = 4
  451. 2) Graphics Mode:
  452. Width-in-pels must be a multiple of 8.
  453. size = (height in pels) * (width in pels) * (bits per pel) * 2 / 8
  454. a) Modes 4 and 5 (320 X 200)
  455. size = (height) * (width) * 2 * 2 / 8
  456. b) Mode 6 (640 X 200)
  457. size = (height) * (width) * 1 * 2 / 8
  458. * If the buffer size is insufficient, the cb field contains the actual size
  459. in bytes of the returned pointer image.
  460. * The pointer shape may be set by the application with MouSetPtrShape or may
  461. be the default image provided by the installed Pointer Device Driver.}
  462. function MouGetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
  463. MouHandle:word):word;
  464. function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
  465. MouHandle:word):word;
  466. {Return status flags for the installed mouse device driver.}
  467. {The current status flag settings for the installed mouse device driver are
  468. returned in Status - see MOUSE_QUEUEBUSY, MOUSE_BLOCKREAD, MOUSE_FLUSH,
  469. MOUSE_UNSUPPORTED_MODE, MOUSE_DISABLED and MOUSE_MICKEYS constants (other bits
  470. are reserved and set to zero), MouHandle is the mouse device handle from
  471. a previous MouOpen call.}
  472. {Possible return codes:
  473. 0 NO_ERROR
  474. 385 ERROR_MOUSE_NO_DEVICE
  475. 466 ERROR_MOU_DETACHED
  476. 501 ERROR_MOUSE_NO_CONSOLE
  477. 505 ERROR_MOU_EXTENDED_SG}
  478. function MouGetDevStatus(var Status:word;MouHandle:word):word;
  479. {Return the number of buttons supported on the installed mouse driver.}
  480. {Number of physical buttons (1..3) returned in ButtonCount, MouHandle is
  481. the mouse device handle from a previous MouOpen call.}
  482. {Possible return codes:
  483. 0 NO_ERROR
  484. 385 ERROR_MOUSE_NO_DEVICE
  485. 466 ERROR_MOU_DETACHED
  486. 501 ERROR_MOUSE_NO_CONSOLE
  487. 505 ERROR_MOU_EXTENDED_SG}
  488. function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word;
  489. {Return the number of mickeys in each centimeter for the installed mouse
  490. driver.}
  491. {Number of physical mouse motion units (mickeys) in each centimeter (a constant
  492. based upon the attached mouse device) returned in MickeyCnt, MouHandle is
  493. the mouse device handle from a previous MouOpen call.}
  494. {Possible return codes:
  495. 0 NO_ERROR
  496. 385 ERROR_MOUSE_NO_DEVICE
  497. 466 ERROR_MOU_DETACHED
  498. 501 ERROR_MOUSE_NO_CONSOLE
  499. 505 ERROR_MOU_EXTENDED_SG}
  500. function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word;
  501. {Read an event from the mouse device FIFO event queue.}
  502. {The mouse event queue is returned in Event, WaitFlag determines the action to
  503. take when MouReadEventQue is issued and no event is available (the mouse event
  504. queue is empty) - see MOU_NOWAIT and MOU_WAIT constants, MouHandle is the mouse
  505. device handle from a previous MouOpen call.}
  506. {Possible return codes:
  507. 0 NO_ERROR
  508. 385 ERROR_MOUSE_NO_DEVICE
  509. 387 ERROR_MOUSE_INV_PARMS
  510. 393 ERROR_MOUSE_NO_DATA
  511. 466 ERROR_MOU_DETACHED
  512. 501 ERROR_MOUSE_NO_CONSOLE
  513. 505 ERROR_MOU_EXTENDED_SG}
  514. {Remarks:
  515. * The types of queued events are directly affected by the current value of
  516. the Mouse EventMask. MouSetEventMask is used to indicate the types of events
  517. desired, and MouGetEventMask is used to query the current value of the mask.
  518. Refer to these functions for further explanation of the masking of events.
  519. Recognition of the mouse transition depends on the use of MouState returned
  520. in the event record. The application should focus on bit transitions that
  521. occur in this word. It is important to properly set the event mask with
  522. MouSetEventMask for reporting the state transitions.
  523. Event.fs reports the state of the mouse that resulted from the action that
  524. caused the event. The action can be pressing or releasing a button, and/or
  525. moving the mouse. All status is given, regardless of the EventMask that
  526. was used to determine whether or not to report the event.
  527. For example, assume the EventMask indicates that the application wishes only
  528. button 1 events. The EventMask has only bits 1 and 2 set in this case. Also
  529. assume the current state of the mouse is no buttons down, and mouse is not
  530. moving. At this point, button 1 is pressed causing an event; the status shows
  531. button 1 down (bit 2 set). Next the mouse is moved, thereby causing more
  532. events; status shows bit 1 set. Finally, mouse is stopped and button 1 is
  533. released. The event shows status with no bits set.
  534. Next, button 2 is pressed. No event occurs. Mouse is then moved; again,
  535. no event. Then, while mouse is still in motion, button 1 is pressed; an event
  536. is generated with bits 1 and 3 set in the state word. While mouse is still
  537. in motion, both buttons are released. Because button 1 changes states,
  538. an event occurs. The state word has bit 0 set. Finally, mouse is stopped.
  539. No event occurs, again because no button 1 transition has taken place.
  540. * The Event.Row and Event.Col fields may contain either absolute display
  541. coordinates or relative mouse motion in mickeys. See MouSetDevStatus for
  542. additional information.}
  543. function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
  544. MouHandle:word):word;
  545. {Return the current status for the mouse device driver event queue.}
  546. {Mouse queue status returned in MouseQInfo, MouHandle is the mouse device
  547. handle from a previous MouOpen call.}
  548. {Possible return codes:
  549. 0 NO_ERROR
  550. 385 ERROR_MOUSE_NO_DEVICE
  551. 466 ERROR_MOU_DETACHED
  552. 501 ERROR_MOUSE_NO_CONSOLE
  553. 505 ERROR_MOU_EXTENDED_SG}
  554. function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word;
  555. {Return the current value of the mouse event queue mask.}
  556. {The current mouse device driver's event mask (as previously set by
  557. MouSetEventMask call) is returned in EventMask - see MOUSE_MOTION,
  558. MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN, MOUSE_MOTION_WITH_BN2_DOWN,
  559. MOUSE_BN2_DOWN, MOUSE_MOTION_WITH_BN3_DOWN and MOUSE_BN3_DOWN constants (other
  560. bits are reserved and set to zero, MouHandle is the mouse device handle from
  561. a previous MouOpen call.}
  562. {Possible return codes:
  563. 0 NO_ERROR
  564. 385 ERROR_MOUSE_NO_DEVICE
  565. 466 ERROR_MOU_DETACHED
  566. 501 ERROR_MOUSE_NO_CONSOLE
  567. 505 ERROR_MOU_EXTENDED_SG}
  568. {Remarks:
  569. * Buttons are logically numbered from left to right.}
  570. function MouGetEventMask(var EventMask:word;MouHandle:word):word;
  571. {Assign a new event mask to the current mouse device driver.}
  572. {EventMask contains the mask indicating what mouse events are to be placed on
  573. the event queue (see MouReadEventQue) and which events are to be ignored - see
  574. MOUSE_MOTION, MOUSE_MOTION_WITH_BN1_DOWN, MOUSE_BN1_DOWN,
  575. MOUSE_MOTION_WITH_BN2_DOWN, MOUSE_BN2_DOWN, MOUSE_MOTION_WITH_BN3_DOWN and
  576. MOUSE_BN3_DOWN constants (other bits reserved and set to zero; a bit set to
  577. zero means that the associated type of event is not reported to the
  578. application, mouse buttons are always numbered from left to right - when the
  579. mouse is properly positioned for use, the left-hand button is button 1),
  580. MouHandle is the mouse device handle from a previous MouOpen call.}
  581. {Possible return codes:
  582. 0 NO_ERROR
  583. 385 ERROR_MOUSE_NO_DEVICE
  584. 466 ERROR_MOU_DETACHED
  585. 501 ERROR_MOUSE_NO_CONSOLE
  586. 505 ERROR_MOU_EXTENDED_SG}
  587. {Remarks:
  588. * Setting a bit in the event mask means that the associated event is reported
  589. on the mouse FIFO event queue. See MouReadEventQue for examples of event
  590. mask use.}
  591. function MouSetEventMask(var EventMask:word;MouHandle:word):word;
  592. {Return scaling factors for the current mouse device (a pair of 1-word
  593. values).}
  594. {Current row and column coordinate scaling factors (1 <= factor <= 32767)
  595. returned in Scale (see MouSetScaleFact for more information), MouHandle is
  596. the mouse device handle from a previous MouOpen call.}
  597. {Possible return codes:
  598. 0 NO_ERROR
  599. 385 ERROR_MOUSE_NO_DEVICE
  600. 466 ERROR_MOU_DETACHED
  601. 501 ERROR_MOUSE_NO_CONSOLE
  602. 505 ERROR_MOU_EXTENDED_SG}
  603. {Remarks:
  604. * The units of the scale factor depend on the mode of the display screen
  605. for the session. If the screen is operating in text mode, the scaling units
  606. are relative to characters. If the screen is operating in graphics mode,
  607. the scaling units are relative to pels.}
  608. function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
  609. {Assign to the current mouse device driver a new pair of 1-word scaling
  610. factors.}
  611. {Scale contains the new row and column coordinate scaling factors (1 <= factor
  612. <= 32767), MouHandle is the mouse device handle from a previous MouOpen call.}
  613. {Possible return codes:
  614. 0 NO_ERROR
  615. 385 ERROR_MOUSE_NO_DEVICE
  616. 387 ERROR_MOUSE_INV_PARMS
  617. 466 ERROR_MOU_DETACHED
  618. 501 ERROR_MOUSE_NO_CONSOLE
  619. 505 ERROR_MOU_EXTENDED_SG}
  620. {Remarks:
  621. * MouSetScaleFact sets the mickey-to-pixel ratio for mouse motion. The row
  622. scale and column scale ratios specify a number of mickeys for each 8 pixels.
  623. The default value for the row scale is 16 mickeys for each 8 pixels. The
  624. default value for the column scale is 8 mickeys to 8 pixels.
  625. * The number of pixels moved does not have to correspond 1-to-1 with the number
  626. of mickeys the mouse moves. The scaling factor defines a sensitivity
  627. for the mouse that is a ratio of the number of mickeys required to move
  628. the cursor 8 pixels on the screen. The sensitivity determines at what rate
  629. the cursor moves on the screen.}
  630. function MouSetScaleFact(const Scale:TScaleFact;MouHandle:word):word;
  631. {Open the mouse device for the current session.}
  632. {DriverName contains the name of the pointer draw device driver to be used as
  633. the pointer-image drawing routine for this session (such device driver must be
  634. included in the CONFIG.SYS file at system start-up time) or is nil (the default
  635. pointer draw device driver supplied by the system is used then), mouse device
  636. handle is returned in MouHandle.}
  637. {Possible return codes:
  638. 0 NO_ERROR
  639. 385 ERROR_MOUSE_NO_DEVICE
  640. 390 ERROR_MOUSE_INV_MODULE_PT
  641. 466 ERROR_MOU_DETACHED
  642. 501 ERROR_MOUSE_NO_CONSOLE
  643. 505 ERROR_MOU_EXTENDED_SG}
  644. {Remarks:
  645. * MouOpen initializes the mouse functions to a known state. The application
  646. may have to issue additional mouse functions to establish the environment
  647. it desires. For example, after the MouOpen, the collision area is defined
  648. to be the size of the entire display. Therefore, to get the pointer to be
  649. displayed, the application must issue a MouDrawPtr to remove the collision
  650. area.
  651. * The state of the mouse after the first MouOpen is:
  652. - Row/Col scale factors set to 16/8 (see MouSetScaleFact)
  653. - all events reported (see MouSetEventMask)
  654. - empty event queue (see MouReadEventQue and MouGetNumQueEl)
  655. - all user settable Device Status bits reset (set to zero;
  656. see MouSetDevStatus)
  657. - pointer set to center of screen if valid display mode is set (see
  658. MouSetPtrPos)
  659. - pointer shape set to the default for the pointer device driver currently
  660. registered in the session (see MouSetPtrShape)
  661. - collision area equal to full screen (see MouDrawPtr and MouRemovePtr)
  662. * DriverName has a different definition when the caller is the Base Video
  663. Subsystem (BVS). However, this implies direct calling of the 16-bit routine,
  664. which is not supported currently. In such case the selector portion
  665. of the pointer is zero, the offset portion is non-zero and contains a display
  666. configuration number (sequentially numbered where 1 is the first display
  667. configuration). The MouOpen call issued by BVS is executed on the VioSetMode
  668. path. Using the display configuration number passed on the MouOpen call, the
  669. Base Mouse Subsystem can detect a change in display configurations. This form
  670. of the MouOpen call is not recommended for applications. Applications should
  671. either send the name of the pointer draw device driver or nil.}
  672. function MouOpen(DriverName:PChar;var MouHandle:word):word;
  673. function MouOpen(DriverName:string;var MouHandle:word):word;
  674. {Close the mouse device for the current session.}
  675. {MouHandle is the mouse device handle from a previous MouOpen call.}
  676. {Possible return codes:
  677. 0 NO_ERROR
  678. 385 ERROR_MOUSE_NO_DEVICE
  679. 466 ERROR_MOU_DETACHED
  680. 501 ERROR_MOUSE_NO_CONSOLE
  681. 505 ERROR_MOU_EXTENDED_SG}
  682. {Remarks:
  683. * MouClose closes the mouse device for the current session and removes the
  684. mouse device driver handle from the list of valid open mouse device
  685. handles.}
  686. function MouClose(MouHandle:word):word;
  687. {Notify the mouse device driver that the area defined by the passed parameters
  688. if for exclusive use of the application. This area is defined as the
  689. "collision" area and is not available to the mouse device driver when drawing
  690. pointer images.}
  691. {ProtectArea is the pointer shape collision area, MouHandle is the mouse device
  692. handle from a previous MouOpen call.}
  693. {Possible return codes:
  694. 0 NO_ERROR
  695. 385 ERROR_MOUSE_NO_DEVICE
  696. 387 ERROR_MOUSE_INV_PARMS
  697. 466 ERROR_MOU_DETACHED
  698. 501 ERROR_MOUSE_NO_CONSOLE
  699. 505 ERROR_MOU_EXTENDED_SG}
  700. {Remarks:
  701. * MouRemovePtr may be issued by any process in the session. However, only one
  702. collision area is active at a time. Each MouRemovePtr command has the effect
  703. of resetting the collision area to the location and area specified
  704. by the current command.
  705. * If the logical pointer position is outside of the collision area specified
  706. by the latest MouRemovePtr command, the pointer image is drawn.
  707. * The MouDrawPtr command effectively cancels the MouRemovePtr command
  708. and allows the pointer to be drawn anywhere on the screen, until a new
  709. MouRemovePtr command is issued.}
  710. function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word;
  711. {Notify the mouse device driver that an area previously restricted
  712. to the pointer image is now available to the mouse device driver.}
  713. {MouHandle is the mouse device handle from a previous MouOpen call.}
  714. {Possible return codes:
  715. 0 NO_ERROR
  716. 385 ERROR_MOUSE_NO_DEVICE
  717. 466 ERROR_MOU_DETACHED
  718. 501 ERROR_MOUSE_NO_CONSOLE
  719. 505 ERROR_MOU_EXTENDED_SG}
  720. {Remarks:
  721. * The collision area (the pointer image restricted area) is established by
  722. MouOpen and by MouRemovePtr. MouDrawPtr nullifies the effect of the
  723. MouRemovePtr command. If there was no previous MouDrawPtr command or if a
  724. previous MouDrawPtr command has already nullified the collision area, the
  725. MouRemovePtr command is effectively a null operation.
  726. * This call is required to begin session pointer image drawing. Immediately
  727. after MouOpen is issued, the collision area is defined as the size of the
  728. display. A MouDrawPtr is issued to begin pointer drawing after the
  729. MouOpen.}
  730. function MouDrawPtr(MouHandle:word):word;
  731. {Set the mouse device driver status flags for the installed mouse device
  732. driver.}
  733. {Status contains the desired status flag settings (2-byte set, only the
  734. high-order byte has meaning - see MOUSE_DISABLED and MOUSE_MICKEYS constants;
  735. other bits are reserved and set to zero). MouHandle is the mouse device handle
  736. from a previous MouOpen call.}
  737. {Possible return codes:
  738. 0 NO_ERROR
  739. 385 ERROR_MOUSE_NO_DEVICE
  740. 387 ERROR_MOUSE_INV_PARMS
  741. 466 ERROR_MOU_DETACHED
  742. 501 ERROR_MOUSE_NO_CONSOLE
  743. 505 ERROR_MOU_EXTENDED_SG}
  744. {Remarks:
  745. * MouSetDevStatus is the complement to MouGetDevStatus. However, not all status
  746. flags may be set with MouSetDevStatus. Only the flags corresponding
  747. to the following functions may be modified:
  748. - Return data in mickeys
  749. Normally, mouse data is returned to the application with the absolute
  750. display mode coordinates of the pointer image position on the display
  751. screen. By setting this status flag, mouse data is returned in relative
  752. mickeys, a unit of mouse movement.
  753. - Don't call pointer draw device
  754. Normally, the pointer draw device driver is called for all drawing
  755. operations. By setting this status flag, the mouse device driver does not
  756. call the pointer draw device driver. The application must draw any required
  757. pointer image on the screen.}
  758. function MouSetDevStatus(var Status:word;MouHandle:word):word;
  759. {Initialize mouse pointer draw support for DOS mode.}
  760. {Name of the Pointer Draw Device Driver used as the pointer-image drawing
  761. routine for the DOS mode session must sent in DriverName; the name of the
  762. device driver must be included in the CONFIG.SYS file at system start-up time.}
  763. {Possible return codes:
  764. 0 NO_ERROR
  765. 385 ERROR_MOUSE_NO_DEVICE
  766. 466 ERROR_MOU_DETACHED
  767. 412 ERROR_MOUSE_SMG_ONLY
  768. 501 ERROR_MOUSE_NO_CONSOLE
  769. 505 ERROR_MOU_EXTENDED_SG}
  770. {Remarks:
  771. * MouInitReal is issued by the Base Video Subsystem at system initialization
  772. time.
  773. * The DOS mode mouse API (INT 33h), in contrast to the OS/2 mode Mouse API,
  774. does not contain an OPEN command. In addition, there is only one session
  775. for DOS mode.
  776. * The default pointer draw routine for DOS mode is located in the same pointer
  777. draw device driver, POINTER$, that is used for OS/2 mode. Establishing
  778. addressability to the pointer draw routine must be done during system
  779. initialization. This requires passing the entry point of the DOS mode pointer
  780. draw routine to the mouse device driver. This is the purpose
  781. of the MouInitReal call. It passes the address of the default, power-up
  782. pointer draw routine for DOS mode to the mouse device driver. This
  783. initialization is transparent to applications.
  784. * This call is for use only by the Base Video Subsystem when invoked during
  785. system initialization under the shell/session manager PID.
  786. * The error code ERROR_MOUSE_SMG_ONLY is valid from shell process only.
  787. * When using direct calls to the 16-bit routine, another version of this call
  788. is supported as well - if the selector part of the far pointer is zero
  789. and the offset portion is non-zero, the offset portion identifies the
  790. power-up display configuration. However, this isn't possible in the current
  791. implementation (using 32-bit wrap-around function supplied in EMXWRAP.DLL).}
  792. function MouInitReal(DriverName:PChar):word;
  793. function MouInitReal(DriverName:string):word;
  794. {Synchronize the mouse subsystem with the mouse device driver.}
  795. {WaitFlag specifies whether the routine should wait for the mouse device driver
  796. being free - see MOU_NOWAIT and MOU_WAIT constants.}
  797. {Possible return codes:
  798. 0 NO_ERROR
  799. 121 ERROR_SEM_TIMEOUT}
  800. {Remarks:
  801. * MouSynch blocks all other threads within a session until the semaphore
  802. clears (returns from the subsystem to the router). To ensure proper
  803. synchronization, MouSynch should be issued by a mouse subsystem if it intends
  804. to access dynamically modifiable shared data for each session or if it
  805. intends to issue a DosDevIOCtl. MouSynch does not protect globally shared
  806. data from threads in other sessions.}
  807. function MouSynch(WaitFlag:word):word;
  808. function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
  809. function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
  810. (*
  811. following two functions are undocumented and not present within C header files:
  812. function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
  813. function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
  814. *)
  815. (* Following routines are not supported
  816. (just have a look in some C header
  817. file - you probably won't find it there either).
  818. MouFree (index 4)
  819. MouShellInit (index 12)
  820. *)
  821. {***************************************************************************}
  822. implementation
  823. {***************************************************************************}
  824. function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word;
  825. external 'EMXWRAP' index 324;
  826. {external 'MOUCALLS' index 24;}
  827. function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
  828. begin
  829. if byte(ModuleName[0])>8 then byte(ModuleName[0]):=8;
  830. ModuleName[Succ(byte(ModuleName[0]))]:=#0;
  831. if byte(ProcName[0])>32 then byte(ProcName[0]):=32;
  832. ProcName[Succ(byte(ProcName[0]))]:=#0;
  833. MouRegister:=MouRegister(@ModuleName[1],@ProcName[1],FnMask);
  834. end;
  835. function MouDeRegister:word;
  836. external 'EMXWRAP' index 314;
  837. {external 'MOUCALLS' index 14;}
  838. function MouFlushQue(MouHandle:word):word;
  839. external 'EMXWRAP' index 307;
  840. {external 'MOUCALLS' index 7;}
  841. function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
  842. external 'EMXWRAP' index 319;
  843. {external 'MOUCALLS' index 19;}
  844. function MouSetPtrPos(const MouPtr:TPtrLoc;MouHandle:word):word;
  845. external 'EMXWRAP' index 321;
  846. {external 'MOUCALLS' index 21;}
  847. function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
  848. MouHandle:word):word;
  849. external 'EMXWRAP' index 302;
  850. {external 'MOUCALLS' index 2;}
  851. function MouSetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
  852. MouHandle:word):word;
  853. external 'EMXWRAP' index 302;
  854. {external 'MOUCALLS' index 2;}
  855. function MouGetPtrShape(var ImageBuf;var ImageInfo:TPtrShape;
  856. MouHandle:word):word;
  857. external 'EMXWRAP' index 301;
  858. {external 'MOUCALLS' index 1;}
  859. function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
  860. MouHandle:word):word;
  861. external 'EMXWRAP' index 301;
  862. {external 'MOUCALLS' index 1;}
  863. function MouGetDevStatus(var Status:word;MouHandle:word):word;
  864. external 'EMXWRAP' index 322;
  865. {external 'MOUCALLS' index 22;}
  866. function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word;
  867. external 'EMXWRAP' index 308;
  868. {external 'MOUCALLS' index 8;}
  869. function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word;
  870. external 'EMXWRAP' index 303;
  871. {external 'MOUCALLS' index 3;}
  872. function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
  873. MouHandle:word):word;
  874. external 'EMXWRAP' index 320;
  875. {external 'MOUCALLS' index 20;}
  876. function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word;
  877. external 'EMXWRAP' index 313;
  878. {external 'MOUCALLS' index 13;}
  879. function MouGetEventMask(var EventMask:word;MouHandle:word):word;
  880. external 'EMXWRAP' index 315;
  881. {external 'MOUCALLS' index 15;}
  882. function MouSetEventMask(var EventMask:word;MouHandle:word):word;
  883. external 'EMXWRAP' index 316;
  884. {external 'MOUCALLS' index 16;}
  885. function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
  886. external 'EMXWRAP' index 306;
  887. {external 'MOUCALLS' index 6;}
  888. function MouSetScaleFact(const Scale:TScaleFact;MouHandle:word):word;
  889. external 'EMXWRAP' index 311;
  890. {external 'MOUCALLS' index 11;}
  891. function MouOpen(DriverName:PChar;var MouHandle:word):word;
  892. external 'EMXWRAP' index 317;
  893. {external 'MOUCALLS' index 17;}
  894. function MouOpen(DriverName:string;var MouHandle:word):word;
  895. var B:byte;
  896. begin
  897. B:=byte(DriverName[0]);
  898. if B=0 then MouOpen:=MouOpen(nil,MouHandle) else
  899. begin
  900. if B<>255 then
  901. begin
  902. DriverName[Succ(B)]:=#0;
  903. MouOpen:=MouOpen(@DriverName[1],MouHandle);
  904. end else
  905. begin
  906. Move(DriverName[1],DriverName[0],B);
  907. DriverName[B]:=#0;
  908. MouOpen:=MouOpen(@DriverName,MouHandle);
  909. end;
  910. end;
  911. end;
  912. function MouClose(MouHandle:word):word;
  913. external 'EMXWRAP' index 309;
  914. {external 'MOUCALLS' index 9;}
  915. function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word;
  916. external 'EMXWRAP' index 318;
  917. {external 'MOUCALLS' index 18;}
  918. function MouDrawPtr(MouHandle:word):word;
  919. external 'EMXWRAP' index 326;
  920. {external 'MOUCALLS' index 26;}
  921. function MouSetDevStatus(var Status:word;MouHandle:word):word;
  922. external 'EMXWRAP' index 326;
  923. {external 'MOUCALLS' index 26;}
  924. function MouInitReal(DriverName:PChar):word;
  925. external 'EMXWRAP' index 327;
  926. {external 'MOUCALLS' index 27;}
  927. function MouInitReal(DriverName:string):word;
  928. var B:byte;
  929. begin
  930. B:=byte(DriverName[0]);
  931. if B=0 then MouInitReal:=MouInitReal(nil) else
  932. begin
  933. if B<>255 then
  934. begin
  935. DriverName[Succ(B)]:=#0;
  936. MouInitReal:=MouInitReal(@DriverName[1]);
  937. end else
  938. begin
  939. Move(DriverName[1],DriverName[0],B);
  940. DriverName[B]:=#0;
  941. MouInitReal:=MouInitReal(@DriverName);
  942. end;
  943. end;
  944. end;
  945. function MouSynch(WaitFlag:word):word;
  946. external 'EMXWRAP' index 323;
  947. {external 'MOUCALLS' index 23;}
  948. function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
  949. external 'EMXWRAP' index 329;
  950. {external 'MOUCALLS' index 29;}
  951. function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
  952. external 'EMXWRAP' index 330;
  953. {external 'MOUCALLS' index 30;}
  954. (*
  955. following two functions are undocumented and not present within C header files:
  956. function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
  957. external 'MOUCALLS' index 4;
  958. function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
  959. external 'MOUCALLS' index 10;
  960. *)
  961. end.