]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/gen/terminal_interface-curses-mouse.ads.m4
ncurses 4.1
[ncurses.git] / Ada95 / gen / terminal_interface-curses-mouse.ads.m4
1 --  -*- ada -*-
2 define(`HTMLNAME',`terminal_interface-curses-mouse_s.html')dnl
3 include(M4MACRO)dnl
4 ------------------------------------------------------------------------------
5 --                                                                          --
6 --                           GNAT ncurses Binding                           --
7 --                                                                          --
8 --                      Terminal_Interface.Curses.Mouse                     --
9 --                                                                          --
10 --                                 S P E C                                  --
11 --                                                                          --
12 --  Version 00.92                                                           --
13 --                                                                          --
14 --  The ncurses Ada95 binding is copyrighted 1996 by                        --
15 --  Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                     --
16 --                                                                          --
17 --  Permission is hereby granted to reproduce and distribute this           --
18 --  binding by any means and for any fee, whether alone or as part          --
19 --  of a larger distribution, in source or in binary form, PROVIDED         --
20 --  this notice is included with any such distribution, and is not          --
21 --  removed from any of its header files. Mention of ncurses and the        --
22 --  author of this binding in any applications linked with it is            --
23 --  highly appreciated.                                                     --
24 --                                                                          --
25 --  This binding comes AS IS with no warranty, implied or expressed.        --
26 ------------------------------------------------------------------------------
27 --  Version Control:
28 --  $Revision: 1.6 $
29 ------------------------------------------------------------------------------
30 include(`Mouse_Base_Defs')
31 with System;
32
33 package Terminal_Interface.Curses.Mouse is
34
35    --  MANPAGE(`curs_mouse.3x')
36    --  Please note, that in ncurses-1.9.9e documentation mouse support
37    --  is still marked as experimental. So also this binding will change
38    --  if the ncurses methods change.
39    --
40    type Event_Mask is private;
41    No_Events  : constant Event_Mask;
42    All_Events : constant Event_Mask;
43
44    type Mouse_Button is (Left,     -- aka: Button 1
45                          Middle,   -- aka: Button 2
46                          Right,    -- aka: Button 3
47                          Button4,  -- aka: Button 4
48                          Control,  -- Control Key
49                          Shift,    -- Shift Key
50                          Alt);     -- ALT Key
51
52    type Button_State is (Released,
53                          Pressed,
54                          Clicked,
55                          Double_Clicked,
56                          Triple_Clicked);
57
58    type Mouse_Event is private;
59
60    --  MANPAGE(`curs_mouse.3x')
61
62    procedure Register_Reportable_Event
63      (B    : in Mouse_Button;
64       S    : in Button_State;
65       Mask : in out Event_Mask);
66    --  Stores the event described by the button and the state in the mask.
67    --  Before you call this the first time, you should init the mask
68    --  with the Empty_Mask constant
69
70    --  ANCHOR(`mousemask()',`Start_Mouse')
71    function Start_Mouse (Mask : Event_Mask := All_Events)
72                          return Event_Mask;
73    --  AKA
74
75    procedure End_Mouse;
76    pragma Import (C, End_Mouse, "_nc_ada_unregister_mouse");
77    --  Terminates the mouse
78
79    --  ANCHOR(`getmouse()',`Get_Mouse')
80    function Get_Mouse return Mouse_Event;
81    --  AKA
82
83    procedure Get_Event (Event  : in  Mouse_Event;
84                         Y      : out Line_Position;
85                         X      : out Column_Position;
86                         Button : out Mouse_Button;
87                         State  : out Button_State);
88    --  !!! Warning: X and Y are screen coordinates. Due to ripped of lines they
89    --  may not be identical to window coordinates.
90
91    --  ANCHOR(`ungetmouse()',`Unget_Mouse')
92    procedure Unget_Mouse (Event : in Mouse_Event);
93    --  AKA
94
95    --  ANCHOR(`wenclose()',`Enclosed_In_Window')
96    function Enclosed_In_Window (Win    : Window := Standard_Window;
97                                 Event  : Mouse_Event) return Boolean;
98    --  AKA
99    --  But : use event instead of screen coordinates.
100
101    --  ANCHOR(`mouseinterval()',`Mouse_Interval')
102    function Mouse_Interval (Msec : Natural := 200) return Natural;
103    --  AKA
104
105 private
106    type Event_Mask is new Interfaces.C.int;
107    No_Events  : constant Event_Mask := 0;
108    All_Events : constant Event_Mask := -1;
109
110    type Mouse_Event is
111       record
112          Id      : Integer range Integer (Interfaces.C.short'First) ..
113                                  Integer (Interfaces.C.Short'Last);
114          X, Y, Z : Integer range Integer (Interfaces.C.int'First) ..
115                                  Integer (Interfaces.C.int'Last);
116          Bstate  : Event_Mask;
117       end record;
118    pragma Convention (C, Mouse_Event);
119    pragma Pack (Mouse_Event);
120
121 include(`Mouse_Event_Rep')
122    Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER;
123    --  This constant may be different on your system.
124
125 end Terminal_Interface.Curses.Mouse;