1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding --
5 -- Terminal_Interface.Curses.Panels --
9 ------------------------------------------------------------------------------
10 -- Copyright 2020 Thomas E. Dickey --
11 -- Copyright 1999-2004,2009 Free Software Foundation, Inc. --
13 -- Permission is hereby granted, free of charge, to any person obtaining a --
14 -- copy of this software and associated documentation files (the --
15 -- "Software"), to deal in the Software without restriction, including --
16 -- without limitation the rights to use, copy, modify, merge, publish, --
17 -- distribute, distribute with modifications, sublicense, and/or sell --
18 -- copies of the Software, and to permit persons to whom the Software is --
19 -- furnished to do so, subject to the following conditions: --
21 -- The above copyright notice and this permission notice shall be included --
22 -- in all copies or substantial portions of the Software. --
24 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
25 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
26 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
27 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
28 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
29 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
30 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
32 -- Except as contained in this notice, the name(s) of the above copyright --
33 -- holders shall not be used in advertising or otherwise to promote the --
34 -- sale, use or other dealings in this Software without prior written --
36 ------------------------------------------------------------------------------
37 -- Author: Juergen Pfeifer, 1996
40 -- $Date: 2020/02/02 23:34:34 $
41 -- Binding Version 01.00
42 ------------------------------------------------------------------------------
43 with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux;
46 package body Terminal_Interface.Curses.Panels is
48 use type Interfaces.C.int;
50 function Create (Win : Window) return Panel
52 function Newpanel (Win : Window) return Panel;
53 pragma Import (C, Newpanel, "new_panel");
57 Pan := Newpanel (Win);
58 if Pan = Null_Panel then
59 raise Panel_Exception;
64 procedure Bottom (Pan : Panel)
66 function Bottompanel (Pan : Panel) return C_Int;
67 pragma Import (C, Bottompanel, "bottom_panel");
69 if Bottompanel (Pan) = Curses_Err then
70 raise Panel_Exception;
74 procedure Top (Pan : Panel)
76 function Toppanel (Pan : Panel) return C_Int;
77 pragma Import (C, Toppanel, "top_panel");
79 if Toppanel (Pan) = Curses_Err then
80 raise Panel_Exception;
84 procedure Show (Pan : Panel)
86 function Showpanel (Pan : Panel) return C_Int;
87 pragma Import (C, Showpanel, "show_panel");
89 if Showpanel (Pan) = Curses_Err then
90 raise Panel_Exception;
94 procedure Hide (Pan : Panel)
96 function Hidepanel (Pan : Panel) return C_Int;
97 pragma Import (C, Hidepanel, "hide_panel");
99 if Hidepanel (Pan) = Curses_Err then
100 raise Panel_Exception;
104 function Get_Window (Pan : Panel) return Window
106 function Panel_Win (Pan : Panel) return Window;
107 pragma Import (C, Panel_Win, "panel_window");
109 Win : constant Window := Panel_Win (Pan);
111 if Win = Null_Window then
112 raise Panel_Exception;
117 procedure Replace (Pan : Panel;
120 function Replace_Pan (Pan : Panel;
121 Win : Window) return C_Int;
122 pragma Import (C, Replace_Pan, "replace_panel");
124 if Replace_Pan (Pan, Win) = Curses_Err then
125 raise Panel_Exception;
129 procedure Move (Pan : Panel;
130 Line : Line_Position;
131 Column : Column_Position)
133 function Move (Pan : Panel;
135 Column : C_Int) return C_Int;
136 pragma Import (C, Move, "move_panel");
138 if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then
139 raise Panel_Exception;
143 function Is_Hidden (Pan : Panel) return Boolean
145 function Panel_Hidden (Pan : Panel) return C_Int;
146 pragma Import (C, Panel_Hidden, "panel_hidden");
148 if Panel_Hidden (Pan) = Curses_False then
155 procedure Delete (Pan : in out Panel)
157 function Del_Panel (Pan : Panel) return C_Int;
158 pragma Import (C, Del_Panel, "del_panel");
160 if Del_Panel (Pan) = Curses_Err then
161 raise Panel_Exception;
166 end Terminal_Interface.Curses.Panels;