mouse.tex 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1998, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  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. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \chapter{The MOUSE unit}
  22. \label{ch:mouse}
  23. This chapter describes the \var{mouse} unit. It is implemented for \dos only.
  24. By default, the \var{Mouse} unit is compiled with the \var{MOUSECHECK}
  25. symbol defined.
  26. This ensures that all functions check if the mouse is installed or not, and
  27. to exit gracefully if the mouse isn't installed.
  28. You may wish to undefine the symbol in the source code, and recompile the
  29. unit, to disable this behaviour.
  30. The first section lists constants, types and variables introduced in the mouse unit
  31. and the second section lists all functions and procedures in alphabetical
  32. order.
  33. \section{Constants, Types and variables}
  34. The \var{MouseFound} variable is set by the \seef{CheckMouse} function.
  35. \begin{verbatim}
  36. Var
  37. MouseFound:Boolean;
  38. \end{verbatim}
  39. \section{Functionas and Procedures}
  40. \Functionl{Check\_Mouse}{CheckMouse}{Boolean}
  41. {\var{Check\_Mouse} checks if the mousedriver is present and sets the
  42. \var{MouseFound} variable to \var{True} if so.}
  43. {None.}{}
  44. \Procedurel{Hide\_Mouse}{HideMouse}
  45. {\var{Hide\_Mouse} hides the mouse pointer.}{None.}{\seep{ShowMouse}}
  46. \Function{IsRPressed}{Boolean}
  47. { \var{IsRPressed} returns \var{True} if the right mouse button is pressed,
  48. \var{False} otherwise}{\seef{IsLPressed}}
  49. \Function{IsLPressed}{Boolean}
  50. { \var{IsRPressed} returns \var{True} if the left mouse button is pressed,
  51. \var{False} otherwise}{\seef{IsRPressed}}
  52. \procedure{Micky}{(Horizontal,Vertical: Longint)}
  53. {\var{Micky} sets the mouse speed in horizontal and vertical
  54. directions}
  55. {None}
  56. {}
  57. \procedurel{Mouse\_Ascii}{MouseAscii}{(Ascii:LongInt)}
  58. {\var{Mouse\_Ascii} sets the mouse ascii in text
  59. mode.}
  60. {None.}
  61. {\seep{MouseShape}}
  62. \Function{MouseButtons}{longint}
  63. { \var{MouseButtons} returns which mouse buttons are pressed. The pressed
  64. buttones are bit encoded in bits 0-2}{None.}{\seef{MouseX}, \seef{MouseY}}
  65. \procedurel{Mouse\_Cur}{MouseCur}{(X,Y:Longint)}
  66. {\var{Mouse\_Cur} sets mouse pointer on \var{X,Y} where \var{X} is the
  67. horizontal coordinate, \var{Y} is the vertical coordinate. You The
  68. coordinates are those you would set in text mode, multiplied by 8.}
  69. {None}{\seep{ReadMouse}}
  70. \functionl{Mouse\_Press}{MousePress}{(var x,y: Longint; button: Longint)}{Longint}
  71. {\var{Mouse\_Press} returns which buttons were pressed after the last call to
  72. this function. It returns the same data as the \seep{ReadMouse}
  73. procedure}
  74. {None.}
  75. {\seep{ReadMouse}, \seef{MouseRelease}}
  76. \functionl{Mouse\_Release}{MouseRelease}{(var Row,Col : Longint;Button : Longint)}{integer}
  77. {\var{Mouse\_Release} returns which button was released after last the call to
  78. this function. It returns the position in \var{Row,Col} (text coordinates) and
  79. the button number in \var{Button} }
  80. {None.}
  81. {\seef{MousePress}, \seep{ReadMouse}}
  82. \procedurel{Mouse\_Shape}{MouseShape}{(BackColor,ForColor,Ascii:LongInt)}
  83. {\var{Mouse\_Shape} changes the shape and color of the text mouse cursor.
  84. The colors are specified in \var{BackColor}, \var{ForColor}, and
  85. \var{Ascii} is (Guys ??)}
  86. {None.}
  87. {\seep{MouseAscii}}
  88. \Function{MouseX}{Longint}
  89. {\var{MouseX} returns the mouses X coordinate in textmode units.}{None.}
  90. {\seef{MouseY}, \seef{MouseButtons}}
  91. \procedurel{Mouse\_XRange}{MouseXRange}{(Min,Max: Longint)}
  92. {\var{Mouse\_XRange} sets the mouses x range, i.e. the minimal (in
  93. \var{Min}) and maximal (in \var{Max}) values that the x-coordinate of the
  94. mouse pointer can take.}
  95. {None.}
  96. {\seep{MouseYRange}, \seep{MWindow}}
  97. \Function{MouseY}{Longint}
  98. {\var{MouseY} returns the mouses X coordinate in textmode units.}{None.}
  99. {\seef{MouseY}, \seef{MouseButtons}}
  100. \procedurel{Mouse\_YRange}{MouseYRange}{(Min,Max: Longint)}
  101. {\var{Mouse\_YRange} sets the mouses y range, i.e. the minimal (in
  102. \var{Min}) and maximal (in \var{Max}) values that the y-coordinate of the
  103. mouse pointer can take.}
  104. {None.}
  105. {\seep{MouseXRange}, \seep{MWindow}}
  106. \procedure{MWindow}{(x1,y1,x2,y2: Longint)}
  107. {\var{MWindow} defines a rectangle (with corners at \var{(x1,y1)} and
  108. \var{(x2,y2)}) on the screen, outside which the mouse cannot be moved.}
  109. {None.}{\seep{MouseXRange}, \seep{MouseYRange}}
  110. \procedurel{Read\_Mouse}{ReadMouse}{(var X,Y:Longint;var Buttons:Longint)}
  111. {\var{Read\_Mouse} reads the mouse position in pixels and returns the
  112. horizontal position in \var{X} and the vertical position in \var{Y}.
  113. (you should divide by 8 to get the text position), and reads the
  114. button states. It is a bitwise combination of
  115. \begin{description}
  116. \item [1] \ for the left button
  117. \item [2] \ for the right button
  118. \item [7] \ for the middle button
  119. \end{description}
  120. }{None.}{\seep{MouseCur}}
  121. \Procedurel{Show\_Mouse}{ShowMouse}
  122. {\var{Show\_Mouse} shows the mouse pointer both on text or graphics screens.}
  123. {None.}{\seep{HideMouse}}
  124. \procedurel{Unseen\_Mouse}{(x1,y1,x2,y2: Longint)}
  125. { \var{Unseen\_Mouse} defines a rectangle (with corner points \var{(X1,Y1)}
  126. and \var{(X2,Y2)} on the screen in which the mouse will disappear if comes
  127. over it.}{None.}{}