2 define(`HTMLNAME',`terminal_interface-curses-mouse__ads.htm')dnl
4 ------------------------------------------------------------------------------
6 -- GNAT ncurses Binding --
8 -- Terminal_Interface.Curses.Mouse --
12 ------------------------------------------------------------------------------
13 -- Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. --
15 -- Permission is hereby granted, free of charge, to any person obtaining a --
16 -- copy of this software and associated documentation files (the --
17 -- "Software"), to deal in the Software without restriction, including --
18 -- without limitation the rights to use, copy, modify, merge, publish, --
19 -- distribute, distribute with modifications, sublicense, and/or sell --
20 -- copies of the Software, and to permit persons to whom the Software is --
21 -- furnished to do so, subject to the following conditions: --
23 -- The above copyright notice and this permission notice shall be included --
24 -- in all copies or substantial portions of the Software. --
26 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
27 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
28 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
29 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
30 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
31 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
32 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
34 -- Except as contained in this notice, the name(s) of the above copyright --
35 -- holders shall not be used in advertising or otherwise to promote the --
36 -- sale, use or other dealings in this Software without prior written --
38 ------------------------------------------------------------------------------
39 -- Author: Juergen Pfeifer, 1996
42 -- $Date: 2011/03/19 12:35:58 $
43 -- Binding Version 01.00
44 ------------------------------------------------------------------------------
45 include(`Mouse_Base_Defs')
48 package Terminal_Interface.Curses.Mouse is
49 pragma Preelaborate (Terminal_Interface.Curses.Mouse);
51 -- MANPAGE(`curs_mouse.3x')
52 -- mouse_trafo, wmouse_trafo are implemented as Transform_Coordinates
53 -- in the parent package.
56 -- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event
58 type Event_Mask is private;
59 No_Events : constant Event_Mask;
60 All_Events : constant Event_Mask;
62 type Mouse_Button is (Left, -- aka: Button 1
63 Middle, -- aka: Button 2
64 Right, -- aka: Button 3
65 Button4, -- aka: Button 4
66 Control, -- Control Key
70 subtype Real_Buttons is Mouse_Button range Left .. Button4;
71 subtype Modifier_Keys is Mouse_Button range Control .. Alt;
73 type Button_State is (Released,
79 type Button_States is array (Button_State) of Boolean;
80 pragma Pack (Button_States);
82 All_Clicks : constant Button_States := (Clicked .. Triple_Clicked => True,
84 All_States : constant Button_States := (others => True);
86 type Mouse_Event is private;
88 -- MANPAGE(`curs_mouse.3x')
90 function Has_Mouse return Boolean;
91 -- Return true if a mouse device is supported, false otherwise.
93 procedure Register_Reportable_Event
94 (Button : Mouse_Button;
96 Mask : in out Event_Mask);
97 -- Stores the event described by the button and the state in the mask.
98 -- Before you call this the first time, you should initialize the mask
99 -- with the Empty_Mask constant
100 pragma Inline (Register_Reportable_Event);
102 procedure Register_Reportable_Events
103 (Button : Mouse_Button;
104 State : Button_States;
105 Mask : in out Event_Mask);
106 -- Register all events described by the Button and the State bitmap.
107 -- Before you call this the first time, you should initialize the mask
108 -- with the Empty_Mask constant
110 -- ANCHOR(`mousemask()',`Start_Mouse')
111 -- There is one difference to mousmask(): we return the value of the
112 -- old mask, that means the event mask value before this call.
113 -- Not Implemented: The library version
114 -- returns a Mouse_Mask that tells which events are reported.
115 function Start_Mouse (Mask : Event_Mask := All_Events)
118 pragma Inline (Start_Mouse);
120 procedure End_Mouse (Mask : Event_Mask := No_Events);
121 -- Terminates the mouse, restores the specified event mask
122 pragma Inline (End_Mouse);
124 -- ANCHOR(`getmouse()',`Get_Mouse')
125 function Get_Mouse return Mouse_Event;
127 pragma Inline (Get_Mouse);
129 procedure Get_Event (Event : Mouse_Event;
130 Y : out Line_Position;
131 X : out Column_Position;
132 Button : out Mouse_Button;
133 State : out Button_State);
134 -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they
135 -- may not be identical to window coordinates.
136 -- Not Implemented: Get_Event only reports one event, the C library
137 -- version supports multiple events, e.g. {click-1, click-3}
138 pragma Inline (Get_Event);
140 -- ANCHOR(`ungetmouse()',`Unget_Mouse')
141 procedure Unget_Mouse (Event : Mouse_Event);
143 pragma Inline (Unget_Mouse);
145 -- ANCHOR(`wenclose()',`Enclosed_In_Window')
146 function Enclosed_In_Window (Win : Window := Standard_Window;
147 Event : Mouse_Event) return Boolean;
149 -- But : use event instead of screen coordinates.
150 pragma Inline (Enclosed_In_Window);
152 -- ANCHOR(`mouseinterval()',`Mouse_Interval')
153 function Mouse_Interval (Msec : Natural := 200) return Natural;
155 pragma Inline (Mouse_Interval);
158 type Event_Mask is new Interfaces.C.unsigned_long;
162 Id : Integer range Integer (Interfaces.C.short'First) ..
163 Integer (Interfaces.C.short'Last);
164 X, Y, Z : Integer range Integer (Interfaces.C.int'First) ..
165 Integer (Interfaces.C.int'Last);
168 pragma Convention (C, Mouse_Event);
170 include(`Mouse_Event_Rep')
171 Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER;
172 -- This constant may be different on your system.
174 include(`Mouse_Events')
175 No_Events : constant Event_Mask := 0;
176 All_Events : constant Event_Mask := ALL_MOUSE_EVENTS;
178 end Terminal_Interface.Curses.Mouse;