terminal_interface-curses-mouse__adb.htm 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML><HEAD><TITLE>terminal_interface-curses-mouse.adb</TITLE></HEAD>
  3. <BODY>
  4. <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-mouse.adb </H1></DIV><HR>
  5. <PRE>
  6. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  7. <FONT COLOR=green><EM>-- --</EM></FONT>
  8. <FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT>
  9. <FONT COLOR=green><EM>-- --</EM></FONT>
  10. <FONT COLOR=green><EM>-- Terminal_Interface.Curses.Mouse --</EM></FONT>
  11. <FONT COLOR=green><EM>-- --</EM></FONT>
  12. <FONT COLOR=green><EM>-- B O D Y --</EM></FONT>
  13. <FONT COLOR=green><EM>-- --</EM></FONT>
  14. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  15. <FONT COLOR=green><EM>-- Copyright (c) 1998-2004,2008 Free Software Foundation, Inc. --</EM></FONT>
  16. <FONT COLOR=green><EM>-- --</EM></FONT>
  17. <FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT>
  18. <FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT>
  19. <FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT>
  20. <FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT>
  21. <FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT>
  22. <FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT>
  23. <FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT>
  24. <FONT COLOR=green><EM>-- --</EM></FONT>
  25. <FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT>
  26. <FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT>
  27. <FONT COLOR=green><EM>-- --</EM></FONT>
  28. <FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT>
  29. <FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT>
  30. <FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT>
  31. <FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT>
  32. <FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT>
  33. <FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT>
  34. <FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT>
  35. <FONT COLOR=green><EM>-- --</EM></FONT>
  36. <FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT>
  37. <FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT>
  38. <FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT>
  39. <FONT COLOR=green><EM>-- authorization. --</EM></FONT>
  40. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  41. <FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT>
  42. <FONT COLOR=green><EM>-- Version Control:</EM></FONT>
  43. <FONT COLOR=green><EM>-- @Revision: 1.22 @</EM></FONT>
  44. <FONT COLOR=green><EM>-- @Date: 2008/07/26 18:51:11 @</EM></FONT>
  45. <FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT>
  46. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  47. <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_50_35">Aux</A>;
  48. <b>with</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>.C;
  49. <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>;
  50. <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_46_40" HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A></FONT> <b>is</b>
  51. <b>use</b> <b>type</b> System.Bit_Order;
  52. <b>function</b> <FONT COLOR=red><A NAME="ref_50_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_98_13">Has_Mouse</A></FONT> <b>return</b> Boolean
  53. <b>is</b>
  54. <b>function</b> <FONT COLOR=red><A NAME="ref_52_16">Mouse_Avail</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
  55. <b>pragma</b> Import (C, Mouse_Avail, "_nc_has_mouse");
  56. <b>begin</b>
  57. <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_767_13">Has_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_204_4">Key_Mouse</A>) <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_52_16">Mouse_Avail</A> /= 0 <b>then</b>
  58. <b>return</b> True;
  59. <b>else</b>
  60. <b>return</b> False;
  61. <b>end</b> <b>if</b>;
  62. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_13">Has_Mouse</A>;
  63. <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_13">Get_Mouse</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>
  64. <b>is</b>
  65. <b>type</b> <FONT COLOR=red><A NAME="ref_64_12">Event_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>;
  66. <b>function</b> <FONT COLOR=red><A NAME="ref_66_16">Getmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_66_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_66_16">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__adb.htm#ref_64_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
  67. <b>pragma</b> Import (C, Getmouse, "getmouse");
  68. <FONT COLOR=red><A NAME="ref_69_7">Event</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>;
  69. <b>begin</b>
  70. <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_66_16">Getmouse</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_7">Event</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b>
  71. <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
  72. <b>end</b> <b>if</b>;
  73. <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_7">Event</A>;
  74. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_13">Get_Mouse</A>;
  75. <b>procedure</b> <FONT COLOR=red><A NAME="ref_77_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_77_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_102_7">Button</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
  76. <FONT COLOR=red><A NAME="ref_78_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">State</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>;
  77. <FONT COLOR=red><A NAME="ref_79_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>)
  78. <b>is</b>
  79. <FONT COLOR=red><A NAME="ref_81_7">Button_Nr</A></FONT> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_102_7">Button</A>);
  80. <FONT COLOR=red><A NAME="ref_82_7">State_Nr</A></FONT> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">State</A>);
  81. <b>begin</b>
  82. <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_102_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_77_12">Modifier_Keys</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">State</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_80_26">Pressed</A> <b>then</b>
  83. <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
  84. <b>else</b>
  85. <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_102_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_76_12">Real_Buttons</A> <b>then</b>
  86. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">Mask</A> <b>or</b> ((2 ** (6 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_81_7">Button_Nr</A>)) ** <A HREF="terminal_interface-curses-mouse__adb.htm#ref_82_7">State_Nr</A>);
  87. <b>else</b>
  88. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">Mask</A> <b>or</b> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_216_4">BUTTON_CTRL</A> ** (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_81_7">Button_Nr</A> - 4));
  89. <b>end</b> <b>if</b>;
  90. <b>end</b> <b>if</b>;
  91. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A>;
  92. <b>procedure</b> <FONT COLOR=red><A NAME="ref_95_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_110_14">Register_Reportable_Events</A></FONT> (<FONT COLOR=red><A NAME="ref_95_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_111_7">Button</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
  93. <FONT COLOR=red><A NAME="ref_96_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_112_7">State</A></FONT> : <b>in</b> Button_States;
  94. <FONT COLOR=red><A NAME="ref_97_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_113_7">Mask</A></FONT> : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>)
  95. <b>is</b>
  96. <b>begin</b>
  97. <b>for</b> <FONT COLOR=red><A NAME="ref_100_11">S</A></FONT> <b>in</b> Button_States'<b>Range</b> <b>loop</b>
  98. <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_112_7">State</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_100_11">S</A>) <b>then</b>
  99. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_111_7">Button</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_100_11">S</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_113_7">Mask</A>);
  100. <b>end</b> <b>if</b>;
  101. <b>end</b> <b>loop</b>;
  102. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_110_14">Register_Reportable_Events</A>;
  103. <b>function</b> <FONT COLOR=red><A NAME="ref_107_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_123_13">Start_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_107_26" HREF="terminal_interface-curses-mouse__ads.htm#ref_123_26">Mask</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_66_4">All_Events</A>)
  104. <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>
  105. <b>is</b>
  106. <b>function</b> <FONT COLOR=red><A NAME="ref_110_16">MMask</A></FONT> (<FONT COLOR=red><A NAME="ref_110_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">M</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  107. <FONT COLOR=red><A NAME="ref_111_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">O</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>) <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  108. <b>pragma</b> Import (C, MMask, "mousemask");
  109. <FONT COLOR=red><A NAME="ref_113_7">R</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  110. <FONT COLOR=red><A NAME="ref_114_7">Old</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  111. <b>begin</b>
  112. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_7">R</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_110_16">MMask</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_123_26">Mask</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_114_7">Old</A>'<b>Access</b>);
  113. <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_7">R</A> = <A HREF="terminal_interface-curses-mouse__ads.htm#ref_65_4">No_Events</A> <b>then</b>
  114. <A HREF="terminal_interface-curses__ads.htm#ref_870_14">Beep</A>;
  115. <b>end</b> <b>if</b>;
  116. <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_114_7">Old</A>;
  117. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_123_13">Start_Mouse</A>;
  118. <b>procedure</b> <FONT COLOR=red><A NAME="ref_123_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_128_14">End_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_123_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_128_25">Mask</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_65_4">No_Events</A>)
  119. <b>is</b>
  120. <b>begin</b>
  121. <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_128_25">Mask</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_65_4">No_Events</A> <b>then</b>
  122. <A HREF="terminal_interface-curses__ads.htm#ref_870_14">Beep</A>;
  123. <b>end</b> <b>if</b>;
  124. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_128_14">End_Mouse</A>;
  125. <b>procedure</b> <FONT COLOR=red><A NAME="ref_131_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_131_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Mask</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  126. <FONT COLOR=red><A NAME="ref_132_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
  127. <FONT COLOR=red><A NAME="ref_133_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_137_30">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>);
  128. <b>procedure</b> <FONT COLOR=red><A NAME="ref_135_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_135_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  129. <FONT COLOR=red><A NAME="ref_136_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
  130. <FONT COLOR=red><A NAME="ref_137_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>) <b>is</b>
  131. <FONT COLOR=red><A NAME="ref_138_7">L</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
  132. <b>begin</b>
  133. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_74_26">Alt</A>; <FONT COLOR=green><EM>-- preset to non real button;</EM></FONT>
  134. <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_221_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b>
  135. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_26">Left</A>;
  136. <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_222_4">BUTTON2_EVENTS</A>) /= 0 <b>then</b>
  137. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_69_26">Middle</A>;
  138. <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_223_4">BUTTON3_EVENTS</A>) /= 0 <b>then</b>
  139. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Right</A>;
  140. <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_224_4">BUTTON4_EVENTS</A>) /= 0 <b>then</b>
  141. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_26">Button4</A>;
  142. <b>end</b> <b>if</b>;
  143. <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_76_12">Real_Buttons</A> <b>then</b>
  144. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A> := 2 ** (6 * <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A>));
  145. <b>for</b> <FONT COLOR=red><A NAME="ref_152_14">I</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>'<b>Range</b> <b>loop</b>
  146. <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A>) /= 0 <b>then</b>
  147. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_152_14">I</A>;
  148. <b>exit</b>;
  149. <b>end</b> <b>if</b>;
  150. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A> := 2 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_138_7">L</A>;
  151. <b>end</b> <b>loop</b>;
  152. <b>else</b>
  153. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">State</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_80_26">Pressed</A>;
  154. <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_216_4">BUTTON_CTRL</A>) /= 0 <b>then</b>
  155. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_26">Control</A>;
  156. <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_217_4">BUTTON_SHIFT</A>) /= 0 <b>then</b>
  157. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_73_26">Shift</A>;
  158. <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_218_4">BUTTON_ALT</A>) /= 0 <b>then</b>
  159. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_132_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_74_26">Alt</A>;
  160. <b>end</b> <b>if</b>;
  161. <b>end</b> <b>if</b>;
  162. <b>end</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A>;
  163. <b>procedure</b> <FONT COLOR=red><A NAME="ref_171_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_137_14">Get_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_171_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">Event</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>;
  164. <FONT COLOR=red><A NAME="ref_172_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_138_25">Y</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A>;
  165. <FONT COLOR=red><A NAME="ref_173_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_139_25">X</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A>;
  166. <FONT COLOR=red><A NAME="ref_174_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_140_25">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
  167. <FONT COLOR=red><A NAME="ref_175_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_141_25">State</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>)
  168. <b>is</b>
  169. <FONT COLOR=red><A NAME="ref_177_7">Mask</A></FONT> : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_174_10">Bstate</A>;
  170. <b>begin</b>
  171. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_139_25">X</A> := <A HREF="terminal_interface-curses__ads.htm#ref_61_9">Column_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_172_10">X</A>);
  172. <A HREF="terminal_interface-curses-mouse__ads.htm#ref_138_25">Y</A> := <A HREF="terminal_interface-curses__ads.htm#ref_60_9">Line_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_172_13">Y</A>);
  173. <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_177_7">Mask</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_140_25">Button</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_141_25">State</A>);
  174. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_14">Get_Event</A>;
  175. <b>procedure</b> <FONT COLOR=red><A NAME="ref_184_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_149_14">Unget_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_184_27" HREF="terminal_interface-curses-mouse__ads.htm#ref_149_27">Event</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>)
  176. <b>is</b>
  177. <b>function</b> <FONT COLOR=red><A NAME="ref_186_16">Ungetmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_186_28" HREF="terminal_interface-curses-mouse__adb.htm#ref_186_16">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
  178. <b>pragma</b> Import (C, Ungetmouse, "ungetmouse");
  179. <b>begin</b>
  180. <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_186_16">Ungetmouse</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_149_27">Event</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b>
  181. <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
  182. <b>end</b> <b>if</b>;
  183. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_149_14">Unget_Mouse</A>;
  184. <b>function</b> <FONT COLOR=red><A NAME="ref_194_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_154_13">Enclosed_In_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_194_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_154_33">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_476_13">Standard_Window</A>;
  185. <FONT COLOR=red><A NAME="ref_195_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_155_33">Event</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>) <b>return</b> Boolean
  186. <b>is</b>
  187. <b>function</b> <FONT COLOR=red><A NAME="ref_197_16">Wenclose</A></FONT> (<FONT COLOR=red><A NAME="ref_197_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_197_40" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Y</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_197_51" HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">X</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>)
  188. <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>;
  189. <b>pragma</b> Import (C, Wenclose, "wenclose");
  190. <b>begin</b>
  191. <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_197_16">Wenclose</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_154_33">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_155_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_172_13">Y</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_155_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_172_10">X</A>))
  192. = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b>
  193. <b>return</b> False;
  194. <b>else</b>
  195. <b>return</b> True;
  196. <b>end</b> <b>if</b>;
  197. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_154_13">Enclosed_In_Window</A>;
  198. <b>function</b> <FONT COLOR=red><A NAME="ref_209_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_161_13">Mouse_Interval</A></FONT> (<FONT COLOR=red><A NAME="ref_209_29" HREF="terminal_interface-curses-mouse__ads.htm#ref_161_29">Msec</A></FONT> : Natural := 200) <b>return</b> Natural
  199. <b>is</b>
  200. <b>function</b> <FONT COLOR=red><A NAME="ref_211_16">Mouseinterval</A></FONT> (<FONT COLOR=red><A NAME="ref_211_31" HREF="terminal_interface-curses-mouse__adb.htm#ref_211_16">Msec</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
  201. <b>pragma</b> Import (C, Mouseinterval, "mouseinterval");
  202. <b>begin</b>
  203. <b>return</b> Natural (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_211_16">Mouseinterval</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_161_29">Msec</A>)));
  204. <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_161_13">Mouse_Interval</A>;
  205. <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A>;
  206. </PRE></BODY></HTML>