mouse.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <?xml version="1.0" encoding="ISO8859-1"?>
  2. <fpdoc-descriptions>
  3. <!--
  4. $Id$
  5. This file is part of the FPC documentation.
  6. Copyright (C) 1997, by Michael Van Canneyt
  7. The FPC documentation is free text; you can redistribute it and/or
  8. modify it under the terms of the GNU Library General Public License as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version.
  11. The FPC Documentation is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with the FPC documentation; see the file COPYING.LIB. If not,
  17. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. Boston, MA 02111-1307, USA.
  19. -->
  20. <package name="rtl">
  21. <module name="mouse">
  22. <short>Mouse event handling unit</short>
  23. <!-- \FPCexampledir{mouseex} -->
  24. <descr>
  25. The <file>Mouse</file> unit implements a platform independent mouse handling
  26. interface. It is implemented identically on all platforms supported by
  27. Free Pascal and can be enhanced with custom drivers, should this be needed.
  28. It is intended to be used only in text-based screens, for instance in
  29. conjunction with the keyboard and video unit. No support for graphical
  30. screens is implemented, and there are (currently) no plans to implement
  31. this.
  32. </descr>
  33. <element name="errMouseBase">
  34. <short>Base for mouse error codes.</short>
  35. </element>
  36. <element name="errMouseInitError">
  37. <short>Mouse initialization error</short>
  38. </element>
  39. <element name="errMouseNotImplemented">
  40. <short>Mouse driver not implemented.</short>
  41. </element>
  42. <element name="MouseActionDown">
  43. <short>Mouse button down event signal.</short>
  44. </element>
  45. <element name="MouseActionUp">
  46. <short>Mouse button up event signal.</short>
  47. </element>
  48. <element name="MouseActionMove">
  49. <short>Mouse cursor move event signal.</short>
  50. </element>
  51. <element name="MouseLeftButton">
  52. <short>Left mouse button event.</short>
  53. </element>
  54. <element name="MouseRightButton">
  55. <short>Right mouse button event.</short>
  56. </element>
  57. <element name="MouseMiddleButton">
  58. <short>Middle mouse button event.</short>
  59. </element>
  60. <element name="MouseEventBufSize">
  61. <short>Mouse event buffer size</short>
  62. <descr>
  63. The mouse unit has a mechanism to buffer mouse events. This
  64. constant defines the size of the event buffer.
  65. </descr>
  66. </element>
  67. <element name="PMouseEvent">
  68. <short>Pointer to <link id="TMouseEvent"/> record.</short>
  69. </element>
  70. <element name="TMouseEvent">
  71. <short>Mouse event reporting record.</short>
  72. <descr>
  73. <p>
  74. The <var>TMouseEvent</var> is the central type of the mouse unit, it is used
  75. to describe all mouse events.
  76. </p>
  77. <p>
  78. The <var>Buttons</var> field describes which buttons were down when the event
  79. occurred. The <var>x,y</var> fields describe where the event occurred on the
  80. screen. The <var>Action</var> describes what action was going on when the event
  81. occurred. The <var>Buttons</var> and <var>Action</var> field can be examined using the
  82. constants defined in the unit interface.
  83. </p>
  84. </descr>
  85. <seealso>
  86. <link id="GetMouseEvent"/>
  87. <link id="PollMouseEvent"/>
  88. <link id="PutMouseEvent"/>
  89. </seealso>
  90. </element>
  91. <element name="TMouseEvent.X">
  92. <short>Horizontal position of mouse cursor.</short>
  93. </element>
  94. <element name="TMouseEvent.Y">
  95. <short>Vertical position of mouse cursor.</short>
  96. </element>
  97. <element name="TMouseEvent.Buttons">
  98. <short>Pressed buttons at time of event.
  99. </short>
  100. </element>
  101. <element name="TMouseEvent.Action">
  102. <short>Type of event.</short>
  103. </element>
  104. <element name="TMouseDriver">
  105. <short>Mouse driver structure</short>
  106. <descr>
  107. The <var>TMouseDriver</var> record is used to implement a mouse driver in the
  108. <link id="SetMouseDriver"/> function. Its fields must be filled in before
  109. calling the <link id="SetMouseDriver"/> function.
  110. </descr>
  111. <seealso>
  112. <link id="SetMouseDriver"/>
  113. </seealso>
  114. </element>
  115. <element name="TMouseDriver.UseDefaultQueue">
  116. <short>Should the default event queue mechanism be used.</short>
  117. </element>
  118. <element name="TMouseDriver.InitDriver">
  119. <short>Called when the driver must be initialized</short>
  120. </element>
  121. <element name="TMouseDriver.DoneDriver">
  122. <short>Called when the driver will be unloaded.</short>
  123. </element>
  124. <element name="TMouseDriver.DetectMouse">
  125. <short>Function called when the mouse must be detected.</short>
  126. </element>
  127. <element name="TMouseDriver.ShowMouse">
  128. <short>Function called when the mouse cursor must be shown.</short>
  129. </element>
  130. <element name="TMouseDriver.HideMouse">
  131. <short>Function called when the mouse cursor must be hidden.</short>
  132. </element>
  133. <element name="TMouseDriver.GetMouseX">
  134. <short>Called to get the mouse cursors horizontal position.</short>
  135. </element>
  136. <element name="TMouseDriver.GetMouseY">
  137. <short>Called to get the mouse cursors vertical position.</short>
  138. </element>
  139. <element name="TMouseDriver.GetMouseButtons">
  140. <short>Called to get the currently pressed mouse buttons.</short>
  141. </element>
  142. <element name="TMouseDriver.SetMouseXY">
  143. <short>Called when the current mouse position must be set.</short>
  144. </element>
  145. <element name="TMouseDriver.GetMouseEvent">
  146. <short>Called to get the next mouse event. Waits if needed.</short>
  147. </element>
  148. <element name="TMouseDriver.PollMouseEvent">
  149. <short>Called to get the next mouse event. Does not wait.</short>
  150. </element>
  151. <element name="TMouseDriver.PutMouseEvent">
  152. <short>Called to put a mouse event back in the queue.</short>
  153. </element>
  154. <element name="MouseIntFlag">
  155. <short>Internal mouse flag</short>
  156. <descr>This variable keeps track of the last known internal mouse state. Do not use.</descr>
  157. </element>
  158. <element name="MouseButtons">
  159. <short>Mouse button state</short>
  160. <descr>This variable keeps track of the last known mouse button state. Do not use.</descr>
  161. </element>
  162. <element name="MouseWhereX">
  163. <short>Mouse cursor horizontal position</short>
  164. <descr>This variable keeps track of the last known cursor position. Do not use.</descr>
  165. </element>
  166. <element name="MouseWhereY">
  167. <short>Mouse cursor vertical position</short>
  168. <descr>This variable keeps track of the last known cursor position. Do not use.</descr>
  169. </element>
  170. <element name="DetectMouse">
  171. <short>Detect the presence of a mouse.</short>
  172. <descr>
  173. <p>
  174. <var>DetectMouse</var> detects whether a mouse is attached to the system or not.
  175. If there is no mouse, then zero is returned. If a mouse is attached, then
  176. the number of mouse buttons is returnead.
  177. </p>
  178. <p>
  179. This function should be called after the mouse driver was initialized.
  180. </p>
  181. </descr>
  182. <errors>
  183. None.
  184. </errors>
  185. <seealso>
  186. <link id="InitMouse"/>
  187. <link id="DoneMouse"/>,
  188. </seealso>
  189. <example file="mouseex/ex1"/>
  190. </element>
  191. <element name="DoneMouse">
  192. <short>Deinitialize mouse driver.</short>
  193. <descr>
  194. <p>
  195. <var>DoneMouse</var> De-initializes the mouse driver. It cleans up any memory
  196. allocated when the mouse was initialized, or removes possible mouse hooks
  197. from memory. The mouse functions will not work after <var>DoneMouse</var> was
  198. called. If <var>DoneMouse</var> is called a second time, it will exit at once.
  199. <var>InitMouse</var> should be called before <var>DoneMouse</var> can be called again.
  200. </p>
  201. <p>
  202. For an example, see most other mouse functions.
  203. </p>
  204. </descr>
  205. <errors>
  206. None.
  207. </errors>
  208. <seealso>
  209. <link id="DetectMouse"/>
  210. <link id="InitMouse"/>
  211. </seealso>
  212. </element>
  213. <element name="GetMouseButtons">
  214. <short>Get the state of the mouse buttons</short>
  215. <descr>
  216. <p>
  217. <var>GetMouseButtons</var> returns the current button state of the mouse, i.e.
  218. it returns a or-ed combination of the following constants:
  219. </p>
  220. <dl>
  221. <dt>MouseLeftButton</dt>
  222. <dd> When the left mouse button is held down.
  223. </dd>
  224. <dt>MouseRightButton</dt>
  225. <dd> When the right mouse button is held down.
  226. </dd>
  227. <dt>MouseMiddleButton</dt>
  228. <dd> When the middle mouse button is held down.
  229. </dd>
  230. </dl>
  231. </descr>
  232. <errors>
  233. None.
  234. </errors>
  235. <seealso>
  236. <link id="GetMouseEvent"/>
  237. <link id="GetMouseX"/>
  238. <link id="GetMouseY"/>
  239. </seealso>
  240. <example file="mouseex/ex2"/>
  241. </element>
  242. <element name="GetMouseDriver">
  243. <short>Get a copy of the currently active mouse driver.</short>
  244. <descr>
  245. <p>
  246. <var>GetMouseDriver</var> returns the currently set mouse driver. It can be used
  247. to retrieve the current mouse driver, and override certain callbacks.
  248. </p>
  249. <p>
  250. A more detailed explanation about getting and setting mouse drivers can be found in
  251. <link id="mousedrv"/>.
  252. </p>
  253. <p>
  254. For an example, see the section on writing a custom mouse driver,
  255. <link id="mousedrv"/>
  256. </p>
  257. </descr>
  258. <errors>
  259. None.
  260. </errors>
  261. <seealso>
  262. <link id="SetMouseDriver"/>
  263. </seealso>
  264. </element>
  265. <element name="GetMouseEvent">
  266. <short>Get next mouse event from the queue.</short>
  267. <descr>
  268. <p>
  269. <var>GetMouseEvent</var> returns the next mouse event (a movement, button press or
  270. button release), and waits for one if none is available in the queue.
  271. </p>
  272. <p>
  273. Some mouse drivers can implement a mouse event queue which can hold multiple
  274. events till they are fetched. Others don't, and in that case, a one-event
  275. queue is implemented for use with <link id="PollMouseEvent"/>.
  276. </p>
  277. </descr>
  278. <errors>
  279. None.
  280. </errors>
  281. <seealso>
  282. <link id="GetMouseButtons"/>
  283. <link id="GetMouseX"/>
  284. <link id="GetMouseY"/>
  285. </seealso>
  286. </element>
  287. <element name="GetMouseX">
  288. <short>Query the current horizontal position of the mouse cursor.</short>
  289. <descr>
  290. <var>GetMouseX</var> returns the current <var>X</var> position of the mouse. <var>X</var> is
  291. measured in characters, starting at 0 for the left side of the screen.
  292. </descr>
  293. <errors>
  294. None.
  295. </errors>
  296. <seealso>
  297. <link id="GetMouseButtons"/>
  298. <link id="GetMouseEvent"/>
  299. <link id="GetMouseY"/>
  300. </seealso>
  301. <example file="mouseex/ex4"/>
  302. </element>
  303. <element name="GetMouseY">
  304. <short>Query the current vertical position of the mouse cursor.</short>
  305. <descr>
  306. <p>
  307. <var>GetMouseY</var> returns the current <var>Y</var> position of the mouse. <var>Y</var> is
  308. measured in characters, starting at 0 for the top of the screen.
  309. </p>
  310. <p>
  311. For an example, see <link id="GetMouseX"/>
  312. </p>
  313. </descr>
  314. <errors>
  315. None.
  316. </errors>
  317. <seealso>
  318. <link id="GetMouseButtons"/>
  319. <link id="GetMouseEvent"/>
  320. <link id="GetMouseX"/>
  321. </seealso>
  322. </element>
  323. <element name="HideMouse">
  324. <short>Hide the mouse cursor.</short>
  325. <descr>
  326. <var>HideMouse</var> hides the mouse cursor. This may or may not be implemented
  327. on all systems, and depends on the driver.
  328. </descr>
  329. <errors>
  330. None.
  331. </errors>
  332. <seealso>
  333. <link id="ShowMouse"/>
  334. </seealso>
  335. <example file="mouseex/ex5"/>
  336. </element>
  337. <element name="InitMouse">
  338. <short>Initialize the FPC mouse driver.</short>
  339. <descr>
  340. <p>
  341. <var>InitMouse</var> Initializes the mouse driver. This will allocate any data
  342. structures needed for the mouse to function. All mouse functions can be
  343. used after a call to <var>InitMouse</var>.
  344. </p>
  345. <p>
  346. A call to <var>InitMouse</var> must always be followed by a call to <link id="DoneMouse"/>
  347. at program exit. Failing to do so may leave the mouse in an unusable state,
  348. or may result in memory leaks.
  349. </p>
  350. <p>
  351. For an example, see most other functions.
  352. </p>
  353. </descr>
  354. <errors>
  355. None.
  356. </errors>
  357. <seealso>
  358. <link id="DoneMouse"/>
  359. <link id="DetectMouse"/>
  360. </seealso>
  361. </element>
  362. <element name="PollMouseEvent">
  363. <short>Query next mouse event. Do not wait if none available.</short>
  364. <descr>
  365. <p>
  366. <var>PollMouseEvent</var> checks whether a mouse event is available, and
  367. returns it in <var>MouseEvent</var> if one is found. The function result is
  368. <var>True</var> in that case. If no mouse event is pending, the function result
  369. is <var>False</var>, and the contents of <var>MouseEvent</var> is undefined.
  370. </p>
  371. <p>
  372. Note that after a call to <var>PollMouseEvent</var>, the event should still
  373. be removed from the mouse event queue with a call to <var>GetMouseEvent</var>.
  374. </p>
  375. </descr>
  376. <errors>
  377. None.
  378. </errors>
  379. <seealso>
  380. <link id="GetMouseEvent"/>
  381. <link id="PutMouseEvent"/>
  382. </seealso>
  383. </element>
  384. <element name="PutMouseEvent">
  385. <short>Put a mouse event in the venet queue.</short>
  386. <descr>
  387. <p>
  388. <var>PutMouseEvent</var> adds <var>MouseEvent</var> to the input queue. The next
  389. call to <link id="GetMouseEvent"/> or <var>PollMouseEvent</var> will then return
  390. <var>MouseEvent</var>.
  391. </p>
  392. <p>
  393. Please note that depending on the implementation the mouse event queue
  394. can hold only one value.
  395. </p>
  396. </descr>
  397. <errors>
  398. None.
  399. </errors>
  400. <seealso>
  401. <link id="GetMouseEvent"/>
  402. <link id="PollMouseEvent"/>
  403. </seealso>
  404. </element>
  405. <element name="SetMouseDriver">
  406. <short>Set a new mouse driver.</short>
  407. <descr>
  408. <p>
  409. <var>SetMouseDriver</var> sets the mouse driver to <var>Driver</var>. This function
  410. should be called before <link id="InitMouse"/> is called, or after <var>DoneMouse</var>
  411. is called. If it is called after the mouse has been initialized, it does
  412. nothing.
  413. </p>
  414. <p>
  415. For more information on setting the mouse driver, <link id="mousedrv"/>.
  416. </p>
  417. <p>
  418. For an example, see <link id="mousedrv"/>
  419. </p>
  420. </descr>
  421. <errors>
  422. </errors>
  423. <seealso>
  424. <link id="InitMouse"/>
  425. <link id="DoneMouse"/>
  426. <link id="GetMouseDriver"/>
  427. </seealso>
  428. </element>
  429. <element name="SetMouseXY">
  430. <short>Set the mouse cursor position.</short>
  431. <descr>
  432. <var>SetMouseXY</var> places the mouse cursor on <var>X,Y</var>. X and Y are zero
  433. based character coordinates: <var>0,0</var> is the top-left corner of the screen,
  434. and the position is in character cells (i.e. not in pixels).
  435. </descr>
  436. <errors>
  437. None.
  438. </errors>
  439. <seealso>
  440. <link id="GetMouseX"/>
  441. <link id="GetMouseY"/>
  442. </seealso>
  443. <example file="mouseex/ex7"/>
  444. </element>
  445. <element name="ShowMouse">
  446. <short>Show the mouse cursor.</short>
  447. <descr>
  448. <p>
  449. <var>ShowMouse</var> shows the mouse cursor if it was previously hidden. The
  450. capability to hide or show the mouse cursor depends on the driver.
  451. </p>
  452. <p>
  453. For an example, see <link id="HideMouse"/>
  454. </p>
  455. </descr>
  456. <errors>
  457. None.
  458. </errors>
  459. <seealso>
  460. <link id="HideMouse"/>
  461. </seealso>
  462. </element>
  463. <topic name="mousedrv">
  464. <short>Writing a custom mouse driver</short>
  465. <descr>
  466. <p>
  467. The <file>mouse</file> unit has support for adding a custom mouse driver. This can be
  468. used to add support for mouses not supported by the standard Free Pascal driver,
  469. but also to enhance an existing driver for instance to log mouse events or
  470. to implement a record and playback function.
  471. </p>
  472. <p>
  473. The following unit shows how a mouse driver can be enhanced by adding some
  474. logging capabilities to the driver.
  475. </p>
  476. </descr>
  477. <example file="mouseex/logmouse"/>
  478. </topic>
  479. </module>
  480. </package>
  481. </fpdoc-descriptions>