blob: 25bb5d9b5f4c0710f632ebe9d981e831c7af584b [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301-- -*- ada -*-
2define(`HTMLNAME',`terminal_interface-curses__ads.htm')dnl
3include(M4MACRO)------------------------------------------------------------------------------
4-- --
5-- GNAT ncurses Binding --
6-- --
7-- Terminal_Interface.Curses --
8-- --
9-- S P E C --
10-- --
11------------------------------------------------------------------------------
Steve Kondikae271bc2015-11-15 02:50:53 +010012-- Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. --
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053013-- --
14-- Permission is hereby granted, free of charge, to any person obtaining a --
15-- copy of this software and associated documentation files (the --
16-- "Software"), to deal in the Software without restriction, including --
17-- without limitation the rights to use, copy, modify, merge, publish, --
18-- distribute, distribute with modifications, sublicense, and/or sell --
19-- copies of the Software, and to permit persons to whom the Software is --
20-- furnished to do so, subject to the following conditions: --
21-- --
22-- The above copyright notice and this permission notice shall be included --
23-- in all copies or substantial portions of the Software. --
24-- --
25-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
26-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
27-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
28-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
29-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
30-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
31-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
32-- --
33-- Except as contained in this notice, the name(s) of the above copyright --
34-- holders shall not be used in advertising or otherwise to promote the --
35-- sale, use or other dealings in this Software without prior written --
36-- authorization. --
37------------------------------------------------------------------------------
38-- Author: Juergen Pfeifer, 1996
39-- Version Control:
Steve Kondikae271bc2015-11-15 02:50:53 +010040-- $Revision: 1.47 $
41-- $Date: 2014/05/24 21:31:57 $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053042-- Binding Version 01.00
43------------------------------------------------------------------------------
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053044with System.Storage_Elements;
45with Interfaces.C; -- We need this for some assertions.
46
Steve Kondikae271bc2015-11-15 02:50:53 +010047with Terminal_Interface.Curses_Constants;
48
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049package Terminal_Interface.Curses is
50 pragma Preelaborate (Terminal_Interface.Curses);
Steve Kondikae271bc2015-11-15 02:50:53 +010051 pragma Linker_Options ("-lncurses" & Curses_Constants.DFT_ARG_SUFFIX);
52
53 Major_Version : constant := Curses_Constants.NCURSES_VERSION_MAJOR;
54 Minor_Version : constant := Curses_Constants.NCURSES_VERSION_MINOR;
55 NC_Version : String renames Curses_Constants.Version;
56
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057 type Window is private;
58 Null_Window : constant Window;
59
Steve Kondikae271bc2015-11-15 02:50:53 +010060 type Line_Position is new Integer; -- line coordinate
61 type Column_Position is new Integer; -- column coordinate
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062
63 subtype Line_Count is Line_Position range 1 .. Line_Position'Last;
64 -- Type to count lines. We do not allow null windows, so must be positive
65 subtype Column_Count is Column_Position range 1 .. Column_Position'Last;
66 -- Type to count columns. We do not allow null windows, so must be positive
67
68 type Key_Code is new Integer;
69 -- That is anything including real characters, special keys and logical
70 -- request codes.
71
72 -- FIXME: The "-1" should be Curses_Err
Steve Kondikae271bc2015-11-15 02:50:53 +010073 subtype Real_Key_Code is Key_Code range -1 .. Curses_Constants.KEY_MAX;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053074 -- This are the codes that potentially represent a real keystroke.
75 -- Not all codes may be possible on a specific terminal. To check the
76 -- availability of a special key, the Has_Key function is provided.
77
78 subtype Special_Key_Code is Real_Key_Code
Steve Kondikae271bc2015-11-15 02:50:53 +010079 range Curses_Constants. KEY_MIN - 1 .. Real_Key_Code'Last;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053080 -- Type for a function- or special key number
81
82 subtype Normal_Key_Code is Real_Key_Code range
83 Character'Pos (Character'First) .. Character'Pos (Character'Last);
84 -- This are the codes for regular (incl. non-graphical) characters.
85
Steve Kondikae271bc2015-11-15 02:50:53 +010086 -- For those who like to use the original key names we produce them were
87 -- they differ from the original.
88
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053089 -- Constants for function- and special keys
Steve Kondikae271bc2015-11-15 02:50:53 +010090 Key_None : constant Special_Key_Code
91 := Curses_Constants.KEY_MIN - 1;
92 Key_Min : constant Special_Key_Code
93 := Curses_Constants.KEY_MIN;
94 Key_Break : constant Special_Key_Code
95 := Curses_Constants.KEY_BREAK;
96 KEY_DOWN : constant Special_Key_Code
97 := Curses_Constants.KEY_DOWN;
98 Key_Cursor_Down : Special_Key_Code renames KEY_DOWN;
99 KEY_UP : constant Special_Key_Code
100 := Curses_Constants.KEY_UP;
101 Key_Cursor_Up : Special_Key_Code renames KEY_UP;
102 KEY_LEFT : constant Special_Key_Code
103 := Curses_Constants.KEY_LEFT;
104 Key_Cursor_Left : Special_Key_Code renames KEY_LEFT;
105 KEY_RIGHT : constant Special_Key_Code
106 := Curses_Constants.KEY_RIGHT;
107 Key_Cursor_Right : Special_Key_Code renames KEY_RIGHT;
108 Key_Home : constant Special_Key_Code
109 := Curses_Constants.KEY_HOME;
110 Key_Backspace : constant Special_Key_Code
111 := Curses_Constants.KEY_BACKSPACE;
112 Key_F0 : constant Special_Key_Code
113 := Curses_Constants.KEY_F0;
114 Key_F1 : constant Special_Key_Code
115 := Curses_Constants.KEY_F1;
116 Key_F2 : constant Special_Key_Code
117 := Curses_Constants.KEY_F2;
118 Key_F3 : constant Special_Key_Code
119 := Curses_Constants.KEY_F3;
120 Key_F4 : constant Special_Key_Code
121 := Curses_Constants.KEY_F4;
122 Key_F5 : constant Special_Key_Code
123 := Curses_Constants.KEY_F5;
124 Key_F6 : constant Special_Key_Code
125 := Curses_Constants.KEY_F6;
126 Key_F7 : constant Special_Key_Code
127 := Curses_Constants.KEY_F7;
128 Key_F8 : constant Special_Key_Code
129 := Curses_Constants.KEY_F8;
130 Key_F9 : constant Special_Key_Code
131 := Curses_Constants.KEY_F9;
132 Key_F10 : constant Special_Key_Code
133 := Curses_Constants.KEY_F10;
134 Key_F11 : constant Special_Key_Code
135 := Curses_Constants.KEY_F11;
136 Key_F12 : constant Special_Key_Code
137 := Curses_Constants.KEY_F12;
138 Key_F13 : constant Special_Key_Code
139 := Curses_Constants.KEY_F13;
140 Key_F14 : constant Special_Key_Code
141 := Curses_Constants.KEY_F14;
142 Key_F15 : constant Special_Key_Code
143 := Curses_Constants.KEY_F15;
144 Key_F16 : constant Special_Key_Code
145 := Curses_Constants.KEY_F16;
146 Key_F17 : constant Special_Key_Code
147 := Curses_Constants.KEY_F17;
148 Key_F18 : constant Special_Key_Code
149 := Curses_Constants.KEY_F18;
150 Key_F19 : constant Special_Key_Code
151 := Curses_Constants.KEY_F19;
152 Key_F20 : constant Special_Key_Code
153 := Curses_Constants.KEY_F20;
154 Key_F21 : constant Special_Key_Code
155 := Curses_Constants.KEY_F21;
156 Key_F22 : constant Special_Key_Code
157 := Curses_Constants.KEY_F22;
158 Key_F23 : constant Special_Key_Code
159 := Curses_Constants.KEY_F23;
160 Key_F24 : constant Special_Key_Code
161 := Curses_Constants.KEY_F24;
162 KEY_DL : constant Special_Key_Code
163 := Curses_Constants.KEY_DL;
164 Key_Delete_Line : Special_Key_Code renames KEY_DL;
165 KEY_IL : constant Special_Key_Code
166 := Curses_Constants.KEY_IL;
167 Key_Insert_Line : Special_Key_Code renames KEY_IL;
168 KEY_DC : constant Special_Key_Code
169 := Curses_Constants.KEY_DC;
170 Key_Delete_Char : Special_Key_Code renames KEY_DC;
171 KEY_IC : constant Special_Key_Code
172 := Curses_Constants.KEY_IC;
173 Key_Insert_Char : Special_Key_Code renames KEY_IC;
174 KEY_EIC : constant Special_Key_Code
175 := Curses_Constants.KEY_EIC;
176 Key_Exit_Insert_Mode : Special_Key_Code renames KEY_EIC;
177 KEY_CLEAR : constant Special_Key_Code
178 := Curses_Constants.KEY_CLEAR;
179 Key_Clear_Screen : Special_Key_Code renames KEY_CLEAR;
180 KEY_EOS : constant Special_Key_Code
181 := Curses_Constants.KEY_EOS;
182 Key_Clear_End_Of_Screen : Special_Key_Code renames KEY_EOS;
183 KEY_EOL : constant Special_Key_Code
184 := Curses_Constants.KEY_EOL;
185 Key_Clear_End_Of_Line : Special_Key_Code renames KEY_EOL;
186 KEY_SF : constant Special_Key_Code
187 := Curses_Constants.KEY_SF;
188 Key_Scroll_1_Forward : Special_Key_Code renames KEY_SF;
189 KEY_SR : constant Special_Key_Code
190 := Curses_Constants.KEY_SR;
191 Key_Scroll_1_Backward : Special_Key_Code renames KEY_SR;
192 KEY_NPAGE : constant Special_Key_Code
193 := Curses_Constants.KEY_NPAGE;
194 Key_Next_Page : Special_Key_Code renames KEY_NPAGE;
195 KEY_PPAGE : constant Special_Key_Code
196 := Curses_Constants.KEY_PPAGE;
197 Key_Previous_Page : Special_Key_Code renames KEY_PPAGE;
198 KEY_STAB : constant Special_Key_Code
199 := Curses_Constants.KEY_STAB;
200 Key_Set_Tab : Special_Key_Code renames KEY_STAB;
201 KEY_CTAB : constant Special_Key_Code
202 := Curses_Constants.KEY_CTAB;
203 Key_Clear_Tab : Special_Key_Code renames KEY_CTAB;
204 KEY_CATAB : constant Special_Key_Code
205 := Curses_Constants.KEY_CATAB;
206 Key_Clear_All_Tabs : Special_Key_Code renames KEY_CATAB;
207 KEY_ENTER : constant Special_Key_Code
208 := Curses_Constants.KEY_ENTER;
209 Key_Enter_Or_Send : Special_Key_Code renames KEY_ENTER;
210 KEY_SRESET : constant Special_Key_Code
211 := Curses_Constants.KEY_SRESET;
212 Key_Soft_Reset : Special_Key_Code renames KEY_SRESET;
213 Key_Reset : constant Special_Key_Code
214 := Curses_Constants.KEY_RESET;
215 Key_Print : constant Special_Key_Code
216 := Curses_Constants.KEY_PRINT;
217 KEY_LL : constant Special_Key_Code
218 := Curses_Constants.KEY_LL;
219 Key_Bottom : Special_Key_Code renames KEY_LL;
220 KEY_A1 : constant Special_Key_Code
221 := Curses_Constants.KEY_A1;
222 Key_Upper_Left_Of_Keypad : Special_Key_Code renames KEY_A1;
223 KEY_A3 : constant Special_Key_Code
224 := Curses_Constants.KEY_A3;
225 Key_Upper_Right_Of_Keypad : Special_Key_Code renames KEY_A3;
226 KEY_B2 : constant Special_Key_Code
227 := Curses_Constants.KEY_B2;
228 Key_Center_Of_Keypad : Special_Key_Code renames KEY_B2;
229 KEY_C1 : constant Special_Key_Code
230 := Curses_Constants.KEY_C1;
231 Key_Lower_Left_Of_Keypad : Special_Key_Code renames KEY_C1;
232 KEY_C3 : constant Special_Key_Code
233 := Curses_Constants.KEY_C3;
234 Key_Lower_Right_Of_Keypad : Special_Key_Code renames KEY_C3;
235 KEY_BTAB : constant Special_Key_Code
236 := Curses_Constants.KEY_BTAB;
237 Key_Back_Tab : Special_Key_Code renames KEY_BTAB;
238 KEY_BEG : constant Special_Key_Code
239 := Curses_Constants.KEY_BEG;
240 Key_Beginning : Special_Key_Code renames KEY_BEG;
241 Key_Cancel : constant Special_Key_Code
242 := Curses_Constants.KEY_CANCEL;
243 Key_Close : constant Special_Key_Code
244 := Curses_Constants.KEY_CLOSE;
245 Key_Command : constant Special_Key_Code
246 := Curses_Constants.KEY_COMMAND;
247 Key_Copy : constant Special_Key_Code
248 := Curses_Constants.KEY_COPY;
249 Key_Create : constant Special_Key_Code
250 := Curses_Constants.KEY_CREATE;
251 Key_End : constant Special_Key_Code
252 := Curses_Constants.KEY_END;
253 Key_Exit : constant Special_Key_Code
254 := Curses_Constants.KEY_EXIT;
255 Key_Find : constant Special_Key_Code
256 := Curses_Constants.KEY_FIND;
257 Key_Help : constant Special_Key_Code
258 := Curses_Constants.KEY_HELP;
259 Key_Mark : constant Special_Key_Code
260 := Curses_Constants.KEY_MARK;
261 Key_Message : constant Special_Key_Code
262 := Curses_Constants.KEY_MESSAGE;
263 Key_Move : constant Special_Key_Code
264 := Curses_Constants.KEY_MOVE;
265 Key_Next : constant Special_Key_Code
266 := Curses_Constants.KEY_NEXT;
267 Key_Open : constant Special_Key_Code
268 := Curses_Constants.KEY_OPEN;
269 Key_Options : constant Special_Key_Code
270 := Curses_Constants.KEY_OPTIONS;
271 Key_Previous : constant Special_Key_Code
272 := Curses_Constants.KEY_PREVIOUS;
273 Key_Redo : constant Special_Key_Code
274 := Curses_Constants.KEY_REDO;
275 Key_Reference : constant Special_Key_Code
276 := Curses_Constants.KEY_REFERENCE;
277 Key_Refresh : constant Special_Key_Code
278 := Curses_Constants.KEY_REFRESH;
279 Key_Replace : constant Special_Key_Code
280 := Curses_Constants.KEY_REPLACE;
281 Key_Restart : constant Special_Key_Code
282 := Curses_Constants.KEY_RESTART;
283 Key_Resume : constant Special_Key_Code
284 := Curses_Constants.KEY_RESUME;
285 Key_Save : constant Special_Key_Code
286 := Curses_Constants.KEY_SAVE;
287 KEY_SBEG : constant Special_Key_Code
288 := Curses_Constants.KEY_SBEG;
289 Key_Shift_Begin : Special_Key_Code renames KEY_SBEG;
290 KEY_SCANCEL : constant Special_Key_Code
291 := Curses_Constants.KEY_SCANCEL;
292 Key_Shift_Cancel : Special_Key_Code renames KEY_SCANCEL;
293 KEY_SCOMMAND : constant Special_Key_Code
294 := Curses_Constants.KEY_SCOMMAND;
295 Key_Shift_Command : Special_Key_Code renames KEY_SCOMMAND;
296 KEY_SCOPY : constant Special_Key_Code
297 := Curses_Constants.KEY_SCOPY;
298 Key_Shift_Copy : Special_Key_Code renames KEY_SCOPY;
299 KEY_SCREATE : constant Special_Key_Code
300 := Curses_Constants.KEY_SCREATE;
301 Key_Shift_Create : Special_Key_Code renames KEY_SCREATE;
302 KEY_SDC : constant Special_Key_Code
303 := Curses_Constants.KEY_SDC;
304 Key_Shift_Delete_Char : Special_Key_Code renames KEY_SDC;
305 KEY_SDL : constant Special_Key_Code
306 := Curses_Constants.KEY_SDL;
307 Key_Shift_Delete_Line : Special_Key_Code renames KEY_SDL;
308 Key_Select : constant Special_Key_Code
309 := Curses_Constants.KEY_SELECT;
310 KEY_SEND : constant Special_Key_Code
311 := Curses_Constants.KEY_SEND;
312 Key_Shift_End : Special_Key_Code renames KEY_SEND;
313 KEY_SEOL : constant Special_Key_Code
314 := Curses_Constants.KEY_SEOL;
315 Key_Shift_Clear_End_Of_Line : Special_Key_Code renames KEY_SEOL;
316 KEY_SEXIT : constant Special_Key_Code
317 := Curses_Constants.KEY_SEXIT;
318 Key_Shift_Exit : Special_Key_Code renames KEY_SEXIT;
319 KEY_SFIND : constant Special_Key_Code
320 := Curses_Constants.KEY_SFIND;
321 Key_Shift_Find : Special_Key_Code renames KEY_SFIND;
322 KEY_SHELP : constant Special_Key_Code
323 := Curses_Constants.KEY_SHELP;
324 Key_Shift_Help : Special_Key_Code renames KEY_SHELP;
325 KEY_SHOME : constant Special_Key_Code
326 := Curses_Constants.KEY_SHOME;
327 Key_Shift_Home : Special_Key_Code renames KEY_SHOME;
328 KEY_SIC : constant Special_Key_Code
329 := Curses_Constants.KEY_SIC;
330 Key_Shift_Insert_Char : Special_Key_Code renames KEY_SIC;
331 KEY_SLEFT : constant Special_Key_Code
332 := Curses_Constants.KEY_SLEFT;
333 Key_Shift_Cursor_Left : Special_Key_Code renames KEY_SLEFT;
334 KEY_SMESSAGE : constant Special_Key_Code
335 := Curses_Constants.KEY_SMESSAGE;
336 Key_Shift_Message : Special_Key_Code renames KEY_SMESSAGE;
337 KEY_SMOVE : constant Special_Key_Code
338 := Curses_Constants.KEY_SMOVE;
339 Key_Shift_Move : Special_Key_Code renames KEY_SMOVE;
340 KEY_SNEXT : constant Special_Key_Code
341 := Curses_Constants.KEY_SNEXT;
342 Key_Shift_Next_Page : Special_Key_Code renames KEY_SNEXT;
343 KEY_SOPTIONS : constant Special_Key_Code
344 := Curses_Constants.KEY_SOPTIONS;
345 Key_Shift_Options : Special_Key_Code renames KEY_SOPTIONS;
346 KEY_SPREVIOUS : constant Special_Key_Code
347 := Curses_Constants.KEY_SPREVIOUS;
348 Key_Shift_Previous_Page : Special_Key_Code renames KEY_SPREVIOUS;
349 KEY_SPRINT : constant Special_Key_Code
350 := Curses_Constants.KEY_SPRINT;
351 Key_Shift_Print : Special_Key_Code renames KEY_SPRINT;
352 KEY_SREDO : constant Special_Key_Code
353 := Curses_Constants.KEY_SREDO;
354 Key_Shift_Redo : Special_Key_Code renames KEY_SREDO;
355 KEY_SREPLACE : constant Special_Key_Code
356 := Curses_Constants.KEY_SREPLACE;
357 Key_Shift_Replace : Special_Key_Code renames KEY_SREPLACE;
358 KEY_SRIGHT : constant Special_Key_Code
359 := Curses_Constants.KEY_SRIGHT;
360 Key_Shift_Cursor_Right : Special_Key_Code renames KEY_SRIGHT;
361 KEY_SRSUME : constant Special_Key_Code
362 := Curses_Constants.KEY_SRSUME;
363 Key_Shift_Resume : Special_Key_Code renames KEY_SRSUME;
364 KEY_SSAVE : constant Special_Key_Code
365 := Curses_Constants.KEY_SSAVE;
366 Key_Shift_Save : Special_Key_Code renames KEY_SSAVE;
367 KEY_SSUSPEND : constant Special_Key_Code
368 := Curses_Constants.KEY_SSUSPEND;
369 Key_Shift_Suspend : Special_Key_Code renames KEY_SSUSPEND;
370 KEY_SUNDO : constant Special_Key_Code
371 := Curses_Constants.KEY_SUNDO;
372 Key_Shift_Undo : Special_Key_Code renames KEY_SUNDO;
373 Key_Suspend : constant Special_Key_Code
374 := Curses_Constants.KEY_SUSPEND;
375 Key_Undo : constant Special_Key_Code
376 := Curses_Constants.KEY_UNDO;
377 Key_Mouse : constant Special_Key_Code
378 := Curses_Constants.KEY_MOUSE;
379 Key_Resize : constant Special_Key_Code
380 := Curses_Constants.KEY_RESIZE;
381 Key_Max : constant Special_Key_Code
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530382 := Special_Key_Code'Last;
383
384 subtype User_Key_Code is Key_Code
385 range (Key_Max + 129) .. Key_Code'Last;
386 -- This is reserved for user defined key codes. The range between Key_Max
387 -- and the first user code is reserved for subsystems like menu and forms.
388
Steve Kondikae271bc2015-11-15 02:50:53 +0100389 --------------------------------------------------------------------------
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530390
391 type Color_Number is range -1 .. Integer (Interfaces.C.short'Last);
392 for Color_Number'Size use Interfaces.C.short'Size;
393 -- (n)curses uses a short for the color index
394 -- The model is, that a Color_Number is an index into an array of
395 -- (potentially) definable colors. Some of those indices are
396 -- predefined (see below), although they may not really exist.
397
Steve Kondikae271bc2015-11-15 02:50:53 +0100398 Black : constant Color_Number := Curses_Constants.COLOR_BLACK;
399 Red : constant Color_Number := Curses_Constants.COLOR_RED;
400 Green : constant Color_Number := Curses_Constants.COLOR_GREEN;
401 Yellow : constant Color_Number := Curses_Constants.COLOR_YELLOW;
402 Blue : constant Color_Number := Curses_Constants.COLOR_BLUE;
403 Magenta : constant Color_Number := Curses_Constants.COLOR_MAGENTA;
404 Cyan : constant Color_Number := Curses_Constants.COLOR_CYAN;
405 White : constant Color_Number := Curses_Constants.COLOR_WHITE;
406
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530407 type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last);
408 for RGB_Value'Size use Interfaces.C.short'Size;
409 -- Some system may allow to redefine a color by setting RGB values.
410
411 type Color_Pair is range 0 .. 255;
412 for Color_Pair'Size use 8;
413 subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255;
414 -- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0
415 -- is fixed (Black & White). A color pair is simply a combination of
416 -- two colors described by Color_Numbers, one for the foreground and
417 -- the other for the background
418
Steve Kondikae271bc2015-11-15 02:50:53 +0100419 type Character_Attribute_Set is
420 record
421 Stand_Out : Boolean;
422 Under_Line : Boolean;
423 Reverse_Video : Boolean;
424 Blink : Boolean;
425 Dim_Character : Boolean;
426 Bold_Character : Boolean;
427 Protected_Character : Boolean;
428 Invisible_Character : Boolean;
429 Alternate_Character_Set : Boolean;
430 Horizontal : Boolean;
431 Left : Boolean;
432 Low : Boolean;
433 Right : Boolean;
434 Top : Boolean;
435 Vertical : Boolean;
436 end record;
437
438 for Character_Attribute_Set use
439 record
440 Stand_Out at 0 range
441 Curses_Constants.A_STANDOUT_First - Curses_Constants.Attr_First
442 .. Curses_Constants.A_STANDOUT_Last - Curses_Constants.Attr_First;
443 Under_Line at 0 range
444 Curses_Constants.A_UNDERLINE_First - Curses_Constants.Attr_First
445 .. Curses_Constants.A_UNDERLINE_Last - Curses_Constants.Attr_First;
446 Reverse_Video at 0 range
447 Curses_Constants.A_REVERSE_First - Curses_Constants.Attr_First
448 .. Curses_Constants.A_REVERSE_Last - Curses_Constants.Attr_First;
449 Blink at 0 range
450 Curses_Constants.A_BLINK_First - Curses_Constants.Attr_First
451 .. Curses_Constants.A_BLINK_Last - Curses_Constants.Attr_First;
452 Dim_Character at 0 range
453 Curses_Constants.A_DIM_First - Curses_Constants.Attr_First
454 .. Curses_Constants.A_DIM_Last - Curses_Constants.Attr_First;
455 Bold_Character at 0 range
456 Curses_Constants.A_BOLD_First - Curses_Constants.Attr_First
457 .. Curses_Constants.A_BOLD_Last - Curses_Constants.Attr_First;
458 Protected_Character at 0 range
459 Curses_Constants.A_PROTECT_First - Curses_Constants.Attr_First
460 .. Curses_Constants.A_PROTECT_Last - Curses_Constants.Attr_First;
461 Invisible_Character at 0 range
462 Curses_Constants.A_INVIS_First - Curses_Constants.Attr_First
463 .. Curses_Constants.A_INVIS_Last - Curses_Constants.Attr_First;
464 Alternate_Character_Set at 0 range
465 Curses_Constants.A_ALTCHARSET_First - Curses_Constants.Attr_First
466 .. Curses_Constants.A_ALTCHARSET_Last - Curses_Constants.Attr_First;
467 Horizontal at 0 range
468 Curses_Constants.A_HORIZONTAL_First - Curses_Constants.Attr_First
469 .. Curses_Constants.A_HORIZONTAL_Last - Curses_Constants.Attr_First;
470 Left at 0 range
471 Curses_Constants.A_LEFT_First - Curses_Constants.Attr_First
472 .. Curses_Constants.A_LEFT_Last - Curses_Constants.Attr_First;
473 Low at 0 range
474 Curses_Constants.A_LOW_First - Curses_Constants.Attr_First
475 .. Curses_Constants.A_LOW_Last - Curses_Constants.Attr_First;
476 Right at 0 range
477 Curses_Constants.A_RIGHT_First - Curses_Constants.Attr_First
478 .. Curses_Constants.A_RIGHT_Last - Curses_Constants.Attr_First;
479 Top at 0 range
480 Curses_Constants.A_TOP_First - Curses_Constants.Attr_First
481 .. Curses_Constants.A_TOP_Last - Curses_Constants.Attr_First;
482 Vertical at 0 range
483 Curses_Constants.A_VERTICAL_First - Curses_Constants.Attr_First
484 .. Curses_Constants.A_VERTICAL_Last - Curses_Constants.Attr_First;
485 end record;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530486
487 Normal_Video : constant Character_Attribute_Set := (others => False);
488
489 type Attributed_Character is
490 record
491 Attr : Character_Attribute_Set;
492 Color : Color_Pair;
493 Ch : Character;
494 end record;
Steve Kondikae271bc2015-11-15 02:50:53 +0100495 pragma Convention (C_Pass_By_Copy, Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530496 -- This is the counterpart for the chtype in C.
497
Steve Kondikae271bc2015-11-15 02:50:53 +0100498 for Attributed_Character use
499 record
500 Ch at 0 range Curses_Constants.A_CHARTEXT_First
501 .. Curses_Constants.A_CHARTEXT_Last;
502 Color at 0 range Curses_Constants.A_COLOR_First
503 .. Curses_Constants.A_COLOR_Last;
504 pragma Warnings (Off);
505 Attr at 0 range Curses_Constants.Attr_First
506 .. Curses_Constants.Attr_Last;
507 pragma Warnings (On);
508 end record;
509 for Attributed_Character'Size use Curses_Constants.chtype_Size;
510
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530511 Default_Character : constant Attributed_Character
512 := (Ch => Character'First,
513 Color => Color_Pair'First,
514 Attr => (others => False)); -- preelaboratable Normal_Video
515
516 type Attributed_String is array (Positive range <>) of Attributed_Character;
Steve Kondikae271bc2015-11-15 02:50:53 +0100517 pragma Convention (C, Attributed_String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530518 -- In this binding we allow strings of attributed characters.
519
520 ------------------
521 -- Exceptions --
522 ------------------
523 Curses_Exception : exception;
524 Wrong_Curses_Version : exception;
525
526 -- Those exceptions are raised by the ETI (Extended Terminal Interface)
527 -- subpackets for Menu and Forms handling.
528 --
529 Eti_System_Error : exception;
530 Eti_Bad_Argument : exception;
531 Eti_Posted : exception;
532 Eti_Connected : exception;
533 Eti_Bad_State : exception;
534 Eti_No_Room : exception;
535 Eti_Not_Posted : exception;
536 Eti_Unknown_Command : exception;
537 Eti_No_Match : exception;
538 Eti_Not_Selectable : exception;
539 Eti_Not_Connected : exception;
540 Eti_Request_Denied : exception;
541 Eti_Invalid_Field : exception;
542 Eti_Current : exception;
543
544 --------------------------------------------------------------------------
545 -- External C variables
546 -- Conceptually even in C this are kind of constants, but they are
547 -- initialized and sometimes changed by the library routines at runtime
548 -- depending on the type of terminal. I believe the best way to model
549 -- this is to use functions.
550 --------------------------------------------------------------------------
551
552 function Lines return Line_Count;
553 pragma Inline (Lines);
554
555 function Columns return Column_Count;
556 pragma Inline (Columns);
557
558 function Tab_Size return Natural;
559 pragma Inline (Tab_Size);
560
561 function Number_Of_Colors return Natural;
562 pragma Inline (Number_Of_Colors);
563
564 function Number_Of_Color_Pairs return Natural;
565 pragma Inline (Number_Of_Color_Pairs);
566
Steve Kondikae271bc2015-11-15 02:50:53 +0100567 subtype ACS_Index is Character range
568 Character'Val (0) .. Character'Val (127);
569 function ACS_Map (Index : ACS_Index) return Attributed_Character;
570 pragma Import (C, ACS_Map, "acs_map_as_function");
571
572 -- Constants for several characters from the Alternate Character Set
573 -- You must use these constants as indices into the ACS_Map function
574 -- to get the corresponding attributed character at runtime
575 ACS_Upper_Left_Corner : constant ACS_Index
576 := Character'Val (Curses_Constants.ACS_ULCORNER);
577 ACS_Lower_Left_Corner : constant ACS_Index
578 := Character'Val (Curses_Constants.ACS_LLCORNER);
579 ACS_Upper_Right_Corner : constant ACS_Index
580 := Character'Val (Curses_Constants.ACS_URCORNER);
581 ACS_Lower_Right_Corner : constant ACS_Index
582 := Character'Val (Curses_Constants.ACS_LRCORNER);
583 ACS_Left_Tee : constant ACS_Index
584 := Character'Val (Curses_Constants.ACS_LTEE);
585 ACS_Right_Tee : constant ACS_Index
586 := Character'Val (Curses_Constants.ACS_RTEE);
587 ACS_Bottom_Tee : constant ACS_Index
588 := Character'Val (Curses_Constants.ACS_BTEE);
589 ACS_Top_Tee : constant ACS_Index
590 := Character'Val (Curses_Constants.ACS_TTEE);
591 ACS_Horizontal_Line : constant ACS_Index
592 := Character'Val (Curses_Constants.ACS_HLINE);
593 ACS_Vertical_Line : constant ACS_Index
594 := Character'Val (Curses_Constants.ACS_VLINE);
595 ACS_Plus_Symbol : constant ACS_Index
596 := Character'Val (Curses_Constants.ACS_PLUS);
597 ACS_Scan_Line_1 : constant ACS_Index
598 := Character'Val (Curses_Constants.ACS_S1);
599 ACS_Scan_Line_9 : constant ACS_Index
600 := Character'Val (Curses_Constants.ACS_S9);
601 ACS_Diamond : constant ACS_Index
602 := Character'Val (Curses_Constants.ACS_DIAMOND);
603 ACS_Checker_Board : constant ACS_Index
604 := Character'Val (Curses_Constants.ACS_CKBOARD);
605 ACS_Degree : constant ACS_Index
606 := Character'Val (Curses_Constants.ACS_DEGREE);
607 ACS_Plus_Minus : constant ACS_Index
608 := Character'Val (Curses_Constants.ACS_PLMINUS);
609 ACS_Bullet : constant ACS_Index
610 := Character'Val (Curses_Constants.ACS_BULLET);
611 ACS_Left_Arrow : constant ACS_Index
612 := Character'Val (Curses_Constants.ACS_LARROW);
613 ACS_Right_Arrow : constant ACS_Index
614 := Character'Val (Curses_Constants.ACS_RARROW);
615 ACS_Down_Arrow : constant ACS_Index
616 := Character'Val (Curses_Constants.ACS_DARROW);
617 ACS_Up_Arrow : constant ACS_Index
618 := Character'Val (Curses_Constants.ACS_UARROW);
619 ACS_Board_Of_Squares : constant ACS_Index
620 := Character'Val (Curses_Constants.ACS_BOARD);
621 ACS_Lantern : constant ACS_Index
622 := Character'Val (Curses_Constants.ACS_LANTERN);
623 ACS_Solid_Block : constant ACS_Index
624 := Character'Val (Curses_Constants.ACS_BLOCK);
625 ACS_Scan_Line_3 : constant ACS_Index
626 := Character'Val (Curses_Constants.ACS_S3);
627 ACS_Scan_Line_7 : constant ACS_Index
628 := Character'Val (Curses_Constants.ACS_S7);
629 ACS_Less_Or_Equal : constant ACS_Index
630 := Character'Val (Curses_Constants.ACS_LEQUAL);
631 ACS_Greater_Or_Equal : constant ACS_Index
632 := Character'Val (Curses_Constants.ACS_GEQUAL);
633 ACS_PI : constant ACS_Index
634 := Character'Val (Curses_Constants.ACS_PI);
635 ACS_Not_Equal : constant ACS_Index
636 := Character'Val (Curses_Constants.ACS_NEQUAL);
637 ACS_Sterling : constant ACS_Index
638 := Character'Val (Curses_Constants.ACS_STERLING);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530639
640 -- MANPAGE(`curs_initscr.3x')
641 -- | Not implemented: newterm, set_term, delscreen
642
643 -- ANCHOR(`stdscr',`Standard_Window')
644 function Standard_Window return Window;
645 -- AKA
Steve Kondikae271bc2015-11-15 02:50:53 +0100646 pragma Import (C, Standard_Window, "stdscr_as_function");
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530647 pragma Inline (Standard_Window);
648
649 -- ANCHOR(`curscr',`Current_Window')
650 function Current_Window return Window;
651 -- AKA
Steve Kondikae271bc2015-11-15 02:50:53 +0100652 pragma Import (C, Current_Window, "curscr_as_function");
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530653 pragma Inline (Current_Window);
654
655 -- ANCHOR(`initscr()',`Init_Screen')
656 procedure Init_Screen;
657
658 -- ANCHOR(`initscr()',`Init_Windows')
659 procedure Init_Windows renames Init_Screen;
660 -- AKA
661 pragma Inline (Init_Screen);
662 -- pragma Inline (Init_Windows);
663
664 -- ANCHOR(`endwin()',`End_Windows')
665 procedure End_Windows;
666 -- AKA
667 procedure End_Screen renames End_Windows;
668 pragma Inline (End_Windows);
669 -- pragma Inline (End_Screen);
670
671 -- ANCHOR(`isendwin()',`Is_End_Window')
672 function Is_End_Window return Boolean;
673 -- AKA
674 pragma Inline (Is_End_Window);
675
676 -- MANPAGE(`curs_move.3x')
677
678 -- ANCHOR(`wmove()',`Move_Cursor')
Steve Kondikae271bc2015-11-15 02:50:53 +0100679 procedure Move_Cursor (Win : Window := Standard_Window;
680 Line : Line_Position;
681 Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530682 -- AKA
683 -- ALIAS(`move()')
684 pragma Inline (Move_Cursor);
685
686 -- MANPAGE(`curs_addch.3x')
687
688 -- ANCHOR(`waddch()',`Add')
Steve Kondikae271bc2015-11-15 02:50:53 +0100689 procedure Add (Win : Window := Standard_Window;
690 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530691 -- AKA
692 -- ALIAS(`addch()')
693
Steve Kondikae271bc2015-11-15 02:50:53 +0100694 procedure Add (Win : Window := Standard_Window;
695 Ch : Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530696 -- Add a single character at the current logical cursor position to
697 -- the window. Use the current windows attributes.
698
699 -- ANCHOR(`mvwaddch()',`Add')
700 procedure Add
Steve Kondikae271bc2015-11-15 02:50:53 +0100701 (Win : Window := Standard_Window;
702 Line : Line_Position;
703 Column : Column_Position;
704 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530705 -- AKA
706 -- ALIAS(`mvaddch()')
707
708 procedure Add
Steve Kondikae271bc2015-11-15 02:50:53 +0100709 (Win : Window := Standard_Window;
710 Line : Line_Position;
711 Column : Column_Position;
712 Ch : Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530713 -- Move to the position and add a single character into the window
714 -- There are more Add routines, so the Inline pragma follows later
715
716 -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo')
717 procedure Add_With_Immediate_Echo
Steve Kondikae271bc2015-11-15 02:50:53 +0100718 (Win : Window := Standard_Window;
719 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530720 -- AKA
721 -- ALIAS(`echochar()')
722
723 procedure Add_With_Immediate_Echo
Steve Kondikae271bc2015-11-15 02:50:53 +0100724 (Win : Window := Standard_Window;
725 Ch : Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530726 -- Add a character and do an immediate refresh of the screen.
727 pragma Inline (Add_With_Immediate_Echo);
728
729 -- MANPAGE(`curs_window.3x')
730 -- Not Implemented: wcursyncup
731
732 -- ANCHOR(`newwin()',`Create')
733 function Create
734 (Number_Of_Lines : Line_Count;
735 Number_Of_Columns : Column_Count;
736 First_Line_Position : Line_Position;
737 First_Column_Position : Column_Position) return Window;
738 -- Not Implemented: Default Number_Of_Lines, Number_Of_Columns
739 -- the C version lets them be 0, see the man page.
740 -- AKA
741 pragma Inline (Create);
742
743 function New_Window
744 (Number_Of_Lines : Line_Count;
745 Number_Of_Columns : Column_Count;
746 First_Line_Position : Line_Position;
747 First_Column_Position : Column_Position) return Window
748 renames Create;
749 -- pragma Inline (New_Window);
750
751 -- ANCHOR(`delwin()',`Delete')
752 procedure Delete (Win : in out Window);
753 -- AKA
754 -- Reset Win to Null_Window
755 pragma Inline (Delete);
756
757 -- ANCHOR(`subwin()',`Sub_Window')
758 function Sub_Window
759 (Win : Window := Standard_Window;
760 Number_Of_Lines : Line_Count;
761 Number_Of_Columns : Column_Count;
762 First_Line_Position : Line_Position;
763 First_Column_Position : Column_Position) return Window;
764 -- AKA
765 pragma Inline (Sub_Window);
766
767 -- ANCHOR(`derwin()',`Derived_Window')
768 function Derived_Window
769 (Win : Window := Standard_Window;
770 Number_Of_Lines : Line_Count;
771 Number_Of_Columns : Column_Count;
772 First_Line_Position : Line_Position;
773 First_Column_Position : Column_Position) return Window;
774 -- AKA
775 pragma Inline (Derived_Window);
776
777 -- ANCHOR(`dupwin()',`Duplicate')
778 function Duplicate (Win : Window) return Window;
779 -- AKA
780 pragma Inline (Duplicate);
781
782 -- ANCHOR(`mvwin()',`Move_Window')
Steve Kondikae271bc2015-11-15 02:50:53 +0100783 procedure Move_Window (Win : Window;
784 Line : Line_Position;
785 Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530786 -- AKA
787 pragma Inline (Move_Window);
788
789 -- ANCHOR(`mvderwin()',`Move_Derived_Window')
Steve Kondikae271bc2015-11-15 02:50:53 +0100790 procedure Move_Derived_Window (Win : Window;
791 Line : Line_Position;
792 Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530793 -- AKA
794 pragma Inline (Move_Derived_Window);
795
796 -- ANCHOR(`wsyncup()',`Synchronize_Upwards')
Steve Kondikae271bc2015-11-15 02:50:53 +0100797 procedure Synchronize_Upwards (Win : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530798 -- AKA
799 pragma Import (C, Synchronize_Upwards, "wsyncup");
800
801 -- ANCHOR(`wsyncdown()',`Synchronize_Downwards')
Steve Kondikae271bc2015-11-15 02:50:53 +0100802 procedure Synchronize_Downwards (Win : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530803 -- AKA
804 pragma Import (C, Synchronize_Downwards, "wsyncdown");
805
806 -- ANCHOR(`syncok()',`Set_Synch_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +0100807 procedure Set_Synch_Mode (Win : Window := Standard_Window;
808 Mode : Boolean := False);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530809 -- AKA
810 pragma Inline (Set_Synch_Mode);
811
812 -- MANPAGE(`curs_addstr.3x')
813
814 -- ANCHOR(`waddnstr()',`Add')
Steve Kondikae271bc2015-11-15 02:50:53 +0100815 procedure Add (Win : Window := Standard_Window;
816 Str : String;
817 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530818 -- AKA
819 -- ALIAS(`waddstr()')
820 -- ALIAS(`addnstr()')
821 -- ALIAS(`addstr()')
822
823 -- ANCHOR(`mvwaddnstr()',`Add')
Steve Kondikae271bc2015-11-15 02:50:53 +0100824 procedure Add (Win : Window := Standard_Window;
825 Line : Line_Position;
826 Column : Column_Position;
827 Str : String;
828 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530829 -- AKA
830 -- ALIAS(`mvwaddstr()')
831 -- ALIAS(`mvaddnstr()')
832 -- ALIAS(`mvaddstr()')
833
834 -- MANPAGE(`curs_addchstr.3x')
835
836 -- ANCHOR(`waddchnstr()',`Add')
Steve Kondikae271bc2015-11-15 02:50:53 +0100837 procedure Add (Win : Window := Standard_Window;
838 Str : Attributed_String;
839 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530840 -- AKA
841 -- ALIAS(`waddchstr()')
842 -- ALIAS(`addchnstr()')
843 -- ALIAS(`addchstr()')
844
845 -- ANCHOR(`mvwaddchnstr()',`Add')
Steve Kondikae271bc2015-11-15 02:50:53 +0100846 procedure Add (Win : Window := Standard_Window;
847 Line : Line_Position;
848 Column : Column_Position;
849 Str : Attributed_String;
850 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530851 -- AKA
852 -- ALIAS(`mvwaddchstr()')
853 -- ALIAS(`mvaddchnstr()')
854 -- ALIAS(`mvaddchstr()')
855 pragma Inline (Add);
856
857 -- MANPAGE(`curs_border.3x')
858 -- | Not implemented: mvhline, mvwhline, mvvline, mvwvline
859 -- | use Move_Cursor then Horizontal_Line or Vertical_Line
860
861 -- ANCHOR(`wborder()',`Border')
862 procedure Border
Steve Kondikae271bc2015-11-15 02:50:53 +0100863 (Win : Window := Standard_Window;
864 Left_Side_Symbol : Attributed_Character := Default_Character;
865 Right_Side_Symbol : Attributed_Character := Default_Character;
866 Top_Side_Symbol : Attributed_Character := Default_Character;
867 Bottom_Side_Symbol : Attributed_Character := Default_Character;
868 Upper_Left_Corner_Symbol : Attributed_Character := Default_Character;
869 Upper_Right_Corner_Symbol : Attributed_Character := Default_Character;
870 Lower_Left_Corner_Symbol : Attributed_Character := Default_Character;
871 Lower_Right_Corner_Symbol : Attributed_Character := Default_Character
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530872 );
873 -- AKA
874 -- ALIAS(`border()')
875 pragma Inline (Border);
876
877 -- ANCHOR(`box()',`Box')
878 procedure Box
Steve Kondikae271bc2015-11-15 02:50:53 +0100879 (Win : Window := Standard_Window;
880 Vertical_Symbol : Attributed_Character := Default_Character;
881 Horizontal_Symbol : Attributed_Character := Default_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530882 -- AKA
883 pragma Inline (Box);
884
885 -- ANCHOR(`whline()',`Horizontal_Line')
886 procedure Horizontal_Line
Steve Kondikae271bc2015-11-15 02:50:53 +0100887 (Win : Window := Standard_Window;
888 Line_Size : Natural;
889 Line_Symbol : Attributed_Character := Default_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530890 -- AKA
891 -- ALIAS(`hline()')
892 pragma Inline (Horizontal_Line);
893
894 -- ANCHOR(`wvline()',`Vertical_Line')
895 procedure Vertical_Line
Steve Kondikae271bc2015-11-15 02:50:53 +0100896 (Win : Window := Standard_Window;
897 Line_Size : Natural;
898 Line_Symbol : Attributed_Character := Default_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530899 -- AKA
900 -- ALIAS(`vline()')
901 pragma Inline (Vertical_Line);
902
903 -- MANPAGE(`curs_getch.3x')
904 -- Not implemented: mvgetch, mvwgetch
905
906 -- ANCHOR(`wgetch()',`Get_Keystroke')
907 function Get_Keystroke (Win : Window := Standard_Window)
908 return Real_Key_Code;
909 -- AKA
910 -- ALIAS(`getch()')
911 -- Get a character from the keyboard and echo it - if enabled - to the
912 -- window.
Steve Kondikae271bc2015-11-15 02:50:53 +0100913 -- If for any reason (i.e. a timeout) we could not get a character the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530914 -- returned keycode is Key_None.
915 pragma Inline (Get_Keystroke);
916
917 -- ANCHOR(`ungetch()',`Undo_Keystroke')
Steve Kondikae271bc2015-11-15 02:50:53 +0100918 procedure Undo_Keystroke (Key : Real_Key_Code);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530919 -- AKA
920 pragma Inline (Undo_Keystroke);
921
922 -- ANCHOR(`has_key()',`Has_Key')
923 function Has_Key (Key : Special_Key_Code) return Boolean;
924 -- AKA
925 pragma Inline (Has_Key);
926
927 -- |
928 -- | Some helper functions
929 -- |
930 function Is_Function_Key (Key : Special_Key_Code) return Boolean;
931 -- Return True if the Key is a function key (i.e. one of F0 .. F63)
932 pragma Inline (Is_Function_Key);
933
934 subtype Function_Key_Number is Integer range 0 .. 63;
935 -- (n)curses allows for 64 function keys.
936
937 function Function_Key (Key : Real_Key_Code) return Function_Key_Number;
938 -- Return the number of the function key. If the code is not a
939 -- function key, a CONSTRAINT_ERROR will be raised.
940 pragma Inline (Function_Key);
941
942 function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code;
943 -- Return the key code for a given function-key number.
944 pragma Inline (Function_Key_Code);
945
946 -- MANPAGE(`curs_attr.3x')
947 -- | Not implemented attr_off, wattr_off,
948 -- | attr_on, wattr_on, attr_set, wattr_set
949
950 -- PAIR_NUMBER
951 -- PAIR_NUMBER(c) is the same as c.Color
952
953 -- ANCHOR(`standout()',`Standout')
954 procedure Standout (Win : Window := Standard_Window;
955 On : Boolean := True);
956 -- ALIAS(`wstandout()')
957 -- ALIAS(`wstandend()')
958
959 -- ANCHOR(`wattron()',`Switch_Character_Attribute')
960 procedure Switch_Character_Attribute
Steve Kondikae271bc2015-11-15 02:50:53 +0100961 (Win : Window := Standard_Window;
962 Attr : Character_Attribute_Set := Normal_Video;
963 On : Boolean := True); -- if False we switch Off.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530964 -- Switches those Attributes set to true in the list.
965 -- AKA
966 -- ALIAS(`wattroff()')
967 -- ALIAS(`attron()')
968 -- ALIAS(`attroff()')
969
970 -- ANCHOR(`wattrset()',`Set_Character_Attributes')
971 procedure Set_Character_Attributes
Steve Kondikae271bc2015-11-15 02:50:53 +0100972 (Win : Window := Standard_Window;
973 Attr : Character_Attribute_Set := Normal_Video;
974 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530975 -- AKA
976 -- ALIAS(`attrset()')
977 pragma Inline (Set_Character_Attributes);
978
979 -- ANCHOR(`wattr_get()',`Get_Character_Attributes')
980 function Get_Character_Attribute
Steve Kondikae271bc2015-11-15 02:50:53 +0100981 (Win : Window := Standard_Window) return Character_Attribute_Set;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530982 -- AKA
983 -- ALIAS(`attr_get()')
984
985 -- ANCHOR(`wattr_get()',`Get_Character_Attribute')
986 function Get_Character_Attribute
Steve Kondikae271bc2015-11-15 02:50:53 +0100987 (Win : Window := Standard_Window) return Color_Pair;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530988 -- AKA
989 pragma Inline (Get_Character_Attribute);
990
991 -- ANCHOR(`wcolor_set()',`Set_Color')
Steve Kondikae271bc2015-11-15 02:50:53 +0100992 procedure Set_Color (Win : Window := Standard_Window;
993 Pair : Color_Pair);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530994 -- AKA
995 -- ALIAS(`color_set()')
996 pragma Inline (Set_Color);
997
998 -- ANCHOR(`wchgat()',`Change_Attributes')
999 procedure Change_Attributes
Steve Kondikae271bc2015-11-15 02:50:53 +01001000 (Win : Window := Standard_Window;
1001 Count : Integer := -1;
1002 Attr : Character_Attribute_Set := Normal_Video;
1003 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301004 -- AKA
1005 -- ALIAS(`chgat()')
1006
1007 -- ANCHOR(`mvwchgat()',`Change_Attributes')
1008 procedure Change_Attributes
Steve Kondikae271bc2015-11-15 02:50:53 +01001009 (Win : Window := Standard_Window;
1010 Line : Line_Position := Line_Position'First;
1011 Column : Column_Position := Column_Position'First;
1012 Count : Integer := -1;
1013 Attr : Character_Attribute_Set := Normal_Video;
1014 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301015 -- AKA
1016 -- ALIAS(`mvchgat()')
1017 pragma Inline (Change_Attributes);
1018
1019 -- MANPAGE(`curs_beep.3x')
1020
1021 -- ANCHOR(`beep()',`Beep')
1022 procedure Beep;
1023 -- AKA
1024 pragma Inline (Beep);
1025
1026 -- ANCHOR(`flash()',`Flash_Screen')
1027 procedure Flash_Screen;
1028 -- AKA
1029 pragma Inline (Flash_Screen);
1030
1031 -- MANPAGE(`curs_inopts.3x')
1032
1033 -- | Not implemented : typeahead
1034 --
1035 -- ANCHOR(`cbreak()',`Set_Cbreak_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001036 procedure Set_Cbreak_Mode (SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301037 -- AKA
1038 -- ALIAS(`nocbreak()')
1039 pragma Inline (Set_Cbreak_Mode);
1040
1041 -- ANCHOR(`raw()',`Set_Raw_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001042 procedure Set_Raw_Mode (SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301043 -- AKA
1044 -- ALIAS(`noraw()')
1045 pragma Inline (Set_Raw_Mode);
1046
1047 -- ANCHOR(`echo()',`Set_Echo_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001048 procedure Set_Echo_Mode (SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301049 -- AKA
1050 -- ALIAS(`noecho()')
1051 pragma Inline (Set_Echo_Mode);
1052
1053 -- ANCHOR(`meta()',`Set_Meta_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001054 procedure Set_Meta_Mode (Win : Window := Standard_Window;
1055 SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301056 -- AKA
1057 pragma Inline (Set_Meta_Mode);
1058
1059 -- ANCHOR(`keypad()',`Set_KeyPad_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001060 procedure Set_KeyPad_Mode (Win : Window := Standard_Window;
1061 SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301062 -- AKA
1063 pragma Inline (Set_KeyPad_Mode);
1064
Steve Kondikae271bc2015-11-15 02:50:53 +01001065 function Get_KeyPad_Mode (Win : Window := Standard_Window)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301066 return Boolean;
1067 -- This has no pendant in C. There you've to look into the WINDOWS
1068 -- structure to get the value. Bad practice, not repeated in Ada.
1069
1070 type Half_Delay_Amount is range 1 .. 255;
1071
1072 -- ANCHOR(`halfdelay()',`Half_Delay')
Steve Kondikae271bc2015-11-15 02:50:53 +01001073 procedure Half_Delay (Amount : Half_Delay_Amount);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301074 -- AKA
1075 pragma Inline (Half_Delay);
1076
1077 -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode')
1078 procedure Set_Flush_On_Interrupt_Mode
Steve Kondikae271bc2015-11-15 02:50:53 +01001079 (Win : Window := Standard_Window;
1080 Mode : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301081 -- AKA
1082 pragma Inline (Set_Flush_On_Interrupt_Mode);
1083
1084 -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode')
1085 procedure Set_Queue_Interrupt_Mode
Steve Kondikae271bc2015-11-15 02:50:53 +01001086 (Win : Window := Standard_Window;
1087 Flush : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301088 -- AKA
1089 -- ALIAS(`noqiflush()')
1090 pragma Inline (Set_Queue_Interrupt_Mode);
1091
1092 -- ANCHOR(`nodelay()',`Set_NoDelay_Mode')
1093 procedure Set_NoDelay_Mode
Steve Kondikae271bc2015-11-15 02:50:53 +01001094 (Win : Window := Standard_Window;
1095 Mode : Boolean := False);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301096 -- AKA
1097 pragma Inline (Set_NoDelay_Mode);
1098
1099 type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
1100
1101 -- ANCHOR(`wtimeout()',`Set_Timeout_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001102 procedure Set_Timeout_Mode (Win : Window := Standard_Window;
1103 Mode : Timeout_Mode;
1104 Amount : Natural); -- in Milliseconds
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301105 -- AKA
1106 -- ALIAS(`timeout()')
1107 -- Instead of overloading the semantic of the sign of amount, we
1108 -- introduce the Timeout_Mode parameter. This should improve
1109 -- readability. For Blocking and Non_Blocking, the Amount is not
1110 -- evaluated.
Steve Kondikae271bc2015-11-15 02:50:53 +01001111 -- We do not inline this procedure.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301112
1113 -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode')
1114 procedure Set_Escape_Timer_Mode
Steve Kondikae271bc2015-11-15 02:50:53 +01001115 (Win : Window := Standard_Window;
1116 Timer_Off : Boolean := False);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301117 -- AKA
1118 pragma Inline (Set_Escape_Timer_Mode);
1119
1120 -- MANPAGE(`curs_outopts.3x')
1121
1122 -- ANCHOR(`nl()',`Set_NL_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001123 procedure Set_NL_Mode (SwitchOn : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301124 -- AKA
1125 -- ALIAS(`nonl()')
1126 pragma Inline (Set_NL_Mode);
1127
1128 -- ANCHOR(`clearok()',`Clear_On_Next_Update')
1129 procedure Clear_On_Next_Update
Steve Kondikae271bc2015-11-15 02:50:53 +01001130 (Win : Window := Standard_Window;
1131 Do_Clear : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301132 -- AKA
1133 pragma Inline (Clear_On_Next_Update);
1134
1135 -- ANCHOR(`idlok()',`Use_Insert_Delete_Line')
1136 procedure Use_Insert_Delete_Line
Steve Kondikae271bc2015-11-15 02:50:53 +01001137 (Win : Window := Standard_Window;
1138 Do_Idl : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301139 -- AKA
1140 pragma Inline (Use_Insert_Delete_Line);
1141
1142 -- ANCHOR(`idcok()',`Use_Insert_Delete_Character')
1143 procedure Use_Insert_Delete_Character
Steve Kondikae271bc2015-11-15 02:50:53 +01001144 (Win : Window := Standard_Window;
1145 Do_Idc : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301146 -- AKA
1147 pragma Inline (Use_Insert_Delete_Character);
1148
1149 -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update')
1150 procedure Leave_Cursor_After_Update
Steve Kondikae271bc2015-11-15 02:50:53 +01001151 (Win : Window := Standard_Window;
1152 Do_Leave : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301153 -- AKA
1154 pragma Inline (Leave_Cursor_After_Update);
1155
1156 -- ANCHOR(`immedok()',`Immediate_Update_Mode')
1157 procedure Immediate_Update_Mode
Steve Kondikae271bc2015-11-15 02:50:53 +01001158 (Win : Window := Standard_Window;
1159 Mode : Boolean := False);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301160 -- AKA
1161 pragma Inline (Immediate_Update_Mode);
1162
1163 -- ANCHOR(`scrollok()',`Allow_Scrolling')
1164 procedure Allow_Scrolling
Steve Kondikae271bc2015-11-15 02:50:53 +01001165 (Win : Window := Standard_Window;
1166 Mode : Boolean := False);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301167 -- AKA
1168 pragma Inline (Allow_Scrolling);
1169
1170 function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean;
1171 -- There is no such function in the C interface.
1172 pragma Inline (Scrolling_Allowed);
1173
1174 -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region')
1175 procedure Set_Scroll_Region
Steve Kondikae271bc2015-11-15 02:50:53 +01001176 (Win : Window := Standard_Window;
1177 Top_Line : Line_Position;
1178 Bottom_Line : Line_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301179 -- AKA
1180 -- ALIAS(`setscrreg()')
1181 pragma Inline (Set_Scroll_Region);
1182
1183 -- MANPAGE(`curs_refresh.3x')
1184
1185 -- ANCHOR(`doupdate()',`Update_Screen')
1186 procedure Update_Screen;
1187 -- AKA
1188 pragma Inline (Update_Screen);
1189
1190 -- ANCHOR(`wrefresh()',`Refresh')
Steve Kondikae271bc2015-11-15 02:50:53 +01001191 procedure Refresh (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301192 -- AKA
1193 -- There is an overloaded Refresh for Pads.
1194 -- The Inline pragma appears there
1195 -- ALIAS(`refresh()')
1196
1197 -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update')
1198 procedure Refresh_Without_Update
Steve Kondikae271bc2015-11-15 02:50:53 +01001199 (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301200 -- AKA
1201 -- There is an overloaded Refresh_Without_Update for Pads.
1202 -- The Inline pragma appears there
1203
1204 -- ANCHOR(`redrawwin()',`Redraw')
Steve Kondikae271bc2015-11-15 02:50:53 +01001205 procedure Redraw (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301206 -- AKA
1207
1208 -- ANCHOR(`wredrawln()',`Redraw')
Steve Kondikae271bc2015-11-15 02:50:53 +01001209 procedure Redraw (Win : Window := Standard_Window;
1210 Begin_Line : Line_Position;
1211 Line_Count : Positive);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301212 -- AKA
1213 pragma Inline (Redraw);
1214
1215 -- MANPAGE(`curs_clear.3x')
1216
1217 -- ANCHOR(`werase()',`Erase')
Steve Kondikae271bc2015-11-15 02:50:53 +01001218 procedure Erase (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301219 -- AKA
1220 -- ALIAS(`erase()')
1221 pragma Inline (Erase);
1222
1223 -- ANCHOR(`wclear()',`Clear')
1224 procedure Clear
Steve Kondikae271bc2015-11-15 02:50:53 +01001225 (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301226 -- AKA
1227 -- ALIAS(`clear()')
1228 pragma Inline (Clear);
1229
1230 -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen')
1231 procedure Clear_To_End_Of_Screen
Steve Kondikae271bc2015-11-15 02:50:53 +01001232 (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301233 -- AKA
1234 -- ALIAS(`clrtobot()')
1235 pragma Inline (Clear_To_End_Of_Screen);
1236
1237 -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line')
1238 procedure Clear_To_End_Of_Line
Steve Kondikae271bc2015-11-15 02:50:53 +01001239 (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301240 -- AKA
1241 -- ALIAS(`clrtoeol()')
1242 pragma Inline (Clear_To_End_Of_Line);
1243
1244 -- MANPAGE(`curs_bkgd.3x')
1245
1246 -- ANCHOR(`wbkgdset()',`Set_Background')
1247 -- TODO: we could have Set_Background(Window; Character_Attribute_Set)
1248 -- because in C it is common to see bkgdset(A_BOLD) or
1249 -- bkgdset(COLOR_PAIR(n))
1250 procedure Set_Background
Steve Kondikae271bc2015-11-15 02:50:53 +01001251 (Win : Window := Standard_Window;
1252 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301253 -- AKA
1254 -- ALIAS(`bkgdset()')
1255 pragma Inline (Set_Background);
1256
1257 -- ANCHOR(`wbkgd()',`Change_Background')
1258 procedure Change_Background
Steve Kondikae271bc2015-11-15 02:50:53 +01001259 (Win : Window := Standard_Window;
1260 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301261 -- AKA
1262 -- ALIAS(`bkgd()')
1263 pragma Inline (Change_Background);
1264
1265 -- ANCHOR(`wbkgdget()',`Get_Background')
1266 -- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough.
1267 function Get_Background (Win : Window := Standard_Window)
1268 return Attributed_Character;
1269 -- AKA
1270 -- ALIAS(`bkgdget()')
1271 pragma Inline (Get_Background);
1272
1273 -- MANPAGE(`curs_touch.3x')
1274
1275 -- ANCHOR(`untouchwin()',`Untouch')
Steve Kondikae271bc2015-11-15 02:50:53 +01001276 procedure Untouch (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301277 -- AKA
1278 pragma Inline (Untouch);
1279
1280 -- ANCHOR(`touchwin()',`Touch')
Steve Kondikae271bc2015-11-15 02:50:53 +01001281 procedure Touch (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301282 -- AKA
1283
1284 -- ANCHOR(`touchline()',`Touch')
Steve Kondikae271bc2015-11-15 02:50:53 +01001285 procedure Touch (Win : Window := Standard_Window;
1286 Start : Line_Position;
1287 Count : Positive);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301288 -- AKA
1289 pragma Inline (Touch);
1290
1291 -- ANCHOR(`wtouchln()',`Change_Line_Status')
Steve Kondikae271bc2015-11-15 02:50:53 +01001292 procedure Change_Lines_Status (Win : Window := Standard_Window;
1293 Start : Line_Position;
1294 Count : Positive;
1295 State : Boolean);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301296 -- AKA
1297 pragma Inline (Change_Lines_Status);
1298
1299 -- ANCHOR(`is_linetouched()',`Is_Touched')
1300 function Is_Touched (Win : Window := Standard_Window;
1301 Line : Line_Position) return Boolean;
1302 -- AKA
1303
1304 -- ANCHOR(`is_wintouched()',`Is_Touched')
1305 function Is_Touched (Win : Window := Standard_Window) return Boolean;
1306 -- AKA
1307 pragma Inline (Is_Touched);
1308
1309 -- MANPAGE(`curs_overlay.3x')
1310
1311 -- ANCHOR(`copywin()',`Copy')
1312 procedure Copy
Steve Kondikae271bc2015-11-15 02:50:53 +01001313 (Source_Window : Window;
1314 Destination_Window : Window;
1315 Source_Top_Row : Line_Position;
1316 Source_Left_Column : Column_Position;
1317 Destination_Top_Row : Line_Position;
1318 Destination_Left_Column : Column_Position;
1319 Destination_Bottom_Row : Line_Position;
1320 Destination_Right_Column : Column_Position;
1321 Non_Destructive_Mode : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301322 -- AKA
1323 pragma Inline (Copy);
1324
1325 -- ANCHOR(`overwrite()',`Overwrite')
Steve Kondikae271bc2015-11-15 02:50:53 +01001326 procedure Overwrite (Source_Window : Window;
1327 Destination_Window : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301328 -- AKA
1329 pragma Inline (Overwrite);
1330
1331 -- ANCHOR(`overlay()',`Overlay')
Steve Kondikae271bc2015-11-15 02:50:53 +01001332 procedure Overlay (Source_Window : Window;
1333 Destination_Window : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301334 -- AKA
1335 pragma Inline (Overlay);
1336
1337 -- MANPAGE(`curs_deleteln.3x')
1338
1339 -- ANCHOR(`winsdelln()',`Insert_Delete_Lines')
1340 procedure Insert_Delete_Lines
Steve Kondikae271bc2015-11-15 02:50:53 +01001341 (Win : Window := Standard_Window;
1342 Lines : Integer := 1); -- default is to insert one line above
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301343 -- AKA
1344 -- ALIAS(`insdelln()')
1345 pragma Inline (Insert_Delete_Lines);
1346
1347 -- ANCHOR(`wdeleteln()',`Delete_Line')
Steve Kondikae271bc2015-11-15 02:50:53 +01001348 procedure Delete_Line (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301349 -- AKA
1350 -- ALIAS(`deleteln()')
1351 pragma Inline (Delete_Line);
1352
1353 -- ANCHOR(`winsertln()',`Insert_Line')
Steve Kondikae271bc2015-11-15 02:50:53 +01001354 procedure Insert_Line (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301355 -- AKA
1356 -- ALIAS(`insertln()')
1357 pragma Inline (Insert_Line);
1358
1359 -- MANPAGE(`curs_getyx.3x')
1360
1361 -- ANCHOR(`getmaxyx()',`Get_Size')
1362 procedure Get_Size
Steve Kondikae271bc2015-11-15 02:50:53 +01001363 (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301364 Number_Of_Lines : out Line_Count;
1365 Number_Of_Columns : out Column_Count);
1366 -- AKA
1367 pragma Inline (Get_Size);
1368
1369 -- ANCHOR(`getbegyx()',`Get_Window_Position')
1370 procedure Get_Window_Position
Steve Kondikae271bc2015-11-15 02:50:53 +01001371 (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301372 Top_Left_Line : out Line_Position;
1373 Top_Left_Column : out Column_Position);
1374 -- AKA
1375 pragma Inline (Get_Window_Position);
1376
1377 -- ANCHOR(`getyx()',`Get_Cursor_Position')
1378 procedure Get_Cursor_Position
Steve Kondikae271bc2015-11-15 02:50:53 +01001379 (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301380 Line : out Line_Position;
1381 Column : out Column_Position);
1382 -- AKA
1383 pragma Inline (Get_Cursor_Position);
1384
1385 -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent')
1386 procedure Get_Origin_Relative_To_Parent
Steve Kondikae271bc2015-11-15 02:50:53 +01001387 (Win : Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301388 Top_Left_Line : out Line_Position;
1389 Top_Left_Column : out Column_Position;
1390 Is_Not_A_Subwindow : out Boolean);
1391 -- AKA
Steve Kondikae271bc2015-11-15 02:50:53 +01001392 -- Instead of placing -1 in the coordinates as return, we use a Boolean
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301393 -- to return the info that the window has no parent.
1394 pragma Inline (Get_Origin_Relative_To_Parent);
1395
1396 -- MANPAGE(`curs_pad.3x')
1397
1398 -- ANCHOR(`newpad()',`New_Pad')
1399 function New_Pad (Lines : Line_Count;
1400 Columns : Column_Count) return Window;
1401 -- AKA
1402 pragma Inline (New_Pad);
1403
1404 -- ANCHOR(`subpad()',`Sub_Pad')
1405 function Sub_Pad
1406 (Pad : Window;
1407 Number_Of_Lines : Line_Count;
1408 Number_Of_Columns : Column_Count;
1409 First_Line_Position : Line_Position;
1410 First_Column_Position : Column_Position) return Window;
1411 -- AKA
1412 pragma Inline (Sub_Pad);
1413
1414 -- ANCHOR(`prefresh()',`Refresh')
1415 procedure Refresh
Steve Kondikae271bc2015-11-15 02:50:53 +01001416 (Pad : Window;
1417 Source_Top_Row : Line_Position;
1418 Source_Left_Column : Column_Position;
1419 Destination_Top_Row : Line_Position;
1420 Destination_Left_Column : Column_Position;
1421 Destination_Bottom_Row : Line_Position;
1422 Destination_Right_Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301423 -- AKA
1424 pragma Inline (Refresh);
1425
1426 -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update')
1427 procedure Refresh_Without_Update
Steve Kondikae271bc2015-11-15 02:50:53 +01001428 (Pad : Window;
1429 Source_Top_Row : Line_Position;
1430 Source_Left_Column : Column_Position;
1431 Destination_Top_Row : Line_Position;
1432 Destination_Left_Column : Column_Position;
1433 Destination_Bottom_Row : Line_Position;
1434 Destination_Right_Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301435 -- AKA
1436 pragma Inline (Refresh_Without_Update);
1437
1438 -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It')
1439 procedure Add_Character_To_Pad_And_Echo_It
Steve Kondikae271bc2015-11-15 02:50:53 +01001440 (Pad : Window;
1441 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301442 -- AKA
1443
1444 procedure Add_Character_To_Pad_And_Echo_It
Steve Kondikae271bc2015-11-15 02:50:53 +01001445 (Pad : Window;
1446 Ch : Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301447 pragma Inline (Add_Character_To_Pad_And_Echo_It);
1448
1449 -- MANPAGE(`curs_scroll.3x')
1450
1451 -- ANCHOR(`wscrl()',`Scroll')
Steve Kondikae271bc2015-11-15 02:50:53 +01001452 procedure Scroll (Win : Window := Standard_Window;
1453 Amount : Integer := 1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301454 -- AKA
1455 -- ALIAS(`scroll()')
1456 -- ALIAS(`scrl()')
1457 pragma Inline (Scroll);
1458
1459 -- MANPAGE(`curs_delch.3x')
1460
1461 -- ANCHOR(`wdelch()',`Delete_Character')
Steve Kondikae271bc2015-11-15 02:50:53 +01001462 procedure Delete_Character (Win : Window := Standard_Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301463 -- AKA
1464 -- ALIAS(`delch()')
1465
1466 -- ANCHOR(`mvwdelch()',`Delete_Character')
1467 procedure Delete_Character
Steve Kondikae271bc2015-11-15 02:50:53 +01001468 (Win : Window := Standard_Window;
1469 Line : Line_Position;
1470 Column : Column_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301471 -- AKA
1472 -- ALIAS(`mvdelch()')
1473 pragma Inline (Delete_Character);
1474
1475 -- MANPAGE(`curs_inch.3x')
1476
1477 -- ANCHOR(`winch()',`Peek')
1478 function Peek (Win : Window := Standard_Window)
1479 return Attributed_Character;
1480 -- ALIAS(`inch()')
1481 -- AKA
1482
1483 -- ANCHOR(`mvwinch()',`Peek')
1484 function Peek
1485 (Win : Window := Standard_Window;
1486 Line : Line_Position;
1487 Column : Column_Position) return Attributed_Character;
1488 -- AKA
1489 -- ALIAS(`mvinch()')
1490 -- More Peek's follow, pragma Inline appears later.
1491
1492 -- MANPAGE(`curs_insch.3x')
1493
1494 -- ANCHOR(`winsch()',`Insert')
Steve Kondikae271bc2015-11-15 02:50:53 +01001495 procedure Insert (Win : Window := Standard_Window;
1496 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301497 -- AKA
1498 -- ALIAS(`insch()')
1499
1500 -- ANCHOR(`mvwinsch()',`Insert')
Steve Kondikae271bc2015-11-15 02:50:53 +01001501 procedure Insert (Win : Window := Standard_Window;
1502 Line : Line_Position;
1503 Column : Column_Position;
1504 Ch : Attributed_Character);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301505 -- AKA
1506 -- ALIAS(`mvinsch()')
1507
1508 -- MANPAGE(`curs_insstr.3x')
1509
1510 -- ANCHOR(`winsnstr()',`Insert')
Steve Kondikae271bc2015-11-15 02:50:53 +01001511 procedure Insert (Win : Window := Standard_Window;
1512 Str : String;
1513 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301514 -- AKA
1515 -- ALIAS(`winsstr()')
1516 -- ALIAS(`insnstr()')
1517 -- ALIAS(`insstr()')
1518
1519 -- ANCHOR(`mvwinsnstr()',`Insert')
Steve Kondikae271bc2015-11-15 02:50:53 +01001520 procedure Insert (Win : Window := Standard_Window;
1521 Line : Line_Position;
1522 Column : Column_Position;
1523 Str : String;
1524 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301525 -- AKA
1526 -- ALIAS(`mvwinsstr()')
1527 -- ALIAS(`mvinsnstr()')
1528 -- ALIAS(`mvinsstr()')
1529 pragma Inline (Insert);
1530
1531 -- MANPAGE(`curs_instr.3x')
1532
1533 -- ANCHOR(`winnstr()',`Peek')
Steve Kondikae271bc2015-11-15 02:50:53 +01001534 procedure Peek (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301535 Str : out String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001536 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301537 -- AKA
1538 -- ALIAS(`winstr()')
1539 -- ALIAS(`innstr()')
1540 -- ALIAS(`instr()')
1541
1542 -- ANCHOR(`mvwinnstr()',`Peek')
Steve Kondikae271bc2015-11-15 02:50:53 +01001543 procedure Peek (Win : Window := Standard_Window;
1544 Line : Line_Position;
1545 Column : Column_Position;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301546 Str : out String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001547 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301548 -- AKA
1549 -- ALIAS(`mvwinstr()')
1550 -- ALIAS(`mvinnstr()')
1551 -- ALIAS(`mvinstr()')
1552
1553 -- MANPAGE(`curs_inchstr.3x')
1554
1555 -- ANCHOR(`winchnstr()',`Peek')
Steve Kondikae271bc2015-11-15 02:50:53 +01001556 procedure Peek (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301557 Str : out Attributed_String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001558 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301559 -- AKA
1560 -- ALIAS(`winchstr()')
1561 -- ALIAS(`inchnstr()')
1562 -- ALIAS(`inchstr()')
1563
1564 -- ANCHOR(`mvwinchnstr()',`Peek')
Steve Kondikae271bc2015-11-15 02:50:53 +01001565 procedure Peek (Win : Window := Standard_Window;
1566 Line : Line_Position;
1567 Column : Column_Position;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301568 Str : out Attributed_String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001569 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301570 -- AKA
1571 -- ALIAS(`mvwinchstr()')
1572 -- ALIAS(`mvinchnstr()')
1573 -- ALIAS(`mvinchstr()')
Steve Kondikae271bc2015-11-15 02:50:53 +01001574 -- We do not inline the Peek procedures
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301575
1576 -- MANPAGE(`curs_getstr.3x')
1577
1578 -- ANCHOR(`wgetnstr()',`Get')
Steve Kondikae271bc2015-11-15 02:50:53 +01001579 procedure Get (Win : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301580 Str : out String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001581 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301582 -- AKA
1583 -- ALIAS(`wgetstr()')
1584 -- ALIAS(`getnstr()')
1585 -- ALIAS(`getstr()')
1586 -- actually getstr is not supported because that results in buffer
1587 -- overflows.
1588
1589 -- ANCHOR(`mvwgetnstr()',`Get')
Steve Kondikae271bc2015-11-15 02:50:53 +01001590 procedure Get (Win : Window := Standard_Window;
1591 Line : Line_Position;
1592 Column : Column_Position;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301593 Str : out String;
Steve Kondikae271bc2015-11-15 02:50:53 +01001594 Len : Integer := -1);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301595 -- AKA
1596 -- ALIAS(`mvwgetstr()')
1597 -- ALIAS(`mvgetnstr()')
1598 -- ALIAS(`mvgetstr()')
1599 -- Get is not inlined
1600
1601 -- MANPAGE(`curs_slk.3x')
1602
1603 -- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set
1604
1605 type Soft_Label_Key_Format is (Three_Two_Three,
1606 Four_Four,
1607 PC_Style, -- ncurses specific
1608 PC_Style_With_Index); -- "
1609 type Label_Number is new Positive range 1 .. 12;
1610 type Label_Justification is (Left, Centered, Right);
1611
1612 -- ANCHOR(`slk_init()',`Init_Soft_Label_Keys')
1613 procedure Init_Soft_Label_Keys
Steve Kondikae271bc2015-11-15 02:50:53 +01001614 (Format : Soft_Label_Key_Format := Three_Two_Three);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301615 -- AKA
1616 pragma Inline (Init_Soft_Label_Keys);
1617
1618 -- ANCHOR(`slk_set()',`Set_Soft_Label_Key')
Steve Kondikae271bc2015-11-15 02:50:53 +01001619 procedure Set_Soft_Label_Key (Label : Label_Number;
1620 Text : String;
1621 Fmt : Label_Justification := Left);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301622 -- AKA
Steve Kondikae271bc2015-11-15 02:50:53 +01001623 -- We do not inline this procedure
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301624
1625 -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key')
1626 procedure Refresh_Soft_Label_Keys;
1627 -- AKA
1628 pragma Inline (Refresh_Soft_Label_Keys);
1629
1630 -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update')
1631 procedure Refresh_Soft_Label_Keys_Without_Update;
1632 -- AKA
1633 pragma Inline (Refresh_Soft_Label_Keys_Without_Update);
1634
1635 -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
Steve Kondikae271bc2015-11-15 02:50:53 +01001636 procedure Get_Soft_Label_Key (Label : Label_Number;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301637 Text : out String);
1638 -- AKA
1639
1640 -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
Steve Kondikae271bc2015-11-15 02:50:53 +01001641 function Get_Soft_Label_Key (Label : Label_Number) return String;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301642 -- AKA
1643 -- Same as function
1644 pragma Inline (Get_Soft_Label_Key);
1645
1646 -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys')
1647 procedure Clear_Soft_Label_Keys;
1648 -- AKA
1649 pragma Inline (Clear_Soft_Label_Keys);
1650
1651 -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys')
1652 procedure Restore_Soft_Label_Keys;
1653 -- AKA
1654 pragma Inline (Restore_Soft_Label_Keys);
1655
1656 -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys')
1657 procedure Touch_Soft_Label_Keys;
1658 -- AKA
1659 pragma Inline (Touch_Soft_Label_Keys);
1660
1661 -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes')
1662 procedure Switch_Soft_Label_Key_Attributes
Steve Kondikae271bc2015-11-15 02:50:53 +01001663 (Attr : Character_Attribute_Set;
1664 On : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301665 -- AKA
1666 -- ALIAS(`slk_attroff()')
1667 pragma Inline (Switch_Soft_Label_Key_Attributes);
1668
1669 -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes')
1670 procedure Set_Soft_Label_Key_Attributes
Steve Kondikae271bc2015-11-15 02:50:53 +01001671 (Attr : Character_Attribute_Set := Normal_Video;
1672 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301673 -- AKA
1674 pragma Inline (Set_Soft_Label_Key_Attributes);
1675
1676 -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1677 function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
1678 -- AKA
1679
1680 -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1681 function Get_Soft_Label_Key_Attributes return Color_Pair;
1682 -- AKA
1683 pragma Inline (Get_Soft_Label_Key_Attributes);
1684
1685 -- ANCHOR(`slk_color()',`Set_Soft_Label_Key_Color')
Steve Kondikae271bc2015-11-15 02:50:53 +01001686 procedure Set_Soft_Label_Key_Color (Pair : Color_Pair);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301687 -- AKA
1688 pragma Inline (Set_Soft_Label_Key_Color);
1689
1690 -- MANPAGE(`keybound.3x')
1691 -- Not Implemented: keybound
1692
1693 -- MANPAGE(`keyok.3x')
1694
1695 -- ANCHOR(`keyok()',`Enable_Key')
Steve Kondikae271bc2015-11-15 02:50:53 +01001696 procedure Enable_Key (Key : Special_Key_Code;
1697 Enable : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301698 -- AKA
1699 pragma Inline (Enable_Key);
1700
1701 -- MANPAGE(`define_key.3x')
1702
1703 -- ANCHOR(`define_key()',`Define_Key')
Steve Kondikae271bc2015-11-15 02:50:53 +01001704 procedure Define_Key (Definition : String;
1705 Key : Special_Key_Code);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301706 -- AKA
1707 pragma Inline (Define_Key);
1708
1709 -- MANPAGE(`curs_util.3x')
1710
1711 -- | Not implemented : filter, use_env
1712 -- | putwin, getwin are in the child package PutWin
1713 --
1714
1715 -- ANCHOR(`keyname()',`Key_Name')
Steve Kondikae271bc2015-11-15 02:50:53 +01001716 procedure Key_Name (Key : Real_Key_Code;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301717 Name : out String);
1718 -- AKA
1719 -- The external name for a real keystroke.
1720
1721 -- ANCHOR(`keyname()',`Key_Name')
Steve Kondikae271bc2015-11-15 02:50:53 +01001722 function Key_Name (Key : Real_Key_Code) return String;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301723 -- AKA
1724 -- Same as function
Steve Kondikae271bc2015-11-15 02:50:53 +01001725 -- We do not inline this routine
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301726
1727 -- ANCHOR(`unctrl()',`Un_Control')
Steve Kondikae271bc2015-11-15 02:50:53 +01001728 procedure Un_Control (Ch : Attributed_Character;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301729 Str : out String);
1730 -- AKA
1731
1732 -- ANCHOR(`unctrl()',`Un_Control')
Steve Kondikae271bc2015-11-15 02:50:53 +01001733 function Un_Control (Ch : Attributed_Character) return String;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301734 -- AKA
1735 -- Same as function
1736 pragma Inline (Un_Control);
1737
1738 -- ANCHOR(`delay_output()',`Delay_Output')
Steve Kondikae271bc2015-11-15 02:50:53 +01001739 procedure Delay_Output (Msecs : Natural);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301740 -- AKA
1741 pragma Inline (Delay_Output);
1742
1743 -- ANCHOR(`flushinp()',`Flush_Input')
1744 procedure Flush_Input;
1745 -- AKA
1746 pragma Inline (Flush_Input);
1747
1748 -- MANPAGE(`curs_termattrs.3x')
1749
1750 -- ANCHOR(`baudrate()',`Baudrate')
1751 function Baudrate return Natural;
1752 -- AKA
1753 pragma Inline (Baudrate);
1754
1755 -- ANCHOR(`erasechar()',`Erase_Character')
1756 function Erase_Character return Character;
1757 -- AKA
1758 pragma Inline (Erase_Character);
1759
1760 -- ANCHOR(`killchar()',`Kill_Character')
1761 function Kill_Character return Character;
1762 -- AKA
1763 pragma Inline (Kill_Character);
1764
1765 -- ANCHOR(`has_ic()',`Has_Insert_Character')
1766 function Has_Insert_Character return Boolean;
1767 -- AKA
1768 pragma Inline (Has_Insert_Character);
1769
1770 -- ANCHOR(`has_il()',`Has_Insert_Line')
1771 function Has_Insert_Line return Boolean;
1772 -- AKA
1773 pragma Inline (Has_Insert_Line);
1774
1775 -- ANCHOR(`termattrs()',`Supported_Attributes')
1776 function Supported_Attributes return Character_Attribute_Set;
1777 -- AKA
1778 pragma Inline (Supported_Attributes);
1779
1780 -- ANCHOR(`longname()',`Long_Name')
1781 procedure Long_Name (Name : out String);
1782 -- AKA
1783
1784 -- ANCHOR(`longname()',`Long_Name')
1785 function Long_Name return String;
1786 -- AKA
1787 -- Same as function
1788 pragma Inline (Long_Name);
1789
1790 -- ANCHOR(`termname()',`Terminal_Name')
1791 procedure Terminal_Name (Name : out String);
1792 -- AKA
1793
1794 -- ANCHOR(`termname()',`Terminal_Name')
1795 function Terminal_Name return String;
1796 -- AKA
1797 -- Same as function
1798 pragma Inline (Terminal_Name);
1799
1800 -- MANPAGE(`curs_color.3x')
1801
1802 -- COLOR_PAIR
1803 -- COLOR_PAIR(n) in C is the same as
1804 -- Attributed_Character(Ch => Nul, Color => n, Attr => Normal_Video)
1805 -- In C you often see something like c = c | COLOR_PAIR(n);
1806 -- This is equivalent to c.Color := n;
1807
1808 -- ANCHOR(`start_color()',`Start_Color')
1809 procedure Start_Color;
1810 -- AKA
1811 pragma Import (C, Start_Color, "start_color");
1812
1813 -- ANCHOR(`init_pair()',`Init_Pair')
Steve Kondikae271bc2015-11-15 02:50:53 +01001814 procedure Init_Pair (Pair : Redefinable_Color_Pair;
1815 Fore : Color_Number;
1816 Back : Color_Number);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301817 -- AKA
1818 pragma Inline (Init_Pair);
1819
1820 -- ANCHOR(`pair_content()',`Pair_Content')
Steve Kondikae271bc2015-11-15 02:50:53 +01001821 procedure Pair_Content (Pair : Color_Pair;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301822 Fore : out Color_Number;
1823 Back : out Color_Number);
1824 -- AKA
1825 pragma Inline (Pair_Content);
1826
1827 -- ANCHOR(`has_colors()',`Has_Colors')
1828 function Has_Colors return Boolean;
1829 -- AKA
1830 pragma Inline (Has_Colors);
1831
1832 -- ANCHOR(`init_color()',`Init_Color')
Steve Kondikae271bc2015-11-15 02:50:53 +01001833 procedure Init_Color (Color : Color_Number;
1834 Red : RGB_Value;
1835 Green : RGB_Value;
1836 Blue : RGB_Value);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301837 -- AKA
1838 pragma Inline (Init_Color);
1839
1840 -- ANCHOR(`can_change_color()',`Can_Change_Color')
1841 function Can_Change_Color return Boolean;
1842 -- AKA
1843 pragma Inline (Can_Change_Color);
1844
1845 -- ANCHOR(`color_content()',`Color_Content')
Steve Kondikae271bc2015-11-15 02:50:53 +01001846 procedure Color_Content (Color : Color_Number;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301847 Red : out RGB_Value;
1848 Green : out RGB_Value;
1849 Blue : out RGB_Value);
1850 -- AKA
1851 pragma Inline (Color_Content);
1852
1853 -- MANPAGE(`curs_kernel.3x')
1854 -- | Not implemented: getsyx, setsyx
1855 --
1856 type Curses_Mode is (Curses, Shell);
1857
1858 -- ANCHOR(`def_prog_mode()',`Save_Curses_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001859 procedure Save_Curses_Mode (Mode : Curses_Mode);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301860 -- AKA
1861 -- ALIAS(`def_shell_mode()')
1862 pragma Inline (Save_Curses_Mode);
1863
1864 -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode')
Steve Kondikae271bc2015-11-15 02:50:53 +01001865 procedure Reset_Curses_Mode (Mode : Curses_Mode);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301866 -- AKA
1867 -- ALIAS(`reset_shell_mode()')
1868 pragma Inline (Reset_Curses_Mode);
1869
1870 -- ANCHOR(`savetty()',`Save_Terminal_State')
1871 procedure Save_Terminal_State;
1872 -- AKA
1873 pragma Inline (Save_Terminal_State);
1874
1875 -- ANCHOR(`resetty();',`Reset_Terminal_State')
1876 procedure Reset_Terminal_State;
1877 -- AKA
1878 pragma Inline (Reset_Terminal_State);
1879
1880 type Stdscr_Init_Proc is access
1881 function (Win : Window;
1882 Columns : Column_Count) return Integer;
1883 pragma Convention (C, Stdscr_Init_Proc);
1884 -- N.B.: the return value is actually ignored, but it seems to be
1885 -- a good practice to return 0 if you think all went fine
1886 -- and -1 otherwise.
1887
1888 -- ANCHOR(`ripoffline()',`Rip_Off_Lines')
Steve Kondikae271bc2015-11-15 02:50:53 +01001889 procedure Rip_Off_Lines (Lines : Integer;
1890 Proc : Stdscr_Init_Proc);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301891 -- AKA
1892 -- N.B.: to be more precise, this uses a ncurses specific enhancement of
1893 -- ripoffline(), in which the Lines argument absolute value is the
1894 -- number of lines to be ripped of. The official ripoffline() only
Steve Kondikae271bc2015-11-15 02:50:53 +01001895 -- uses the sign of Lines to remove a single line from bottom or top.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301896 pragma Inline (Rip_Off_Lines);
1897
1898 type Cursor_Visibility is (Invisible, Normal, Very_Visible);
1899
1900 -- ANCHOR(`curs_set()',`Set_Cursor_Visibility')
1901 procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
1902 -- AKA
1903 pragma Inline (Set_Cursor_Visibility);
1904
1905 -- ANCHOR(`napms()',`Nap_Milli_Seconds')
Steve Kondikae271bc2015-11-15 02:50:53 +01001906 procedure Nap_Milli_Seconds (Ms : Natural);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301907 -- AKA
1908 pragma Inline (Nap_Milli_Seconds);
1909
1910 -- |=====================================================================
1911 -- | Some useful helpers.
1912 -- |=====================================================================
1913 type Transform_Direction is (From_Screen, To_Screen);
1914 procedure Transform_Coordinates
Steve Kondikae271bc2015-11-15 02:50:53 +01001915 (W : Window := Standard_Window;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301916 Line : in out Line_Position;
1917 Column : in out Column_Position;
Steve Kondikae271bc2015-11-15 02:50:53 +01001918 Dir : Transform_Direction := From_Screen);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301919 -- This procedure transforms screen coordinates into coordinates relative
1920 -- to the window and vice versa, depending on the Dir parameter.
Steve Kondikae271bc2015-11-15 02:50:53 +01001921 -- Screen coordinates are the position information for the physical device.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301922 -- An Curses_Exception will be raised if Line and Column are not in the
1923 -- Window or if you pass the Null_Window as argument.
Steve Kondikae271bc2015-11-15 02:50:53 +01001924 -- We do not inline this procedure
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301925
1926 -- MANPAGE(`default_colors.3x')
1927
Steve Kondikae271bc2015-11-15 02:50:53 +01001928 Default_Color : constant Color_Number := -1;
1929
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301930 -- ANCHOR(`use_default_colors()',`Use_Default_Colors')
1931 procedure Use_Default_Colors;
1932 -- AKA
1933 pragma Inline (Use_Default_Colors);
1934
1935 -- ANCHOR(`assume_default_colors()',`Assume_Default_Colors')
1936 procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
1937 Back : Color_Number := Default_Color);
1938 -- AKA
1939 pragma Inline (Assume_Default_Colors);
1940
1941 -- MANPAGE(`curs_extend.3x')
1942
1943 -- ANCHOR(`curses_version()',`Curses_Version')
1944 function Curses_Version return String;
1945 -- AKA
1946
1947 -- ANCHOR(`use_extended_names()',`Use_Extended_Names')
1948 -- The returnvalue is the previous setting of the flag
1949 function Use_Extended_Names (Enable : Boolean) return Boolean;
1950 -- AKA
1951
1952 -- MANPAGE(`curs_trace.3x')
1953
1954 -- ANCHOR(`_nc_freeall()',`Curses_Free_All')
1955 procedure Curses_Free_All;
1956 -- AKA
1957
1958 -- MANPAGE(`curs_scr_dump.3x')
1959
1960 -- ANCHOR(`scr_dump()',`Screen_Dump_To_File')
Steve Kondikae271bc2015-11-15 02:50:53 +01001961 procedure Screen_Dump_To_File (Filename : String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301962 -- AKA
1963
1964 -- ANCHOR(`scr_restore()',`Screen_Restore_From_File')
Steve Kondikae271bc2015-11-15 02:50:53 +01001965 procedure Screen_Restore_From_File (Filename : String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301966 -- AKA
1967
1968 -- ANCHOR(`scr_init()',`Screen_Init_From_File')
Steve Kondikae271bc2015-11-15 02:50:53 +01001969 procedure Screen_Init_From_File (Filename : String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301970 -- AKA
1971
1972 -- ANCHOR(`scr_set()',`Screen_Set_File')
Steve Kondikae271bc2015-11-15 02:50:53 +01001973 procedure Screen_Set_File (Filename : String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301974 -- AKA
1975
1976 -- MANPAGE(`curs_print.3x')
Steve Kondikae271bc2015-11-15 02:50:53 +01001977 -- Not implemented: mcprint
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301978
1979 -- MANPAGE(`curs_printw.3x')
1980 -- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,
1981 -- vw_printw
1982 -- Please use the Ada style Text_IO child packages for formatted
Steve Kondikae271bc2015-11-15 02:50:53 +01001983 -- printing. It does not make a lot of sense to map the printf style
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301984 -- C functions to Ada.
1985
1986 -- MANPAGE(`curs_scanw.3x')
1987 -- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw
1988
1989 -- MANPAGE(`resizeterm.3x')
1990 -- Not Implemented: resizeterm
1991
1992 -- MANPAGE(`wresize.3x')
1993
1994 -- ANCHOR(`wresize()',`Resize')
1995 procedure Resize (Win : Window := Standard_Window;
1996 Number_Of_Lines : Line_Count;
1997 Number_Of_Columns : Column_Count);
1998 -- AKA
1999
2000private
2001 type Window is new System.Storage_Elements.Integer_Address;
2002 Null_Window : constant Window := 0;
2003
2004 -- The next constants are generated and may be different on your
2005 -- architecture.
2006 --
Steve Kondikae271bc2015-11-15 02:50:53 +01002007
2008 Sizeof_Bool : constant := Curses_Constants.Sizeof_Bool;
2009
2010 type Curses_Bool is mod 2 ** Sizeof_Bool;
2011
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05302012 Curses_Bool_False : constant Curses_Bool := 0;
2013
2014end Terminal_Interface.Curses;