ncurses 5.5
[ncurses.git] / Ada95 / samples / sample-menu_demo.adb
index 1d08316f9afcfe26d4c785ca93c4b82da231d472..261658f90057afa61c6990a6d46dbfa92ccbf74a 100644 (file)
@@ -7,7 +7,7 @@
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
 --                                 B O D Y                                  --
 --                                                                          --
 ------------------------------------------------------------------------------
--- Copyright (c) 1998 Free Software Foundation, Inc.                        --
+-- Copyright (c) 1998,2004 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            --
 --                                                                          --
 -- Permission is hereby granted, free of charge, to any person obtaining a  --
 -- copy of this software and associated documentation files (the            --
 -- sale, use or other dealings in this Software without prior written       --
 -- authorization.                                                           --
 ------------------------------------------------------------------------------
 -- sale, use or other dealings in this Software without prior written       --
 -- authorization.                                                           --
 ------------------------------------------------------------------------------
---  Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
+--  Author:  Juergen Pfeifer, 1996
 --  Version Control
 --  Version Control
---  $Revision: 1.7 $
---  Binding Version 00.93
+--  $Revision: 1.17 $
+--  $Date: 2004/08/21 21:37:00 $
+--  Binding Version 01.00
 ------------------------------------------------------------------------------
 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
 with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
 ------------------------------------------------------------------------------
 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
 with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
@@ -44,11 +45,8 @@ with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
 with Terminal_Interface.Curses.Menus.Menu_User_Data;
 with Terminal_Interface.Curses.Menus.Item_User_Data;
 
 with Terminal_Interface.Curses.Menus.Menu_User_Data;
 with Terminal_Interface.Curses.Menus.Item_User_Data;
 
-with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
-
 with Sample.Manifest; use Sample.Manifest;
 with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
 with Sample.Manifest; use Sample.Manifest;
 with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
-with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
 with Sample.Menu_Demo.Handler;
 with Sample.Helpers; use Sample.Helpers;
 with Sample.Explanation; use Sample.Explanation;
 with Sample.Menu_Demo.Handler;
 with Sample.Helpers; use Sample.Helpers;
 with Sample.Explanation; use Sample.Explanation;
@@ -108,6 +106,12 @@ package body Sample.Menu_Demo is
                              P : Panel) return Boolean
          is
          begin
                              P : Panel) return Boolean
          is
          begin
+            if M = Null_Menu then
+               raise Menu_Exception;
+            end if;
+            if P = Null_Panel then
+               raise Panel_Exception;
+            end if;
             To_Change := No_Change;
             if K in User_Key_Code'Range then
                if K = QUIT then
             To_Change := No_Change;
             if K in User_Key_Code'Range then
                if K = QUIT then
@@ -303,6 +307,7 @@ package body Sample.Menu_Demo is
          Flip_State := True;
 
          Pop_Environment;
          Flip_State := True;
 
          Pop_Environment;
+         pragma Assert (Get_Index (Items (M, 1)) = Get_Index (I (1)));
          Delete (M);
          Free (I, True);
       end Spacing_Test;
          Delete (M);
          Free (I, True);
       end Spacing_Test;
@@ -333,9 +338,9 @@ package body Sample.Menu_Demo is
          Null_Item);
       M : Menu := New_Menu (Itm);
 
          Null_Item);
       M : Menu := New_Menu (Itm);
 
-      U1 : User_Data_Access := new User_Data'(4711);
+      U1 : constant User_Data_Access := new User_Data'(4711);
       U2 : User_Data_Access;
       U2 : User_Data_Access;
-      U3 : User_Data_Access := new User_Data'(4712);
+      U3 : constant User_Data_Access := new User_Data'(4712);
       U4 : User_Data_Access;
 
       function My_Driver (M : Menu;
       U4 : User_Data_Access;
 
       function My_Driver (M : Menu;