ncurses 5.8 - patch 20110226
[ncurses.git] / doc / html / ada / terminal_interface-curses-mouse__adb.htm
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-2008,2009 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.24 @</EM></FONT>
44 <FONT COLOR=green><EM>--  @Date: 2009/12/26 17:38:58 @</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
51 <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>
52
53    <b>use</b> <b>type</b> System.Bit_Order;
54
55    <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
56    <b>is</b>
57       <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>;
58       <b>pragma</b> Import (C, Mouse_Avail, "has_mouse");
59    <b>begin</b>
60       <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>
61          <b>return</b> True;
62       <b>else</b>
63          <b>return</b> False;
64       <b>end</b> <b>if</b>;
65    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_13">Has_Mouse</A>;
66
67    <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>
68    <b>is</b>
69       <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>;
70
71       <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>;
72       <b>pragma</b> Import (C, Getmouse, "getmouse");
73
74       <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>;
75    <b>begin</b>
76       <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>
77          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
78       <b>end</b> <b>if</b>;
79       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_7">Event</A>;
80    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_13">Get_Mouse</A>;
81
82    <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> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
83                                         <FONT COLOR=red><A NAME="ref_78_41" HREF="terminal_interface-curses-mouse__ads.htm#ref_103_7">State</A></FONT>  : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>;
84                                         <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>)
85    <b>is</b>
86       <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>);
87       <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>);
88    <b>begin</b>
89       <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>
90          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
91       <b>else</b>
92          <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>
93             <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>);
94          <b>else</b>
95             <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));
96          <b>end</b> <b>if</b>;
97       <b>end</b> <b>if</b>;
98    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A>;
99
100    <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> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
101                                          <FONT COLOR=red><A NAME="ref_96_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_112_7">State</A></FONT>  : Button_States;
102                                          <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>)
103    <b>is</b>
104    <b>begin</b>
105       <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>
106          <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>
107             <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>);
108          <b>end</b> <b>if</b>;
109       <b>end</b> <b>loop</b>;
110    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_110_14">Register_Reportable_Events</A>;
111
112    <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>)
113                          <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>
114    <b>is</b>
115       <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>;
116                       <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>;
117       <b>pragma</b> Import (C, MMask, "mousemask");
118       <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>;
119       <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>;
120    <b>begin</b>
121       <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>);
122       <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>
123          <A HREF="terminal_interface-curses__ads.htm#ref_870_14">Beep</A>;
124       <b>end</b> <b>if</b>;
125       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_114_7">Old</A>;
126    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_123_13">Start_Mouse</A>;
127
128    <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> : <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>)
129    <b>is</b>
130    <b>begin</b>
131       <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>
132          <A HREF="terminal_interface-curses__ads.htm#ref_870_14">Beep</A>;
133       <b>end</b> <b>if</b>;
134    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_128_14">End_Mouse</A>;
135
136    <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>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
137                              <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>;
138                              <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>);
139
140    <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>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
141                              <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>;
142                              <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>
143       <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>;
144    <b>begin</b>
145       <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>
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__ads.htm#ref_221_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b>
147          <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>;
148       <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>
149          <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>;
150       <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>
151          <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>;
152       <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>
153          <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>;
154       <b>end</b> <b>if</b>;
155       <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>
156          <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>));
157          <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>
158             <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>
159                <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>;
160                <b>exit</b>;
161             <b>end</b> <b>if</b>;
162             <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>;
163          <b>end</b> <b>loop</b>;
164       <b>else</b>
165          <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>;
166          <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>
167             <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>;
168          <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>
169             <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>;
170          <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>
171             <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>;
172          <b>end</b> <b>if</b>;
173       <b>end</b> <b>if</b>;
174    <b>end</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_131_14">Dispatch_Event</A>;
175
176    <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>  : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>;
177                         <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>;
178                         <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>;
179                         <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>;
180                         <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>)
181    <b>is</b>
182       <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>;
183    <b>begin</b>
184       <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>);
185       <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>);
186       <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>);
187    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_14">Get_Event</A>;
188
189    <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> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>)
190    <b>is</b>
191       <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>;
192       <b>pragma</b> Import (C, Ungetmouse, "ungetmouse");
193    <b>begin</b>
194       <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>
195          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
196       <b>end</b> <b>if</b>;
197    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_149_14">Unget_Mouse</A>;
198
199    <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>;
200                                 <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
201    <b>is</b>
202       <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>)
203                          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1926_9">Curses_Bool</A>;
204       <b>pragma</b> Import (C, Wenclose, "wenclose");
205    <b>begin</b>
206       <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>))
207         = <A HREF="terminal_interface-curses__ads.htm#ref_1927_4">Curses_Bool_False</A> <b>then</b>
208          <b>return</b> False;
209       <b>else</b>
210          <b>return</b> True;
211       <b>end</b> <b>if</b>;
212    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_154_13">Enclosed_In_Window</A>;
213
214    <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
215    <b>is</b>
216       <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>;
217       <b>pragma</b> Import (C, Mouseinterval, "mouseinterval");
218    <b>begin</b>
219       <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>)));
220    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_161_13">Mouse_Interval</A>;
221
222 <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>;
223 </PRE></BODY></HTML>