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 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 -- Binding Version 01.00
43 ------------------------------------------------------------------------------
44 include(`Mouse_Base_Defs')
47 package Terminal_Interface.Curses.Mouse is
48 pragma Preelaborate (Terminal_Interface.Curses.Mouse);
50 -- MANPAGE(`curs_mouse.3x')
51 -- Please note, that in ncurses-1.9.9e documentation mouse support
52 -- is still marked as experimental. So also this binding will change
53 -- if the ncurses methods change.
55 -- mouse_trafo, wmouse_trafo are implemented as Transform_Coordinates
56 -- in the parent package.
59 -- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event
61 type Event_Mask is private;
62 No_Events : constant Event_Mask;
63 All_Events : constant Event_Mask;
65 type Mouse_Button is (Left, -- aka: Button 1
66 Middle, -- aka: Button 2
67 Right, -- aka: Button 3
68 Button4, -- aka: Button 4
69 Control, -- Control Key
73 subtype Real_Buttons is Mouse_Button range Left .. Button4;
74 subtype Modifier_Keys is Mouse_Button range Control .. Alt;
76 type Button_State is (Released,
82 type Button_States is array (Button_State) of Boolean;
83 pragma Pack (Button_States);
85 All_Clicks : constant Button_States := (Clicked .. Triple_Clicked => True,
87 All_States : constant Button_States := (others => True);
89 type Mouse_Event is private;
91 -- MANPAGE(`curs_mouse.3x')
93 function Has_Mouse return Boolean;
94 -- Return true if a mouse device is supported, false otherwise.
96 procedure Register_Reportable_Event
97 (Button : in Mouse_Button;
98 State : in Button_State;
99 Mask : in out Event_Mask);
100 -- Stores the event described by the button and the state in the mask.
101 -- Before you call this the first time, you should init the mask
102 -- with the Empty_Mask constant
103 pragma Inline (Register_Reportable_Event);
105 procedure Register_Reportable_Events
106 (Button : in Mouse_Button;
107 State : in Button_States;
108 Mask : in out Event_Mask);
109 -- Register all events described by the Button and the State bitmap.
110 -- Before you call this the first time, you should init the mask
111 -- with the Empty_Mask constant
113 -- ANCHOR(`mousemask()',`Start_Mouse')
114 -- There is one difference to mousmask(): we return the value of the
115 -- old mask, that means the event mask value before this call.
116 -- Not Implemented: The library version
117 -- returns a Mouse_Mask that tells which events are reported.
118 function Start_Mouse (Mask : Event_Mask := All_Events)
121 pragma Inline (Start_Mouse);
123 procedure End_Mouse (Mask : in Event_Mask := No_Events);
124 -- Terminates the mouse, restores the specified event mask
125 pragma Inline (End_Mouse);
127 -- ANCHOR(`getmouse()',`Get_Mouse')
128 function Get_Mouse return Mouse_Event;
130 pragma Inline (Get_Mouse);
132 procedure Get_Event (Event : in Mouse_Event;
133 Y : out Line_Position;
134 X : out Column_Position;
135 Button : out Mouse_Button;
136 State : out Button_State);
137 -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they
138 -- may not be identical to window coordinates.
139 -- Not Implemented: Get_Event only reports one event, the C library
140 -- version supports multiple events, e.g. {click-1, click-3}
141 pragma Inline (Get_Event);
143 -- ANCHOR(`ungetmouse()',`Unget_Mouse')
144 procedure Unget_Mouse (Event : in Mouse_Event);
146 pragma Inline (Unget_Mouse);
148 -- ANCHOR(`wenclose()',`Enclosed_In_Window')
149 function Enclosed_In_Window (Win : Window := Standard_Window;
150 Event : Mouse_Event) return Boolean;
152 -- But : use event instead of screen coordinates.
153 pragma Inline (Enclosed_In_Window);
155 -- ANCHOR(`mouseinterval()',`Mouse_Interval')
156 function Mouse_Interval (Msec : Natural := 200) return Natural;
158 pragma Inline (Mouse_Interval);
161 type Event_Mask is new Interfaces.C.unsigned_long;
165 Id : Integer range Integer (Interfaces.C.short'First) ..
166 Integer (Interfaces.C.short'Last);
167 X, Y, Z : Integer range Integer (Interfaces.C.int'First) ..
168 Integer (Interfaces.C.int'Last);
171 pragma Convention (C, Mouse_Event);
172 pragma Pack (Mouse_Event);
174 include(`Mouse_Event_Rep')
175 Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER;
176 -- This constant may be different on your system.
178 include(`Mouse_Events')
180 No_Events : constant Event_Mask := 0;
181 All_Events : constant Event_Mask := ALL_MOUSE_EVENTS;
183 end Terminal_Interface.Curses.Mouse;