ncurses 6.1 - patch 20190727
[ncurses.git] / doc / html / ada / terminal_interface-curses-mouse__adb.htm
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>terminal_interface-curses-mouse.adb</TITLE>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <style type="text/css">
7 *.comment {
8         color: green;
9 }
10 *.symbol {
11         color: red;
12 }
13 </style>
14 </HEAD>
15 <BODY>
16 <HR><DIV style="text-align:center"><H1> File : terminal_interface-curses-mouse.adb </H1></DIV><HR>
17 <PRE>
18 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
19 <span class="comment"><EM>--                                                                          --</EM></span>
20 <span class="comment"><EM>--                           <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding                           --</EM></span>
21 <span class="comment"><EM>--                                                                          --</EM></span>
22 <span class="comment"><EM>--                     Terminal_Interface.Curses.Mouse                      --</EM></span>
23 <span class="comment"><EM>--                                                                          --</EM></span>
24 <span class="comment"><EM>--                                 B O D Y                                  --</EM></span>
25 <span class="comment"><EM>--                                                                          --</EM></span>
26 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
27 <span class="comment"><EM>-- Copyright (c) 1998-2014,2018 Free Software Foundation, Inc.              --</EM></span>
28 <span class="comment"><EM>--                                                                          --</EM></span>
29 <span class="comment"><EM>-- Permission is hereby granted, free of charge, to any person obtaining a  --</EM></span>
30 <span class="comment"><EM>-- copy of this software and associated documentation files (the            --</EM></span>
31 <span class="comment"><EM>-- "Software"), to deal in the Software without restriction, including      --</EM></span>
32 <span class="comment"><EM>-- without limitation the rights to use, copy, modify, merge, publish,      --</EM></span>
33 <span class="comment"><EM>-- distribute, distribute with modifications, sublicense, and/or sell       --</EM></span>
34 <span class="comment"><EM>-- copies of the Software, and to permit persons to whom the Software is    --</EM></span>
35 <span class="comment"><EM>-- furnished to do so, subject to the following conditions:                 --</EM></span>
36 <span class="comment"><EM>--                                                                          --</EM></span>
37 <span class="comment"><EM>-- The above copyright notice and this permission notice shall be included  --</EM></span>
38 <span class="comment"><EM>-- in all copies or substantial portions of the Software.                   --</EM></span>
39 <span class="comment"><EM>--                                                                          --</EM></span>
40 <span class="comment"><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</EM></span>
41 <span class="comment"><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</EM></span>
42 <span class="comment"><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</EM></span>
43 <span class="comment"><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</EM></span>
44 <span class="comment"><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</EM></span>
45 <span class="comment"><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</EM></span>
46 <span class="comment"><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</EM></span>
47 <span class="comment"><EM>--                                                                          --</EM></span>
48 <span class="comment"><EM>-- Except as contained in this notice, the name(s) of the above copyright   --</EM></span>
49 <span class="comment"><EM>-- holders shall not be used in advertising or otherwise to promote the     --</EM></span>
50 <span class="comment"><EM>-- sale, use or other dealings in this Software without prior written       --</EM></span>
51 <span class="comment"><EM>-- authorization.                                                           --</EM></span>
52 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
53 <span class="comment"><EM>--  Author:  Juergen Pfeifer, 1996</EM></span>
54 <span class="comment"><EM>--  Version Control:</EM></span>
55 <span class="comment"><EM>--  @Revision: 1.26 @</EM></span>
56 <span class="comment"><EM>--  @Date: 2018/07/07 23:35:05 @</EM></span>
57 <span class="comment"><EM>--  Binding Version 01.00</EM></span>
58 <span class="comment"><EM>------------------------------------------------------------------------------</EM></span>
59 <b>with</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_47_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_45_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_47_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#ref_45_35">Aux</A>;
60 <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;
61 <b>use</b> <A HREF="interfac__ads.htm#ref_38_9">Interfaces</A>;
62
63 <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_47_28">Curses</A>.<span class="symbol"><A NAME="ref_46_40" HREF="terminal_interface-curses-mouse__ads.htm#ref_44_35">Mouse</A></span> <b>is</b>
64
65    <b>function</b> <span class="symbol"><A NAME="ref_48_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_90_13">Has_Mouse</A></span> <b>return</b> Boolean
66    <b>is</b>
67       <b>function</b> <span class="symbol"><A NAME="ref_50_16">Mouse_Avail</A></span> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>;
68       <b>pragma</b> Import (C, Mouse_Avail, "has_mouse");
69    <b>begin</b>
70       <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_937_13">Has_Key</A> (<A HREF="terminal_interface-curses__ads.htm#ref_375_4">Key_Mouse</A>) <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_50_16">Mouse_Avail</A> /= 0 <b>then</b>
71          <b>return</b> True;
72       <b>else</b>
73          <b>return</b> False;
74       <b>end</b> <b>if</b>;
75    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_90_13">Has_Mouse</A>;
76
77    <b>function</b> <span class="symbol"><A NAME="ref_60_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_125_13">Get_Mouse</A></span> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>
78    <b>is</b>
79       <b>type</b> <span class="symbol"><A NAME="ref_62_12">Event_Access</A></span> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>;
80
81       <b>function</b> <span class="symbol"><A NAME="ref_64_16">Getmouse</A></span> (<span class="symbol"><A NAME="ref_64_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_64_16">Ev</A></span> : <A HREF="terminal_interface-curses-mouse__adb.htm#ref_62_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>;
82       <b>pragma</b> Import (C, Getmouse, "getmouse");
83
84       <span class="symbol"><A NAME="ref_67_7">Event</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>;
85    <b>begin</b>
86       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_64_16">Getmouse</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_67_7">Event</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_4">Curses_Err</A> <b>then</b>
87          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_521_4">Curses_Exception</A>;
88       <b>end</b> <b>if</b>;
89       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_67_7">Event</A>;
90    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_125_13">Get_Mouse</A>;
91
92    <b>procedure</b> <span class="symbol"><A NAME="ref_75_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_93_14">Register_Reportable_Event</A></span> (<span class="symbol"><A NAME="ref_75_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_94_7">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>;
93                                         <span class="symbol"><A NAME="ref_76_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_95_7">State</A></span>  : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>;
94                                         <span class="symbol"><A NAME="ref_77_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_96_7">Mask</A></span>   : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>)
95    <b>is</b>
96       <span class="symbol"><A NAME="ref_79_7">Button_Nr</A></span> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_94_7">Button</A>);
97       <span class="symbol"><A NAME="ref_80_7">State_Nr</A></span>  : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_95_7">State</A>);
98    <b>begin</b>
99       <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_94_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_69_12">Modifier_Keys</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_95_7">State</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_26">Pressed</A> <b>then</b>
100          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_521_4">Curses_Exception</A>;
101       <b>else</b>
102          <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_94_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_12">Real_Buttons</A> <b>then</b>
103             <A HREF="terminal_interface-curses-mouse__ads.htm#ref_96_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_96_7">Mask</A> <b>or</b> ((2 ** (6 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_79_7">Button_Nr</A>)) ** <A HREF="terminal_interface-curses-mouse__adb.htm#ref_80_7">State_Nr</A>);
104          <b>else</b>
105             <A HREF="terminal_interface-curses-mouse__ads.htm#ref_96_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_96_7">Mask</A> <b>or</b> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_189_4">BUTTON_CTRL</A> ** (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_79_7">Button_Nr</A> - 4));
106          <b>end</b> <b>if</b>;
107       <b>end</b> <b>if</b>;
108    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_93_14">Register_Reportable_Event</A>;
109
110    <b>procedure</b> <span class="symbol"><A NAME="ref_93_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_102_14">Register_Reportable_Events</A></span> (<span class="symbol"><A NAME="ref_93_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">Button</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>;
111                                          <span class="symbol"><A NAME="ref_94_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">State</A></span>  : Button_States;
112                                          <span class="symbol"><A NAME="ref_95_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_105_7">Mask</A></span>   : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>)
113    <b>is</b>
114    <b>begin</b>
115       <b>for</b> <span class="symbol"><A NAME="ref_98_11">S</A></span> <b>in</b> Button_States'<b>Range</b> <b>loop</b>
116          <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_104_7">State</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_98_11">S</A>) <b>then</b>
117             <A HREF="terminal_interface-curses-mouse__ads.htm#ref_93_14">Register_Reportable_Event</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">Button</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_98_11">S</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_105_7">Mask</A>);
118          <b>end</b> <b>if</b>;
119       <b>end</b> <b>loop</b>;
120    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_102_14">Register_Reportable_Events</A>;
121
122    <b>function</b> <span class="symbol"><A NAME="ref_105_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_115_13">Start_Mouse</A></span> (<span class="symbol"><A NAME="ref_105_26" HREF="terminal_interface-curses-mouse__ads.htm#ref_115_26">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_58_4">All_Events</A>)
123                          <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>
124    <b>is</b>
125       <b>function</b> <span class="symbol"><A NAME="ref_108_16">MMask</A></span> (<span class="symbol"><A NAME="ref_108_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_108_16">M</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
126                       <span class="symbol"><A NAME="ref_109_23" HREF="terminal_interface-curses-mouse__adb.htm#ref_108_16">O</A></span> : <b>access</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>) <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
127       <b>pragma</b> Import (C, MMask, "mousemask");
128       <span class="symbol"><A NAME="ref_111_7">R</A></span>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
129       <span class="symbol"><A NAME="ref_112_7">Old</A></span> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
130    <b>begin</b>
131       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_111_7">R</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_108_16">MMask</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_115_26">Mask</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_112_7">Old</A>'<b>Access</b>);
132       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_111_7">R</A> = <A HREF="terminal_interface-curses-mouse__ads.htm#ref_57_4">No_Events</A> <b>then</b>
133          <A HREF="terminal_interface-curses__ads.htm#ref_1040_14">Beep</A>;
134       <b>end</b> <b>if</b>;
135       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_112_7">Old</A>;
136    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_115_13">Start_Mouse</A>;
137
138    <b>procedure</b> <span class="symbol"><A NAME="ref_121_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_120_14">End_Mouse</A></span> (<span class="symbol"><A NAME="ref_121_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_120_25">Mask</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_57_4">No_Events</A>)
139    <b>is</b>
140    <b>begin</b>
141       <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_120_25">Mask</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#ref_57_4">No_Events</A> <b>then</b>
142          <A HREF="terminal_interface-curses__ads.htm#ref_1040_14">Beep</A>;
143       <b>end</b> <b>if</b>;
144    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_120_14">End_Mouse</A>;
145
146    <b>procedure</b> <span class="symbol"><A NAME="ref_129_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_133_14">Dispatch_Event</A></span> (<span class="symbol"><A NAME="ref_129_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_133_30">Mask</A></span>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
147                              <span class="symbol"><A NAME="ref_130_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>;
148                              <span class="symbol"><A NAME="ref_131_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">State</A></span>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>);
149
150    <b>procedure</b> <span class="symbol"><A NAME="ref_133_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_129_14">Dispatch_Event</A></span> (<span class="symbol"><A NAME="ref_133_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A></span>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
151                              <span class="symbol"><A NAME="ref_134_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>;
152                              <span class="symbol"><A NAME="ref_135_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">State</A></span>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>) <b>is</b>
153       <span class="symbol"><A NAME="ref_136_7">L</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A>;
154    <b>begin</b>
155       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_66_26">Alt</A>;  <span class="comment"><EM>--  preset to non real button;</EM></span>
156       <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_192_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b>
157          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_26">Left</A>;
158       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_194_4">BUTTON2_EVENTS</A>) /= 0 <b>then</b>
159          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_61_26">Middle</A>;
160       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_196_4">BUTTON3_EVENTS</A>) /= 0 <b>then</b>
161          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_62_26">Right</A>;
162       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_198_4">BUTTON4_EVENTS</A>) /= 0 <b>then</b>
163          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_63_26">Button4</A>;
164       <b>end</b> <b>if</b>;
165       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_12">Real_Buttons</A> <b>then</b>
166          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_7">L</A> := 2 ** (6 * <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A>));
167          <b>for</b> <span class="symbol"><A NAME="ref_150_14">I</A></span> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>'<b>Range</b> <b>loop</b>
168             <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_7">L</A>) /= 0 <b>then</b>
169                <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">State</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_150_14">I</A>;
170                <b>exit</b>;
171             <b>end</b> <b>if</b>;
172             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_7">L</A> := 2 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_7">L</A>;
173          <b>end</b> <b>loop</b>;
174       <b>else</b>
175          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_30">State</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_26">Pressed</A>;
176          <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_189_4">BUTTON_CTRL</A>) /= 0 <b>then</b>
177             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_26">Control</A>;
178          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_190_4">BUTTON_SHIFT</A>) /= 0 <b>then</b>
179             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_65_26">Shift</A>;
180          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_191_4">BUTTON_ALT</A>) /= 0 <b>then</b>
181             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_66_26">Alt</A>;
182          <b>end</b> <b>if</b>;
183       <b>end</b> <b>if</b>;
184    <b>end</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_14">Dispatch_Event</A>;
185
186    <b>procedure</b> <span class="symbol"><A NAME="ref_169_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_129_14">Get_Event</A></span> (<span class="symbol"><A NAME="ref_169_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_129_25">Event</A></span>  : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>;
187                         <span class="symbol"><A NAME="ref_170_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_130_25">Y</A></span>      : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>;
188                         <span class="symbol"><A NAME="ref_171_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_131_25">X</A></span>      : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A>;
189                         <span class="symbol"><A NAME="ref_172_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_132_25">Button</A></span> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_60_9">Mouse_Button</A>;
190                         <span class="symbol"><A NAME="ref_173_25" HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">State</A></span>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_9">Button_State</A>)
191    <b>is</b>
192       <span class="symbol"><A NAME="ref_175_7">Mask</A></span>  : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_56_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_169_10">Bstate</A>;
193    <b>begin</b>
194       <A HREF="terminal_interface-curses-mouse__ads.htm#ref_131_25">X</A> := <A HREF="terminal_interface-curses__ads.htm#ref_59_9">Column_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_167_10">X</A>);
195       <A HREF="terminal_interface-curses-mouse__ads.htm#ref_130_25">Y</A> := <A HREF="terminal_interface-curses__ads.htm#ref_58_9">Line_Position</A>   (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_167_13">Y</A>);
196       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_129_14">Dispatch_Event</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_175_7">Mask</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_132_25">Button</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_25">State</A>);
197    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_129_14">Get_Event</A>;
198
199    <b>procedure</b> <span class="symbol"><A NAME="ref_182_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_141_14">Unget_Mouse</A></span> (<span class="symbol"><A NAME="ref_182_27" HREF="terminal_interface-curses-mouse__ads.htm#ref_141_27">Event</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>)
200    <b>is</b>
201       <b>function</b> <span class="symbol"><A NAME="ref_184_16">Ungetmouse</A></span> (<span class="symbol"><A NAME="ref_184_28" HREF="terminal_interface-curses-mouse__adb.htm#ref_184_16">Ev</A></span> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>;
202       <b>pragma</b> Import (C, Ungetmouse, "ungetmouse");
203    <b>begin</b>
204       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_184_16">Ungetmouse</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_141_27">Event</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_63_4">Curses_Err</A> <b>then</b>
205          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_521_4">Curses_Exception</A>;
206       <b>end</b> <b>if</b>;
207    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_141_14">Unget_Mouse</A>;
208
209    <b>function</b> <span class="symbol"><A NAME="ref_192_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_146_13">Enclosed_In_Window</A></span> (<span class="symbol"><A NAME="ref_192_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_146_33">Win</A></span>    : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#ref_644_13">Standard_Window</A>;
210                                 <span class="symbol"><A NAME="ref_193_33" HREF="terminal_interface-curses-mouse__ads.htm#ref_147_33">Event</A></span>  : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_84_9">Mouse_Event</A>) <b>return</b> Boolean
211    <b>is</b>
212       <b>function</b> <span class="symbol"><A NAME="ref_195_16">Wenclose</A></span> (<span class="symbol"><A NAME="ref_195_26" HREF="terminal_interface-curses-mouse__adb.htm#ref_195_16">Win</A></span> : <A HREF="terminal_interface-curses__ads.htm#ref_55_9">Window</A>; <span class="symbol"><A NAME="ref_195_40" HREF="terminal_interface-curses-mouse__adb.htm#ref_195_16">Y</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>; <span class="symbol"><A NAME="ref_195_51" HREF="terminal_interface-curses-mouse__adb.htm#ref_195_16">X</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>)
213                          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_2098_9">Curses_Bool</A>;
214       <b>pragma</b> Import (C, Wenclose, "wenclose");
215    <b>begin</b>
216       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_195_16">Wenclose</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_146_33">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_147_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_167_13">Y</A>), <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_147_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_167_10">X</A>))
217         = <A HREF="terminal_interface-curses__ads.htm#ref_2100_4">Curses_Bool_False</A>
218       <b>then</b>
219          <b>return</b> False;
220       <b>else</b>
221          <b>return</b> True;
222       <b>end</b> <b>if</b>;
223    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_146_13">Enclosed_In_Window</A>;
224
225    <b>function</b> <span class="symbol"><A NAME="ref_208_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_153_13">Mouse_Interval</A></span> (<span class="symbol"><A NAME="ref_208_29" HREF="terminal_interface-curses-mouse__ads.htm#ref_153_29">Msec</A></span> : Natural := 200) <b>return</b> Natural
226    <b>is</b>
227       <b>function</b> <span class="symbol"><A NAME="ref_210_16">Mouseinterval</A></span> (<span class="symbol"><A NAME="ref_210_31" HREF="terminal_interface-curses-mouse__adb.htm#ref_210_16">Msec</A></span> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A>;
228       <b>pragma</b> Import (C, Mouseinterval, "mouseinterval");
229    <b>begin</b>
230       <b>return</b> Natural (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_210_16">Mouseinterval</A> (<A HREF="terminal_interface-curses-aux__ads.htm#ref_48_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#ref_153_29">Msec</A>)));
231    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_153_13">Mouse_Interval</A>;
232
233 <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_47_28">Curses</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#ref_44_35">Mouse</A>;
234 </PRE></BODY></HTML>