2 define(`HTMLNAME',`terminal_interface-curses__ads.htm')dnl
3 include(M4MACRO)------------------------------------------------------------------------------
5 -- GNAT ncurses Binding --
7 -- Terminal_Interface.Curses --
11 ------------------------------------------------------------------------------
12 -- Copyright (c) 1998-2011,2014 Free Software Foundation, Inc. --
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: --
22 -- The above copyright notice and this permission notice shall be included --
23 -- in all copies or substantial portions of the Software. --
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. --
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 --
37 ------------------------------------------------------------------------------
38 -- Author: Juergen Pfeifer, 1996
41 -- $Date: 2014/05/24 21:31:57 $
42 -- Binding Version 01.00
43 ------------------------------------------------------------------------------
44 with System.Storage_Elements;
45 with Interfaces.C; -- We need this for some assertions.
47 with Terminal_Interface.Curses_Constants;
49 package Terminal_Interface.Curses is
50 pragma Preelaborate (Terminal_Interface.Curses);
51 pragma Linker_Options ("-lncurses" & Curses_Constants.DFT_ARG_SUFFIX);
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;
57 type Window is private;
58 Null_Window : constant Window;
60 type Line_Position is new Integer; -- line coordinate
61 type Column_Position is new Integer; -- column coordinate
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
68 type Key_Code is new Integer;
69 -- That is anything including real characters, special keys and logical
72 -- FIXME: The "-1" should be Curses_Err
73 subtype Real_Key_Code is Key_Code range -1 .. Curses_Constants.KEY_MAX;
74 -- 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.
78 subtype Special_Key_Code is Real_Key_Code
79 range Curses_Constants. KEY_MIN - 1 .. Real_Key_Code'Last;
80 -- Type for a function- or special key number
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.
86 -- For those who like to use the original key names we produce them were
87 -- they differ from the original.
89 -- Constants for function- and special keys
90 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
382 := Special_Key_Code'Last;
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.
389 --------------------------------------------------------------------------
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.
398 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;
407 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.
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
419 type Character_Attribute_Set is
422 Under_Line : Boolean;
423 Reverse_Video : 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;
438 for Character_Attribute_Set use
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;
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;
471 Curses_Constants.A_LEFT_First - Curses_Constants.Attr_First
472 .. Curses_Constants.A_LEFT_Last - Curses_Constants.Attr_First;
474 Curses_Constants.A_LOW_First - Curses_Constants.Attr_First
475 .. Curses_Constants.A_LOW_Last - Curses_Constants.Attr_First;
477 Curses_Constants.A_RIGHT_First - Curses_Constants.Attr_First
478 .. Curses_Constants.A_RIGHT_Last - Curses_Constants.Attr_First;
480 Curses_Constants.A_TOP_First - Curses_Constants.Attr_First
481 .. Curses_Constants.A_TOP_Last - Curses_Constants.Attr_First;
483 Curses_Constants.A_VERTICAL_First - Curses_Constants.Attr_First
484 .. Curses_Constants.A_VERTICAL_Last - Curses_Constants.Attr_First;
487 Normal_Video : constant Character_Attribute_Set := (others => False);
489 type Attributed_Character is
491 Attr : Character_Attribute_Set;
495 pragma Convention (C_Pass_By_Copy, Attributed_Character);
496 -- This is the counterpart for the chtype in C.
498 for Attributed_Character use
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);
509 for Attributed_Character'Size use Curses_Constants.chtype_Size;
511 Default_Character : constant Attributed_Character
512 := (Ch => Character'First,
513 Color => Color_Pair'First,
514 Attr => (others => False)); -- preelaboratable Normal_Video
516 type Attributed_String is array (Positive range <>) of Attributed_Character;
517 pragma Convention (C, Attributed_String);
518 -- In this binding we allow strings of attributed characters.
523 Curses_Exception : exception;
524 Wrong_Curses_Version : exception;
526 -- Those exceptions are raised by the ETI (Extended Terminal Interface)
527 -- subpackets for Menu and Forms handling.
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;
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 --------------------------------------------------------------------------
552 function Lines return Line_Count;
553 pragma Inline (Lines);
555 function Columns return Column_Count;
556 pragma Inline (Columns);
558 function Tab_Size return Natural;
559 pragma Inline (Tab_Size);
561 function Number_Of_Colors return Natural;
562 pragma Inline (Number_Of_Colors);
564 function Number_Of_Color_Pairs return Natural;
565 pragma Inline (Number_Of_Color_Pairs);
567 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");
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);
640 -- MANPAGE(`curs_initscr.3x')
641 -- | Not implemented: newterm, set_term, delscreen
643 -- ANCHOR(`stdscr',`Standard_Window')
644 function Standard_Window return Window;
646 pragma Import (C, Standard_Window, "stdscr_as_function");
647 pragma Inline (Standard_Window);
649 -- ANCHOR(`curscr',`Current_Window')
650 function Current_Window return Window;
652 pragma Import (C, Current_Window, "curscr_as_function");
653 pragma Inline (Current_Window);
655 -- ANCHOR(`initscr()',`Init_Screen')
656 procedure Init_Screen;
658 -- ANCHOR(`initscr()',`Init_Windows')
659 procedure Init_Windows renames Init_Screen;
661 pragma Inline (Init_Screen);
662 -- pragma Inline (Init_Windows);
664 -- ANCHOR(`endwin()',`End_Windows')
665 procedure End_Windows;
667 procedure End_Screen renames End_Windows;
668 pragma Inline (End_Windows);
669 -- pragma Inline (End_Screen);
671 -- ANCHOR(`isendwin()',`Is_End_Window')
672 function Is_End_Window return Boolean;
674 pragma Inline (Is_End_Window);
676 -- MANPAGE(`curs_move.3x')
678 -- ANCHOR(`wmove()',`Move_Cursor')
679 procedure Move_Cursor (Win : Window := Standard_Window;
680 Line : Line_Position;
681 Column : Column_Position);
684 pragma Inline (Move_Cursor);
686 -- MANPAGE(`curs_addch.3x')
688 -- ANCHOR(`waddch()',`Add')
689 procedure Add (Win : Window := Standard_Window;
690 Ch : Attributed_Character);
694 procedure Add (Win : Window := Standard_Window;
696 -- Add a single character at the current logical cursor position to
697 -- the window. Use the current windows attributes.
699 -- ANCHOR(`mvwaddch()',`Add')
701 (Win : Window := Standard_Window;
702 Line : Line_Position;
703 Column : Column_Position;
704 Ch : Attributed_Character);
706 -- ALIAS(`mvaddch()')
709 (Win : Window := Standard_Window;
710 Line : Line_Position;
711 Column : Column_Position;
713 -- Move to the position and add a single character into the window
714 -- There are more Add routines, so the Inline pragma follows later
716 -- ANCHOR(`wechochar()',`Add_With_Immediate_Echo')
717 procedure Add_With_Immediate_Echo
718 (Win : Window := Standard_Window;
719 Ch : Attributed_Character);
721 -- ALIAS(`echochar()')
723 procedure Add_With_Immediate_Echo
724 (Win : Window := Standard_Window;
726 -- Add a character and do an immediate refresh of the screen.
727 pragma Inline (Add_With_Immediate_Echo);
729 -- MANPAGE(`curs_window.3x')
730 -- Not Implemented: wcursyncup
732 -- ANCHOR(`newwin()',`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.
741 pragma Inline (Create);
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
749 -- pragma Inline (New_Window);
751 -- ANCHOR(`delwin()',`Delete')
752 procedure Delete (Win : in out Window);
754 -- Reset Win to Null_Window
755 pragma Inline (Delete);
757 -- ANCHOR(`subwin()',`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;
765 pragma Inline (Sub_Window);
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;
775 pragma Inline (Derived_Window);
777 -- ANCHOR(`dupwin()',`Duplicate')
778 function Duplicate (Win : Window) return Window;
780 pragma Inline (Duplicate);
782 -- ANCHOR(`mvwin()',`Move_Window')
783 procedure Move_Window (Win : Window;
784 Line : Line_Position;
785 Column : Column_Position);
787 pragma Inline (Move_Window);
789 -- ANCHOR(`mvderwin()',`Move_Derived_Window')
790 procedure Move_Derived_Window (Win : Window;
791 Line : Line_Position;
792 Column : Column_Position);
794 pragma Inline (Move_Derived_Window);
796 -- ANCHOR(`wsyncup()',`Synchronize_Upwards')
797 procedure Synchronize_Upwards (Win : Window);
799 pragma Import (C, Synchronize_Upwards, "wsyncup");
801 -- ANCHOR(`wsyncdown()',`Synchronize_Downwards')
802 procedure Synchronize_Downwards (Win : Window);
804 pragma Import (C, Synchronize_Downwards, "wsyncdown");
806 -- ANCHOR(`syncok()',`Set_Synch_Mode')
807 procedure Set_Synch_Mode (Win : Window := Standard_Window;
808 Mode : Boolean := False);
810 pragma Inline (Set_Synch_Mode);
812 -- MANPAGE(`curs_addstr.3x')
814 -- ANCHOR(`waddnstr()',`Add')
815 procedure Add (Win : Window := Standard_Window;
817 Len : Integer := -1);
819 -- ALIAS(`waddstr()')
820 -- ALIAS(`addnstr()')
823 -- ANCHOR(`mvwaddnstr()',`Add')
824 procedure Add (Win : Window := Standard_Window;
825 Line : Line_Position;
826 Column : Column_Position;
828 Len : Integer := -1);
830 -- ALIAS(`mvwaddstr()')
831 -- ALIAS(`mvaddnstr()')
832 -- ALIAS(`mvaddstr()')
834 -- MANPAGE(`curs_addchstr.3x')
836 -- ANCHOR(`waddchnstr()',`Add')
837 procedure Add (Win : Window := Standard_Window;
838 Str : Attributed_String;
839 Len : Integer := -1);
841 -- ALIAS(`waddchstr()')
842 -- ALIAS(`addchnstr()')
843 -- ALIAS(`addchstr()')
845 -- ANCHOR(`mvwaddchnstr()',`Add')
846 procedure Add (Win : Window := Standard_Window;
847 Line : Line_Position;
848 Column : Column_Position;
849 Str : Attributed_String;
850 Len : Integer := -1);
852 -- ALIAS(`mvwaddchstr()')
853 -- ALIAS(`mvaddchnstr()')
854 -- ALIAS(`mvaddchstr()')
857 -- MANPAGE(`curs_border.3x')
858 -- | Not implemented: mvhline, mvwhline, mvvline, mvwvline
859 -- | use Move_Cursor then Horizontal_Line or Vertical_Line
861 -- ANCHOR(`wborder()',`Border')
863 (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
875 pragma Inline (Border);
877 -- ANCHOR(`box()',`Box')
879 (Win : Window := Standard_Window;
880 Vertical_Symbol : Attributed_Character := Default_Character;
881 Horizontal_Symbol : Attributed_Character := Default_Character);
885 -- ANCHOR(`whline()',`Horizontal_Line')
886 procedure Horizontal_Line
887 (Win : Window := Standard_Window;
889 Line_Symbol : Attributed_Character := Default_Character);
892 pragma Inline (Horizontal_Line);
894 -- ANCHOR(`wvline()',`Vertical_Line')
895 procedure Vertical_Line
896 (Win : Window := Standard_Window;
898 Line_Symbol : Attributed_Character := Default_Character);
901 pragma Inline (Vertical_Line);
903 -- MANPAGE(`curs_getch.3x')
904 -- Not implemented: mvgetch, mvwgetch
906 -- ANCHOR(`wgetch()',`Get_Keystroke')
907 function Get_Keystroke (Win : Window := Standard_Window)
908 return Real_Key_Code;
911 -- Get a character from the keyboard and echo it - if enabled - to the
913 -- If for any reason (i.e. a timeout) we could not get a character the
914 -- returned keycode is Key_None.
915 pragma Inline (Get_Keystroke);
917 -- ANCHOR(`ungetch()',`Undo_Keystroke')
918 procedure Undo_Keystroke (Key : Real_Key_Code);
920 pragma Inline (Undo_Keystroke);
922 -- ANCHOR(`has_key()',`Has_Key')
923 function Has_Key (Key : Special_Key_Code) return Boolean;
925 pragma Inline (Has_Key);
928 -- | Some helper functions
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);
934 subtype Function_Key_Number is Integer range 0 .. 63;
935 -- (n)curses allows for 64 function keys.
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);
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);
946 -- MANPAGE(`curs_attr.3x')
947 -- | Not implemented attr_off, wattr_off,
948 -- | attr_on, wattr_on, attr_set, wattr_set
951 -- PAIR_NUMBER(c) is the same as c.Color
953 -- ANCHOR(`standout()',`Standout')
954 procedure Standout (Win : Window := Standard_Window;
955 On : Boolean := True);
956 -- ALIAS(`wstandout()')
957 -- ALIAS(`wstandend()')
959 -- ANCHOR(`wattron()',`Switch_Character_Attribute')
960 procedure Switch_Character_Attribute
961 (Win : Window := Standard_Window;
962 Attr : Character_Attribute_Set := Normal_Video;
963 On : Boolean := True); -- if False we switch Off.
964 -- Switches those Attributes set to true in the list.
966 -- ALIAS(`wattroff()')
968 -- ALIAS(`attroff()')
970 -- ANCHOR(`wattrset()',`Set_Character_Attributes')
971 procedure Set_Character_Attributes
972 (Win : Window := Standard_Window;
973 Attr : Character_Attribute_Set := Normal_Video;
974 Color : Color_Pair := Color_Pair'First);
976 -- ALIAS(`attrset()')
977 pragma Inline (Set_Character_Attributes);
979 -- ANCHOR(`wattr_get()',`Get_Character_Attributes')
980 function Get_Character_Attribute
981 (Win : Window := Standard_Window) return Character_Attribute_Set;
983 -- ALIAS(`attr_get()')
985 -- ANCHOR(`wattr_get()',`Get_Character_Attribute')
986 function Get_Character_Attribute
987 (Win : Window := Standard_Window) return Color_Pair;
989 pragma Inline (Get_Character_Attribute);
991 -- ANCHOR(`wcolor_set()',`Set_Color')
992 procedure Set_Color (Win : Window := Standard_Window;
995 -- ALIAS(`color_set()')
996 pragma Inline (Set_Color);
998 -- ANCHOR(`wchgat()',`Change_Attributes')
999 procedure Change_Attributes
1000 (Win : Window := Standard_Window;
1001 Count : Integer := -1;
1002 Attr : Character_Attribute_Set := Normal_Video;
1003 Color : Color_Pair := Color_Pair'First);
1007 -- ANCHOR(`mvwchgat()',`Change_Attributes')
1008 procedure Change_Attributes
1009 (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);
1016 -- ALIAS(`mvchgat()')
1017 pragma Inline (Change_Attributes);
1019 -- MANPAGE(`curs_beep.3x')
1021 -- ANCHOR(`beep()',`Beep')
1024 pragma Inline (Beep);
1026 -- ANCHOR(`flash()',`Flash_Screen')
1027 procedure Flash_Screen;
1029 pragma Inline (Flash_Screen);
1031 -- MANPAGE(`curs_inopts.3x')
1033 -- | Not implemented : typeahead
1035 -- ANCHOR(`cbreak()',`Set_Cbreak_Mode')
1036 procedure Set_Cbreak_Mode (SwitchOn : Boolean := True);
1038 -- ALIAS(`nocbreak()')
1039 pragma Inline (Set_Cbreak_Mode);
1041 -- ANCHOR(`raw()',`Set_Raw_Mode')
1042 procedure Set_Raw_Mode (SwitchOn : Boolean := True);
1045 pragma Inline (Set_Raw_Mode);
1047 -- ANCHOR(`echo()',`Set_Echo_Mode')
1048 procedure Set_Echo_Mode (SwitchOn : Boolean := True);
1050 -- ALIAS(`noecho()')
1051 pragma Inline (Set_Echo_Mode);
1053 -- ANCHOR(`meta()',`Set_Meta_Mode')
1054 procedure Set_Meta_Mode (Win : Window := Standard_Window;
1055 SwitchOn : Boolean := True);
1057 pragma Inline (Set_Meta_Mode);
1059 -- ANCHOR(`keypad()',`Set_KeyPad_Mode')
1060 procedure Set_KeyPad_Mode (Win : Window := Standard_Window;
1061 SwitchOn : Boolean := True);
1063 pragma Inline (Set_KeyPad_Mode);
1065 function Get_KeyPad_Mode (Win : Window := Standard_Window)
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.
1070 type Half_Delay_Amount is range 1 .. 255;
1072 -- ANCHOR(`halfdelay()',`Half_Delay')
1073 procedure Half_Delay (Amount : Half_Delay_Amount);
1075 pragma Inline (Half_Delay);
1077 -- ANCHOR(`intrflush()',`Set_Flush_On_Interrupt_Mode')
1078 procedure Set_Flush_On_Interrupt_Mode
1079 (Win : Window := Standard_Window;
1080 Mode : Boolean := True);
1082 pragma Inline (Set_Flush_On_Interrupt_Mode);
1084 -- ANCHOR(`qiflush()',`Set_Queue_Interrupt_Mode')
1085 procedure Set_Queue_Interrupt_Mode
1086 (Win : Window := Standard_Window;
1087 Flush : Boolean := True);
1089 -- ALIAS(`noqiflush()')
1090 pragma Inline (Set_Queue_Interrupt_Mode);
1092 -- ANCHOR(`nodelay()',`Set_NoDelay_Mode')
1093 procedure Set_NoDelay_Mode
1094 (Win : Window := Standard_Window;
1095 Mode : Boolean := False);
1097 pragma Inline (Set_NoDelay_Mode);
1099 type Timeout_Mode is (Blocking, Non_Blocking, Delayed);
1101 -- ANCHOR(`wtimeout()',`Set_Timeout_Mode')
1102 procedure Set_Timeout_Mode (Win : Window := Standard_Window;
1103 Mode : Timeout_Mode;
1104 Amount : Natural); -- in Milliseconds
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
1111 -- We do not inline this procedure.
1113 -- ANCHOR(`notimeout()',`Set_Escape_Time_Mode')
1114 procedure Set_Escape_Timer_Mode
1115 (Win : Window := Standard_Window;
1116 Timer_Off : Boolean := False);
1118 pragma Inline (Set_Escape_Timer_Mode);
1120 -- MANPAGE(`curs_outopts.3x')
1122 -- ANCHOR(`nl()',`Set_NL_Mode')
1123 procedure Set_NL_Mode (SwitchOn : Boolean := True);
1126 pragma Inline (Set_NL_Mode);
1128 -- ANCHOR(`clearok()',`Clear_On_Next_Update')
1129 procedure Clear_On_Next_Update
1130 (Win : Window := Standard_Window;
1131 Do_Clear : Boolean := True);
1133 pragma Inline (Clear_On_Next_Update);
1135 -- ANCHOR(`idlok()',`Use_Insert_Delete_Line')
1136 procedure Use_Insert_Delete_Line
1137 (Win : Window := Standard_Window;
1138 Do_Idl : Boolean := True);
1140 pragma Inline (Use_Insert_Delete_Line);
1142 -- ANCHOR(`idcok()',`Use_Insert_Delete_Character')
1143 procedure Use_Insert_Delete_Character
1144 (Win : Window := Standard_Window;
1145 Do_Idc : Boolean := True);
1147 pragma Inline (Use_Insert_Delete_Character);
1149 -- ANCHOR(`leaveok()',`Leave_Cursor_After_Update')
1150 procedure Leave_Cursor_After_Update
1151 (Win : Window := Standard_Window;
1152 Do_Leave : Boolean := True);
1154 pragma Inline (Leave_Cursor_After_Update);
1156 -- ANCHOR(`immedok()',`Immediate_Update_Mode')
1157 procedure Immediate_Update_Mode
1158 (Win : Window := Standard_Window;
1159 Mode : Boolean := False);
1161 pragma Inline (Immediate_Update_Mode);
1163 -- ANCHOR(`scrollok()',`Allow_Scrolling')
1164 procedure Allow_Scrolling
1165 (Win : Window := Standard_Window;
1166 Mode : Boolean := False);
1168 pragma Inline (Allow_Scrolling);
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);
1174 -- ANCHOR(`wsetscrreg()',`Set_Scroll_Region')
1175 procedure Set_Scroll_Region
1176 (Win : Window := Standard_Window;
1177 Top_Line : Line_Position;
1178 Bottom_Line : Line_Position);
1180 -- ALIAS(`setscrreg()')
1181 pragma Inline (Set_Scroll_Region);
1183 -- MANPAGE(`curs_refresh.3x')
1185 -- ANCHOR(`doupdate()',`Update_Screen')
1186 procedure Update_Screen;
1188 pragma Inline (Update_Screen);
1190 -- ANCHOR(`wrefresh()',`Refresh')
1191 procedure Refresh (Win : Window := Standard_Window);
1193 -- There is an overloaded Refresh for Pads.
1194 -- The Inline pragma appears there
1195 -- ALIAS(`refresh()')
1197 -- ANCHOR(`wnoutrefresh()',`Refresh_Without_Update')
1198 procedure Refresh_Without_Update
1199 (Win : Window := Standard_Window);
1201 -- There is an overloaded Refresh_Without_Update for Pads.
1202 -- The Inline pragma appears there
1204 -- ANCHOR(`redrawwin()',`Redraw')
1205 procedure Redraw (Win : Window := Standard_Window);
1208 -- ANCHOR(`wredrawln()',`Redraw')
1209 procedure Redraw (Win : Window := Standard_Window;
1210 Begin_Line : Line_Position;
1211 Line_Count : Positive);
1213 pragma Inline (Redraw);
1215 -- MANPAGE(`curs_clear.3x')
1217 -- ANCHOR(`werase()',`Erase')
1218 procedure Erase (Win : Window := Standard_Window);
1221 pragma Inline (Erase);
1223 -- ANCHOR(`wclear()',`Clear')
1225 (Win : Window := Standard_Window);
1228 pragma Inline (Clear);
1230 -- ANCHOR(`wclrtobot()',`Clear_To_End_Of_Screen')
1231 procedure Clear_To_End_Of_Screen
1232 (Win : Window := Standard_Window);
1234 -- ALIAS(`clrtobot()')
1235 pragma Inline (Clear_To_End_Of_Screen);
1237 -- ANCHOR(`wclrtoeol()',`Clear_To_End_Of_Line')
1238 procedure Clear_To_End_Of_Line
1239 (Win : Window := Standard_Window);
1241 -- ALIAS(`clrtoeol()')
1242 pragma Inline (Clear_To_End_Of_Line);
1244 -- MANPAGE(`curs_bkgd.3x')
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
1251 (Win : Window := Standard_Window;
1252 Ch : Attributed_Character);
1254 -- ALIAS(`bkgdset()')
1255 pragma Inline (Set_Background);
1257 -- ANCHOR(`wbkgd()',`Change_Background')
1258 procedure Change_Background
1259 (Win : Window := Standard_Window;
1260 Ch : Attributed_Character);
1263 pragma Inline (Change_Background);
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;
1270 -- ALIAS(`bkgdget()')
1271 pragma Inline (Get_Background);
1273 -- MANPAGE(`curs_touch.3x')
1275 -- ANCHOR(`untouchwin()',`Untouch')
1276 procedure Untouch (Win : Window := Standard_Window);
1278 pragma Inline (Untouch);
1280 -- ANCHOR(`touchwin()',`Touch')
1281 procedure Touch (Win : Window := Standard_Window);
1284 -- ANCHOR(`touchline()',`Touch')
1285 procedure Touch (Win : Window := Standard_Window;
1286 Start : Line_Position;
1289 pragma Inline (Touch);
1291 -- ANCHOR(`wtouchln()',`Change_Line_Status')
1292 procedure Change_Lines_Status (Win : Window := Standard_Window;
1293 Start : Line_Position;
1297 pragma Inline (Change_Lines_Status);
1299 -- ANCHOR(`is_linetouched()',`Is_Touched')
1300 function Is_Touched (Win : Window := Standard_Window;
1301 Line : Line_Position) return Boolean;
1304 -- ANCHOR(`is_wintouched()',`Is_Touched')
1305 function Is_Touched (Win : Window := Standard_Window) return Boolean;
1307 pragma Inline (Is_Touched);
1309 -- MANPAGE(`curs_overlay.3x')
1311 -- ANCHOR(`copywin()',`Copy')
1313 (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);
1323 pragma Inline (Copy);
1325 -- ANCHOR(`overwrite()',`Overwrite')
1326 procedure Overwrite (Source_Window : Window;
1327 Destination_Window : Window);
1329 pragma Inline (Overwrite);
1331 -- ANCHOR(`overlay()',`Overlay')
1332 procedure Overlay (Source_Window : Window;
1333 Destination_Window : Window);
1335 pragma Inline (Overlay);
1337 -- MANPAGE(`curs_deleteln.3x')
1339 -- ANCHOR(`winsdelln()',`Insert_Delete_Lines')
1340 procedure Insert_Delete_Lines
1341 (Win : Window := Standard_Window;
1342 Lines : Integer := 1); -- default is to insert one line above
1344 -- ALIAS(`insdelln()')
1345 pragma Inline (Insert_Delete_Lines);
1347 -- ANCHOR(`wdeleteln()',`Delete_Line')
1348 procedure Delete_Line (Win : Window := Standard_Window);
1350 -- ALIAS(`deleteln()')
1351 pragma Inline (Delete_Line);
1353 -- ANCHOR(`winsertln()',`Insert_Line')
1354 procedure Insert_Line (Win : Window := Standard_Window);
1356 -- ALIAS(`insertln()')
1357 pragma Inline (Insert_Line);
1359 -- MANPAGE(`curs_getyx.3x')
1361 -- ANCHOR(`getmaxyx()',`Get_Size')
1363 (Win : Window := Standard_Window;
1364 Number_Of_Lines : out Line_Count;
1365 Number_Of_Columns : out Column_Count);
1367 pragma Inline (Get_Size);
1369 -- ANCHOR(`getbegyx()',`Get_Window_Position')
1370 procedure Get_Window_Position
1371 (Win : Window := Standard_Window;
1372 Top_Left_Line : out Line_Position;
1373 Top_Left_Column : out Column_Position);
1375 pragma Inline (Get_Window_Position);
1377 -- ANCHOR(`getyx()',`Get_Cursor_Position')
1378 procedure Get_Cursor_Position
1379 (Win : Window := Standard_Window;
1380 Line : out Line_Position;
1381 Column : out Column_Position);
1383 pragma Inline (Get_Cursor_Position);
1385 -- ANCHOR(`getparyx()',`Get_Origin_Relative_To_Parent')
1386 procedure Get_Origin_Relative_To_Parent
1388 Top_Left_Line : out Line_Position;
1389 Top_Left_Column : out Column_Position;
1390 Is_Not_A_Subwindow : out Boolean);
1392 -- Instead of placing -1 in the coordinates as return, we use a Boolean
1393 -- to return the info that the window has no parent.
1394 pragma Inline (Get_Origin_Relative_To_Parent);
1396 -- MANPAGE(`curs_pad.3x')
1398 -- ANCHOR(`newpad()',`New_Pad')
1399 function New_Pad (Lines : Line_Count;
1400 Columns : Column_Count) return Window;
1402 pragma Inline (New_Pad);
1404 -- ANCHOR(`subpad()',`Sub_Pad')
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;
1412 pragma Inline (Sub_Pad);
1414 -- ANCHOR(`prefresh()',`Refresh')
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);
1424 pragma Inline (Refresh);
1426 -- ANCHOR(`pnoutrefresh()',`Refresh_Without_Update')
1427 procedure Refresh_Without_Update
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);
1436 pragma Inline (Refresh_Without_Update);
1438 -- ANCHOR(`pechochar()',`Add_Character_To_Pad_And_Echo_It')
1439 procedure Add_Character_To_Pad_And_Echo_It
1441 Ch : Attributed_Character);
1444 procedure Add_Character_To_Pad_And_Echo_It
1447 pragma Inline (Add_Character_To_Pad_And_Echo_It);
1449 -- MANPAGE(`curs_scroll.3x')
1451 -- ANCHOR(`wscrl()',`Scroll')
1452 procedure Scroll (Win : Window := Standard_Window;
1453 Amount : Integer := 1);
1455 -- ALIAS(`scroll()')
1457 pragma Inline (Scroll);
1459 -- MANPAGE(`curs_delch.3x')
1461 -- ANCHOR(`wdelch()',`Delete_Character')
1462 procedure Delete_Character (Win : Window := Standard_Window);
1466 -- ANCHOR(`mvwdelch()',`Delete_Character')
1467 procedure Delete_Character
1468 (Win : Window := Standard_Window;
1469 Line : Line_Position;
1470 Column : Column_Position);
1472 -- ALIAS(`mvdelch()')
1473 pragma Inline (Delete_Character);
1475 -- MANPAGE(`curs_inch.3x')
1477 -- ANCHOR(`winch()',`Peek')
1478 function Peek (Win : Window := Standard_Window)
1479 return Attributed_Character;
1483 -- ANCHOR(`mvwinch()',`Peek')
1485 (Win : Window := Standard_Window;
1486 Line : Line_Position;
1487 Column : Column_Position) return Attributed_Character;
1489 -- ALIAS(`mvinch()')
1490 -- More Peek's follow, pragma Inline appears later.
1492 -- MANPAGE(`curs_insch.3x')
1494 -- ANCHOR(`winsch()',`Insert')
1495 procedure Insert (Win : Window := Standard_Window;
1496 Ch : Attributed_Character);
1500 -- ANCHOR(`mvwinsch()',`Insert')
1501 procedure Insert (Win : Window := Standard_Window;
1502 Line : Line_Position;
1503 Column : Column_Position;
1504 Ch : Attributed_Character);
1506 -- ALIAS(`mvinsch()')
1508 -- MANPAGE(`curs_insstr.3x')
1510 -- ANCHOR(`winsnstr()',`Insert')
1511 procedure Insert (Win : Window := Standard_Window;
1513 Len : Integer := -1);
1515 -- ALIAS(`winsstr()')
1516 -- ALIAS(`insnstr()')
1517 -- ALIAS(`insstr()')
1519 -- ANCHOR(`mvwinsnstr()',`Insert')
1520 procedure Insert (Win : Window := Standard_Window;
1521 Line : Line_Position;
1522 Column : Column_Position;
1524 Len : Integer := -1);
1526 -- ALIAS(`mvwinsstr()')
1527 -- ALIAS(`mvinsnstr()')
1528 -- ALIAS(`mvinsstr()')
1529 pragma Inline (Insert);
1531 -- MANPAGE(`curs_instr.3x')
1533 -- ANCHOR(`winnstr()',`Peek')
1534 procedure Peek (Win : Window := Standard_Window;
1536 Len : Integer := -1);
1538 -- ALIAS(`winstr()')
1539 -- ALIAS(`innstr()')
1542 -- ANCHOR(`mvwinnstr()',`Peek')
1543 procedure Peek (Win : Window := Standard_Window;
1544 Line : Line_Position;
1545 Column : Column_Position;
1547 Len : Integer := -1);
1549 -- ALIAS(`mvwinstr()')
1550 -- ALIAS(`mvinnstr()')
1551 -- ALIAS(`mvinstr()')
1553 -- MANPAGE(`curs_inchstr.3x')
1555 -- ANCHOR(`winchnstr()',`Peek')
1556 procedure Peek (Win : Window := Standard_Window;
1557 Str : out Attributed_String;
1558 Len : Integer := -1);
1560 -- ALIAS(`winchstr()')
1561 -- ALIAS(`inchnstr()')
1562 -- ALIAS(`inchstr()')
1564 -- ANCHOR(`mvwinchnstr()',`Peek')
1565 procedure Peek (Win : Window := Standard_Window;
1566 Line : Line_Position;
1567 Column : Column_Position;
1568 Str : out Attributed_String;
1569 Len : Integer := -1);
1571 -- ALIAS(`mvwinchstr()')
1572 -- ALIAS(`mvinchnstr()')
1573 -- ALIAS(`mvinchstr()')
1574 -- We do not inline the Peek procedures
1576 -- MANPAGE(`curs_getstr.3x')
1578 -- ANCHOR(`wgetnstr()',`Get')
1579 procedure Get (Win : Window := Standard_Window;
1581 Len : Integer := -1);
1583 -- ALIAS(`wgetstr()')
1584 -- ALIAS(`getnstr()')
1585 -- ALIAS(`getstr()')
1586 -- actually getstr is not supported because that results in buffer
1589 -- ANCHOR(`mvwgetnstr()',`Get')
1590 procedure Get (Win : Window := Standard_Window;
1591 Line : Line_Position;
1592 Column : Column_Position;
1594 Len : Integer := -1);
1596 -- ALIAS(`mvwgetstr()')
1597 -- ALIAS(`mvgetnstr()')
1598 -- ALIAS(`mvgetstr()')
1599 -- Get is not inlined
1601 -- MANPAGE(`curs_slk.3x')
1603 -- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set
1605 type Soft_Label_Key_Format is (Three_Two_Three,
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);
1612 -- ANCHOR(`slk_init()',`Init_Soft_Label_Keys')
1613 procedure Init_Soft_Label_Keys
1614 (Format : Soft_Label_Key_Format := Three_Two_Three);
1616 pragma Inline (Init_Soft_Label_Keys);
1618 -- ANCHOR(`slk_set()',`Set_Soft_Label_Key')
1619 procedure Set_Soft_Label_Key (Label : Label_Number;
1621 Fmt : Label_Justification := Left);
1623 -- We do not inline this procedure
1625 -- ANCHOR(`slk_refresh()',`Refresh_Soft_Label_Key')
1626 procedure Refresh_Soft_Label_Keys;
1628 pragma Inline (Refresh_Soft_Label_Keys);
1630 -- ANCHOR(`slk_noutrefresh()',`Refresh_Soft_Label_Keys_Without_Update')
1631 procedure Refresh_Soft_Label_Keys_Without_Update;
1633 pragma Inline (Refresh_Soft_Label_Keys_Without_Update);
1635 -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
1636 procedure Get_Soft_Label_Key (Label : Label_Number;
1640 -- ANCHOR(`slk_label()',`Get_Soft_Label_Key')
1641 function Get_Soft_Label_Key (Label : Label_Number) return String;
1644 pragma Inline (Get_Soft_Label_Key);
1646 -- ANCHOR(`slk_clear()',`Clear_Soft_Label_Keys')
1647 procedure Clear_Soft_Label_Keys;
1649 pragma Inline (Clear_Soft_Label_Keys);
1651 -- ANCHOR(`slk_restore()',`Restore_Soft_Label_Keys')
1652 procedure Restore_Soft_Label_Keys;
1654 pragma Inline (Restore_Soft_Label_Keys);
1656 -- ANCHOR(`slk_touch()',`Touch_Soft_Label_Keys')
1657 procedure Touch_Soft_Label_Keys;
1659 pragma Inline (Touch_Soft_Label_Keys);
1661 -- ANCHOR(`slk_attron()',`Switch_Soft_Label_Key_Attributes')
1662 procedure Switch_Soft_Label_Key_Attributes
1663 (Attr : Character_Attribute_Set;
1664 On : Boolean := True);
1666 -- ALIAS(`slk_attroff()')
1667 pragma Inline (Switch_Soft_Label_Key_Attributes);
1669 -- ANCHOR(`slk_attrset()',`Set_Soft_Label_Key_Attributes')
1670 procedure Set_Soft_Label_Key_Attributes
1671 (Attr : Character_Attribute_Set := Normal_Video;
1672 Color : Color_Pair := Color_Pair'First);
1674 pragma Inline (Set_Soft_Label_Key_Attributes);
1676 -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1677 function Get_Soft_Label_Key_Attributes return Character_Attribute_Set;
1680 -- ANCHOR(`slk_attr()',`Get_Soft_Label_Key_Attributes')
1681 function Get_Soft_Label_Key_Attributes return Color_Pair;
1683 pragma Inline (Get_Soft_Label_Key_Attributes);
1685 -- ANCHOR(`slk_color()',`Set_Soft_Label_Key_Color')
1686 procedure Set_Soft_Label_Key_Color (Pair : Color_Pair);
1688 pragma Inline (Set_Soft_Label_Key_Color);
1690 -- MANPAGE(`keybound.3x')
1691 -- Not Implemented: keybound
1693 -- MANPAGE(`keyok.3x')
1695 -- ANCHOR(`keyok()',`Enable_Key')
1696 procedure Enable_Key (Key : Special_Key_Code;
1697 Enable : Boolean := True);
1699 pragma Inline (Enable_Key);
1701 -- MANPAGE(`define_key.3x')
1703 -- ANCHOR(`define_key()',`Define_Key')
1704 procedure Define_Key (Definition : String;
1705 Key : Special_Key_Code);
1707 pragma Inline (Define_Key);
1709 -- MANPAGE(`curs_util.3x')
1711 -- | Not implemented : filter, use_env
1712 -- | putwin, getwin are in the child package PutWin
1715 -- ANCHOR(`keyname()',`Key_Name')
1716 procedure Key_Name (Key : Real_Key_Code;
1719 -- The external name for a real keystroke.
1721 -- ANCHOR(`keyname()',`Key_Name')
1722 function Key_Name (Key : Real_Key_Code) return String;
1725 -- We do not inline this routine
1727 -- ANCHOR(`unctrl()',`Un_Control')
1728 procedure Un_Control (Ch : Attributed_Character;
1732 -- ANCHOR(`unctrl()',`Un_Control')
1733 function Un_Control (Ch : Attributed_Character) return String;
1736 pragma Inline (Un_Control);
1738 -- ANCHOR(`delay_output()',`Delay_Output')
1739 procedure Delay_Output (Msecs : Natural);
1741 pragma Inline (Delay_Output);
1743 -- ANCHOR(`flushinp()',`Flush_Input')
1744 procedure Flush_Input;
1746 pragma Inline (Flush_Input);
1748 -- MANPAGE(`curs_termattrs.3x')
1750 -- ANCHOR(`baudrate()',`Baudrate')
1751 function Baudrate return Natural;
1753 pragma Inline (Baudrate);
1755 -- ANCHOR(`erasechar()',`Erase_Character')
1756 function Erase_Character return Character;
1758 pragma Inline (Erase_Character);
1760 -- ANCHOR(`killchar()',`Kill_Character')
1761 function Kill_Character return Character;
1763 pragma Inline (Kill_Character);
1765 -- ANCHOR(`has_ic()',`Has_Insert_Character')
1766 function Has_Insert_Character return Boolean;
1768 pragma Inline (Has_Insert_Character);
1770 -- ANCHOR(`has_il()',`Has_Insert_Line')
1771 function Has_Insert_Line return Boolean;
1773 pragma Inline (Has_Insert_Line);
1775 -- ANCHOR(`termattrs()',`Supported_Attributes')
1776 function Supported_Attributes return Character_Attribute_Set;
1778 pragma Inline (Supported_Attributes);
1780 -- ANCHOR(`longname()',`Long_Name')
1781 procedure Long_Name (Name : out String);
1784 -- ANCHOR(`longname()',`Long_Name')
1785 function Long_Name return String;
1788 pragma Inline (Long_Name);
1790 -- ANCHOR(`termname()',`Terminal_Name')
1791 procedure Terminal_Name (Name : out String);
1794 -- ANCHOR(`termname()',`Terminal_Name')
1795 function Terminal_Name return String;
1798 pragma Inline (Terminal_Name);
1800 -- MANPAGE(`curs_color.3x')
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;
1808 -- ANCHOR(`start_color()',`Start_Color')
1809 procedure Start_Color;
1811 pragma Import (C, Start_Color, "start_color");
1813 -- ANCHOR(`init_pair()',`Init_Pair')
1814 procedure Init_Pair (Pair : Redefinable_Color_Pair;
1815 Fore : Color_Number;
1816 Back : Color_Number);
1818 pragma Inline (Init_Pair);
1820 -- ANCHOR(`pair_content()',`Pair_Content')
1821 procedure Pair_Content (Pair : Color_Pair;
1822 Fore : out Color_Number;
1823 Back : out Color_Number);
1825 pragma Inline (Pair_Content);
1827 -- ANCHOR(`has_colors()',`Has_Colors')
1828 function Has_Colors return Boolean;
1830 pragma Inline (Has_Colors);
1832 -- ANCHOR(`init_color()',`Init_Color')
1833 procedure Init_Color (Color : Color_Number;
1838 pragma Inline (Init_Color);
1840 -- ANCHOR(`can_change_color()',`Can_Change_Color')
1841 function Can_Change_Color return Boolean;
1843 pragma Inline (Can_Change_Color);
1845 -- ANCHOR(`color_content()',`Color_Content')
1846 procedure Color_Content (Color : Color_Number;
1847 Red : out RGB_Value;
1848 Green : out RGB_Value;
1849 Blue : out RGB_Value);
1851 pragma Inline (Color_Content);
1853 -- MANPAGE(`curs_kernel.3x')
1854 -- | Not implemented: getsyx, setsyx
1856 type Curses_Mode is (Curses, Shell);
1858 -- ANCHOR(`def_prog_mode()',`Save_Curses_Mode')
1859 procedure Save_Curses_Mode (Mode : Curses_Mode);
1861 -- ALIAS(`def_shell_mode()')
1862 pragma Inline (Save_Curses_Mode);
1864 -- ANCHOR(`reset_prog_mode()',`Reset_Curses_Mode')
1865 procedure Reset_Curses_Mode (Mode : Curses_Mode);
1867 -- ALIAS(`reset_shell_mode()')
1868 pragma Inline (Reset_Curses_Mode);
1870 -- ANCHOR(`savetty()',`Save_Terminal_State')
1871 procedure Save_Terminal_State;
1873 pragma Inline (Save_Terminal_State);
1875 -- ANCHOR(`resetty();',`Reset_Terminal_State')
1876 procedure Reset_Terminal_State;
1878 pragma Inline (Reset_Terminal_State);
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.
1888 -- ANCHOR(`ripoffline()',`Rip_Off_Lines')
1889 procedure Rip_Off_Lines (Lines : Integer;
1890 Proc : Stdscr_Init_Proc);
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
1895 -- uses the sign of Lines to remove a single line from bottom or top.
1896 pragma Inline (Rip_Off_Lines);
1898 type Cursor_Visibility is (Invisible, Normal, Very_Visible);
1900 -- ANCHOR(`curs_set()',`Set_Cursor_Visibility')
1901 procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility);
1903 pragma Inline (Set_Cursor_Visibility);
1905 -- ANCHOR(`napms()',`Nap_Milli_Seconds')
1906 procedure Nap_Milli_Seconds (Ms : Natural);
1908 pragma Inline (Nap_Milli_Seconds);
1910 -- |=====================================================================
1911 -- | Some useful helpers.
1912 -- |=====================================================================
1913 type Transform_Direction is (From_Screen, To_Screen);
1914 procedure Transform_Coordinates
1915 (W : Window := Standard_Window;
1916 Line : in out Line_Position;
1917 Column : in out Column_Position;
1918 Dir : Transform_Direction := From_Screen);
1919 -- This procedure transforms screen coordinates into coordinates relative
1920 -- to the window and vice versa, depending on the Dir parameter.
1921 -- Screen coordinates are the position information for the physical device.
1922 -- 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.
1924 -- We do not inline this procedure
1926 -- MANPAGE(`default_colors.3x')
1928 Default_Color : constant Color_Number := -1;
1930 -- ANCHOR(`use_default_colors()',`Use_Default_Colors')
1931 procedure Use_Default_Colors;
1933 pragma Inline (Use_Default_Colors);
1935 -- ANCHOR(`assume_default_colors()',`Assume_Default_Colors')
1936 procedure Assume_Default_Colors (Fore : Color_Number := Default_Color;
1937 Back : Color_Number := Default_Color);
1939 pragma Inline (Assume_Default_Colors);
1941 -- MANPAGE(`curs_extend.3x')
1943 -- ANCHOR(`curses_version()',`Curses_Version')
1944 function Curses_Version return String;
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;
1952 -- MANPAGE(`curs_trace.3x')
1954 -- ANCHOR(`_nc_freeall()',`Curses_Free_All')
1955 procedure Curses_Free_All;
1958 -- MANPAGE(`curs_scr_dump.3x')
1960 -- ANCHOR(`scr_dump()',`Screen_Dump_To_File')
1961 procedure Screen_Dump_To_File (Filename : String);
1964 -- ANCHOR(`scr_restore()',`Screen_Restore_From_File')
1965 procedure Screen_Restore_From_File (Filename : String);
1968 -- ANCHOR(`scr_init()',`Screen_Init_From_File')
1969 procedure Screen_Init_From_File (Filename : String);
1972 -- ANCHOR(`scr_set()',`Screen_Set_File')
1973 procedure Screen_Set_File (Filename : String);
1976 -- MANPAGE(`curs_print.3x')
1977 -- Not implemented: mcprint
1979 -- MANPAGE(`curs_printw.3x')
1980 -- Not implemented: printw, wprintw, mvprintw, mvwprintw, vwprintw,
1982 -- Please use the Ada style Text_IO child packages for formatted
1983 -- printing. It does not make a lot of sense to map the printf style
1984 -- C functions to Ada.
1986 -- MANPAGE(`curs_scanw.3x')
1987 -- Not implemented: scanw, wscanw, mvscanw, mvwscanw, vwscanw, vw_scanw
1989 -- MANPAGE(`resizeterm.3x')
1990 -- Not Implemented: resizeterm
1992 -- MANPAGE(`wresize.3x')
1994 -- ANCHOR(`wresize()',`Resize')
1995 procedure Resize (Win : Window := Standard_Window;
1996 Number_Of_Lines : Line_Count;
1997 Number_Of_Columns : Column_Count);
2001 type Window is new System.Storage_Elements.Integer_Address;
2002 Null_Window : constant Window := 0;
2004 -- The next constants are generated and may be different on your
2008 Sizeof_Bool : constant := Curses_Constants.Sizeof_Bool;
2010 type Curses_Bool is mod 2 ** Sizeof_Bool;
2012 Curses_Bool_False : constant Curses_Bool := 0;
2014 end Terminal_Interface.Curses;