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