ncurses 5.3
[ncurses.git] / doc / html / ada / terminal_interface-curses-mouse__adb.htm
1 <HTML><HEAD><TITLE>terminal_interface-curses-mouse.adb</TITLE></HEAD>
2 <BODY>
3 <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-mouse.adb </H1></DIV><HR>
4 <PRE>
5 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
6 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
7 <FONT COLOR=green><EM>--                           <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding                           --</EM></FONT>
8 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
9 <FONT COLOR=green><EM>--                     Terminal_Interface.Curses.Mouse                      --</EM></FONT>
10 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
11 <FONT COLOR=green><EM>--                                 B O D Y                                  --</EM></FONT>
12 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
13 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
14 <FONT COLOR=green><EM>-- Copyright (c) 1998 Free Software Foundation, Inc.                        --</EM></FONT>
15 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
16 <FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a  --</EM></FONT>
17 <FONT COLOR=green><EM>-- copy of this software and associated documentation files (the            --</EM></FONT>
18 <FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including      --</EM></FONT>
19 <FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish,      --</EM></FONT>
20 <FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell       --</EM></FONT>
21 <FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is    --</EM></FONT>
22 <FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions:                 --</EM></FONT>
23 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
24 <FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included  --</EM></FONT>
25 <FONT COLOR=green><EM>-- in all copies or substantial portions of the Software.                   --</EM></FONT>
26 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
27 <FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --</EM></FONT>
28 <FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --</EM></FONT>
29 <FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --</EM></FONT>
30 <FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --</EM></FONT>
31 <FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --</EM></FONT>
32 <FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --</EM></FONT>
33 <FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --</EM></FONT>
34 <FONT COLOR=green><EM>--                                                                          --</EM></FONT>
35 <FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright   --</EM></FONT>
36 <FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the     --</EM></FONT>
37 <FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written       --</EM></FONT>
38 <FONT COLOR=green><EM>-- authorization.                                                           --</EM></FONT>
39 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
40 <FONT COLOR=green><EM>--  Author:  <A HREF="http://www.familiepfeifer.de/juergen">J&uuml;rgen Pfeifer</A>, 1996</EM></FONT>
41 <FONT COLOR=green><EM>--  Contact: <A HREF="http://www.familiepfeifer.de/Contact.aspx?Lang=en">www.familiepfeifer.de/Contact.aspx?Lang=en</A></EM></FONT>
42 <FONT COLOR=green><EM>--  Version Control:</EM></FONT>
43 <FONT COLOR=green><EM>--  @Revision: 1.17 @</EM></FONT>
44 <FONT COLOR=green><EM>--  Binding Version 01.00</EM></FONT>
45 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
46 <b>with</b> System;
47
48 <b>with</b> <A HREF="terminal_interface__ads.htm#42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#51_35">Aux</A>; <b>use</b> <A HREF="terminal_interface__ads.htm#42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#49_28">Curses</A>.<A HREF="terminal_interface-curses-aux__ads.htm#51_35">Aux</A>;
49 <b>with</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>.C;
50 <b>use</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>;
51
52 <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#49_28">Curses</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#48_35">Mouse</A><FONT COLOR=red><A NAME="48_40"></A></FONT> <b>is</b>
53
54    <b>use</b> <b>type</b> System.Bit_Order;
55    <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#23_9">Interfaces</A>.C.int;
56
57    <b>function</b> <A HREF="terminal_interface-curses-mouse__ads.htm#98_13">Has_Mouse</A><FONT COLOR=red><A NAME="53_13"></A></FONT> <b>return</b> Boolean
58    <b>is</b>
59       <b>function</b> <FONT COLOR=red><A NAME="55_16">Mouse_Avail</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>;
60       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#55_16">Mouse_Avail</A>, "_nc_has_mouse");
61    <b>begin</b>
62       <b>if</b> <A HREF="terminal_interface-curses__ads.htm#761_13">Has_Key</A> (<A HREF="terminal_interface-curses__ads.htm#203_4">Key_Mouse</A>) <b>or</b> <b>else</b> <A HREF="terminal_interface-curses-mouse__adb.htm#55_16">Mouse_Avail</A> /= 0 <b>then</b>
63          <b>return</b> True;
64       <b>else</b>
65          <b>return</b> False;
66       <b>end</b> <b>if</b>;
67    <b>end</b> Has_Mouse;
68
69    <b>function</b> <A HREF="terminal_interface-curses-mouse__ads.htm#133_13">Get_Mouse</A><FONT COLOR=red><A NAME="65_13"></A></FONT> <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>
70    <b>is</b>
71       <b>type</b> <FONT COLOR=red><A NAME="67_12">Event_Access</A></FONT> <b>is</b> <b>access</b> <b>all</b> <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>;
72
73       <b>function</b> <FONT COLOR=red><A NAME="69_16">Getmouse</A></FONT> (<FONT COLOR=red><A NAME="69_26">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__adb.htm#67_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>;
74       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#69_16">Getmouse</A>, "getmouse");
75
76       <FONT COLOR=red><A NAME="72_7">Event</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>;
77    <b>begin</b>
78       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#69_16">Getmouse</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#72_7">Event</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#73_4">Curses_Err</A> <b>then</b>
79          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#383_4">Curses_Exception</A>;
80       <b>end</b> <b>if</b>;
81       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#72_7">Event</A>;
82    <b>end</b> Get_Mouse;
83
84    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__ads.htm#101_14">Register_Reportable_Event</A><FONT COLOR=red><A NAME="80_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#102_7">Button</A> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>;
85                                         <A HREF="terminal_interface-curses-mouse__ads.htm#103_7">State</A>  : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>;
86                                         <A HREF="terminal_interface-curses-mouse__ads.htm#104_7">Mask</A>   : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>)
87    <b>is</b>
88       <FONT COLOR=red><A NAME="84_7">Button_Nr</A></FONT> : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#102_7">Button</A>);
89       <FONT COLOR=red><A NAME="85_7">State_Nr</A></FONT>  : <b>constant</b> Natural := <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>'Pos (<A HREF="terminal_interface-curses-mouse__ads.htm#103_7">State</A>);
90    <b>begin</b>
91       <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#102_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#77_12">Modifier_Keys</A> <b>and</b> <b>then</b> <A HREF="terminal_interface-curses-mouse__ads.htm#103_7">State</A> /= <A HREF="terminal_interface-curses-mouse__ads.htm#80_26">Pressed</A> <b>then</b>
92          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#383_4">Curses_Exception</A>;
93       <b>else</b>
94          <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#102_7">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#76_12">Real_Buttons</A> <b>then</b>
95             <A HREF="terminal_interface-curses-mouse__ads.htm#104_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#104_7">Mask</A> <b>or</b> ((2 ** (6 * <A HREF="terminal_interface-curses-mouse__adb.htm#84_7">Button_Nr</A>)) ** <A HREF="terminal_interface-curses-mouse__adb.htm#85_7">State_Nr</A>);
96          <b>else</b>
97             <A HREF="terminal_interface-curses-mouse__ads.htm#104_7">Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#104_7">Mask</A> <b>or</b> (<A HREF="terminal_interface-curses-mouse__ads.htm#217_4">BUTTON_CTRL</A> ** (<A HREF="terminal_interface-curses-mouse__adb.htm#84_7">Button_Nr</A> - 4));
98          <b>end</b> <b>if</b>;
99       <b>end</b> <b>if</b>;
100    <b>end</b> Register_Reportable_Event;
101
102    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__ads.htm#110_14">Register_Reportable_Events</A><FONT COLOR=red><A NAME="98_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#111_7">Button</A> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>;
103                                          <A HREF="terminal_interface-curses-mouse__ads.htm#112_7">State</A>  : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#85_9">Button_States</A>;
104                                          <A HREF="terminal_interface-curses-mouse__ads.htm#113_7">Mask</A>   : <b>in</b> <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>)
105    <b>is</b>
106    <b>begin</b>
107       <b>for</b> <FONT COLOR=red><A NAME="103_11">S</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#85_9">Button_States</A>'<b>Range</b> <b>loop</b>
108          <b>if</b> <A HREF="terminal_interface-curses-mouse__ads.htm#112_7">State</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#103_11">S</A>) <b>then</b>
109             <A HREF="terminal_interface-curses-mouse__ads.htm#101_14">Register_Reportable_Event</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#111_7">Button</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#103_11">S</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#113_7">Mask</A>);
110          <b>end</b> <b>if</b>;
111       <b>end</b> <b>loop</b>;
112    <b>end</b> Register_Reportable_Events;
113
114    <b>function</b> <A HREF="terminal_interface-curses-mouse__ads.htm#123_13">Start_Mouse</A><FONT COLOR=red><A NAME="110_13"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#123_26">Mask</A> : <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#66_4">All_Events</A>)
115                          <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>
116    <b>is</b>
117       <b>function</b> <FONT COLOR=red><A NAME="113_16">MMask</A></FONT> (<FONT COLOR=red><A NAME="113_23">M</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
118                       <FONT COLOR=red><A NAME="114_23">O</A></FONT> : <b>access</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>) <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
119       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#113_16">MMask</A>, "mousemask");
120       <FONT COLOR=red><A NAME="116_7">R</A></FONT>   : <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
121       <FONT COLOR=red><A NAME="117_7">Old</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
122    <b>begin</b>
123       <A HREF="terminal_interface-curses-mouse__adb.htm#116_7">R</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#113_16">MMask</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#123_26">Mask</A>, <A HREF="terminal_interface-curses-mouse__adb.htm#117_7">Old</A>'<b>Access</b>);
124       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#117_7">Old</A>;
125    <b>end</b> Start_Mouse;
126
127    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__ads.htm#128_14">End_Mouse</A><FONT COLOR=red><A NAME="123_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#128_25">Mask</A> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#65_4">No_Events</A>)
128    <b>is</b>
129    <b>begin</b>
130       <b>null</b>;
131    <b>end</b> End_Mouse;
132
133    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__adb.htm#133_14">Dispatch_Event</A><FONT COLOR=red><A NAME="129_14"></A></FONT> (<FONT COLOR=red><A NAME="129_30">Mask</A></FONT>   : <b>in</b>  <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
134                              <FONT COLOR=red><A NAME="130_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>;
135                              <FONT COLOR=red><A NAME="131_30">State</A></FONT>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>);
136
137    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__adb.htm#129_14">Dispatch_Event</A><FONT COLOR=red><A NAME="133_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A>   : <b>in</b>  <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
138                              <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>;
139                              <A HREF="terminal_interface-curses-mouse__adb.htm#131_30">State</A>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>) <b>is</b>
140       <FONT COLOR=red><A NAME="136_7">L</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A>;
141    <b>begin</b>
142       <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#74_26">Alt</A>;  <FONT COLOR=green><EM>--  preset to non real button;</EM></FONT>
143       <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#222_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b>
144          <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#68_26">Left</A>;
145       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#223_4">BUTTON2_EVENTS</A>) /= 0 <b>then</b>
146          <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#69_26">Middle</A>;
147       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#224_4">BUTTON3_EVENTS</A>) /= 0 <b>then</b>
148          <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#70_26">Right</A>;
149       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#225_4">BUTTON4_EVENTS</A>) /= 0 <b>then</b>
150          <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#71_26">Button4</A>;
151       <b>end</b> <b>if</b>;
152       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#76_12">Real_Buttons</A> <b>then</b>
153          <A HREF="terminal_interface-curses-mouse__adb.htm#136_7">L</A> := 2 ** (6 * <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>'Pos (<A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A>));
154          <b>for</b> <FONT COLOR=red><A NAME="150_14">I</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>'<b>Range</b> <b>loop</b>
155             <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__adb.htm#136_7">L</A>) /= 0 <b>then</b>
156                <A HREF="terminal_interface-curses-mouse__adb.htm#131_30">State</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#150_14">I</A>;
157                <b>exit</b>;
158             <b>end</b> <b>if</b>;
159             <A HREF="terminal_interface-curses-mouse__adb.htm#136_7">L</A> := 2 * <A HREF="terminal_interface-curses-mouse__adb.htm#136_7">L</A>;
160          <b>end</b> <b>loop</b>;
161       <b>else</b>
162          <A HREF="terminal_interface-curses-mouse__adb.htm#131_30">State</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#80_26">Pressed</A>;
163          <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#217_4">BUTTON_CTRL</A>) /= 0 <b>then</b>
164             <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#72_26">Control</A>;
165          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#218_4">BUTTON_SHIFT</A>) /= 0 <b>then</b>
166             <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#73_26">Shift</A>;
167          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#129_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#219_4">BUTTON_ALT</A>) /= 0 <b>then</b>
168             <A HREF="terminal_interface-curses-mouse__adb.htm#130_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#74_26">Alt</A>;
169          <b>end</b> <b>if</b>;
170       <b>end</b> <b>if</b>;
171    <b>end</b> Dispatch_Event;
172
173    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__ads.htm#137_14">Get_Event</A><FONT COLOR=red><A NAME="169_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#137_25">Event</A>  : <b>in</b>  <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>;
174                         <A HREF="terminal_interface-curses-mouse__ads.htm#138_25">Y</A>      : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>;
175                         <A HREF="terminal_interface-curses-mouse__ads.htm#139_25">X</A>      : <b>out</b> <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A>;
176                         <A HREF="terminal_interface-curses-mouse__ads.htm#140_25">Button</A> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#68_9">Mouse_Button</A>;
177                         <A HREF="terminal_interface-curses-mouse__ads.htm#141_25">State</A>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#79_9">Button_State</A>)
178    <b>is</b>
179       <FONT COLOR=red><A NAME="175_7">Mask</A></FONT>  : <b>constant</b> <A HREF="terminal_interface-curses-mouse__ads.htm#64_9">Event_Mask</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#174_10">Bstate</A>;
180    <b>begin</b>
181       <A HREF="terminal_interface-curses-mouse__ads.htm#139_25">X</A> := <A HREF="terminal_interface-curses__ads.htm#61_9">Column_Position</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#172_10">X</A>);
182       <A HREF="terminal_interface-curses-mouse__ads.htm#138_25">Y</A> := <A HREF="terminal_interface-curses__ads.htm#60_9">Line_Position</A>   (<A HREF="terminal_interface-curses-mouse__ads.htm#137_25">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#172_13">Y</A>);
183       <A HREF="terminal_interface-curses-mouse__adb.htm#129_14">Dispatch_Event</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#175_7">Mask</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#140_25">Button</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#141_25">State</A>);
184    <b>end</b> Get_Event;
185
186    <b>procedure</b> <A HREF="terminal_interface-curses-mouse__ads.htm#149_14">Unget_Mouse</A><FONT COLOR=red><A NAME="182_14"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#149_27">Event</A> : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>)
187    <b>is</b>
188       <b>function</b> <FONT COLOR=red><A NAME="184_16">Ungetmouse</A></FONT> (<FONT COLOR=red><A NAME="184_28">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>;
189       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#184_16">Ungetmouse</A>, "ungetmouse");
190    <b>begin</b>
191       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#184_16">Ungetmouse</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#149_27">Event</A>) = <A HREF="terminal_interface-curses-aux__ads.htm#73_4">Curses_Err</A> <b>then</b>
192          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#383_4">Curses_Exception</A>;
193       <b>end</b> <b>if</b>;
194    <b>end</b> Unget_Mouse;
195
196    <b>function</b> <A HREF="terminal_interface-curses-mouse__ads.htm#154_13">Enclosed_In_Window</A><FONT COLOR=red><A NAME="192_13"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#154_33">Win</A>    : <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A> := <A HREF="terminal_interface-curses__ads.htm#475_13">Standard_Window</A>;
197                                 <A HREF="terminal_interface-curses-mouse__ads.htm#155_33">Event</A>  : <A HREF="terminal_interface-curses-mouse__ads.htm#92_9">Mouse_Event</A>) <b>return</b> Boolean
198    <b>is</b>
199       <b>function</b> <FONT COLOR=red><A NAME="195_16">Wenclose</A></FONT> (<FONT COLOR=red><A NAME="195_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#57_9">Window</A>; <FONT COLOR=red><A NAME="195_40">Y</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>; <FONT COLOR=red><A NAME="195_51">X</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>)
200                          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#1931_9">Curses_Bool</A>;
201       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#195_16">Wenclose</A>, "wenclose");
202    <b>begin</b>
203       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#195_16">Wenclose</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#154_33">Win</A>, <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#155_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#172_13">Y</A>), <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#155_33">Event</A>.<A HREF="terminal_interface-curses-mouse__ads.htm#172_10">X</A>))
204         = <A HREF="terminal_interface-curses__ads.htm#1932_4">Curses_Bool_False</A> <b>then</b>
205          <b>return</b> False;
206       <b>else</b>
207          <b>return</b> True;
208       <b>end</b> <b>if</b>;
209    <b>end</b> Enclosed_In_Window;
210
211    <b>function</b> <A HREF="terminal_interface-curses-mouse__ads.htm#161_13">Mouse_Interval</A><FONT COLOR=red><A NAME="207_13"></A></FONT> (<A HREF="terminal_interface-curses-mouse__ads.htm#161_29">Msec</A> : Natural := 200) <b>return</b> Natural
212    <b>is</b>
213       <b>function</b> <FONT COLOR=red><A NAME="209_16">Mouseinterval</A></FONT> (<FONT COLOR=red><A NAME="209_31">Msec</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A>;
214       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#209_16">Mouseinterval</A>, "mouseinterval");
215    <b>begin</b>
216       <b>return</b> Natural (<A HREF="terminal_interface-curses-mouse__adb.htm#209_16">Mouseinterval</A> (<A HREF="terminal_interface-curses-aux__ads.htm#56_12">C_Int</A> (<A HREF="terminal_interface-curses-mouse__ads.htm#161_29">Msec</A>)));
217    <b>end</b> Mouse_Interval;
218
219 <b>end</b> Terminal_Interface.Curses.Mouse;
220 </PRE></BODY></HTML>