-- --
-- B O D Y --
-- --
--- Version 00.92 --
+------------------------------------------------------------------------------
+-- Copyright 2020 Thomas E. Dickey --
+-- Copyright 1998-2008,2011 Free Software Foundation, Inc. --
+-- --
+-- Permission is hereby granted, free of charge, to any person obtaining a --
+-- copy of this software and associated documentation files (the --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell --
+-- copies of the Software, and to permit persons to whom the Software is --
+-- furnished to do so, subject to the following conditions: --
-- --
--- The ncurses Ada95 binding is copyrighted 1996 by --
--- Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
-- --
--- Permission is hereby granted to reproduce and distribute this --
--- binding by any means and for any fee, whether alone or as part --
--- of a larger distribution, in source or in binary form, PROVIDED --
--- this notice is included with any such distribution, and is not --
--- removed from any of its header files. Mention of ncurses and the --
--- author of this binding in any applications linked with it is --
--- highly appreciated. --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
+-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
+-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
-- --
--- This binding comes AS IS with no warranty, implied or expressed. --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
------------------------------------------------------------------------------
+-- Author: Juergen Pfeifer, 1996
-- Version Control
--- $Revision: 1.5 $
+-- $Revision: 1.19 $
+-- $Date: 2020/02/02 23:34:34 $
+-- Binding Version 01.00
------------------------------------------------------------------------------
with Text_IO;
-with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
with Ada.Exceptions; use Ada.Exceptions;
with Terminal_Interface.Curses; use Terminal_Interface.Curses;
with Terminal_Interface.Curses.Menus.Item_User_Data;
with Sample.Manifest; use Sample.Manifest;
-with Sample.Helpers; use Sample.Helpers;
with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
with Sample.Header_Handler; use Sample.Header_Handler;
package Mh is new Sample.Menu_Demo.Handler (My_Driver);
- I : constant Item_Array (1 .. 4) :=
+ I : Item_Array_Access := new Item_Array'
(New_Item ("Curses Core Demo"),
New_Item ("Menu Demo"),
New_Item ("Form Demo"),
- New_Item ("Text IO Demo"));
+ New_Item ("Text IO Demo"),
+ Null_Item);
M : Menu := New_Menu (I);
if K = QUIT then
return True;
elsif K = SELECT_ITEM then
- if Idx in 1 .. 4 then
+ if Idx <= 4 then
Hide (Pan);
Update_Panels;
end if;
when 4 => Sample.Text_IO_Demo.Demo;
when others => null;
end case;
- if Idx in 1 .. 4 then
+ if Idx <= 4 then
Top (Pan);
Show (Pan);
Update_Panels;
begin
- if Item_Count (M) /= I'Length then
+ if (1 + Item_Count (M)) /= I'Length then
raise Constraint_Error;
end if;
Ud.Set_User_Data (M, D1);
I1 := new User_Data'(Data => 1174);
- Id.Set_User_Data (I (1), I1);
+ Id.Set_User_Data (I.all (1), I1);
Set_Spacing (Men => M, Row => 2);
pragma Assert (D1 = D2);
pragma Assert (D1.Data = D2.Data);
- Id.Get_User_Data (I (1), I2);
+ Id.Get_User_Data (I.all (1), I2);
pragma Assert (I1 = I2);
pragma Assert (I1.Data = I2.Data);
Delete (M);
+ Free (I, True);
end Main_Menu;
begin
Set_Soft_Label_Key_Attributes (Color => Header_Color);
-- This propagates the attributes to the label window
- Clear_Soft_Label_Keys; Restore_Soft_Label_Keys;
+ Refresh_Soft_Label_Keys;
end if;
Init_Keyboard_Handler;
- Set_Echo_Mode (FALSE);
+ Set_Echo_Mode (False);
Set_Raw_Mode;
Set_Meta_Mode;
Set_KeyPad_Mode;
-- We have some fixed key throughout this sample
Main_Menu;
End_Windows;
+ Curses_Free_All;
exception
when Event : others =>