terminal_interface-curses-forms.ads.m4 27 KB

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