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