ncurses 5.5
[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,2004 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.21 @</EM></FONT>
44 <FONT COLOR=green><EM>--  @Date: 2004/08/21 21:37:00 @</EM></FONT>
45 <FONT COLOR=green><EM>--  Binding Version 01.00</EM></FONT>
46 <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
47 <b>with</b> System;
48
49 <b>with</b> <A HREF="terminal_interface__ads.htm#ref_41_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_41_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>;
50 <b>with</b> <A HREF="interfac__ads.htm#ref_23_9">Interfaces</A>.C; <b>use</b> <A HREF="interfac__ads.htm#ref_23_9">Interfaces</A>.C;
51 <b>use</b> <A HREF="interfac__ads.htm#ref_23_9">Interfaces</A>;
52
53 <b>package</b> <b>body</b> <A HREF="terminal_interface__ads.htm#ref_41_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_48_40" HREF="terminal_interface-curses-mouse__ads.htm#ref_48_35">Mouse</A></FONT> <b>is</b>
54
55    <b>use</b> <b>type</b> System.Bit_Order;
56    <b>use</b> <b>type</b> <A HREF="interfac__ads.htm#ref_23_9">Interfaces</A>.C.int;
57
58    <b>function</b> <FONT COLOR=red><A NAME="ref_53_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_98_13">Has_Mouse</A></FONT> <b>return</b> Boolean
59    <b>is</b>
60       <b>function</b> <FONT COLOR=red><A NAME="ref_55_16">Mouse_Avail</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
61       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_55_16">Mouse_Avail</A>, "_nc_has_mouse");
62    <b>begin</b>
63       <b>if</b> <A HREF="terminal_interface-curses__ads.htm#ref_761_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_55_16">Mouse_Avail</A> /= 0 <b>then</b>
64          <b>return</b> True;
65       <b>else</b>
66          <b>return</b> False;
67       <b>end</b> <b>if</b>;
68    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_98_13">Has_Mouse</A>;
69
70    <b>function</b> <FONT COLOR=red><A NAME="ref_65_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>
71    <b>is</b>
72       <b>type</b> <FONT COLOR=red><A NAME="ref_67_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>;
73
74       <b>function</b> <FONT COLOR=red><A NAME="ref_69_16">Getmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_69_26">Ev</A></FONT> : <A HREF="terminal_interface-curses-mouse__adb.htm#ref_67_12">Event_Access</A>) <b>return</b> <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>;
75       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_16">Getmouse</A>, "getmouse");
76
77       <FONT COLOR=red><A NAME="ref_72_7">Event</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_92_9">Mouse_Event</A>;
78    <b>begin</b>
79       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_69_16">Getmouse</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_72_7">Event</A>'<b>Access</b>) = <A HREF="terminal_interface-curses-aux__ads.htm#ref_72_4">Curses_Err</A> <b>then</b>
80          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
81       <b>end</b> <b>if</b>;
82       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_72_7">Event</A>;
83    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_133_13">Get_Mouse</A>;
84
85    <b>procedure</b> <FONT COLOR=red><A NAME="ref_80_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_80_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>;
86                                         <FONT COLOR=red><A NAME="ref_81_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>;
87                                         <FONT COLOR=red><A NAME="ref_82_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>)
88    <b>is</b>
89       <FONT COLOR=red><A NAME="ref_84_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>);
90       <FONT COLOR=red><A NAME="ref_85_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>);
91    <b>begin</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_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>
93          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
94       <b>else</b>
95          <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>
96             <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_84_7">Button_Nr</A>)) ** <A HREF="terminal_interface-curses-mouse__adb.htm#ref_85_7">State_Nr</A>);
97          <b>else</b>
98             <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_84_7">Button_Nr</A> - 4));
99          <b>end</b> <b>if</b>;
100       <b>end</b> <b>if</b>;
101    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_101_14">Register_Reportable_Event</A>;
102
103    <b>procedure</b> <FONT COLOR=red><A NAME="ref_98_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_110_14">Register_Reportable_Events</A></FONT> (<FONT COLOR=red><A NAME="ref_98_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>;
104                                          <FONT COLOR=red><A NAME="ref_99_42" HREF="terminal_interface-curses-mouse__ads.htm#ref_112_7">State</A></FONT>  : <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_85_9">Button_States</A>;
105                                          <FONT COLOR=red><A NAME="ref_100_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>)
106    <b>is</b>
107    <b>begin</b>
108       <b>for</b> <FONT COLOR=red><A NAME="ref_103_11">S</A></FONT> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_85_9">Button_States</A>'<b>Range</b> <b>loop</b>
109          <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_103_11">S</A>) <b>then</b>
110             <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_103_11">S</A>, <A HREF="terminal_interface-curses-mouse__ads.htm#ref_113_7">Mask</A>);
111          <b>end</b> <b>if</b>;
112       <b>end</b> <b>loop</b>;
113    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_110_14">Register_Reportable_Events</A>;
114
115    <b>function</b> <FONT COLOR=red><A NAME="ref_110_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_123_13">Start_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_110_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>)
116                          <b>return</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>
117    <b>is</b>
118       <b>function</b> <FONT COLOR=red><A NAME="ref_113_16">MMask</A></FONT> (<FONT COLOR=red><A NAME="ref_113_23">M</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
119                       <FONT COLOR=red><A NAME="ref_114_23">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>;
120       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_16">MMask</A>, "mousemask");
121       <FONT COLOR=red><A NAME="ref_116_7">R</A></FONT>   : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
122       <FONT COLOR=red><A NAME="ref_117_7">Old</A></FONT> : <b>aliased</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
123    <b>begin</b>
124       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_116_7">R</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_113_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_117_7">Old</A>'<b>Access</b>);
125       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_116_7">R</A> = <A HREF="terminal_interface-curses-mouse__ads.htm#ref_65_4">No_Events</A> <b>then</b>
126          <A HREF="terminal_interface-curses__ads.htm#ref_864_14">Beep</A>;
127       <b>end</b> <b>if</b>;
128       <b>return</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_117_7">Old</A>;
129    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_123_13">Start_Mouse</A>;
130
131    <b>procedure</b> <FONT COLOR=red><A NAME="ref_126_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_128_14">End_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_126_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>)
132    <b>is</b>
133    <b>begin</b>
134       <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>
135          <A HREF="terminal_interface-curses__ads.htm#ref_864_14">Beep</A>;
136       <b>end</b> <b>if</b>;
137    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_128_14">End_Mouse</A>;
138
139    <b>procedure</b> <FONT COLOR=red><A NAME="ref_134_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_138_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_134_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_138_30">Mask</A></FONT>   : <b>in</b>  <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
140                              <FONT COLOR=red><A NAME="ref_135_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_139_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
141                              <FONT COLOR=red><A NAME="ref_136_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_140_30">State</A></FONT>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>);
142
143    <b>procedure</b> <FONT COLOR=red><A NAME="ref_138_14" HREF="terminal_interface-curses-mouse__adb.htm#ref_134_14">Dispatch_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_138_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A></FONT>   : <b>in</b>  <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
144                              <FONT COLOR=red><A NAME="ref_139_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A></FONT> : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_9">Mouse_Button</A>;
145                              <FONT COLOR=red><A NAME="ref_140_30" HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">State</A></FONT>  : <b>out</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_79_9">Button_State</A>) <b>is</b>
146       <FONT COLOR=red><A NAME="ref_141_7">L</A></FONT> : <A HREF="terminal_interface-curses-mouse__ads.htm#ref_64_9">Event_Mask</A>;
147    <b>begin</b>
148       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_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>
149       <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_221_4">BUTTON1_EVENTS</A>) /= 0 <b>then</b>
150          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_68_26">Left</A>;
151       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_222_4">BUTTON2_EVENTS</A>) /= 0 <b>then</b>
152          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_69_26">Middle</A>;
153       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_223_4">BUTTON3_EVENTS</A>) /= 0 <b>then</b>
154          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_70_26">Right</A>;
155       <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_224_4">BUTTON4_EVENTS</A>) /= 0 <b>then</b>
156          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_71_26">Button4</A>;
157       <b>end</b> <b>if</b>;
158       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> <b>in</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_76_12">Real_Buttons</A> <b>then</b>
159          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_141_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_135_30">Button</A>));
160          <b>for</b> <FONT COLOR=red><A NAME="ref_155_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>
161             <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_141_7">L</A>) /= 0 <b>then</b>
162                <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">State</A> := <A HREF="terminal_interface-curses-mouse__adb.htm#ref_155_14">I</A>;
163                <b>exit</b>;
164             <b>end</b> <b>if</b>;
165             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_141_7">L</A> := 2 * <A HREF="terminal_interface-curses-mouse__adb.htm#ref_141_7">L</A>;
166          <b>end</b> <b>loop</b>;
167       <b>else</b>
168          <A HREF="terminal_interface-curses-mouse__adb.htm#ref_136_30">State</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_80_26">Pressed</A>;
169          <b>if</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_216_4">BUTTON_CTRL</A>) /= 0 <b>then</b>
170             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_72_26">Control</A>;
171          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_217_4">BUTTON_SHIFT</A>) /= 0 <b>then</b>
172             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_73_26">Shift</A>;
173          <b>elsif</b> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_30">Mask</A> <b>and</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_218_4">BUTTON_ALT</A>) /= 0 <b>then</b>
174             <A HREF="terminal_interface-curses-mouse__adb.htm#ref_135_30">Button</A> := <A HREF="terminal_interface-curses-mouse__ads.htm#ref_74_26">Alt</A>;
175          <b>end</b> <b>if</b>;
176       <b>end</b> <b>if</b>;
177    <b>end</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_14">Dispatch_Event</A>;
178
179    <b>procedure</b> <FONT COLOR=red><A NAME="ref_174_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_137_14">Get_Event</A></FONT> (<FONT COLOR=red><A NAME="ref_174_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>;
180                         <FONT COLOR=red><A NAME="ref_175_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>;
181                         <FONT COLOR=red><A NAME="ref_176_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>;
182                         <FONT COLOR=red><A NAME="ref_177_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>;
183                         <FONT COLOR=red><A NAME="ref_178_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>)
184    <b>is</b>
185       <FONT COLOR=red><A NAME="ref_180_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>;
186    <b>begin</b>
187       <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>);
188       <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>);
189       <A HREF="terminal_interface-curses-mouse__adb.htm#ref_134_14">Dispatch_Event</A> (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_180_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>);
190    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_137_14">Get_Event</A>;
191
192    <b>procedure</b> <FONT COLOR=red><A NAME="ref_187_14" HREF="terminal_interface-curses-mouse__ads.htm#ref_149_14">Unget_Mouse</A></FONT> (<FONT COLOR=red><A NAME="ref_187_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>)
193    <b>is</b>
194       <b>function</b> <FONT COLOR=red><A NAME="ref_189_16">Ungetmouse</A></FONT> (<FONT COLOR=red><A NAME="ref_189_28">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>;
195       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_189_16">Ungetmouse</A>, "ungetmouse");
196    <b>begin</b>
197       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_189_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>
198          <b>raise</b> <A HREF="terminal_interface-curses__ads.htm#ref_383_4">Curses_Exception</A>;
199       <b>end</b> <b>if</b>;
200    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_149_14">Unget_Mouse</A>;
201
202    <b>function</b> <FONT COLOR=red><A NAME="ref_197_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_154_13">Enclosed_In_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_197_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_475_13">Standard_Window</A>;
203                                 <FONT COLOR=red><A NAME="ref_198_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
204    <b>is</b>
205       <b>function</b> <FONT COLOR=red><A NAME="ref_200_16">Wenclose</A></FONT> (<FONT COLOR=red><A NAME="ref_200_26">Win</A></FONT> : <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_200_40">Y</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>; <FONT COLOR=red><A NAME="ref_200_51">X</A></FONT> : <A HREF="terminal_interface-curses-aux__ads.htm#ref_55_12">C_Int</A>)
206                          <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_1931_9">Curses_Bool</A>;
207       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_200_16">Wenclose</A>, "wenclose");
208    <b>begin</b>
209       <b>if</b> <A HREF="terminal_interface-curses-mouse__adb.htm#ref_200_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>))
210         = <A HREF="terminal_interface-curses__ads.htm#ref_1932_4">Curses_Bool_False</A> <b>then</b>
211          <b>return</b> False;
212       <b>else</b>
213          <b>return</b> True;
214       <b>end</b> <b>if</b>;
215    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_154_13">Enclosed_In_Window</A>;
216
217    <b>function</b> <FONT COLOR=red><A NAME="ref_212_13" HREF="terminal_interface-curses-mouse__ads.htm#ref_161_13">Mouse_Interval</A></FONT> (<FONT COLOR=red><A NAME="ref_212_29" HREF="terminal_interface-curses-mouse__ads.htm#ref_161_29">Msec</A></FONT> : Natural := 200) <b>return</b> Natural
218    <b>is</b>
219       <b>function</b> <FONT COLOR=red><A NAME="ref_214_16">Mouseinterval</A></FONT> (<FONT COLOR=red><A NAME="ref_214_31">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>;
220       <b>pragma</b> Import (C, <A HREF="terminal_interface-curses-mouse__adb.htm#ref_214_16">Mouseinterval</A>, "mouseinterval");
221    <b>begin</b>
222       <b>return</b> Natural (<A HREF="terminal_interface-curses-mouse__adb.htm#ref_214_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>)));
223    <b>end</b> <A HREF="terminal_interface-curses-mouse__ads.htm#ref_161_13">Mouse_Interval</A>;
224
225 <b>end</b> <A HREF="terminal_interface__ads.htm#ref_41_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>;
226 </PRE></BODY></HTML>