blob: 0ad9c456dbda78c1201fe03923487c287527401b [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301-- -*- ada -*-
2define(`HTMLNAME',`terminal_interface-curses-menus__ads.htm')dnl
3include(M4MACRO)dnl
4------------------------------------------------------------------------------
5-- --
6-- GNAT ncurses Binding --
7-- --
8-- Terminal_Interface.Curses.Menu --
9-- --
10-- S P E C --
11-- --
12------------------------------------------------------------------------------
Steve Kondikae271bc2015-11-15 02:50:53 +010013-- Copyright (c) 1998-2009,2014 Free Software Foundation, Inc. --
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053014-- --
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:
Steve Kondikae271bc2015-11-15 02:50:53 +010041-- $Revision: 1.31 $
42-- $Date: 2014/05/24 21:31:57 $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053043-- Binding Version 01.00
44------------------------------------------------------------------------------
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053045with System;
46with Ada.Characters.Latin_1;
47
48package Terminal_Interface.Curses.Menus is
49 pragma Preelaborate (Terminal_Interface.Curses.Menus);
Steve Kondikae271bc2015-11-15 02:50:53 +010050 pragma Linker_Options ("-lmenu" & Curses_Constants.DFT_ARG_SUFFIX);
51
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053052 Space : Character renames Ada.Characters.Latin_1.Space;
53
54 type Item is private;
55 type Menu is private;
56
57 ---------------------------
58 -- Interface constants --
59 ---------------------------
60 Null_Item : constant Item;
61 Null_Menu : constant Menu;
62
63 subtype Menu_Request_Code is Key_Code
64 range (Key_Max + 1) .. (Key_Max + 17);
65
66 -- The prefix M_ stands for "Menu Request"
67 M_Left_Item : constant Menu_Request_Code := Key_Max + 1;
68 M_Right_Item : constant Menu_Request_Code := Key_Max + 2;
69 M_Up_Item : constant Menu_Request_Code := Key_Max + 3;
70 M_Down_Item : constant Menu_Request_Code := Key_Max + 4;
71 M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5;
72 M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6;
73 M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7;
74 M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8;
75 M_First_Item : constant Menu_Request_Code := Key_Max + 9;
76 M_Last_Item : constant Menu_Request_Code := Key_Max + 10;
77 M_Next_Item : constant Menu_Request_Code := Key_Max + 11;
78 M_Previous_Item : constant Menu_Request_Code := Key_Max + 12;
79 M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13;
80 M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14;
81 M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15;
82 M_Next_Match : constant Menu_Request_Code := Key_Max + 16;
83 M_Previous_Match : constant Menu_Request_Code := Key_Max + 17;
84
85 -- For those who like the old 'C' names for the request codes
86 REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item;
87 REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item;
88 REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item;
89 REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item;
90 REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line;
91 REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line;
92 REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page;
93 REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page;
94 REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item;
95 REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item;
96 REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item;
97 REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item;
98 REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item;
99 REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern;
100 REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern;
101 REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match;
102 REQ_PREV_MATCH : Menu_Request_Code renames M_Previous_Match;
103
Steve Kondikae271bc2015-11-15 02:50:53 +0100104 procedure Request_Name (Key : Menu_Request_Code;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530105 Name : out String);
106
107 function Request_Name (Key : Menu_Request_Code) return String;
108 -- Same as function
109
110 ------------------
111 -- Exceptions --
112 ------------------
113
114 Menu_Exception : exception;
115 --
116 -- Menu options
117 --
Steve Kondikae271bc2015-11-15 02:50:53 +0100118 type Menu_Option_Set is
119 record
120 One_Valued : Boolean;
121 Show_Descriptions : Boolean;
122 Row_Major_Order : Boolean;
123 Ignore_Case : Boolean;
124 Show_Matches : Boolean;
125 Non_Cyclic : Boolean;
126 end record;
127 pragma Convention (C_Pass_By_Copy, Menu_Option_Set);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530128
Steve Kondikae271bc2015-11-15 02:50:53 +0100129 for Menu_Option_Set use
130 record
131 One_Valued at 0 range Curses_Constants.O_ONEVALUE_First
132 .. Curses_Constants.O_ONEVALUE_Last;
133 Show_Descriptions at 0 range Curses_Constants.O_SHOWDESC_First
134 .. Curses_Constants.O_SHOWDESC_Last;
135 Row_Major_Order at 0 range Curses_Constants.O_ROWMAJOR_First
136 .. Curses_Constants.O_ROWMAJOR_Last;
137 Ignore_Case at 0 range Curses_Constants.O_IGNORECASE_First
138 .. Curses_Constants.O_IGNORECASE_Last;
139 Show_Matches at 0 range Curses_Constants.O_SHOWMATCH_First
140 .. Curses_Constants.O_SHOWMATCH_Last;
141 Non_Cyclic at 0 range Curses_Constants.O_NONCYCLIC_First
142 .. Curses_Constants.O_NONCYCLIC_Last;
143 end record;
144 pragma Warnings (Off);
145 for Menu_Option_Set'Size use Curses_Constants.Menu_Options_Size;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530146 pragma Warnings (On);
147
148 function Default_Menu_Options return Menu_Option_Set;
149 -- Initial default options for a menu.
150 pragma Inline (Default_Menu_Options);
151 --
152 -- Item options
153 --
Steve Kondikae271bc2015-11-15 02:50:53 +0100154 type Item_Option_Set is
155 record
156 Selectable : Boolean;
157 end record;
158 pragma Convention (C_Pass_By_Copy, Item_Option_Set);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530159
Steve Kondikae271bc2015-11-15 02:50:53 +0100160 for Item_Option_Set use
161 record
162 Selectable at 0 range Curses_Constants.O_SELECTABLE_First
163 .. Curses_Constants.O_SELECTABLE_Last;
164 end record;
165 pragma Warnings (Off);
166 for Item_Option_Set'Size use Curses_Constants.Item_Options_Size;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530167 pragma Warnings (On);
168
169 function Default_Item_Options return Item_Option_Set;
170 -- Initial default options for an item.
171 pragma Inline (Default_Item_Options);
172
173 --
174 -- Item Array
175 --
176 type Item_Array is array (Positive range <>) of aliased Item;
177 pragma Convention (C, Item_Array);
178
179 type Item_Array_Access is access Item_Array;
180
181 procedure Free (IA : in out Item_Array_Access;
182 Free_Items : Boolean := False);
183 -- Release the memory for an allocated item array
184 -- If Free_Items is True, call Delete() for all the items in
185 -- the array.
186
187 -- MANPAGE(`mitem_new.3x')
188
189 -- ANCHOR(`new_item()',`Create')
190 function Create (Name : String;
191 Description : String := "") return Item;
192 -- AKA
193 -- Not inlined.
194
195 -- ANCHOR(`new_item()',`New_Item')
196 function New_Item (Name : String;
197 Description : String := "") return Item
198 renames Create;
199 -- AKA
200
201 -- ANCHOR(`free_item()',`Delete')
202 procedure Delete (Itm : in out Item);
203 -- AKA
204 -- Resets Itm to Null_Item
205
206 -- MANPAGE(`mitem_value.3x')
207
208 -- ANCHOR(`set_item_value()',`Set_Value')
Steve Kondikae271bc2015-11-15 02:50:53 +0100209 procedure Set_Value (Itm : Item;
210 Value : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530211 -- AKA
212 pragma Inline (Set_Value);
213
214 -- ANCHOR(`item_value()',`Value')
215 function Value (Itm : Item) return Boolean;
216 -- AKA
217 pragma Inline (Value);
218
219 -- MANPAGE(`mitem_visible.3x')
220
221 -- ANCHOR(`item_visible()',`Visible')
222 function Visible (Itm : Item) return Boolean;
223 -- AKA
224 pragma Inline (Visible);
225
226 -- MANPAGE(`mitem_opts.3x')
227
228 -- ANCHOR(`set_item_opts()',`Set_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100229 procedure Set_Options (Itm : Item;
230 Options : Item_Option_Set);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530231 -- AKA
232 -- An overloaded Set_Options is defined later. Pragma Inline appears there
233
234 -- ANCHOR(`item_opts_on()',`Switch_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100235 procedure Switch_Options (Itm : Item;
236 Options : Item_Option_Set;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530237 On : Boolean := True);
238 -- AKA
239 -- ALIAS(`item_opts_off()')
240 -- An overloaded Switch_Options is defined later.
241 -- Pragma Inline appears there
242
243 -- ANCHOR(`item_opts()',`Get_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100244 procedure Get_Options (Itm : Item;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530245 Options : out Item_Option_Set);
246 -- AKA
247
248 -- ANCHOR(`item_opts()',`Get_Options')
249 function Get_Options (Itm : Item := Null_Item) return Item_Option_Set;
250 -- AKA
251 -- An overloaded Get_Options is defined later. Pragma Inline appears there
252
253 -- MANPAGE(`mitem_name.3x')
254
255 -- ANCHOR(`item_name()',`Name')
Steve Kondikae271bc2015-11-15 02:50:53 +0100256 procedure Name (Itm : Item;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530257 Name : out String);
258 -- AKA
259 function Name (Itm : Item) return String;
260 -- AKA
261 -- Implemented as function
262 pragma Inline (Name);
263
264 -- ANCHOR(`item_description();',`Description')
Steve Kondikae271bc2015-11-15 02:50:53 +0100265 procedure Description (Itm : Item;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530266 Description : out String);
267 -- AKA
268
269 function Description (Itm : Item) return String;
270 -- AKA
271 -- Implemented as function
272 pragma Inline (Description);
273
274 -- MANPAGE(`mitem_current.3x')
275
276 -- ANCHOR(`set_current_item()',`Set_Current')
Steve Kondikae271bc2015-11-15 02:50:53 +0100277 procedure Set_Current (Men : Menu;
278 Itm : Item);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530279 -- AKA
280 pragma Inline (Set_Current);
281
282 -- ANCHOR(`current_item()',`Current')
283 function Current (Men : Menu) return Item;
284 -- AKA
285 pragma Inline (Current);
286
287 -- ANCHOR(`set_top_row()',`Set_Top_Row')
Steve Kondikae271bc2015-11-15 02:50:53 +0100288 procedure Set_Top_Row (Men : Menu;
289 Line : Line_Position);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530290 -- AKA
291 pragma Inline (Set_Top_Row);
292
293 -- ANCHOR(`top_row()',`Top_Row')
294 function Top_Row (Men : Menu) return Line_Position;
295 -- AKA
296 pragma Inline (Top_Row);
297
298 -- ANCHOR(`item_index()',`Get_Index')
299 function Get_Index (Itm : Item) return Positive;
300 -- AKA
301 -- Please note that in this binding we start the numbering of items
302 -- with 1. So this is number is one more than you get from the low
303 -- level call.
304 pragma Inline (Get_Index);
305
306 -- MANPAGE(`menu_post.3x')
307
308 -- ANCHOR(`post_menu()',`Post')
Steve Kondikae271bc2015-11-15 02:50:53 +0100309 procedure Post (Men : Menu;
310 Post : Boolean := True);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530311 -- AKA
312 -- ALIAS(`unpost_menu()')
313 pragma Inline (Post);
314
315 -- MANPAGE(`menu_opts.3x')
316
317 -- ANCHOR(`set_menu_opts()',`Set_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100318 procedure Set_Options (Men : Menu;
319 Options : Menu_Option_Set);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530320 -- AKA
321 pragma Inline (Set_Options);
322
323 -- ANCHOR(`menu_opts_on()',`Switch_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100324 procedure Switch_Options (Men : Menu;
325 Options : Menu_Option_Set;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530326 On : Boolean := True);
327 -- AKA
328 -- ALIAS(`menu_opts_off()')
329 pragma Inline (Switch_Options);
330
331 -- ANCHOR(`menu_opts()',`Get_Options')
Steve Kondikae271bc2015-11-15 02:50:53 +0100332 procedure Get_Options (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530333 Options : out Menu_Option_Set);
334 -- AKA
335
336 -- ANCHOR(`menu_opts()',`Get_Options')
337 function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set;
338 -- AKA
339 pragma Inline (Get_Options);
340
341 -- MANPAGE(`menu_win.3x')
342
343 -- ANCHOR(`set_menu_win()',`Set_Window')
Steve Kondikae271bc2015-11-15 02:50:53 +0100344 procedure Set_Window (Men : Menu;
345 Win : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530346 -- AKA
347 pragma Inline (Set_Window);
348
349 -- ANCHOR(`menu_win()',`Get_Window')
350 function Get_Window (Men : Menu) return Window;
351 -- AKA
352 pragma Inline (Get_Window);
353
354 -- ANCHOR(`set_menu_sub()',`Set_Sub_Window')
Steve Kondikae271bc2015-11-15 02:50:53 +0100355 procedure Set_Sub_Window (Men : Menu;
356 Win : Window);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530357 -- AKA
358 pragma Inline (Set_Sub_Window);
359
360 -- ANCHOR(`menu_sub()',`Get_Sub_Window')
361 function Get_Sub_Window (Men : Menu) return Window;
362 -- AKA
363 pragma Inline (Get_Sub_Window);
364
365 -- ANCHOR(`scale_menu()',`Scale')
Steve Kondikae271bc2015-11-15 02:50:53 +0100366 procedure Scale (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530367 Lines : out Line_Count;
368 Columns : out Column_Count);
369 -- AKA
370 pragma Inline (Scale);
371
372 -- MANPAGE(`menu_cursor.3x')
373
374 -- ANCHOR(`pos_menu_cursor()',`Position_Cursor')
375 procedure Position_Cursor (Men : Menu);
376 -- AKA
377 pragma Inline (Position_Cursor);
378
379 -- MANPAGE(`menu_mark.3x')
380
381 -- ANCHOR(`set_menu_mark()',`Set_Mark')
Steve Kondikae271bc2015-11-15 02:50:53 +0100382 procedure Set_Mark (Men : Menu;
383 Mark : String);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530384 -- AKA
385 pragma Inline (Set_Mark);
386
387 -- ANCHOR(`menu_mark()',`Mark')
Steve Kondikae271bc2015-11-15 02:50:53 +0100388 procedure Mark (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530389 Mark : out String);
390 -- AKA
391
392 function Mark (Men : Menu) return String;
393 -- AKA
394 -- Implemented as function
395 pragma Inline (Mark);
396
397 -- MANPAGE(`menu_attributes.3x')
398
399 -- ANCHOR(`set_menu_fore()',`Set_Foreground')
400 procedure Set_Foreground
Steve Kondikae271bc2015-11-15 02:50:53 +0100401 (Men : Menu;
402 Fore : Character_Attribute_Set := Normal_Video;
403 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530404 -- AKA
405 pragma Inline (Set_Foreground);
406
407 -- ANCHOR(`menu_fore()',`Foreground')
Steve Kondikae271bc2015-11-15 02:50:53 +0100408 procedure Foreground (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530409 Fore : out Character_Attribute_Set);
410 -- AKA
411
412 -- ANCHOR(`menu_fore()',`Foreground')
Steve Kondikae271bc2015-11-15 02:50:53 +0100413 procedure Foreground (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530414 Fore : out Character_Attribute_Set;
415 Color : out Color_Pair);
416 -- AKA
417 pragma Inline (Foreground);
418
419 -- ANCHOR(`set_menu_back()',`Set_Background')
420 procedure Set_Background
Steve Kondikae271bc2015-11-15 02:50:53 +0100421 (Men : Menu;
422 Back : Character_Attribute_Set := Normal_Video;
423 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530424 -- AKA
425 pragma Inline (Set_Background);
426
427 -- ANCHOR(`menu_back()',`Background')
Steve Kondikae271bc2015-11-15 02:50:53 +0100428 procedure Background (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530429 Back : out Character_Attribute_Set);
430 -- AKA
431 -- ANCHOR(`menu_back()',`Background')
432
Steve Kondikae271bc2015-11-15 02:50:53 +0100433 procedure Background (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530434 Back : out Character_Attribute_Set;
435 Color : out Color_Pair);
436 -- AKA
437 pragma Inline (Background);
438
439 -- ANCHOR(`set_menu_grey()',`Set_Grey')
440 procedure Set_Grey
Steve Kondikae271bc2015-11-15 02:50:53 +0100441 (Men : Menu;
442 Grey : Character_Attribute_Set := Normal_Video;
443 Color : Color_Pair := Color_Pair'First);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530444 -- AKA
445 pragma Inline (Set_Grey);
446
447 -- ANCHOR(`menu_grey()',`Grey')
Steve Kondikae271bc2015-11-15 02:50:53 +0100448 procedure Grey (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530449 Grey : out Character_Attribute_Set);
450 -- AKA
451
452 -- ANCHOR(`menu_grey()',`Grey')
453 procedure Grey
Steve Kondikae271bc2015-11-15 02:50:53 +0100454 (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530455 Grey : out Character_Attribute_Set;
456 Color : out Color_Pair);
457 -- AKA
458 pragma Inline (Grey);
459
460 -- ANCHOR(`set_menu_pad()',`Set_Pad_Character')
Steve Kondikae271bc2015-11-15 02:50:53 +0100461 procedure Set_Pad_Character (Men : Menu;
462 Pad : Character := Space);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530463 -- AKA
464 pragma Inline (Set_Pad_Character);
465
466 -- ANCHOR(`menu_pad()',`Pad_Character')
Steve Kondikae271bc2015-11-15 02:50:53 +0100467 procedure Pad_Character (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530468 Pad : out Character);
469 -- AKA
470 pragma Inline (Pad_Character);
471
472 -- MANPAGE(`menu_spacing.3x')
473
474 -- ANCHOR(`set_menu_spacing()',`Set_Spacing')
Steve Kondikae271bc2015-11-15 02:50:53 +0100475 procedure Set_Spacing (Men : Menu;
476 Descr : Column_Position := 0;
477 Row : Line_Position := 0;
478 Col : Column_Position := 0);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530479 -- AKA
480 pragma Inline (Set_Spacing);
481
482 -- ANCHOR(`menu_spacing()',`Spacing')
Steve Kondikae271bc2015-11-15 02:50:53 +0100483 procedure Spacing (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530484 Descr : out Column_Position;
485 Row : out Line_Position;
486 Col : out Column_Position);
487 -- AKA
488 pragma Inline (Spacing);
489
490 -- MANPAGE(`menu_pattern.3x')
491
492 -- ANCHOR(`set_menu_pattern()',`Set_Pattern')
493 function Set_Pattern (Men : Menu;
494 Text : String) return Boolean;
495 -- AKA
496 -- Return TRUE if the pattern matches, FALSE otherwise
497 pragma Inline (Set_Pattern);
498
499 -- ANCHOR(`menu_pattern()',`Pattern')
Steve Kondikae271bc2015-11-15 02:50:53 +0100500 procedure Pattern (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530501 Text : out String);
502 -- AKA
503 pragma Inline (Pattern);
504
505 -- MANPAGE(`menu_format.3x')
506
507 -- ANCHOR(`set_menu_format()',`Set_Format')
Steve Kondikae271bc2015-11-15 02:50:53 +0100508 procedure Set_Format (Men : Menu;
509 Lines : Line_Count;
510 Columns : Column_Count);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530511 -- Not implemented: 0 argument for Lines or Columns;
512 -- instead use Format to get the current sizes
513 -- The default format is 16 rows, 1 column. Calling
514 -- set_menu_format with a null menu pointer will change this
515 -- default. A zero row or column argument to set_menu_format
516 -- is interpreted as a request not to change the current
517 -- value.
518 -- AKA
519 pragma Inline (Set_Format);
520
521 -- ANCHOR(`menu_format()',`Format')
Steve Kondikae271bc2015-11-15 02:50:53 +0100522 procedure Format (Men : Menu;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530523 Lines : out Line_Count;
524 Columns : out Column_Count);
525 -- AKA
526 pragma Inline (Format);
527
528 -- MANPAGE(`menu_hook.3x')
529
Steve Kondikae271bc2015-11-15 02:50:53 +0100530 type Menu_Hook_Function is access procedure (Men : Menu);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530531 pragma Convention (C, Menu_Hook_Function);
532
533 -- ANCHOR(`set_item_init()',`Set_Item_Init_Hook')
Steve Kondikae271bc2015-11-15 02:50:53 +0100534 procedure Set_Item_Init_Hook (Men : Menu;
535 Proc : Menu_Hook_Function);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530536 -- AKA
537 pragma Inline (Set_Item_Init_Hook);
538
539 -- ANCHOR(`set_item_term()',`Set_Item_Term_Hook')
Steve Kondikae271bc2015-11-15 02:50:53 +0100540 procedure Set_Item_Term_Hook (Men : Menu;
541 Proc : Menu_Hook_Function);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530542 -- AKA
543 pragma Inline (Set_Item_Term_Hook);
544
545 -- ANCHOR(`set_menu_init()',`Set_Menu_Init_Hook')
Steve Kondikae271bc2015-11-15 02:50:53 +0100546 procedure Set_Menu_Init_Hook (Men : Menu;
547 Proc : Menu_Hook_Function);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530548 -- AKA
549 pragma Inline (Set_Menu_Init_Hook);
550
551 -- ANCHOR(`set_menu_term()',`Set_Menu_Term_Hook')
Steve Kondikae271bc2015-11-15 02:50:53 +0100552 procedure Set_Menu_Term_Hook (Men : Menu;
553 Proc : Menu_Hook_Function);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530554 -- AKA
555 pragma Inline (Set_Menu_Term_Hook);
556
557 -- ANCHOR(`item_init()',`Get_Item_Init_Hook')
558 function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function;
559 -- AKA
560 pragma Inline (Get_Item_Init_Hook);
561
562 -- ANCHOR(`item_term()',`Get_Item_Term_Hook')
563 function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function;
564 -- AKA
565 pragma Inline (Get_Item_Term_Hook);
566
567 -- ANCHOR(`menu_init()',`Get_Menu_Init_Hook')
568 function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function;
569 -- AKA
570 pragma Inline (Get_Menu_Init_Hook);
571
572 -- ANCHOR(`menu_term()',`Get_Menu_Term_Hook')
573 function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function;
574 -- AKA
575 pragma Inline (Get_Menu_Term_Hook);
576
577 -- MANPAGE(`menu_items.3x')
578
579 -- ANCHOR(`set_menu_items()',`Redefine')
Steve Kondikae271bc2015-11-15 02:50:53 +0100580 procedure Redefine (Men : Menu;
581 Items : Item_Array_Access);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530582 -- AKA
583 pragma Inline (Redefine);
584
Steve Kondikae271bc2015-11-15 02:50:53 +0100585 procedure Set_Items (Men : Menu;
586 Items : Item_Array_Access) renames Redefine;
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530587 -- pragma Inline (Set_Items);
588
589 -- ANCHOR(`menu_items()',`Items')
590 function Items (Men : Menu;
591 Index : Positive) return Item;
592 -- AKA
593 pragma Inline (Items);
594
595 -- ANCHOR(`item_count()',`Item_Count')
596 function Item_Count (Men : Menu) return Natural;
597 -- AKA
598 pragma Inline (Item_Count);
599
600 -- MANPAGE(`menu_new.3x')
601
602 -- ANCHOR(`new_menu()',`Create')
603 function Create (Items : Item_Array_Access) return Menu;
604 -- AKA
605 -- Not inlined
606
607 function New_Menu (Items : Item_Array_Access) return Menu renames Create;
608
609 -- ANCHOR(`free_menu()',`Delete')
610 procedure Delete (Men : in out Menu);
611 -- AKA
612 -- Reset Men to Null_Menu
613 -- Not inlined
614
615 -- MANPAGE(`menu_driver.3x')
616
617 type Driver_Result is (Menu_Ok,
618 Request_Denied,
619 Unknown_Request,
620 No_Match);
621
622 -- ANCHOR(`menu_driver()',`Driver')
623 function Driver (Men : Menu;
624 Key : Key_Code) return Driver_Result;
625 -- AKA
626 -- Driver is not inlined
627
628 -- ANCHOR(`menu_requestname.3x')
629 -- Not Implemented: menu_request_name, menu_request_by_name
630-------------------------------------------------------------------------------
631private
632 type Item is new System.Storage_Elements.Integer_Address;
633 type Menu is new System.Storage_Elements.Integer_Address;
634
635 Null_Item : constant Item := 0;
636 Null_Menu : constant Menu := 0;
637
638end Terminal_Interface.Curses.Menus;