Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | -- -*- ada -*- |
| 2 | define(`HTMLNAME',`terminal_interface-curses-menus__ads.htm')dnl |
| 3 | include(M4MACRO)dnl |
| 4 | ------------------------------------------------------------------------------ |
| 5 | -- -- |
| 6 | -- GNAT ncurses Binding -- |
| 7 | -- -- |
| 8 | -- Terminal_Interface.Curses.Menu -- |
| 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.27 $ |
| 42 | -- $Date: 2007/05/05 20:20:52 $ |
| 43 | -- Binding Version 01.00 |
| 44 | ------------------------------------------------------------------------------ |
| 45 | include(`Menu_Base_Defs') |
| 46 | with System; |
| 47 | with Ada.Characters.Latin_1; |
| 48 | |
| 49 | package Terminal_Interface.Curses.Menus is |
| 50 | pragma Preelaborate (Terminal_Interface.Curses.Menus); |
| 51 | include(`Menu_Linker_Options')dnl |
| 52 | include(`Linker_Options') |
| 53 | Space : Character renames Ada.Characters.Latin_1.Space; |
| 54 | |
| 55 | type Item is private; |
| 56 | type Menu is private; |
| 57 | |
| 58 | --------------------------- |
| 59 | -- Interface constants -- |
| 60 | --------------------------- |
| 61 | Null_Item : constant Item; |
| 62 | Null_Menu : constant Menu; |
| 63 | |
| 64 | subtype Menu_Request_Code is Key_Code |
| 65 | range (Key_Max + 1) .. (Key_Max + 17); |
| 66 | |
| 67 | -- The prefix M_ stands for "Menu Request" |
| 68 | M_Left_Item : constant Menu_Request_Code := Key_Max + 1; |
| 69 | M_Right_Item : constant Menu_Request_Code := Key_Max + 2; |
| 70 | M_Up_Item : constant Menu_Request_Code := Key_Max + 3; |
| 71 | M_Down_Item : constant Menu_Request_Code := Key_Max + 4; |
| 72 | M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5; |
| 73 | M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6; |
| 74 | M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7; |
| 75 | M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8; |
| 76 | M_First_Item : constant Menu_Request_Code := Key_Max + 9; |
| 77 | M_Last_Item : constant Menu_Request_Code := Key_Max + 10; |
| 78 | M_Next_Item : constant Menu_Request_Code := Key_Max + 11; |
| 79 | M_Previous_Item : constant Menu_Request_Code := Key_Max + 12; |
| 80 | M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13; |
| 81 | M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14; |
| 82 | M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15; |
| 83 | M_Next_Match : constant Menu_Request_Code := Key_Max + 16; |
| 84 | M_Previous_Match : constant Menu_Request_Code := Key_Max + 17; |
| 85 | |
| 86 | -- For those who like the old 'C' names for the request codes |
| 87 | REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item; |
| 88 | REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item; |
| 89 | REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item; |
| 90 | REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item; |
| 91 | REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line; |
| 92 | REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line; |
| 93 | REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page; |
| 94 | REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page; |
| 95 | REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item; |
| 96 | REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item; |
| 97 | REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item; |
| 98 | REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item; |
| 99 | REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item; |
| 100 | REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern; |
| 101 | REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern; |
| 102 | REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match; |
| 103 | REQ_PREV_MATCH : Menu_Request_Code renames M_Previous_Match; |
| 104 | |
| 105 | procedure Request_Name (Key : in Menu_Request_Code; |
| 106 | Name : out String); |
| 107 | |
| 108 | function Request_Name (Key : Menu_Request_Code) return String; |
| 109 | -- Same as function |
| 110 | |
| 111 | ------------------ |
| 112 | -- Exceptions -- |
| 113 | ------------------ |
| 114 | |
| 115 | Menu_Exception : exception; |
| 116 | -- |
| 117 | -- Menu options |
| 118 | -- |
| 119 | pragma Warnings (Off); |
| 120 | include(`Menu_Opt_Rep')dnl |
| 121 | |
| 122 | pragma Warnings (On); |
| 123 | |
| 124 | function Default_Menu_Options return Menu_Option_Set; |
| 125 | -- Initial default options for a menu. |
| 126 | pragma Inline (Default_Menu_Options); |
| 127 | -- |
| 128 | -- Item options |
| 129 | -- |
| 130 | pragma Warnings (Off); |
| 131 | include(`Item_Rep')dnl |
| 132 | |
| 133 | pragma Warnings (On); |
| 134 | |
| 135 | function Default_Item_Options return Item_Option_Set; |
| 136 | -- Initial default options for an item. |
| 137 | pragma Inline (Default_Item_Options); |
| 138 | |
| 139 | -- |
| 140 | -- Item Array |
| 141 | -- |
| 142 | type Item_Array is array (Positive range <>) of aliased Item; |
| 143 | pragma Convention (C, Item_Array); |
| 144 | |
| 145 | type Item_Array_Access is access Item_Array; |
| 146 | |
| 147 | procedure Free (IA : in out Item_Array_Access; |
| 148 | Free_Items : Boolean := False); |
| 149 | -- Release the memory for an allocated item array |
| 150 | -- If Free_Items is True, call Delete() for all the items in |
| 151 | -- the array. |
| 152 | |
| 153 | -- MANPAGE(`mitem_new.3x') |
| 154 | |
| 155 | -- ANCHOR(`new_item()',`Create') |
| 156 | function Create (Name : String; |
| 157 | Description : String := "") return Item; |
| 158 | -- AKA |
| 159 | -- Not inlined. |
| 160 | |
| 161 | -- ANCHOR(`new_item()',`New_Item') |
| 162 | function New_Item (Name : String; |
| 163 | Description : String := "") return Item |
| 164 | renames Create; |
| 165 | -- AKA |
| 166 | |
| 167 | -- ANCHOR(`free_item()',`Delete') |
| 168 | procedure Delete (Itm : in out Item); |
| 169 | -- AKA |
| 170 | -- Resets Itm to Null_Item |
| 171 | |
| 172 | -- MANPAGE(`mitem_value.3x') |
| 173 | |
| 174 | -- ANCHOR(`set_item_value()',`Set_Value') |
| 175 | procedure Set_Value (Itm : in Item; |
| 176 | Value : in Boolean := True); |
| 177 | -- AKA |
| 178 | pragma Inline (Set_Value); |
| 179 | |
| 180 | -- ANCHOR(`item_value()',`Value') |
| 181 | function Value (Itm : Item) return Boolean; |
| 182 | -- AKA |
| 183 | pragma Inline (Value); |
| 184 | |
| 185 | -- MANPAGE(`mitem_visible.3x') |
| 186 | |
| 187 | -- ANCHOR(`item_visible()',`Visible') |
| 188 | function Visible (Itm : Item) return Boolean; |
| 189 | -- AKA |
| 190 | pragma Inline (Visible); |
| 191 | |
| 192 | -- MANPAGE(`mitem_opts.3x') |
| 193 | |
| 194 | -- ANCHOR(`set_item_opts()',`Set_Options') |
| 195 | procedure Set_Options (Itm : in Item; |
| 196 | Options : in Item_Option_Set); |
| 197 | -- AKA |
| 198 | -- An overloaded Set_Options is defined later. Pragma Inline appears there |
| 199 | |
| 200 | -- ANCHOR(`item_opts_on()',`Switch_Options') |
| 201 | procedure Switch_Options (Itm : in Item; |
| 202 | Options : in Item_Option_Set; |
| 203 | On : Boolean := True); |
| 204 | -- AKA |
| 205 | -- ALIAS(`item_opts_off()') |
| 206 | -- An overloaded Switch_Options is defined later. |
| 207 | -- Pragma Inline appears there |
| 208 | |
| 209 | -- ANCHOR(`item_opts()',`Get_Options') |
| 210 | procedure Get_Options (Itm : in Item; |
| 211 | Options : out Item_Option_Set); |
| 212 | -- AKA |
| 213 | |
| 214 | -- ANCHOR(`item_opts()',`Get_Options') |
| 215 | function Get_Options (Itm : Item := Null_Item) return Item_Option_Set; |
| 216 | -- AKA |
| 217 | -- An overloaded Get_Options is defined later. Pragma Inline appears there |
| 218 | |
| 219 | -- MANPAGE(`mitem_name.3x') |
| 220 | |
| 221 | -- ANCHOR(`item_name()',`Name') |
| 222 | procedure Name (Itm : in Item; |
| 223 | Name : out String); |
| 224 | -- AKA |
| 225 | function Name (Itm : Item) return String; |
| 226 | -- AKA |
| 227 | -- Implemented as function |
| 228 | pragma Inline (Name); |
| 229 | |
| 230 | -- ANCHOR(`item_description();',`Description') |
| 231 | procedure Description (Itm : in Item; |
| 232 | Description : out String); |
| 233 | -- AKA |
| 234 | |
| 235 | function Description (Itm : Item) return String; |
| 236 | -- AKA |
| 237 | -- Implemented as function |
| 238 | pragma Inline (Description); |
| 239 | |
| 240 | -- MANPAGE(`mitem_current.3x') |
| 241 | |
| 242 | -- ANCHOR(`set_current_item()',`Set_Current') |
| 243 | procedure Set_Current (Men : in Menu; |
| 244 | Itm : in Item); |
| 245 | -- AKA |
| 246 | pragma Inline (Set_Current); |
| 247 | |
| 248 | -- ANCHOR(`current_item()',`Current') |
| 249 | function Current (Men : Menu) return Item; |
| 250 | -- AKA |
| 251 | pragma Inline (Current); |
| 252 | |
| 253 | -- ANCHOR(`set_top_row()',`Set_Top_Row') |
| 254 | procedure Set_Top_Row (Men : in Menu; |
| 255 | Line : in Line_Position); |
| 256 | -- AKA |
| 257 | pragma Inline (Set_Top_Row); |
| 258 | |
| 259 | -- ANCHOR(`top_row()',`Top_Row') |
| 260 | function Top_Row (Men : Menu) return Line_Position; |
| 261 | -- AKA |
| 262 | pragma Inline (Top_Row); |
| 263 | |
| 264 | -- ANCHOR(`item_index()',`Get_Index') |
| 265 | function Get_Index (Itm : Item) return Positive; |
| 266 | -- AKA |
| 267 | -- Please note that in this binding we start the numbering of items |
| 268 | -- with 1. So this is number is one more than you get from the low |
| 269 | -- level call. |
| 270 | pragma Inline (Get_Index); |
| 271 | |
| 272 | -- MANPAGE(`menu_post.3x') |
| 273 | |
| 274 | -- ANCHOR(`post_menu()',`Post') |
| 275 | procedure Post (Men : in Menu; |
| 276 | Post : in Boolean := True); |
| 277 | -- AKA |
| 278 | -- ALIAS(`unpost_menu()') |
| 279 | pragma Inline (Post); |
| 280 | |
| 281 | -- MANPAGE(`menu_opts.3x') |
| 282 | |
| 283 | -- ANCHOR(`set_menu_opts()',`Set_Options') |
| 284 | procedure Set_Options (Men : in Menu; |
| 285 | Options : in Menu_Option_Set); |
| 286 | -- AKA |
| 287 | pragma Inline (Set_Options); |
| 288 | |
| 289 | -- ANCHOR(`menu_opts_on()',`Switch_Options') |
| 290 | procedure Switch_Options (Men : in Menu; |
| 291 | Options : in Menu_Option_Set; |
| 292 | On : Boolean := True); |
| 293 | -- AKA |
| 294 | -- ALIAS(`menu_opts_off()') |
| 295 | pragma Inline (Switch_Options); |
| 296 | |
| 297 | -- ANCHOR(`menu_opts()',`Get_Options') |
| 298 | procedure Get_Options (Men : in Menu; |
| 299 | Options : out Menu_Option_Set); |
| 300 | -- AKA |
| 301 | |
| 302 | -- ANCHOR(`menu_opts()',`Get_Options') |
| 303 | function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set; |
| 304 | -- AKA |
| 305 | pragma Inline (Get_Options); |
| 306 | |
| 307 | -- MANPAGE(`menu_win.3x') |
| 308 | |
| 309 | -- ANCHOR(`set_menu_win()',`Set_Window') |
| 310 | procedure Set_Window (Men : in Menu; |
| 311 | Win : in Window); |
| 312 | -- AKA |
| 313 | pragma Inline (Set_Window); |
| 314 | |
| 315 | -- ANCHOR(`menu_win()',`Get_Window') |
| 316 | function Get_Window (Men : Menu) return Window; |
| 317 | -- AKA |
| 318 | pragma Inline (Get_Window); |
| 319 | |
| 320 | -- ANCHOR(`set_menu_sub()',`Set_Sub_Window') |
| 321 | procedure Set_Sub_Window (Men : in Menu; |
| 322 | Win : in Window); |
| 323 | -- AKA |
| 324 | pragma Inline (Set_Sub_Window); |
| 325 | |
| 326 | -- ANCHOR(`menu_sub()',`Get_Sub_Window') |
| 327 | function Get_Sub_Window (Men : Menu) return Window; |
| 328 | -- AKA |
| 329 | pragma Inline (Get_Sub_Window); |
| 330 | |
| 331 | -- ANCHOR(`scale_menu()',`Scale') |
| 332 | procedure Scale (Men : in Menu; |
| 333 | Lines : out Line_Count; |
| 334 | Columns : out Column_Count); |
| 335 | -- AKA |
| 336 | pragma Inline (Scale); |
| 337 | |
| 338 | -- MANPAGE(`menu_cursor.3x') |
| 339 | |
| 340 | -- ANCHOR(`pos_menu_cursor()',`Position_Cursor') |
| 341 | procedure Position_Cursor (Men : Menu); |
| 342 | -- AKA |
| 343 | pragma Inline (Position_Cursor); |
| 344 | |
| 345 | -- MANPAGE(`menu_mark.3x') |
| 346 | |
| 347 | -- ANCHOR(`set_menu_mark()',`Set_Mark') |
| 348 | procedure Set_Mark (Men : in Menu; |
| 349 | Mark : in String); |
| 350 | -- AKA |
| 351 | pragma Inline (Set_Mark); |
| 352 | |
| 353 | -- ANCHOR(`menu_mark()',`Mark') |
| 354 | procedure Mark (Men : in Menu; |
| 355 | Mark : out String); |
| 356 | -- AKA |
| 357 | |
| 358 | function Mark (Men : Menu) return String; |
| 359 | -- AKA |
| 360 | -- Implemented as function |
| 361 | pragma Inline (Mark); |
| 362 | |
| 363 | -- MANPAGE(`menu_attributes.3x') |
| 364 | |
| 365 | -- ANCHOR(`set_menu_fore()',`Set_Foreground') |
| 366 | procedure Set_Foreground |
| 367 | (Men : in Menu; |
| 368 | Fore : in Character_Attribute_Set := Normal_Video; |
| 369 | Color : in Color_Pair := Color_Pair'First); |
| 370 | -- AKA |
| 371 | pragma Inline (Set_Foreground); |
| 372 | |
| 373 | -- ANCHOR(`menu_fore()',`Foreground') |
| 374 | procedure Foreground (Men : in Menu; |
| 375 | Fore : out Character_Attribute_Set); |
| 376 | -- AKA |
| 377 | |
| 378 | -- ANCHOR(`menu_fore()',`Foreground') |
| 379 | procedure Foreground (Men : in Menu; |
| 380 | Fore : out Character_Attribute_Set; |
| 381 | Color : out Color_Pair); |
| 382 | -- AKA |
| 383 | pragma Inline (Foreground); |
| 384 | |
| 385 | -- ANCHOR(`set_menu_back()',`Set_Background') |
| 386 | procedure Set_Background |
| 387 | (Men : in Menu; |
| 388 | Back : in Character_Attribute_Set := Normal_Video; |
| 389 | Color : in Color_Pair := Color_Pair'First); |
| 390 | -- AKA |
| 391 | pragma Inline (Set_Background); |
| 392 | |
| 393 | -- ANCHOR(`menu_back()',`Background') |
| 394 | procedure Background (Men : in Menu; |
| 395 | Back : out Character_Attribute_Set); |
| 396 | -- AKA |
| 397 | -- ANCHOR(`menu_back()',`Background') |
| 398 | |
| 399 | procedure Background (Men : in Menu; |
| 400 | Back : out Character_Attribute_Set; |
| 401 | Color : out Color_Pair); |
| 402 | -- AKA |
| 403 | pragma Inline (Background); |
| 404 | |
| 405 | -- ANCHOR(`set_menu_grey()',`Set_Grey') |
| 406 | procedure Set_Grey |
| 407 | (Men : in Menu; |
| 408 | Grey : in Character_Attribute_Set := Normal_Video; |
| 409 | Color : in Color_Pair := Color_Pair'First); |
| 410 | -- AKA |
| 411 | pragma Inline (Set_Grey); |
| 412 | |
| 413 | -- ANCHOR(`menu_grey()',`Grey') |
| 414 | procedure Grey (Men : in Menu; |
| 415 | Grey : out Character_Attribute_Set); |
| 416 | -- AKA |
| 417 | |
| 418 | -- ANCHOR(`menu_grey()',`Grey') |
| 419 | procedure Grey |
| 420 | (Men : in Menu; |
| 421 | Grey : out Character_Attribute_Set; |
| 422 | Color : out Color_Pair); |
| 423 | -- AKA |
| 424 | pragma Inline (Grey); |
| 425 | |
| 426 | -- ANCHOR(`set_menu_pad()',`Set_Pad_Character') |
| 427 | procedure Set_Pad_Character (Men : in Menu; |
| 428 | Pad : in Character := Space); |
| 429 | -- AKA |
| 430 | pragma Inline (Set_Pad_Character); |
| 431 | |
| 432 | -- ANCHOR(`menu_pad()',`Pad_Character') |
| 433 | procedure Pad_Character (Men : in Menu; |
| 434 | Pad : out Character); |
| 435 | -- AKA |
| 436 | pragma Inline (Pad_Character); |
| 437 | |
| 438 | -- MANPAGE(`menu_spacing.3x') |
| 439 | |
| 440 | -- ANCHOR(`set_menu_spacing()',`Set_Spacing') |
| 441 | procedure Set_Spacing (Men : in Menu; |
| 442 | Descr : in Column_Position := 0; |
| 443 | Row : in Line_Position := 0; |
| 444 | Col : in Column_Position := 0); |
| 445 | -- AKA |
| 446 | pragma Inline (Set_Spacing); |
| 447 | |
| 448 | -- ANCHOR(`menu_spacing()',`Spacing') |
| 449 | procedure Spacing (Men : in Menu; |
| 450 | Descr : out Column_Position; |
| 451 | Row : out Line_Position; |
| 452 | Col : out Column_Position); |
| 453 | -- AKA |
| 454 | pragma Inline (Spacing); |
| 455 | |
| 456 | -- MANPAGE(`menu_pattern.3x') |
| 457 | |
| 458 | -- ANCHOR(`set_menu_pattern()',`Set_Pattern') |
| 459 | function Set_Pattern (Men : Menu; |
| 460 | Text : String) return Boolean; |
| 461 | -- AKA |
| 462 | -- Return TRUE if the pattern matches, FALSE otherwise |
| 463 | pragma Inline (Set_Pattern); |
| 464 | |
| 465 | -- ANCHOR(`menu_pattern()',`Pattern') |
| 466 | procedure Pattern (Men : in Menu; |
| 467 | Text : out String); |
| 468 | -- AKA |
| 469 | pragma Inline (Pattern); |
| 470 | |
| 471 | -- MANPAGE(`menu_format.3x') |
| 472 | |
| 473 | -- ANCHOR(`set_menu_format()',`Set_Format') |
| 474 | procedure Set_Format (Men : in Menu; |
| 475 | Lines : in Line_Count; |
| 476 | Columns : in Column_Count); |
| 477 | -- Not implemented: 0 argument for Lines or Columns; |
| 478 | -- instead use Format to get the current sizes |
| 479 | -- The default format is 16 rows, 1 column. Calling |
| 480 | -- set_menu_format with a null menu pointer will change this |
| 481 | -- default. A zero row or column argument to set_menu_format |
| 482 | -- is interpreted as a request not to change the current |
| 483 | -- value. |
| 484 | -- AKA |
| 485 | pragma Inline (Set_Format); |
| 486 | |
| 487 | -- ANCHOR(`menu_format()',`Format') |
| 488 | procedure Format (Men : in Menu; |
| 489 | Lines : out Line_Count; |
| 490 | Columns : out Column_Count); |
| 491 | -- AKA |
| 492 | pragma Inline (Format); |
| 493 | |
| 494 | -- MANPAGE(`menu_hook.3x') |
| 495 | |
| 496 | type Menu_Hook_Function is access procedure (Men : in Menu); |
| 497 | pragma Convention (C, Menu_Hook_Function); |
| 498 | |
| 499 | -- ANCHOR(`set_item_init()',`Set_Item_Init_Hook') |
| 500 | procedure Set_Item_Init_Hook (Men : in Menu; |
| 501 | Proc : in Menu_Hook_Function); |
| 502 | -- AKA |
| 503 | pragma Inline (Set_Item_Init_Hook); |
| 504 | |
| 505 | -- ANCHOR(`set_item_term()',`Set_Item_Term_Hook') |
| 506 | procedure Set_Item_Term_Hook (Men : in Menu; |
| 507 | Proc : in Menu_Hook_Function); |
| 508 | -- AKA |
| 509 | pragma Inline (Set_Item_Term_Hook); |
| 510 | |
| 511 | -- ANCHOR(`set_menu_init()',`Set_Menu_Init_Hook') |
| 512 | procedure Set_Menu_Init_Hook (Men : in Menu; |
| 513 | Proc : in Menu_Hook_Function); |
| 514 | -- AKA |
| 515 | pragma Inline (Set_Menu_Init_Hook); |
| 516 | |
| 517 | -- ANCHOR(`set_menu_term()',`Set_Menu_Term_Hook') |
| 518 | procedure Set_Menu_Term_Hook (Men : in Menu; |
| 519 | Proc : in Menu_Hook_Function); |
| 520 | -- AKA |
| 521 | pragma Inline (Set_Menu_Term_Hook); |
| 522 | |
| 523 | -- ANCHOR(`item_init()',`Get_Item_Init_Hook') |
| 524 | function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function; |
| 525 | -- AKA |
| 526 | pragma Inline (Get_Item_Init_Hook); |
| 527 | |
| 528 | -- ANCHOR(`item_term()',`Get_Item_Term_Hook') |
| 529 | function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function; |
| 530 | -- AKA |
| 531 | pragma Inline (Get_Item_Term_Hook); |
| 532 | |
| 533 | -- ANCHOR(`menu_init()',`Get_Menu_Init_Hook') |
| 534 | function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function; |
| 535 | -- AKA |
| 536 | pragma Inline (Get_Menu_Init_Hook); |
| 537 | |
| 538 | -- ANCHOR(`menu_term()',`Get_Menu_Term_Hook') |
| 539 | function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function; |
| 540 | -- AKA |
| 541 | pragma Inline (Get_Menu_Term_Hook); |
| 542 | |
| 543 | -- MANPAGE(`menu_items.3x') |
| 544 | |
| 545 | -- ANCHOR(`set_menu_items()',`Redefine') |
| 546 | procedure Redefine (Men : in Menu; |
| 547 | Items : in Item_Array_Access); |
| 548 | -- AKA |
| 549 | pragma Inline (Redefine); |
| 550 | |
| 551 | procedure Set_Items (Men : in Menu; |
| 552 | Items : in Item_Array_Access) renames Redefine; |
| 553 | -- pragma Inline (Set_Items); |
| 554 | |
| 555 | -- ANCHOR(`menu_items()',`Items') |
| 556 | function Items (Men : Menu; |
| 557 | Index : Positive) return Item; |
| 558 | -- AKA |
| 559 | pragma Inline (Items); |
| 560 | |
| 561 | -- ANCHOR(`item_count()',`Item_Count') |
| 562 | function Item_Count (Men : Menu) return Natural; |
| 563 | -- AKA |
| 564 | pragma Inline (Item_Count); |
| 565 | |
| 566 | -- MANPAGE(`menu_new.3x') |
| 567 | |
| 568 | -- ANCHOR(`new_menu()',`Create') |
| 569 | function Create (Items : Item_Array_Access) return Menu; |
| 570 | -- AKA |
| 571 | -- Not inlined |
| 572 | |
| 573 | function New_Menu (Items : Item_Array_Access) return Menu renames Create; |
| 574 | |
| 575 | -- ANCHOR(`free_menu()',`Delete') |
| 576 | procedure Delete (Men : in out Menu); |
| 577 | -- AKA |
| 578 | -- Reset Men to Null_Menu |
| 579 | -- Not inlined |
| 580 | |
| 581 | -- MANPAGE(`menu_driver.3x') |
| 582 | |
| 583 | type Driver_Result is (Menu_Ok, |
| 584 | Request_Denied, |
| 585 | Unknown_Request, |
| 586 | No_Match); |
| 587 | |
| 588 | -- ANCHOR(`menu_driver()',`Driver') |
| 589 | function Driver (Men : Menu; |
| 590 | Key : Key_Code) return Driver_Result; |
| 591 | -- AKA |
| 592 | -- Driver is not inlined |
| 593 | |
| 594 | -- ANCHOR(`menu_requestname.3x') |
| 595 | -- Not Implemented: menu_request_name, menu_request_by_name |
| 596 | ------------------------------------------------------------------------------- |
| 597 | private |
| 598 | type Item is new System.Storage_Elements.Integer_Address; |
| 599 | type Menu is new System.Storage_Elements.Integer_Address; |
| 600 | |
| 601 | Null_Item : constant Item := 0; |
| 602 | Null_Menu : constant Menu := 0; |
| 603 | |
| 604 | end Terminal_Interface.Curses.Menus; |