1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding --
5 -- Terminal_Interface.Curses.Forms --
9 ------------------------------------------------------------------------------
10 -- Copyright (c) 1998 Free Software Foundation, Inc. --
12 -- Permission is hereby granted, free of charge, to any person obtaining a --
13 -- copy of this software and associated documentation files (the --
14 -- "Software"), to deal in the Software without restriction, including --
15 -- without limitation the rights to use, copy, modify, merge, publish, --
16 -- distribute, distribute with modifications, sublicense, and/or sell --
17 -- copies of the Software, and to permit persons to whom the Software is --
18 -- furnished to do so, subject to the following conditions: --
20 -- The above copyright notice and this permission notice shall be included --
21 -- in all copies or substantial portions of the Software. --
23 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
24 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
25 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
26 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
27 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
28 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
29 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
31 -- Except as contained in this notice, the name(s) of the above copyright --
32 -- holders shall not be used in advertising or otherwise to promote the --
33 -- sale, use or other dealings in this Software without prior written --
35 ------------------------------------------------------------------------------
36 -- Author: Juergen Pfeifer, 1996
39 -- Binding Version 01.00
40 ------------------------------------------------------------------------------
41 with Ada.Unchecked_Deallocation;
42 with Ada.Unchecked_Conversion;
44 with Interfaces.C; use Interfaces.C;
45 with Interfaces.C.Strings; use Interfaces.C.Strings;
46 with Interfaces.C.Pointers;
48 with Terminal_Interface.Curses.Aux;
50 package body Terminal_Interface.Curses.Forms is
52 use Terminal_Interface.Curses.Aux;
54 type C_Field_Array is array (Natural range <>) of aliased Field;
55 package F_Array is new
56 Interfaces.C.Pointers (Natural, Field, C_Field_Array, Null_Field);
58 ------------------------------------------------------------------------------
62 -- subtype chars_ptr is Interfaces.C.Strings.chars_ptr;
64 function FOS_2_CInt is new
65 Ada.Unchecked_Conversion (Field_Option_Set,
68 function CInt_2_FOS is new
69 Ada.Unchecked_Conversion (C_Int,
72 function FrmOS_2_CInt is new
73 Ada.Unchecked_Conversion (Form_Option_Set,
76 function CInt_2_FrmOS is new
77 Ada.Unchecked_Conversion (C_Int,
80 procedure Request_Name (Key : in Form_Request_Code;
83 function Form_Request_Name (Key : C_Int) return chars_ptr;
84 pragma Import (C, Form_Request_Name, "form_request_name");
86 Fill_String (Form_Request_Name (C_Int (Key)), Name);
89 function Request_Name (Key : Form_Request_Code) return String
91 function Form_Request_Name (Key : C_Int) return chars_ptr;
92 pragma Import (C, Form_Request_Name, "form_request_name");
94 return Fill_String (Form_Request_Name (C_Int (Key)));
96 ------------------------------------------------------------------------------
101 -- |=====================================================================
102 -- | man page form_field_new.3x
103 -- |=====================================================================
107 function Create (Height : Line_Count;
108 Width : Column_Count;
110 Left : Column_Position;
111 Off_Screen : Natural := 0;
112 More_Buffers : Buffer_Number := Buffer_Number'First)
115 function Newfield (H, W, T, L, O, M : C_Int) return Field;
116 pragma Import (C, Newfield, "new_field");
117 Fld : constant Field := Newfield (C_Int (Height), C_Int (Width),
118 C_Int (Top), C_Int (Left),
120 C_Int (More_Buffers));
122 if Fld = Null_Field then
123 raise Form_Exception;
130 procedure Delete (Fld : in out Field)
132 function Free_Field (Fld : Field) return C_Int;
133 pragma Import (C, Free_Field, "free_field");
137 Res := Free_Field (Fld);
146 function Duplicate (Fld : Field;
148 Left : Column_Position) return Field
150 function Dup_Field (Fld : Field;
152 Left : C_Int) return Field;
153 pragma Import (C, Dup_Field, "dup_field");
155 F : constant Field := Dup_Field (Fld,
159 if F = Null_Field then
160 raise Form_Exception;
167 function Link (Fld : Field;
169 Left : Column_Position) return Field
171 function Lnk_Field (Fld : Field;
173 Left : C_Int) return Field;
174 pragma Import (C, Lnk_Field, "link_field");
176 F : constant Field := Lnk_Field (Fld,
180 if F = Null_Field then
181 raise Form_Exception;
186 -- |=====================================================================
187 -- | man page form_field_just.3x
188 -- |=====================================================================
192 procedure Set_Justification (Fld : in Field;
193 Just : in Field_Justification := None)
195 function Set_Field_Just (Fld : Field;
196 Just : C_Int) return C_Int;
197 pragma Import (C, Set_Field_Just, "set_field_just");
199 Res : constant Eti_Error :=
201 C_Int (Field_Justification'Pos (Just)));
206 end Set_Justification;
210 function Get_Justification (Fld : Field) return Field_Justification
212 function Field_Just (Fld : Field) return C_Int;
213 pragma Import (C, Field_Just, "field_just");
215 return Field_Justification'Val (Field_Just (Fld));
216 end Get_Justification;
218 -- |=====================================================================
219 -- | man page form_field_buffer.3x
220 -- |=====================================================================
226 Buffer : in Buffer_Number := Buffer_Number'First;
229 type Char_Ptr is access all Interfaces.C.char;
230 function Set_Fld_Buffer (Fld : Field;
234 pragma Import (C, Set_Fld_Buffer, "set_field_buffer");
236 Txt : char_array (0 .. Str'Length);
240 To_C (Str, Txt, Len);
241 Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access);
251 Buffer : in Buffer_Number := Buffer_Number'First;
254 function Field_Buffer (Fld : Field;
255 B : C_Int) return chars_ptr;
256 pragma Import (C, Field_Buffer, "field_buffer");
258 Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str);
263 Buffer : in Buffer_Number := Buffer_Number'First) return String
265 function Field_Buffer (Fld : Field;
266 B : C_Int) return chars_ptr;
267 pragma Import (C, Field_Buffer, "field_buffer");
269 return Fill_String (Field_Buffer (Fld, C_Int (Buffer)));
274 procedure Set_Status (Fld : in Field;
275 Status : in Boolean := True)
277 function Set_Fld_Status (Fld : Field;
278 St : C_Int) return C_Int;
279 pragma Import (C, Set_Fld_Status, "set_field_status");
281 Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status));
284 raise Form_Exception;
290 function Changed (Fld : Field) return Boolean
292 function Field_Status (Fld : Field) return C_Int;
293 pragma Import (C, Field_Status, "field_status");
295 Res : constant C_Int := Field_Status (Fld);
297 if Res = Curses_False then
306 procedure Set_Maximum_Size (Fld : in Field;
307 Max : in Natural := 0)
309 function Set_Field_Max (Fld : Field;
310 M : C_Int) return C_Int;
311 pragma Import (C, Set_Field_Max, "set_max_field");
313 Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max));
318 end Set_Maximum_Size;
320 -- |=====================================================================
321 -- | man page form_field_opts.3x
322 -- |=====================================================================
326 procedure Set_Options (Fld : in Field;
327 Options : in Field_Option_Set)
329 function Set_Field_Opts (Fld : Field;
330 Opt : C_Int) return C_Int;
331 pragma Import (C, Set_Field_Opts, "set_field_opts");
333 Opt : C_Int := FOS_2_CInt (Options);
336 Res := Set_Field_Opts (Fld, Opt);
344 procedure Switch_Options (Fld : in Field;
345 Options : in Field_Option_Set;
346 On : Boolean := True)
348 function Field_Opts_On (Fld : Field;
349 Opt : C_Int) return C_Int;
350 pragma Import (C, Field_Opts_On, "field_opts_on");
351 function Field_Opts_Off (Fld : Field;
352 Opt : C_Int) return C_Int;
353 pragma Import (C, Field_Opts_Off, "field_opts_off");
356 Opt : C_Int := FOS_2_CInt (Options);
359 Err := Field_Opts_On (Fld, Opt);
361 Err := Field_Opts_Off (Fld, Opt);
370 procedure Get_Options (Fld : in Field;
371 Options : out Field_Option_Set)
373 function Field_Opts (Fld : Field) return C_Int;
374 pragma Import (C, Field_Opts, "field_opts");
376 Res : C_Int := Field_Opts (Fld);
378 Options := CInt_2_FOS (Res);
383 function Get_Options (Fld : Field := Null_Field)
384 return Field_Option_Set
386 Fos : Field_Option_Set;
388 Get_Options (Fld, Fos);
392 -- |=====================================================================
393 -- | man page form_field_attributes.3x
394 -- |=====================================================================
398 procedure Set_Foreground
400 Fore : in Character_Attribute_Set := Normal_Video;
401 Color : in Color_Pair := Color_Pair'First)
403 function Set_Field_Fore (Fld : Field;
404 Attr : C_Chtype) return C_Int;
405 pragma Import (C, Set_Field_Fore, "set_field_fore");
407 Ch : constant Attributed_Character := (Ch => Character'First,
410 Res : constant Eti_Error :=
411 Set_Field_Fore (Fld, AttrChar_To_Chtype (Ch));
420 procedure Foreground (Fld : in Field;
421 Fore : out Character_Attribute_Set)
423 function Field_Fore (Fld : Field) return C_Chtype;
424 pragma Import (C, Field_Fore, "field_fore");
426 Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr;
429 procedure Foreground (Fld : in Field;
430 Fore : out Character_Attribute_Set;
431 Color : out Color_Pair)
433 function Field_Fore (Fld : Field) return C_Chtype;
434 pragma Import (C, Field_Fore, "field_fore");
436 Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr;
437 Color := Chtype_To_AttrChar (Field_Fore (Fld)).Color;
442 procedure Set_Background
444 Back : in Character_Attribute_Set := Normal_Video;
445 Color : in Color_Pair := Color_Pair'First)
447 function Set_Field_Back (Fld : Field;
448 Attr : C_Chtype) return C_Int;
449 pragma Import (C, Set_Field_Back, "set_field_back");
451 Ch : constant Attributed_Character := (Ch => Character'First,
454 Res : constant Eti_Error :=
455 Set_Field_Back (Fld, AttrChar_To_Chtype (Ch));
464 procedure Background (Fld : in Field;
465 Back : out Character_Attribute_Set)
467 function Field_Back (Fld : Field) return C_Chtype;
468 pragma Import (C, Field_Back, "field_back");
470 Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr;
473 procedure Background (Fld : in Field;
474 Back : out Character_Attribute_Set;
475 Color : out Color_Pair)
477 function Field_Back (Fld : Field) return C_Chtype;
478 pragma Import (C, Field_Back, "field_back");
480 Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr;
481 Color := Chtype_To_AttrChar (Field_Back (Fld)).Color;
486 procedure Set_Pad_Character (Fld : in Field;
487 Pad : in Character := Space)
489 function Set_Field_Pad (Fld : Field;
490 Ch : C_Int) return C_Int;
491 pragma Import (C, Set_Field_Pad, "set_field_pad");
493 Res : constant Eti_Error := Set_Field_Pad (Fld,
494 C_Int (Character'Pos (Pad)));
499 end Set_Pad_Character;
503 procedure Pad_Character (Fld : in Field;
506 function Field_Pad (Fld : Field) return C_Int;
507 pragma Import (C, Field_Pad, "field_pad");
509 Pad := Character'Val (Field_Pad (Fld));
512 -- |=====================================================================
513 -- | man page form_field_info.3x
514 -- |=====================================================================
518 procedure Info (Fld : in Field;
519 Lines : out Line_Count;
520 Columns : out Column_Count;
521 First_Row : out Line_Position;
522 First_Column : out Column_Position;
523 Off_Screen : out Natural;
524 Additional_Buffers : out Buffer_Number)
526 type C_Int_Access is access all C_Int;
527 function Fld_Info (Fld : Field;
528 L, C, Fr, Fc, Os, Ab : C_Int_Access)
530 pragma Import (C, Fld_Info, "field_info");
532 L, C, Fr, Fc, Os, Ab : aliased C_Int;
533 Res : constant Eti_Error := Fld_Info (Fld,
535 Fr'Access, Fc'Access,
536 Os'Access, Ab'Access);
541 Lines := Line_Count (L);
542 Columns := Column_Count (C);
543 First_Row := Line_Position (Fr);
544 First_Column := Column_Position (Fc);
545 Off_Screen := Natural (Os);
546 Additional_Buffers := Buffer_Number (Ab);
552 procedure Dynamic_Info (Fld : in Field;
553 Lines : out Line_Count;
554 Columns : out Column_Count;
557 type C_Int_Access is access all C_Int;
558 function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int;
559 pragma Import (C, Dyn_Info, "dynamic_field_info");
561 L, C, M : aliased C_Int;
562 Res : constant Eti_Error := Dyn_Info (Fld,
569 Lines := Line_Count (L);
570 Columns := Column_Count (C);
575 -- |=====================================================================
576 -- | man page form_win.3x
577 -- |=====================================================================
581 procedure Set_Window (Frm : in Form;
584 function Set_Form_Win (Frm : Form;
585 Win : Window) return C_Int;
586 pragma Import (C, Set_Form_Win, "set_form_win");
588 Res : constant Eti_Error := Set_Form_Win (Frm, Win);
597 function Get_Window (Frm : Form) return Window
599 function Form_Win (Frm : Form) return Window;
600 pragma Import (C, Form_Win, "form_win");
602 W : constant Window := Form_Win (Frm);
609 procedure Set_Sub_Window (Frm : in Form;
612 function Set_Form_Sub (Frm : Form;
613 Win : Window) return C_Int;
614 pragma Import (C, Set_Form_Sub, "set_form_sub");
616 Res : constant Eti_Error := Set_Form_Sub (Frm, Win);
625 function Get_Sub_Window (Frm : Form) return Window
627 function Form_Sub (Frm : Form) return Window;
628 pragma Import (C, Form_Sub, "form_sub");
630 W : constant Window := Form_Sub (Frm);
637 procedure Scale (Frm : in Form;
638 Lines : out Line_Count;
639 Columns : out Column_Count)
641 type C_Int_Access is access all C_Int;
642 function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int;
643 pragma Import (C, M_Scale, "scale_form");
645 X, Y : aliased C_Int;
646 Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access);
651 Lines := Line_Count (Y);
652 Columns := Column_Count (X);
655 -- |=====================================================================
656 -- | man page menu_hook.3x
657 -- |=====================================================================
661 procedure Set_Field_Init_Hook (Frm : in Form;
662 Proc : in Form_Hook_Function)
664 function Set_Field_Init (Frm : Form;
665 Proc : Form_Hook_Function) return C_Int;
666 pragma Import (C, Set_Field_Init, "set_field_init");
668 Res : constant Eti_Error := Set_Field_Init (Frm, Proc);
673 end Set_Field_Init_Hook;
677 procedure Set_Field_Term_Hook (Frm : in Form;
678 Proc : in Form_Hook_Function)
680 function Set_Field_Term (Frm : Form;
681 Proc : Form_Hook_Function) return C_Int;
682 pragma Import (C, Set_Field_Term, "set_field_term");
684 Res : constant Eti_Error := Set_Field_Term (Frm, Proc);
689 end Set_Field_Term_Hook;
693 procedure Set_Form_Init_Hook (Frm : in Form;
694 Proc : in Form_Hook_Function)
696 function Set_Form_Init (Frm : Form;
697 Proc : Form_Hook_Function) return C_Int;
698 pragma Import (C, Set_Form_Init, "set_form_init");
700 Res : constant Eti_Error := Set_Form_Init (Frm, Proc);
705 end Set_Form_Init_Hook;
709 procedure Set_Form_Term_Hook (Frm : in Form;
710 Proc : in Form_Hook_Function)
712 function Set_Form_Term (Frm : Form;
713 Proc : Form_Hook_Function) return C_Int;
714 pragma Import (C, Set_Form_Term, "set_form_term");
716 Res : constant Eti_Error := Set_Form_Term (Frm, Proc);
721 end Set_Form_Term_Hook;
723 -- |=====================================================================
724 -- | man page form_fields.3x
725 -- |=====================================================================
729 procedure Redefine (Frm : in Form;
730 Flds : in Field_Array_Access)
732 function Set_Frm_Fields (Frm : Form;
733 Items : System.Address) return C_Int;
734 pragma Import (C, Set_Frm_Fields, "set_form_fields");
738 pragma Assert (Flds (Flds'Last) = Null_Field);
739 if Flds (Flds'Last) /= Null_Field then
740 raise Form_Exception;
742 Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address);
751 function Fields (Frm : Form;
752 Index : Positive) return Field
756 function C_Fields (Frm : Form) return Pointer;
757 pragma Import (C, C_Fields, "form_fields");
759 P : Pointer := C_Fields (Frm);
761 if P = null or else Index not in 1 .. Field_Count (Frm) then
762 raise Form_Exception;
764 P := P + ptrdiff_t (C_Int (Index) - 1);
771 function Field_Count (Frm : Form) return Natural
773 function Count (Frm : Form) return C_Int;
774 pragma Import (C, Count, "field_count");
776 return Natural (Count (Frm));
781 procedure Move (Fld : in Field;
782 Line : in Line_Position;
783 Column : in Column_Position)
785 function Move (Fld : Field; L, C : C_Int) return C_Int;
786 pragma Import (C, Move, "move_field");
788 Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column));
795 -- |=====================================================================
796 -- | man page form_new.3x
797 -- |=====================================================================
801 function Create (Fields : Field_Array_Access) return Form
803 function NewForm (Fields : System.Address) return Form;
804 pragma Import (C, NewForm, "new_form");
808 pragma Assert (Fields (Fields'Last) = Null_Field);
809 if Fields (Fields'Last) /= Null_Field then
810 raise Form_Exception;
812 M := NewForm (Fields (Fields'First)'Address);
813 if M = Null_Form then
814 raise Form_Exception;
822 procedure Delete (Frm : in out Form)
824 function Free (Frm : Form) return C_Int;
825 pragma Import (C, Free, "free_form");
827 Res : constant Eti_Error := Free (Frm);
835 -- |=====================================================================
836 -- | man page form_opts.3x
837 -- |=====================================================================
841 procedure Set_Options (Frm : in Form;
842 Options : in Form_Option_Set)
844 function Set_Form_Opts (Frm : Form;
845 Opt : C_Int) return C_Int;
846 pragma Import (C, Set_Form_Opts, "set_form_opts");
848 Opt : C_Int := FrmOS_2_CInt (Options);
851 Res := Set_Form_Opts (Frm, Opt);
859 procedure Switch_Options (Frm : in Form;
860 Options : in Form_Option_Set;
861 On : Boolean := True)
863 function Form_Opts_On (Frm : Form;
864 Opt : C_Int) return C_Int;
865 pragma Import (C, Form_Opts_On, "form_opts_on");
866 function Form_Opts_Off (Frm : Form;
867 Opt : C_Int) return C_Int;
868 pragma Import (C, Form_Opts_Off, "form_opts_off");
871 Opt : C_Int := FrmOS_2_CInt (Options);
874 Err := Form_Opts_On (Frm, Opt);
876 Err := Form_Opts_Off (Frm, Opt);
885 procedure Get_Options (Frm : in Form;
886 Options : out Form_Option_Set)
888 function Form_Opts (Frm : Form) return C_Int;
889 pragma Import (C, Form_Opts, "form_opts");
891 Res : C_Int := Form_Opts (Frm);
893 Options := CInt_2_FrmOS (Res);
898 function Get_Options (Frm : Form := Null_Form) return Form_Option_Set
900 Fos : Form_Option_Set;
902 Get_Options (Frm, Fos);
906 -- |=====================================================================
907 -- | man page form_post.3x
908 -- |=====================================================================
912 procedure Post (Frm : in Form;
913 Post : in Boolean := True)
915 function M_Post (Frm : Form) return C_Int;
916 pragma Import (C, M_Post, "post_form");
917 function M_Unpost (Frm : Form) return C_Int;
918 pragma Import (C, M_Unpost, "unpost_form");
925 Res := M_Unpost (Frm);
932 -- |=====================================================================
933 -- | man page form_cursor.3x
934 -- |=====================================================================
938 procedure Position_Cursor (Frm : Form)
940 function Pos_Form_Cursor (Frm : Form) return C_Int;
941 pragma Import (C, Pos_Form_Cursor, "pos_form_cursor");
943 Res : constant Eti_Error := Pos_Form_Cursor (Frm);
950 -- |=====================================================================
951 -- | man page form_data.3x
952 -- |=====================================================================
956 function Data_Ahead (Frm : Form) return Boolean
958 function Ahead (Frm : Form) return C_Int;
959 pragma Import (C, Ahead, "data_ahead");
961 Res : constant C_Int := Ahead (Frm);
963 if Res = Curses_False then
972 function Data_Behind (Frm : Form) return Boolean
974 function Behind (Frm : Form) return C_Int;
975 pragma Import (C, Behind, "data_behind");
977 Res : constant C_Int := Behind (Frm);
979 if Res = Curses_False then
986 -- |=====================================================================
987 -- | man page form_driver.3x
988 -- |=====================================================================
992 function Driver (Frm : Form;
993 Key : Key_Code) return Driver_Result
995 function Frm_Driver (Frm : Form; Key : C_Int) return C_Int;
996 pragma Import (C, Frm_Driver, "form_driver");
998 R : Eti_Error := Frm_Driver (Frm, C_Int (Key));
1001 if R = E_Unknown_Command then
1002 return Unknown_Request;
1003 elsif R = E_Invalid_Field then
1004 return Invalid_Field;
1005 elsif R = E_Request_Denied then
1006 return Request_Denied;
1016 -- |=====================================================================
1017 -- | man page form_page.3x
1018 -- |=====================================================================
1022 procedure Set_Current (Frm : in Form;
1025 function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int;
1026 pragma Import (C, Set_Current_Fld, "set_current_field");
1028 Res : constant Eti_Error := Set_Current_Fld (Frm, Fld);
1031 Eti_Exception (Res);
1037 function Current (Frm : in Form) return Field
1039 function Current_Fld (Frm : Form) return Field;
1040 pragma Import (C, Current_Fld, "current_field");
1042 Fld : constant Field := Current_Fld (Frm);
1044 if Fld = Null_Field then
1045 raise Form_Exception;
1052 procedure Set_Page (Frm : in Form;
1053 Page : in Page_Number := Page_Number'First)
1055 function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int;
1056 pragma Import (C, Set_Frm_Page, "set_form_page");
1058 Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page));
1061 Eti_Exception (Res);
1067 function Page (Frm : Form) return Page_Number
1069 function Get_Page (Frm : Form) return C_Int;
1070 pragma Import (C, Get_Page, "form_page");
1072 P : constant C_Int := Get_Page (Frm);
1075 raise Form_Exception;
1077 return Page_Number (P);
1081 function Get_Index (Fld : Field) return Positive
1083 function Get_Fieldindex (Fld : Field) return C_Int;
1084 pragma Import (C, Get_Fieldindex, "field_index");
1086 Res : constant C_Int := Get_Fieldindex (Fld);
1088 if Res = Curses_Err then
1089 raise Form_Exception;
1091 return Positive (Natural (Res) + Positive'First);
1095 -- |=====================================================================
1096 -- | man page form_new_page.3x
1097 -- |=====================================================================
1101 procedure Set_New_Page (Fld : in Field;
1102 New_Page : in Boolean := True)
1104 function Set_Page (Fld : Field; Flg : C_Int) return C_Int;
1105 pragma Import (C, Set_Page, "set_new_page");
1107 Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page));
1110 Eti_Exception (Res);
1116 function Is_New_Page (Fld : Field) return Boolean
1118 function Is_New (Fld : Field) return C_Int;
1119 pragma Import (C, Is_New, "new_page");
1121 Res : constant C_Int := Is_New (Fld);
1123 if Res = Curses_False then
1130 procedure Free (FA : in out Field_Array_Access;
1131 Free_Fields : in Boolean := False)
1133 procedure Release is new Ada.Unchecked_Deallocation
1134 (Field_Array, Field_Array_Access);
1136 if FA /= null and then Free_Fields then
1137 for I in FA'First .. (FA'Last - 1) loop
1138 if (FA (I) /= Null_Field) then
1146 -- |=====================================================================
1148 function Default_Field_Options return Field_Option_Set
1151 return Get_Options (Null_Field);
1152 end Default_Field_Options;
1154 function Default_Form_Options return Form_Option_Set
1157 return Get_Options (Null_Form);
1158 end Default_Form_Options;
1160 end Terminal_Interface.Curses.Forms;