]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/gen/terminal_interface-curses-forms.ads.m4
ncurses 6.0 - patch 20170617
[ncurses.git] / Ada95 / gen / terminal_interface-curses-forms.ads.m4
1 --  -*- ada -*-
2 define(`HTMLNAME',`terminal_interface-curses-forms__ads.htm')dnl
3 include(M4MACRO)dnl
4 ------------------------------------------------------------------------------
5 --                                                                          --
6 --                           GNAT ncurses Binding                           --
7 --                                                                          --
8 --                      Terminal_Interface.Curses.Form                      --
9 --                                                                          --
10 --                                 S P E C                                  --
11 --                                                                          --
12 ------------------------------------------------------------------------------
13 -- Copyright (c) 1998-2009,2014 Free Software Foundation, Inc.              --
14 --                                                                          --
15 -- Permission is hereby granted, free of charge, to any person obtaining a  --
16 -- copy of this software and associated documentation files (the            --
17 -- "Software"), to deal in the Software without restriction, including      --
18 -- without limitation the rights to use, copy, modify, merge, publish,      --
19 -- distribute, distribute with modifications, sublicense, and/or sell       --
20 -- copies of the Software, and to permit persons to whom the Software is    --
21 -- furnished to do so, subject to the following conditions:                 --
22 --                                                                          --
23 -- The above copyright notice and this permission notice shall be included  --
24 -- in all copies or substantial portions of the Software.                   --
25 --                                                                          --
26 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --
27 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --
28 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --
29 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --
30 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --
31 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --
32 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --
33 --                                                                          --
34 -- Except as contained in this notice, the name(s) of the above copyright   --
35 -- holders shall not be used in advertising or otherwise to promote the     --
36 -- sale, use or other dealings in this Software without prior written       --
37 -- authorization.                                                           --
38 ------------------------------------------------------------------------------
39 --  Author:  Juergen Pfeifer, 1996
40 --  Version Control:
41 --  $Revision: 1.33 $
42 --  $Date: 2014/05/24 21:31:57 $
43 --  Binding Version 01.00
44 ------------------------------------------------------------------------------
45 with System;
46 with Ada.Characters.Latin_1;
47
48 package Terminal_Interface.Curses.Forms is
49    pragma Preelaborate (Terminal_Interface.Curses.Forms);
50    pragma Linker_Options ("-lform" & Curses_Constants.DFT_ARG_SUFFIX);
51
52    Space : Character renames Ada.Characters.Latin_1.Space;
53
54    type Field        is private;
55    type Form         is private;
56
57    Null_Field        : constant Field;
58    Null_Form         : constant Form;
59
60    type Field_Justification is (None,
61                                 Left,
62                                 Center,
63                                 Right);
64
65    type Field_Option_Set is
66       record
67          Visible   : Boolean;
68          Active    : Boolean;
69          Public    : Boolean;
70          Edit      : Boolean;
71          Wrap      : Boolean;
72          Blank     : Boolean;
73          Auto_Skip : Boolean;
74          Null_Ok   : Boolean;
75          Pass_Ok   : Boolean;
76          Static    : Boolean;
77       end record;
78    pragma Convention (C_Pass_By_Copy, Field_Option_Set);
79
80    for Field_Option_Set use
81       record
82          Visible   at 0 range Curses_Constants.O_VISIBLE_First
83            .. Curses_Constants.O_VISIBLE_Last;
84          Active    at 0 range Curses_Constants.O_ACTIVE_First
85            .. Curses_Constants.O_ACTIVE_Last;
86          Public    at 0 range Curses_Constants.O_PUBLIC_First
87            .. Curses_Constants.O_PUBLIC_Last;
88          Edit      at 0 range Curses_Constants.O_EDIT_First
89            .. Curses_Constants.O_EDIT_Last;
90          Wrap      at 0 range Curses_Constants.O_WRAP_First
91            .. Curses_Constants.O_WRAP_Last;
92          Blank     at 0 range Curses_Constants.O_BLANK_First
93            .. Curses_Constants.O_BLANK_Last;
94          Auto_Skip at 0 range Curses_Constants.O_AUTOSKIP_First
95            .. Curses_Constants.O_AUTOSKIP_Last;
96          Null_Ok   at 0 range Curses_Constants.O_NULLOK_First
97            .. Curses_Constants.O_NULLOK_Last;
98          Pass_Ok   at 0 range Curses_Constants.O_PASSOK_First
99            .. Curses_Constants.O_PASSOK_Last;
100          Static    at 0 range Curses_Constants.O_STATIC_First
101            .. Curses_Constants.O_STATIC_Last;
102       end record;
103    pragma Warnings (Off);
104    for Field_Option_Set'Size use Curses_Constants.Field_Options_Size;
105    pragma Warnings (On);
106
107    function Default_Field_Options return Field_Option_Set;
108    --  The initial defaults for the field options.
109    pragma Inline (Default_Field_Options);
110
111    type Form_Option_Set is
112       record
113          NL_Overload : Boolean;
114          BS_Overload : Boolean;
115       end record;
116    pragma Convention (C_Pass_By_Copy, Form_Option_Set);
117
118    for Form_Option_Set use
119       record
120          NL_Overload at 0 range Curses_Constants.O_NL_OVERLOAD_First
121            .. Curses_Constants.O_NL_OVERLOAD_Last;
122          BS_Overload at 0 range Curses_Constants.O_BS_OVERLOAD_First
123            .. Curses_Constants.O_BS_OVERLOAD_Last;
124       end record;
125    pragma Warnings (Off);
126    for Form_Option_Set'Size use Curses_Constants.Field_Options_Size;
127    pragma Warnings (On);
128
129    function Default_Form_Options return Form_Option_Set;
130    --  The initial defaults for the form options.
131    pragma Inline (Default_Form_Options);
132
133    type Buffer_Number is new Natural;
134
135    type Field_Array is array (Positive range <>) of aliased Field;
136    pragma Convention (C, Field_Array);
137
138    type Field_Array_Access is access Field_Array;
139
140    procedure Free (FA          : in out Field_Array_Access;
141                    Free_Fields : Boolean := False);
142    --  Release the memory for an allocated field array
143    --  If Free_Fields is True, call Delete() for all the fields in
144    --  the array.
145
146    subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57);
147
148    --  The prefix F_ stands for "Form Request"
149    F_Next_Page                : constant Form_Request_Code := Key_Max + 1;
150    F_Previous_Page            : constant Form_Request_Code := Key_Max + 2;
151    F_First_Page               : constant Form_Request_Code := Key_Max + 3;
152    F_Last_Page                : constant Form_Request_Code := Key_Max + 4;
153
154    F_Next_Field               : constant Form_Request_Code := Key_Max + 5;
155    F_Previous_Field           : constant Form_Request_Code := Key_Max + 6;
156    F_First_Field              : constant Form_Request_Code := Key_Max + 7;
157    F_Last_Field               : constant Form_Request_Code := Key_Max + 8;
158    F_Sorted_Next_Field        : constant Form_Request_Code := Key_Max + 9;
159    F_Sorted_Previous_Field    : constant Form_Request_Code := Key_Max + 10;
160    F_Sorted_First_Field       : constant Form_Request_Code := Key_Max + 11;
161    F_Sorted_Last_Field        : constant Form_Request_Code := Key_Max + 12;
162    F_Left_Field               : constant Form_Request_Code := Key_Max + 13;
163    F_Right_Field              : constant Form_Request_Code := Key_Max + 14;
164    F_Up_Field                 : constant Form_Request_Code := Key_Max + 15;
165    F_Down_Field               : constant Form_Request_Code := Key_Max + 16;
166
167    F_Next_Char                : constant Form_Request_Code := Key_Max + 17;
168    F_Previous_Char            : constant Form_Request_Code := Key_Max + 18;
169    F_Next_Line                : constant Form_Request_Code := Key_Max + 19;
170    F_Previous_Line            : constant Form_Request_Code := Key_Max + 20;
171    F_Next_Word                : constant Form_Request_Code := Key_Max + 21;
172    F_Previous_Word            : constant Form_Request_Code := Key_Max + 22;
173    F_Begin_Field              : constant Form_Request_Code := Key_Max + 23;
174    F_End_Field                : constant Form_Request_Code := Key_Max + 24;
175    F_Begin_Line               : constant Form_Request_Code := Key_Max + 25;
176    F_End_Line                 : constant Form_Request_Code := Key_Max + 26;
177    F_Left_Char                : constant Form_Request_Code := Key_Max + 27;
178    F_Right_Char               : constant Form_Request_Code := Key_Max + 28;
179    F_Up_Char                  : constant Form_Request_Code := Key_Max + 29;
180    F_Down_Char                : constant Form_Request_Code := Key_Max + 30;
181
182    F_New_Line                 : constant Form_Request_Code := Key_Max + 31;
183    F_Insert_Char              : constant Form_Request_Code := Key_Max + 32;
184    F_Insert_Line              : constant Form_Request_Code := Key_Max + 33;
185    F_Delete_Char              : constant Form_Request_Code := Key_Max + 34;
186    F_Delete_Previous          : constant Form_Request_Code := Key_Max + 35;
187    F_Delete_Line              : constant Form_Request_Code := Key_Max + 36;
188    F_Delete_Word              : constant Form_Request_Code := Key_Max + 37;
189    F_Clear_EOL                : constant Form_Request_Code := Key_Max + 38;
190    F_Clear_EOF                : constant Form_Request_Code := Key_Max + 39;
191    F_Clear_Field              : constant Form_Request_Code := Key_Max + 40;
192    F_Overlay_Mode             : constant Form_Request_Code := Key_Max + 41;
193    F_Insert_Mode              : constant Form_Request_Code := Key_Max + 42;
194
195    --  Vertical Scrolling
196    F_ScrollForward_Line       : constant Form_Request_Code := Key_Max + 43;
197    F_ScrollBackward_Line      : constant Form_Request_Code := Key_Max + 44;
198    F_ScrollForward_Page       : constant Form_Request_Code := Key_Max + 45;
199    F_ScrollBackward_Page      : constant Form_Request_Code := Key_Max + 46;
200    F_ScrollForward_HalfPage   : constant Form_Request_Code := Key_Max + 47;
201    F_ScrollBackward_HalfPage  : constant Form_Request_Code := Key_Max + 48;
202
203    --  Horizontal Scrolling
204    F_HScrollForward_Char      : constant Form_Request_Code := Key_Max + 49;
205    F_HScrollBackward_Char     : constant Form_Request_Code := Key_Max + 50;
206    F_HScrollForward_Line      : constant Form_Request_Code := Key_Max + 51;
207    F_HScrollBackward_Line     : constant Form_Request_Code := Key_Max + 52;
208    F_HScrollForward_HalfLine  : constant Form_Request_Code := Key_Max + 53;
209    F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54;
210
211    F_Validate_Field           : constant Form_Request_Code := Key_Max + 55;
212    F_Next_Choice              : constant Form_Request_Code := Key_Max + 56;
213    F_Previous_Choice          : constant Form_Request_Code := Key_Max + 57;
214
215    --  For those who like the old 'C' style request names
216    REQ_NEXT_PAGE    : Form_Request_Code renames F_Next_Page;
217    REQ_PREV_PAGE    : Form_Request_Code renames F_Previous_Page;
218    REQ_FIRST_PAGE   : Form_Request_Code renames F_First_Page;
219    REQ_LAST_PAGE    : Form_Request_Code renames F_Last_Page;
220
221    REQ_NEXT_FIELD   : Form_Request_Code renames F_Next_Field;
222    REQ_PREV_FIELD   : Form_Request_Code renames F_Previous_Field;
223    REQ_FIRST_FIELD  : Form_Request_Code renames F_First_Field;
224    REQ_LAST_FIELD   : Form_Request_Code renames F_Last_Field;
225    REQ_SNEXT_FIELD  : Form_Request_Code renames F_Sorted_Next_Field;
226    REQ_SPREV_FIELD  : Form_Request_Code renames F_Sorted_Previous_Field;
227    REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field;
228    REQ_SLAST_FIELD  : Form_Request_Code renames F_Sorted_Last_Field;
229    REQ_LEFT_FIELD   : Form_Request_Code renames F_Left_Field;
230    REQ_RIGHT_FIELD  : Form_Request_Code renames F_Right_Field;
231    REQ_UP_FIELD     : Form_Request_Code renames F_Up_Field;
232    REQ_DOWN_FIELD   : Form_Request_Code renames F_Down_Field;
233
234    REQ_NEXT_CHAR    : Form_Request_Code renames F_Next_Char;
235    REQ_PREV_CHAR    : Form_Request_Code renames F_Previous_Char;
236    REQ_NEXT_LINE    : Form_Request_Code renames F_Next_Line;
237    REQ_PREV_LINE    : Form_Request_Code renames F_Previous_Line;
238    REQ_NEXT_WORD    : Form_Request_Code renames F_Next_Word;
239    REQ_PREV_WORD    : Form_Request_Code renames F_Previous_Word;
240    REQ_BEG_FIELD    : Form_Request_Code renames F_Begin_Field;
241    REQ_END_FIELD    : Form_Request_Code renames F_End_Field;
242    REQ_BEG_LINE     : Form_Request_Code renames F_Begin_Line;
243    REQ_END_LINE     : Form_Request_Code renames F_End_Line;
244    REQ_LEFT_CHAR    : Form_Request_Code renames F_Left_Char;
245    REQ_RIGHT_CHAR   : Form_Request_Code renames F_Right_Char;
246    REQ_UP_CHAR      : Form_Request_Code renames F_Up_Char;
247    REQ_DOWN_CHAR    : Form_Request_Code renames F_Down_Char;
248
249    REQ_NEW_LINE     : Form_Request_Code renames F_New_Line;
250    REQ_INS_CHAR     : Form_Request_Code renames F_Insert_Char;
251    REQ_INS_LINE     : Form_Request_Code renames F_Insert_Line;
252    REQ_DEL_CHAR     : Form_Request_Code renames F_Delete_Char;
253    REQ_DEL_PREV     : Form_Request_Code renames F_Delete_Previous;
254    REQ_DEL_LINE     : Form_Request_Code renames F_Delete_Line;
255    REQ_DEL_WORD     : Form_Request_Code renames F_Delete_Word;
256    REQ_CLR_EOL      : Form_Request_Code renames F_Clear_EOL;
257    REQ_CLR_EOF      : Form_Request_Code renames F_Clear_EOF;
258    REQ_CLR_FIELD    : Form_Request_Code renames F_Clear_Field;
259    REQ_OVL_MODE     : Form_Request_Code renames F_Overlay_Mode;
260    REQ_INS_MODE     : Form_Request_Code renames F_Insert_Mode;
261
262    REQ_SCR_FLINE    : Form_Request_Code renames F_ScrollForward_Line;
263    REQ_SCR_BLINE    : Form_Request_Code renames F_ScrollBackward_Line;
264    REQ_SCR_FPAGE    : Form_Request_Code renames F_ScrollForward_Page;
265    REQ_SCR_BPAGE    : Form_Request_Code renames F_ScrollBackward_Page;
266    REQ_SCR_FHPAGE   : Form_Request_Code renames F_ScrollForward_HalfPage;
267    REQ_SCR_BHPAGE   : Form_Request_Code renames F_ScrollBackward_HalfPage;
268
269    REQ_SCR_FCHAR    : Form_Request_Code renames F_HScrollForward_Char;
270    REQ_SCR_BCHAR    : Form_Request_Code renames F_HScrollBackward_Char;
271    REQ_SCR_HFLINE   : Form_Request_Code renames F_HScrollForward_Line;
272    REQ_SCR_HBLINE   : Form_Request_Code renames F_HScrollBackward_Line;
273    REQ_SCR_HFHALF   : Form_Request_Code renames F_HScrollForward_HalfLine;
274    REQ_SCR_HBHALF   : Form_Request_Code renames F_HScrollBackward_HalfLine;
275
276    REQ_VALIDATION   : Form_Request_Code renames F_Validate_Field;
277    REQ_NEXT_CHOICE  : Form_Request_Code renames F_Next_Choice;
278    REQ_PREV_CHOICE  : Form_Request_Code renames F_Previous_Choice;
279
280    procedure Request_Name (Key  : Form_Request_Code;
281                            Name : out String);
282
283    function  Request_Name (Key : Form_Request_Code) return String;
284    --  Same as function
285    pragma Inline (Request_Name);
286
287    ------------------
288    --  Exceptions  --
289    ------------------
290    Form_Exception : exception;
291
292    --  MANPAGE(`form_field_new.3x')
293
294    --  ANCHOR(`new_field()',`Create')
295    function Create (Height       : Line_Count;
296                     Width        : Column_Count;
297                     Top          : Line_Position;
298                     Left         : Column_Position;
299                     Off_Screen   : Natural := 0;
300                     More_Buffers : Buffer_Number := Buffer_Number'First)
301                     return Field;
302    --  AKA
303    --  An overloaded Create is defined later. Pragma Inline appears there.
304
305    --  ANCHOR(`new_field()',`New_Field')
306    function New_Field (Height       : Line_Count;
307                        Width        : Column_Count;
308                        Top          : Line_Position;
309                        Left         : Column_Position;
310                        Off_Screen   : Natural := 0;
311                        More_Buffers : Buffer_Number := Buffer_Number'First)
312                        return Field renames Create;
313    --  AKA
314    pragma Inline (New_Field);
315
316    --  ANCHOR(`free_field()',`Delete')
317    procedure Delete (Fld : in out Field);
318    --  AKA
319    --  Reset Fld to Null_Field
320    --  An overloaded Delete is defined later. Pragma Inline appears there.
321
322    --  ANCHOR(`dup_field()',`Duplicate')
323    function Duplicate (Fld  : Field;
324                        Top  : Line_Position;
325                        Left : Column_Position) return Field;
326    --  AKA
327    pragma Inline (Duplicate);
328
329    --  ANCHOR(`link_field()',`Link')
330    function Link (Fld  : Field;
331                   Top  : Line_Position;
332                   Left : Column_Position) return Field;
333    --  AKA
334    pragma Inline (Link);
335
336    --  MANPAGE(`form_field_just.3x')
337
338    --  ANCHOR(`set_field_just()',`Set_Justification')
339    procedure Set_Justification (Fld  : Field;
340                                 Just : Field_Justification := None);
341    --  AKA
342    pragma Inline (Set_Justification);
343
344    --  ANCHOR(`field_just()',`Get_Justification')
345    function Get_Justification (Fld : Field) return Field_Justification;
346    --  AKA
347    pragma Inline (Get_Justification);
348
349    --  MANPAGE(`form_field_buffer.3x')
350
351    --  ANCHOR(`set_field_buffer()',`Set_Buffer')
352    procedure Set_Buffer
353      (Fld    : Field;
354       Buffer : Buffer_Number := Buffer_Number'First;
355       Str    : String);
356    --  AKA
357    --  Not inlined
358
359    --  ANCHOR(`field_buffer()',`Get_Buffer')
360    procedure Get_Buffer
361      (Fld    : Field;
362       Buffer : Buffer_Number := Buffer_Number'First;
363       Str    : out String);
364    --  AKA
365
366    function Get_Buffer
367      (Fld    : Field;
368       Buffer : Buffer_Number := Buffer_Number'First) return String;
369    --  AKA
370    --  Same but as function
371    pragma Inline (Get_Buffer);
372
373    --  ANCHOR(`set_field_status()',`Set_Status')
374    procedure Set_Status (Fld    : Field;
375                          Status : Boolean := True);
376    --  AKA
377    pragma Inline (Set_Status);
378
379    --  ANCHOR(`field_status()',`Changed')
380    function Changed (Fld : Field) return Boolean;
381    --  AKA
382    pragma Inline (Changed);
383
384    --  ANCHOR(`set_field_max()',`Set_Maximum_Size')
385    procedure Set_Maximum_Size (Fld : Field;
386                                Max : Natural := 0);
387    --  AKA
388    pragma Inline (Set_Maximum_Size);
389
390    --  MANPAGE(`form_field_opts.3x')
391
392    --  ANCHOR(`set_field_opts()',`Set_Options')
393    procedure Set_Options (Fld     : Field;
394                           Options : Field_Option_Set);
395    --  AKA
396    --  An overloaded version is defined later. Pragma Inline appears there
397
398    --  ANCHOR(`field_opts_on()',`Switch_Options')
399    procedure Switch_Options (Fld     : Field;
400                              Options : Field_Option_Set;
401                              On      : Boolean := True);
402    --  AKA
403    --  ALIAS(`field_opts_off()')
404    --  An overloaded version is defined later. Pragma Inline appears there
405
406    --  ANCHOR(`field_opts()',`Get_Options')
407    procedure Get_Options (Fld     : Field;
408                           Options : out Field_Option_Set);
409    --  AKA
410
411    --  ANCHOR(`field_opts()',`Get_Options')
412    function Get_Options (Fld : Field := Null_Field)
413                          return Field_Option_Set;
414    --  AKA
415    --  An overloaded version is defined later. Pragma Inline appears there
416
417    --  MANPAGE(`form_field_attributes.3x')
418
419    --  ANCHOR(`set_field_fore()',`Set_Foreground')
420    procedure Set_Foreground
421      (Fld   : Field;
422       Fore  : Character_Attribute_Set := Normal_Video;
423       Color : Color_Pair := Color_Pair'First);
424    --  AKA
425    pragma Inline (Set_Foreground);
426
427    --  ANCHOR(`field_fore()',`Foreground')
428    procedure Foreground (Fld  : Field;
429                          Fore : out Character_Attribute_Set);
430    --  AKA
431
432    --  ANCHOR(`field_fore()',`Foreground')
433    procedure Foreground (Fld   : Field;
434                          Fore  : out Character_Attribute_Set;
435                          Color : out Color_Pair);
436    --  AKA
437    pragma Inline (Foreground);
438
439    --  ANCHOR(`set_field_back()',`Set_Background')
440    procedure Set_Background
441      (Fld   : Field;
442       Back  : Character_Attribute_Set := Normal_Video;
443       Color : Color_Pair := Color_Pair'First);
444    --  AKA
445    pragma Inline (Set_Background);
446
447    --  ANCHOR(`field_back()',`Background')
448    procedure Background (Fld  : Field;
449                          Back : out Character_Attribute_Set);
450    --  AKA
451
452    --  ANCHOR(`field_back()',`Background')
453    procedure Background (Fld   : Field;
454                          Back  : out Character_Attribute_Set;
455                          Color : out Color_Pair);
456    --  AKA
457    pragma Inline (Background);
458
459    --  ANCHOR(`set_field_pad()',`Set_Pad_Character')
460    procedure Set_Pad_Character (Fld : Field;
461                                 Pad : Character := Space);
462    --  AKA
463    pragma Inline (Set_Pad_Character);
464
465    --  ANCHOR(`field_pad()',`Pad_Character')
466    procedure Pad_Character (Fld : Field;
467                             Pad : out Character);
468    --  AKA
469    pragma Inline (Pad_Character);
470
471    --  MANPAGE(`form_field_info.3x')
472
473    --  ANCHOR(`field_info()',`Info')
474    procedure Info (Fld                : Field;
475                    Lines              : out Line_Count;
476                    Columns            : out Column_Count;
477                    First_Row          : out Line_Position;
478                    First_Column       : out Column_Position;
479                    Off_Screen         : out Natural;
480                    Additional_Buffers : out Buffer_Number);
481    --  AKA
482    pragma Inline (Info);
483
484    --  ANCHOR(`dynamic_field_info()',`Dynamic_Info')
485    procedure Dynamic_Info (Fld     : Field;
486                            Lines   : out Line_Count;
487                            Columns : out Column_Count;
488                            Max     : out Natural);
489    --  AKA
490    pragma Inline (Dynamic_Info);
491
492    --  MANPAGE(`form_win.3x')
493
494    --  ANCHOR(`set_form_win()',`Set_Window')
495    procedure Set_Window (Frm : Form;
496                          Win : Window);
497    --  AKA
498    pragma Inline (Set_Window);
499
500    --  ANCHOR(`form_win()',`Get_Window')
501    function Get_Window (Frm : Form) return Window;
502    --  AKA
503    pragma Inline (Get_Window);
504
505    --  ANCHOR(`set_form_sub()',`Set_Sub_Window')
506    procedure Set_Sub_Window (Frm : Form;
507                              Win : Window);
508    --  AKA
509    pragma Inline (Set_Sub_Window);
510
511    --  ANCHOR(`form_sub()',`Get_Sub_Window')
512    function Get_Sub_Window (Frm : Form) return Window;
513    --  AKA
514    pragma Inline (Get_Sub_Window);
515
516    --  ANCHOR(`scale_form()',`Scale')
517    procedure Scale (Frm     : Form;
518                     Lines   : out Line_Count;
519                     Columns : out Column_Count);
520    --  AKA
521    pragma Inline (Scale);
522
523    --  MANPAGE(`form_hook.3x')
524
525    type Form_Hook_Function is access procedure (Frm : Form);
526    pragma Convention (C, Form_Hook_Function);
527
528    --  ANCHOR(`set_field_init()',`Set_Field_Init_Hook')
529    procedure Set_Field_Init_Hook (Frm  : Form;
530                                   Proc : Form_Hook_Function);
531    --  AKA
532    pragma Inline (Set_Field_Init_Hook);
533
534    --  ANCHOR(`set_field_term()',`Set_Field_Term_Hook')
535    procedure Set_Field_Term_Hook (Frm  : Form;
536                                   Proc : Form_Hook_Function);
537    --  AKA
538    pragma Inline (Set_Field_Term_Hook);
539
540    --  ANCHOR(`set_form_init()',`Set_Form_Init_Hook')
541    procedure Set_Form_Init_Hook (Frm  : Form;
542                                  Proc : Form_Hook_Function);
543    --  AKA
544    pragma Inline (Set_Form_Init_Hook);
545
546    --  ANCHOR(`set_form_term()',`Set_Form_Term_Hook')
547    procedure Set_Form_Term_Hook (Frm  : Form;
548                                  Proc : Form_Hook_Function);
549    --  AKA
550    pragma Inline (Set_Form_Term_Hook);
551
552    --  ANCHOR(`field_init()',`Get_Field_Init_Hook')
553    function Get_Field_Init_Hook (Frm : Form) return Form_Hook_Function;
554    --  AKA
555    pragma Import (C, Get_Field_Init_Hook, "field_init");
556
557    --  ANCHOR(`field_term()',`Get_Field_Term_Hook')
558    function Get_Field_Term_Hook (Frm : Form) return Form_Hook_Function;
559    --  AKA
560    pragma Import (C, Get_Field_Term_Hook, "field_term");
561
562    --  ANCHOR(`form_init()',`Get_Form_Init_Hook')
563    function Get_Form_Init_Hook (Frm : Form) return Form_Hook_Function;
564    --  AKA
565    pragma Import (C, Get_Form_Init_Hook, "form_init");
566
567    --  ANCHOR(`form_term()',`Get_Form_Term_Hook')
568    function Get_Form_Term_Hook (Frm : Form) return Form_Hook_Function;
569    --  AKA
570    pragma Import (C, Get_Form_Term_Hook, "form_term");
571
572    --  MANPAGE(`form_field.3x')
573
574    --  ANCHOR(`set_form_fields()',`Redefine')
575    procedure Redefine (Frm  : Form;
576                        Flds : Field_Array_Access);
577    --  AKA
578    pragma Inline (Redefine);
579
580    --  ANCHOR(`set_form_fields()',`Set_Fields')
581    procedure Set_Fields (Frm  : Form;
582                          Flds : Field_Array_Access) renames Redefine;
583    --  AKA
584    --  pragma Inline (Set_Fields);
585
586    --  ANCHOR(`form_fields()',`Fields')
587    function Fields (Frm   : Form;
588                     Index : Positive) return Field;
589    --  AKA
590    pragma Inline (Fields);
591
592    --  ANCHOR(`field_count()',`Field_Count')
593    function Field_Count (Frm : Form) return Natural;
594    --  AKA
595    pragma Inline (Field_Count);
596
597    --  ANCHOR(`move_field()',`Move')
598    procedure Move (Fld    : Field;
599                    Line   : Line_Position;
600                    Column : Column_Position);
601    --  AKA
602    pragma Inline (Move);
603
604    --  MANPAGE(`form_new.3x')
605
606    --  ANCHOR(`new_form()',`Create')
607    function Create (Fields : Field_Array_Access) return Form;
608    --  AKA
609    pragma Inline (Create);
610
611    --  ANCHOR(`new_form()',`New_Form')
612    function New_Form (Fields : Field_Array_Access) return Form
613      renames Create;
614    --  AKA
615    --  pragma Inline (New_Form);
616
617    --  ANCHOR(`free_form()',`Delete')
618    procedure Delete (Frm : in out Form);
619    --  AKA
620    --  Reset Frm to Null_Form
621    pragma Inline (Delete);
622
623    --  MANPAGE(`form_opts.3x')
624
625    --  ANCHOR(`set_form_opts()',`Set_Options')
626    procedure Set_Options (Frm     : Form;
627                           Options : Form_Option_Set);
628    --  AKA
629    pragma Inline (Set_Options);
630
631    --  ANCHOR(`form_opts_on()',`Switch_Options')
632    procedure Switch_Options (Frm     : Form;
633                              Options : Form_Option_Set;
634                              On      : Boolean := True);
635    --  AKA
636    --  ALIAS(`form_opts_off()')
637    pragma Inline (Switch_Options);
638
639    --  ANCHOR(`form_opts()',`Get_Options')
640    procedure Get_Options (Frm     : Form;
641                           Options : out Form_Option_Set);
642    --  AKA
643
644    --  ANCHOR(`form_opts()',`Get_Options')
645    function Get_Options (Frm : Form := Null_Form) return Form_Option_Set;
646    --  AKA
647    pragma Inline (Get_Options);
648
649    --  MANPAGE(`form_post.3x')
650
651    --  ANCHOR(`post_form()',`Post')
652    procedure Post (Frm  : Form;
653                    Post : Boolean := True);
654    --  AKA
655    --  ALIAS(`unpost_form()')
656    pragma Inline (Post);
657
658    --  MANPAGE(`form_cursor.3x')
659
660    --  ANCHOR(`pos_form_cursor()',`Position_Cursor')
661    procedure Position_Cursor (Frm : Form);
662    --  AKA
663    pragma Inline (Position_Cursor);
664
665    --  MANPAGE(`form_data.3x')
666
667    --  ANCHOR(`data_ahead()',`Data_Ahead')
668    function Data_Ahead (Frm : Form) return Boolean;
669    --  AKA
670    pragma Inline (Data_Ahead);
671
672    --  ANCHOR(`data_behind()',`Data_Behind')
673    function Data_Behind (Frm : Form) return Boolean;
674    --  AKA
675    pragma Inline (Data_Behind);
676
677    --  MANPAGE(`form_driver.3x')
678
679    type Driver_Result is (Form_Ok,
680                           Request_Denied,
681                           Unknown_Request,
682                           Invalid_Field);
683
684    --  ANCHOR(`form_driver()',`Driver')
685    function Driver (Frm : Form;
686                     Key : Key_Code) return Driver_Result;
687    --  AKA
688    --  Driver not inlined
689
690    --  MANPAGE(`form_page.3x')
691
692    type Page_Number is new Natural;
693
694    --  ANCHOR(`set_current_field()',`Set_Current')
695    procedure Set_Current (Frm : Form;
696                           Fld : Field);
697    --  AKA
698    pragma Inline (Set_Current);
699
700    --  ANCHOR(`current_field()',`Current')
701    function Current (Frm : Form) return Field;
702    --  AKA
703    pragma Inline (Current);
704
705    --  ANCHOR(`set_form_page()',`Set_Page')
706    procedure Set_Page (Frm  : Form;
707                        Page : Page_Number := Page_Number'First);
708    --  AKA
709    pragma Inline (Set_Page);
710
711    --  ANCHOR(`form_page()',`Page')
712    function Page (Frm : Form) return Page_Number;
713    --  AKA
714    pragma Inline (Page);
715
716    --  ANCHOR(`field_index()',`Get_Index')
717    function Get_Index (Fld : Field) return Positive;
718    --  AKA
719    --  Please note that in this binding we start the numbering of fields
720    --  with 1. So this is number is one more than you get from the low
721    --  level call.
722    pragma Inline (Get_Index);
723
724    --  MANPAGE(`form_new_page.3x')
725
726    --  ANCHOR(`set_new_page()',`Set_New_Page')
727    procedure Set_New_Page (Fld      : Field;
728                            New_Page : Boolean := True);
729    --  AKA
730    pragma Inline (Set_New_Page);
731
732    --  ANCHOR(`new_page()',`Is_New_Page')
733    function Is_New_Page (Fld : Field) return Boolean;
734    --  AKA
735    pragma Inline (Is_New_Page);
736
737    --  MANPAGE(`form_requestname.3x')
738    --  Not Implemented: form_request_name, form_request_by_name
739
740 ------------------------------------------------------------------------------
741 private
742    type Field is new System.Storage_Elements.Integer_Address;
743    type Form  is new System.Storage_Elements.Integer_Address;
744
745    Null_Field : constant Field := 0;
746    Null_Form  : constant Form  := 0;
747
748 end Terminal_Interface.Curses.Forms;