summaryrefslogtreecommitdiffstats
path: root/ncurses-5.2/Ada95/samples
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses-5.2/Ada95/samples')
-rw-r--r--ncurses-5.2/Ada95/samples/Makefile.in137
-rw-r--r--ncurses-5.2/Ada95/samples/README6
-rw-r--r--ncurses-5.2/Ada95/samples/explain.txt186
-rw-r--r--ncurses-5.2/Ada95/samples/rain.adb161
-rw-r--r--ncurses-5.2/Ada95/samples/rain.ads42
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.adb122
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.adb220
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo.adb142
-rw-r--r--ncurses-5.2/Ada95/samples/sample-curses_demo.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample-explanation.adb408
-rw-r--r--ncurses-5.2/Ada95/samples/sample-explanation.ads59
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo-aux.adb259
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo-aux.ads92
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo-handler.adb97
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo-handler.ads64
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo.adb134
-rw-r--r--ncurses-5.2/Ada95/samples/sample-form_demo.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample-function_key_setting.adb213
-rw-r--r--ncurses-5.2/Ada95/samples/sample-function_key_setting.ads82
-rw-r--r--ncurses-5.2/Ada95/samples/sample-header_handler.adb180
-rw-r--r--ncurses-5.2/Ada95/samples/sample-header_handler.ads53
-rw-r--r--ncurses-5.2/Ada95/samples/sample-helpers.adb69
-rw-r--r--ncurses-5.2/Ada95/samples/sample-helpers.ads54
-rw-r--r--ncurses-5.2/Ada95/samples/sample-keyboard_handler.adb191
-rw-r--r--ncurses-5.2/Ada95/samples/sample-keyboard_handler.ads55
-rw-r--r--ncurses-5.2/Ada95/samples/sample-manifest.ads67
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo-aux.adb204
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo-aux.ads71
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo-handler.adb107
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo-handler.ads64
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo.adb390
-rw-r--r--ncurses-5.2/Ada95/samples/sample-menu_demo.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample-my_field_type.adb65
-rw-r--r--ncurses-5.2/Ada95/samples/sample-my_field_type.ads62
-rw-r--r--ncurses-5.2/Ada95/samples/sample-text_io_demo.adb180
-rw-r--r--ncurses-5.2/Ada95/samples/sample-text_io_demo.ads45
-rw-r--r--ncurses-5.2/Ada95/samples/sample.adb218
-rw-r--r--ncurses-5.2/Ada95/samples/sample.ads43
-rw-r--r--ncurses-5.2/Ada95/samples/status.adb56
-rw-r--r--ncurses-5.2/Ada95/samples/status.ads59
-rw-r--r--ncurses-5.2/Ada95/samples/tour.adb46
-rw-r--r--ncurses-5.2/Ada95/samples/tour.ads41
44 files changed, 4969 insertions, 0 deletions
diff --git a/ncurses-5.2/Ada95/samples/Makefile.in b/ncurses-5.2/Ada95/samples/Makefile.in
new file mode 100644
index 0000000..9e9f0c7
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/Makefile.in
@@ -0,0 +1,137 @@
+##############################################################################
+# Copyright (c) 1998 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 above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software. #
+# #
+# 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. #
+# #
+# 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 <juergen.pfeifer@gmx.net> 1996
+#
+# Version Control
+# $Revision$
+#
+.SUFFIXES:
+
+SHELL = /bin/sh
+THIS = Makefile
+
+x = @PROG_EXT@
+
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+includedir = @includedir@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+
+AWK = @AWK@
+LN_S = @LN_S@
+
+CC = @CC@
+CFLAGS = @CFLAGS@
+
+CPPFLAGS = @ACPPFLAGS@ \
+ -DHAVE_CONFIG_H -I$(srcdir)
+
+CCFLAGS = $(CPPFLAGS) $(CFLAGS)
+
+CFLAGS_NORMAL = $(CCFLAGS)
+CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE
+CFLAGS_PROFILE = $(CCFLAGS) -pg
+CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
+
+CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
+
+LINK = $(CC)
+LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
+
+RANLIB = @RANLIB@
+################################################################################
+ada_srcdir=../src
+
+LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS)
+
+ADA = @cf_ada_compiler@
+ADAFLAGS = @ADAFLAGS@ -I$(srcdir)
+
+ADAMAKE = @cf_ada_make@
+ADAMAKEFLAGS = -a -A$(srcdir) -A$(ada_srcdir) -A$(srcdir)/$(ada_srcdir)
+
+ALIB = @cf_ada_package@
+ABASE = $(ALIB)-curses
+
+CARGS =-cargs $(ADAFLAGS)
+LARGS =-largs -L../../lib $(LD_FLAGS) -lAdaCurses -lncurses@LIB_SUFFIX@
+
+PROGS = tour rain
+
+TOUR_OBJS = tour.o sample.o sample-curses_demo.o sample-explanation.o \
+ sample-form_demo.o sample-function_key_setting.o \
+ sample-header_handler.o sample-helpers.o \
+ sample-keyboard_handler.o sample-manifest.o sample-menu_demo.o \
+ sample-menu_demo-aux.o sample-text_io_demo.o \
+ sample-curses_demo-attributes.o sample-curses_demo-mouse.o \
+ sample-form_demo-aux.o sample-my_field_type.o
+
+RAIN_OBJS = rain.o status.o
+
+all :: tour$x rain$x
+ @
+
+sources :
+ @
+
+libs \
+install \
+install.libs ::
+ @
+
+uninstall \
+uninstall.libs ::
+ @
+
+tour$x : explain.msg
+ $(ADAMAKE) $(ADAMAKEFLAGS) tour $(CARGS) $(LARGS)
+
+explain.msg: $(srcdir)/explain.txt
+ cp $(srcdir)/explain.txt $@
+
+rain$x :
+ $(ADAMAKE) $(ADAMAKEFLAGS) rain $(CARGS) $(LARGS)
+
+mostlyclean:
+ @
+
+clean :: mostlyclean
+ rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] explain.msg
+
+distclean :: clean
+ rm -f Makefile
+
+realclean :: distclean
+ @
+
+
diff --git a/ncurses-5.2/Ada95/samples/README b/ncurses-5.2/Ada95/samples/README
new file mode 100644
index 0000000..6ea8a18
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/README
@@ -0,0 +1,6 @@
+The intention of the demo at this point in time is not to demonstrate all
+the features of (n)curses and it's subsystems, but to give some sample
+sources how to use the binding at all.
+
+Ideally in the future we can combine both goals.
+
diff --git a/ncurses-5.2/Ada95/samples/explain.txt b/ncurses-5.2/Ada95/samples/explain.txt
new file mode 100644
index 0000000..570f617
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/explain.txt
@@ -0,0 +1,186 @@
+#VERSION
+This is Version 00.90.00 of the demo package.
+#MENUKEYS
+In a menu you can use the following Keys in the whole application:
+
+ - CTRL-X eXit the menu
+ - CTRL-N Go to next item
+ - CTRL-P Go to previous item
+ - CTRL-U Scroll up one line
+ - CTRL-D Scroll down one line
+ - CTRL-F Scroll down one page
+ - PAGE DOWN Scroll down one page
+ - PAGE UP Scroll back one page
+ - CTRL-B Scroll back one page
+ - CTRL-Y Clear pattern
+ - CTRL-H Delete last character from pattern
+ - Backspace Delete last character from pattern
+ - CTRL-A Next pattern match
+ - CTRL-E Previous pattern match
+ - CTRL-T Toggle item in a multi-selection menu
+ - CR or LF Select an item
+ - HOME Key Go to the first item
+ - F3 Quit the menu
+ - Cursor Down Down one item
+ - Cursor Up Up one item
+ - Cursor Left Left one item
+ - Cursor Right Right one item
+ - END Key Go to last item
+#FORMKEYS
+ - CTRL-X eXit the form
+ - CTRL-F Go forward to the next field
+ - CTRL-B Go backward to the previous field
+ - CTRL-L Go to the field left of the current one
+ - CTRL-R Go to the field right of the current one
+ - CTRL-U Go to the field above the current one
+ - CTRL-D Go to the field below the current one
+
+ - CTRL-W Go to the next word in the field
+ - CTRL-T Go to the previous word in the field
+
+ - CTRL-A Go to the beginning of the field
+ - CTRL-E Go to the end of the field
+
+ - CTRL-I Insert a blank character at the current position
+ - CTRL-O Insert a line
+ - CTRL-V Delete a character
+ - CTRL-H Delete previous character
+ - CTRL-Y Delete a line
+ - CTRL-G Delete a word
+ - CTRL-K Clear to end of field
+
+ - CTRL-N Next choice in a choice field (Enumerations etc.)
+ - CTRL-P Previous choice in a choice field.
+#HELP
+#HELPKEYS
+You may scroll with the Cursor Up/Down Keys.
+You may leave the help with the Function Key labelled 'Quit'.
+#INHELP
+You are already in the help system.
+You may leave the help with the Function Key labelled 'Quit'.
+#MAIN
+This is the main menu of the sample program for the ncurses Ada95
+binding. The main intention of the demo is not to demonstate or
+test all the features of ncurses and it's subsystems, but to provide
+to you some sample code how to use the binding with Ada95.
+
+You may select this options:
+
+ * Look at some ncurses core functions
+ * Look at some features of the menu subsystem
+ * Look at some features of the form subsystem
+ * Look at the output of the Ada.Text_IO like functions
+ for ncurses.
+
+#MAINPAD
+You may press at any place in this demo CTRL-C. This will give you a command
+window. You can just type in the Label-String of a function key, then this
+key will be simulated. This should help you to run the application even if
+you run it on a terminal with no or only a few function keys. With CTRL-N
+and CTRL-P you may browse through the possible values in the command window.
+#MENU00
+Here we give you a selection of various menu demonstrations.
+#MENU-PAD00
+This menu itself is a demo for a single valued, 1-column menu with
+descriptions for the items, a marker and a padding character between
+the item name and the description.
+#MENU01
+This is a demo of the some of the menu layout options. One of them
+is the spacing functionality. Just press the Key labelled "Flip" to
+flip between the non-spaced and a spaced version of the menu. Please
+note that this functionality is unique for ncurses and is not found
+in the SVr4 menu implementation.
+
+This is a menu that sometimes doesn't fit into it's window and
+therefore it becomes a scroll menu.
+
+You can also see here very nicely the pattern matching functionality
+of menus. Type for example a 'J' and you will be positioned to the
+next item after the current starting with a 'J'. Any more characters
+you type in make the pattern more specific. With CTRL-A and CTRL-Z
+(for more details press the Key labelled "Keys") you can browse
+through all the items matching the pattern.
+
+You may change the format of the menu. Just press one of the keys
+labelled "4x1", "4x2" or "4x3" to get a menu with that many rows
+and columns.
+
+With the Keys "O-Row" or "O-Col" (they occupy the same label and
+switch on selection) you can change the major order scheme for
+the menu. If "O-Col" is visible, the menu is currently major
+ordered by rows, you can switch to major column order by pressing
+the key. If "O-Row" is visible, it's just the reverse situation.
+This Key is not visible in "4x1" layout mode, because in this case
+the functionality makes no sense.
+
+With the Keys "Multi" or "Singl" (they occupy the same label and
+switch on selection) you can change whether or not the menu allows
+multiple or only single selection.
+
+With the Keys "+Desc" or "-Desc" (they occupy the same label and
+switch on selection) you can change whether or not the descriptions
+for each item should be displayed. Please not that this key is
+not visible in the "4x3" layout mode, because in this case the
+menu wouldn't fit on a typicall 80x24 screen.
+
+With the Keys "Disab" or "Enab" (they occupy the same label and
+switch on selection) you can dis- or enable the selectability of
+the month with 31 days.
+#MENU-PAD01
+You may press "Flip" to see the effect of ncurses unique menu-spacing.
+The Keys "4x1", "4x2" and "4x3" will change the format of the menu.
+Please note that this is a scrolling menu. You may also play with the
+pattern matching functionality or try to change the format of the menu.
+For more details press the Key labelled "Help".
+#FORM00
+This is a demo of the forms package.
+#FORM-PAD00
+Please note that this demo is far from being complete. It really shows
+only a small part of the functionality of the forms package. Let's hope
+the next version will have a richer demo (You wan't to contribute ?).
+#NOTIMPL
+Sorry this functionality of the demo is not implemented at the moment.
+Remember this is a freeware project, so I can use only my very rare
+free time to continue coding. If you would like to contribute, you
+are very welcome !
+#CURSES00
+This is a menu where you can select some different demos of the ncurses
+functionality.
+#CURSES-PAD00
+Please note that this demo is far from being complete. It really shows
+only a small part of the functionality of the curses package. Let's hope
+the next version will have a richer demo (You wan't to contribute ?).
+#MOUSEKEYS
+In this demo you may use this keys:
+
+ - Key labelled "Help" to get a help
+ - Key labelled "Keys" is what you are reading now
+ - Key labelled "Quit" to leave the demo
+
+You may click the mouse buttons at any location at the screen and look
+at the protocol window !
+#MOUSE00
+A rather simple use of a mouse as demo. It's there just to test the
+code and to provide the sample source.
+
+It might be of interest, that the output into the protocol window is
+done by the (n)curses Text_IO subpackages. Especially the output of
+the button and state names is done by Ads's enumeration IO, which
+allows you to print the names of enumeration literals. That's really
+nice.
+#MOUSE-PAD00
+This is a very simple demo of the mouse features of ncurses. It's there
+just to test whether or not the generated code for the binding really
+works on the different architectures (seems so).
+#ATTRIBDEMO
+Again this is a more than simple demo and just here to give you the
+sourcecode.
+#ATTRIBKEYS
+You may press one of the three well known standard keys of this demo.
+#ATTRIB-PAD00
+Again this is a more than simple demo and just here to give you the
+sourcecode. Feel free to contribute more.
+#TEXTIO
+#TEXTIOKEYS
+#TEXTIO-PAD00
+#END
diff --git a/ncurses-5.2/Ada95/samples/rain.adb b/ncurses-5.2/Ada95/samples/rain.adb
new file mode 100644
index 0000000..6d5fd63
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/rain.adb
@@ -0,0 +1,161 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Rain --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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: Laurent Pautet <pautet@gnat.com> 1997 (modified by J.Pfeifer)
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- --
+with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random;
+with Status; use Status;
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+procedure Rain is
+
+ Visibility : Cursor_Visibility;
+
+ subtype X_Position is Line_Position;
+ subtype Y_Position is Column_Position;
+
+ Xpos : array (1 .. 5) of X_Position;
+ Ypos : array (1 .. 5) of Y_Position;
+
+ N : Integer;
+
+ G : Generator;
+
+ Max_X, X : X_Position;
+ Max_Y, Y : Y_Position;
+
+ procedure Next (J : in out Integer);
+ procedure Cursor (X : X_Position; Y : Y_Position);
+
+ procedure Next (J : in out Integer) is
+ begin
+ if J = 5 then
+ J := 1;
+ else
+ J := J + 1;
+ end if;
+ end Next;
+
+ procedure Cursor (X : X_Position; Y : Y_Position) is
+ begin
+ Move_Cursor (Line => X, Column => Y);
+ end Cursor;
+ pragma Inline (Cursor);
+
+begin
+
+ Init_Screen;
+ Set_NL_Mode;
+ Set_Echo_Mode (False);
+
+ Visibility := Invisible;
+ Set_Cursor_Visibility (Visibility);
+
+ Max_X := Lines - 5;
+ Max_Y := Columns - 5;
+
+ for I in Xpos'Range loop
+ Xpos (I) := X_Position (Float (Max_X) * Random (G)) + 2;
+ Ypos (I) := Y_Position (Float (Max_Y) * Random (G)) + 2;
+ end loop;
+
+ N := 1;
+ while Process.Continue loop
+
+ X := X_Position (Float (Max_X) * Random (G)) + 2;
+ Y := Y_Position (Float (Max_Y) * Random (G)) + 2;
+
+ Cursor (X, Y);
+ Add (Ch => '.');
+
+ Cursor (Xpos (N), Ypos (N));
+ Add (Ch => 'o');
+
+ --
+ Next (N);
+ Cursor (Xpos (N), Ypos (N));
+ Add (Ch => 'O');
+
+ --
+ Next (N);
+ Cursor (Xpos (N) - 1, Ypos (N));
+ Add (Ch => '-');
+ Cursor (Xpos (N), Ypos (N) - 1);
+ Add (Str => "|.|");
+ Cursor (Xpos (N) + 1, Ypos (N));
+ Add (Ch => '-');
+
+ --
+ Next (N);
+ Cursor (Xpos (N) - 2, Ypos (N));
+ Add (Ch => '-');
+ Cursor (Xpos (N) - 1, Ypos (N) - 1);
+ Add (Str => "/\\");
+ Cursor (Xpos (N), Ypos (N) - 2);
+ Add (Str => "| O |");
+ Cursor (Xpos (N) + 1, Ypos (N) - 1);
+ Add (Str => "\\/");
+ Cursor (Xpos (N) + 2, Ypos (N));
+ Add (Ch => '-');
+
+ --
+ Next (N);
+ Cursor (Xpos (N) - 2, Ypos (N));
+ Add (Ch => ' ');
+ Cursor (Xpos (N) - 1, Ypos (N) - 1);
+ Add (Str => " ");
+ Cursor (Xpos (N), Ypos (N) - 2);
+ Add (Str => " ");
+ Cursor (Xpos (N) + 1, Ypos (N) - 1);
+ Add (Str => " ");
+ Cursor (Xpos (N) + 2, Ypos (N));
+ Add (Ch => ' ');
+
+ Xpos (N) := X;
+ Ypos (N) := Y;
+
+ Refresh;
+ Nap_Milli_Seconds (50);
+ end loop;
+
+ Visibility := Normal;
+ Set_Cursor_Visibility (Visibility);
+ End_Windows;
+
+end Rain;
diff --git a/ncurses-5.2/Ada95/samples/rain.ads b/ncurses-5.2/Ada95/samples/rain.ads
new file mode 100644
index 0000000..64b42a9
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/rain.ads
@@ -0,0 +1,42 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Rain --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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: Laurent Pautet <pautet@gnat.com> 1997 (modified by J.Pfeifer)
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- --
+procedure Rain;
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.adb b/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.adb
new file mode 100644
index 0000000..ac0f54c
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.adb
@@ -0,0 +1,122 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo.Attributes --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+
+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.Explanation; use Sample.Explanation;
+
+package body Sample.Curses_Demo.Attributes is
+
+ procedure Demo
+ is
+ P : Panel := Create (Standard_Window);
+ K : Real_Key_Code;
+ begin
+ Set_Meta_Mode;
+ Set_KeyPad_Mode;
+
+ Top (P);
+
+ Push_Environment ("ATTRIBDEMO");
+ Default_Labels;
+ Notepad ("ATTRIB-PAD00");
+
+ Set_Character_Attributes (Attr => (others => False));
+ Add (Line => 1, Column => Columns / 2 - 10,
+ Str => "This is NORMAL");
+
+ Set_Character_Attributes (Attr => (Stand_Out => True,
+ others => False));
+ Add (Line => 2, Column => Columns / 2 - 10,
+ Str => "This is Stand_Out");
+
+ Set_Character_Attributes (Attr => (Under_Line => True,
+ others => False));
+ Add (Line => 3, Column => Columns / 2 - 10,
+ Str => "This is Under_Line");
+
+ Set_Character_Attributes (Attr => (Reverse_Video => True,
+ others => False));
+ Add (Line => 4, Column => Columns / 2 - 10,
+ Str => "This is Reverse_Video");
+
+ Set_Character_Attributes (Attr => (Blink => True,
+ others => False));
+ Add (Line => 5, Column => Columns / 2 - 10,
+ Str => "This is Blink");
+
+ Set_Character_Attributes (Attr => (Dim_Character => True,
+ others => False));
+ Add (Line => 6, Column => Columns / 2 - 10,
+ Str => "This is Dim_Character");
+
+ Set_Character_Attributes (Attr => (Bold_Character => True,
+ others => False));
+ Add (Line => 7, Column => Columns / 2 - 10,
+ Str => "This is Bold_Character");
+
+ Refresh_Without_Update;
+ Update_Panels; Update_Screen;
+
+ loop
+ K := Get_Key;
+ if K in Special_Key_Code'Range then
+ case K is
+ when QUIT_CODE => exit;
+ when HELP_CODE => Explain_Context;
+ when EXPLAIN_CODE => Explain ("ATTRIBKEYS");
+ when others => null;
+ end case;
+ end if;
+ end loop;
+
+ Pop_Environment;
+ Clear;
+ Refresh_Without_Update;
+ Delete (P);
+ Update_Panels; Update_Screen;
+
+ end Demo;
+
+end Sample.Curses_Demo.Attributes;
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.ads b/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.ads
new file mode 100644
index 0000000..a9a0121
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo-attributes.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo.Attributes --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Curses_Demo.Attributes is
+
+ procedure Demo;
+
+end Sample.Curses_Demo.Attributes;
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.adb b/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.adb
new file mode 100644
index 0000000..3b20b69
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.adb
@@ -0,0 +1,220 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo.Mouse --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Mouse; use Terminal_Interface.Curses.Mouse;
+with Terminal_Interface.Curses.Text_IO; use Terminal_Interface.Curses.Text_IO;
+with Terminal_Interface.Curses.Text_IO.Integer_IO;
+with Terminal_Interface.Curses.Text_IO.Enumeration_IO;
+
+with Sample.Helpers; use Sample.Helpers;
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
+with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
+with Sample.Explanation; use Sample.Explanation;
+
+package body Sample.Curses_Demo.Mouse is
+
+ package Int_IO is new
+ Terminal_Interface.Curses.Text_IO.Integer_IO (Integer);
+ use Int_IO;
+
+ package Button_IO is new
+ Terminal_Interface.Curses.Text_IO.Enumeration_IO (Mouse_Button);
+ use Button_IO;
+
+ package State_IO is new
+ Terminal_Interface.Curses.Text_IO.Enumeration_IO (Button_State);
+ use State_IO;
+
+ procedure Demo is
+
+ type Controls is array (1 .. 3) of Panel;
+
+ Frame : Window;
+ Msg : Window;
+ Ctl : Controls;
+ Pan : Panel;
+ K : Real_Key_Code;
+ V : Cursor_Visibility := Invisible;
+ W : Window;
+ Note : Window;
+ Msg_L : constant Line_Count := 8;
+ Lins : Line_Position := Lines;
+ Cols : Column_Position;
+ Mask : Event_Mask;
+ procedure Show_Mouse_Event;
+
+ procedure Show_Mouse_Event
+ is
+ Evt : constant Mouse_Event := Get_Mouse;
+ Y : Line_Position;
+ X : Column_Position;
+ Button : Mouse_Button;
+ State : Button_State;
+ W : Window;
+ begin
+ Get_Event (Evt, Y, X, Button, State);
+ Put (Msg, "Event at");
+ Put (Msg, " X="); Put (Msg, Integer (X), 3);
+ Put (Msg, ", Y="); Put (Msg, Integer (Y), 3);
+ Put (Msg, ", Btn="); Put (Msg, Button, 10);
+ Put (Msg, ", Stat="); Put (Msg, State, 15);
+ for I in Ctl'Range loop
+ W := Get_Window (Ctl (I));
+ if Enclosed_In_Window (W, Evt) then
+ Transform_Coordinates (W, Y, X, From_Screen);
+ Put (Msg, ",Box(");
+ Put (Msg, Integer (I), 1); Put (Msg, ",");
+ Put (Msg, Integer (Y), 1); Put (Msg, ",");
+ Put (Msg, Integer (X), 1); Put (Msg, ")");
+ end if;
+ end loop;
+ New_Line (Msg);
+ Flush (Msg);
+ Update_Panels; Update_Screen;
+ end Show_Mouse_Event;
+
+ begin
+ Push_Environment ("MOUSE00");
+ Notepad ("MOUSE-PAD00");
+ Default_Labels;
+ Set_Cursor_Visibility (V);
+
+ Note := Notepad_Window;
+ if Note /= Null_Window then
+ Get_Window_Position (Note, Lins, Cols);
+ end if;
+ Frame := Create (Msg_L, Columns, Lins - Msg_L, 0);
+ if Has_Colors then
+ Set_Background (Win => Frame,
+ Ch => (Color => Default_Colors,
+ Attr => Normal_Video,
+ Ch => ' '));
+ Set_Character_Attributes (Win => Frame,
+ Attr => Normal_Video,
+ Color => Default_Colors);
+ Erase (Frame);
+ end if;
+ Msg := Derived_Window (Frame, Msg_L - 2, Columns - 2, 1, 1);
+ Pan := Create (Frame);
+
+ Set_Meta_Mode;
+ Set_KeyPad_Mode;
+ Mask := Start_Mouse;
+
+ Box (Frame);
+ Window_Title (Frame, "Mouse Protocol");
+ Refresh_Without_Update (Frame);
+ Allow_Scrolling (Msg, True);
+
+ declare
+ Middle_Column : constant Integer := Integer (Columns) / 2;
+ Middle_Index : constant Natural := Ctl'First + (Ctl'Length / 2);
+ Width : constant Column_Count := 5;
+ Height : constant Line_Count := 3;
+ Half : constant Column_Count := Width / 2;
+ Space : constant Column_Count := 3;
+ Position : Integer;
+ W : Window;
+ begin
+ for I in Ctl'Range loop
+ Position := (Integer (I) - Integer (Middle_Index)) *
+ Integer (Half + Space + Width) + Middle_Column;
+ W := Create (Height,
+ Width,
+ 1,
+ Column_Position (Position));
+ if Has_Colors then
+ Set_Background (Win => W,
+ Ch => (Color => Menu_Back_Color,
+ Attr => Normal_Video,
+ Ch => ' '));
+ Set_Character_Attributes (Win => W,
+ Attr => Normal_Video,
+ Color => Menu_Fore_Color);
+ Erase (W);
+ end if;
+ Ctl (I) := Create (W);
+ Box (W);
+ Move_Cursor (W, 1, Half);
+ Put (W, Integer (I), 1);
+ Refresh_Without_Update (W);
+ end loop;
+ end;
+
+ Update_Panels; Update_Screen;
+
+ loop
+ K := Get_Key;
+ if K in Special_Key_Code'Range then
+ case K is
+ when QUIT_CODE => exit;
+ when HELP_CODE => Explain_Context;
+ when EXPLAIN_CODE => Explain ("MOUSEKEYS");
+ when Key_Mouse => Show_Mouse_Event;
+ when others => null;
+ end case;
+ end if;
+ end loop;
+
+ for I in Ctl'Range loop
+ W := Get_Window (Ctl (I));
+ Clear (W);
+ Delete (Ctl (I));
+ Delete (W);
+ end loop;
+
+ Clear (Frame);
+ Delete (Pan);
+ Delete (Msg);
+ Delete (Frame);
+
+ Set_Cursor_Visibility (V);
+ End_Mouse (Mask);
+
+ Pop_Environment;
+ Update_Panels; Update_Screen;
+
+ end Demo;
+
+end Sample.Curses_Demo.Mouse;
+
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.ads b/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.ads
new file mode 100644
index 0000000..603050a
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo-mouse.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo.Mouse --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Curses_Demo.Mouse is
+
+ procedure Demo;
+
+end Sample.Curses_Demo.Mouse;
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo.adb b/ncurses-5.2/Ada95/samples/sample-curses_demo.adb
new file mode 100644
index 0000000..02c751a
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo.adb
@@ -0,0 +1,142 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Menus; use Terminal_Interface.Curses.Menus;
+with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+with Terminal_Interface.Curses.Panels.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.Explanation; use Sample.Explanation;
+
+with Sample.Menu_Demo.Handler;
+with Sample.Curses_Demo.Mouse;
+with Sample.Curses_Demo.Attributes;
+
+package body Sample.Curses_Demo is
+
+ type User_Data is new Integer;
+ type User_Data_Access is access all User_Data;
+ package PUD is new Panels.User_Data (User_Data, User_Data_Access);
+ -- We use above instantiation of the generic User_Data package to
+ -- demonstrate and test the use of the user data maechanism.
+
+ procedure Demo
+ is
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ Pan : Panel) return Boolean;
+ package Mh is new Sample.Menu_Demo.Handler (My_Driver);
+
+ Itm : Item_Array_Access := new Item_Array'
+ (New_Item ("Attributes Demo"),
+ New_Item ("Mouse Demo"),
+ Null_Item);
+ M : Menu := New_Menu (Itm);
+ U1 : User_Data_Access := new User_Data'(4711);
+ U2 : User_Data_Access;
+
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ Pan : Panel) return Boolean
+ is
+ Idx : constant Positive := Get_Index (Current (M));
+ Result : Boolean := False;
+ begin
+ PUD.Set_User_Data (Pan, U1); -- set some user data, just for fun
+ if K in User_Key_Code'Range then
+ if K = QUIT then
+ Result := True;
+ elsif K = SELECT_ITEM then
+ if Idx in Itm'Range then
+ Hide (Pan);
+ Update_Panels;
+ end if;
+ case Idx is
+ when 1 => Sample.Curses_Demo.Attributes.Demo;
+ when 2 => Sample.Curses_Demo.Mouse.Demo;
+ when others => Not_Implemented;
+ end case;
+ if Idx in Itm'Range then
+ Top (Pan);
+ Show (Pan);
+ Update_Panels;
+ Update_Screen;
+ end if;
+ end if;
+ end if;
+ PUD.Get_User_Data (Pan, U2); -- get the user data
+ pragma Assert (U1.all = U2.all and then U1 = U2);
+ return Result;
+ end My_Driver;
+
+ begin
+
+ if (1 + Item_Count (M)) /= Itm'Length then
+ raise Constraint_Error;
+ end if;
+
+ if not Has_Mouse then
+ declare
+ O : Item_Option_Set;
+ begin
+ Get_Options (Itm (2), O);
+ O.Selectable := False;
+ Set_Options (Itm (2), O);
+ end;
+ end if;
+
+ Push_Environment ("CURSES00");
+ Notepad ("CURSES-PAD00");
+ Default_Labels;
+ Refresh_Soft_Label_Keys_Without_Update;
+
+ Mh.Drive_Me (M, " Demo ");
+ Pop_Environment;
+
+ Delete (M);
+ Free (Itm, True);
+ end Demo;
+
+end Sample.Curses_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-curses_demo.ads b/ncurses-5.2/Ada95/samples/sample-curses_demo.ads
new file mode 100644
index 0000000..9b791b6
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-curses_demo.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Curses_Demo --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Curses_Demo is
+
+ procedure Demo;
+
+end Sample.Curses_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-explanation.adb b/ncurses-5.2/Ada95/samples/sample-explanation.adb
new file mode 100644
index 0000000..f42652c
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-explanation.adb
@@ -0,0 +1,408 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Explanation --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- Poor mans help system. This scans a sequential file for key lines and
+-- then reads the lines up to the next key. Those lines are presented in
+-- a window as help or explanation.
+--
+with Ada.Text_IO; use Ada.Text_IO;
+with Ada.Unchecked_Deallocation;
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+
+with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
+with Sample.Helpers; use Sample.Helpers;
+
+package body Sample.Explanation is
+
+ Help_Keys : constant String := "HELPKEYS";
+ In_Help : constant String := "INHELP";
+
+ File_Name : String := "explain.msg";
+ F : File_Type;
+
+ type Help_Line;
+ type Help_Line_Access is access Help_Line;
+ pragma Controlled (Help_Line_Access);
+ type String_Access is access String;
+ pragma Controlled (String_Access);
+
+ type Help_Line is
+ record
+ Prev, Next : Help_Line_Access;
+ Line : String_Access;
+ end record;
+
+ procedure Explain (Key : in String;
+ Win : in Window);
+
+ procedure Release_String is
+ new Ada.Unchecked_Deallocation (String,
+ String_Access);
+ procedure Release_Help_Line is
+ new Ada.Unchecked_Deallocation (Help_Line,
+ Help_Line_Access);
+
+ function Search (Key : String) return Help_Line_Access;
+ procedure Release_Help (Root : in out Help_Line_Access);
+
+ procedure Explain (Key : in String)
+ is
+ begin
+ Explain (Key, Null_Window);
+ end Explain;
+
+ procedure Explain (Key : in String;
+ Win : in Window)
+ is
+ -- Retrieve the text associated with this key and display it in this
+ -- window. If no window argument is passed, the routine will create
+ -- a temporary window and use it.
+
+ function Filter_Key return Real_Key_Code;
+ procedure Unknown_Key;
+ procedure Redo;
+ procedure To_Window (C : in out Help_Line_Access;
+ More : in out Boolean);
+
+ Frame : Window := Null_Window;
+
+ W : Window := Win;
+ K : Real_Key_Code;
+ P : Panel;
+
+ Height : Line_Count;
+ Width : Column_Count;
+ Help : Help_Line_Access := Search (Key);
+ Current : Help_Line_Access;
+ Top_Line : Help_Line_Access;
+
+ Has_More : Boolean;
+
+ procedure Unknown_Key
+ is
+ begin
+ Add (W, "Help message with ID ");
+ Add (W, Key);
+ Add (W, " not found.");
+ Add (W, Character'Val (10));
+ Add (W, "Press the Function key labelled 'Quit' key to continue.");
+ end Unknown_Key;
+
+ procedure Redo
+ is
+ H : Help_Line_Access := Top_Line;
+ begin
+ if Top_Line /= null then
+ for L in 0 .. (Height - 1) loop
+ Add (W, L, 0, H.Line.all);
+ exit when H.Next = null;
+ H := H.Next;
+ end loop;
+ else
+ Unknown_Key;
+ end if;
+ end Redo;
+
+ function Filter_Key return Real_Key_Code
+ is
+ K : Real_Key_Code;
+ begin
+ loop
+ K := Get_Key (W);
+ if K in Special_Key_Code'Range then
+ case K is
+ when HELP_CODE =>
+ if not Find_Context (In_Help) then
+ Push_Environment (In_Help, False);
+ Explain (In_Help, W);
+ Pop_Environment;
+ Redo;
+ end if;
+ when EXPLAIN_CODE =>
+ if not Find_Context (Help_Keys) then
+ Push_Environment (Help_Keys, False);
+ Explain (Help_Keys, W);
+ Pop_Environment;
+ Redo;
+ end if;
+ when others => exit;
+ end case;
+ else
+ exit;
+ end if;
+ end loop;
+ return K;
+ end Filter_Key;
+
+ procedure To_Window (C : in out Help_Line_Access;
+ More : in out Boolean)
+ is
+ L : Line_Position := 0;
+ begin
+ loop
+ Add (W, L, 0, C.Line.all);
+ L := L + 1;
+ exit when C.Next = null or else L = Height;
+ C := C.Next;
+ end loop;
+ if C.Next /= null then
+ pragma Assert (L = Height);
+ More := True;
+ else
+ More := False;
+ end if;
+ end To_Window;
+
+ begin
+ if W = Null_Window then
+ Push_Environment ("HELP");
+ Default_Labels;
+ Frame := New_Window (Lines - 2, Columns, 0, 0);
+ if Has_Colors then
+ Set_Background (Win => Frame,
+ Ch => (Ch => ' ',
+ Color => Help_Color,
+ Attr => Normal_Video));
+ Set_Character_Attributes (Win => Frame,
+ Attr => Normal_Video,
+ Color => Help_Color);
+ Erase (Frame);
+ end if;
+ Box (Frame);
+ Set_Character_Attributes (Frame, (Reverse_Video => True,
+ others => False));
+ Add (Frame, Lines - 3, 2, "Cursor Up/Down scrolls");
+ Set_Character_Attributes (Frame); -- Back to default.
+ Window_Title (Frame, "Explanation");
+ W := Derived_Window (Frame, Lines - 4, Columns - 2, 1, 1);
+ Refresh_Without_Update (Frame);
+ Get_Size (W, Height, Width);
+ Set_Meta_Mode (W);
+ Set_KeyPad_Mode (W);
+ Allow_Scrolling (W, True);
+ Set_Echo_Mode (False);
+ P := Create (Frame);
+ Top (P);
+ Update_Panels;
+ else
+ Clear (W);
+ Refresh_Without_Update (W);
+ end if;
+
+ Current := Help; Top_Line := Help;
+
+ if null = Help then
+ Unknown_Key;
+ loop
+ K := Filter_Key;
+ exit when K = QUIT_CODE;
+ end loop;
+ else
+ To_Window (Current, Has_More);
+ if Has_More then
+ -- This means there are more lines available, so we have to go
+ -- into a scroll manager.
+ loop
+ K := Filter_Key;
+ if K in Special_Key_Code'Range then
+ case K is
+ when Key_Cursor_Down =>
+ if Current.Next /= null then
+ Move_Cursor (W, Height - 1, 0);
+ Scroll (W, 1);
+ Current := Current.Next;
+ Top_Line := Top_Line.Next;
+ Add (W, Current.Line.all);
+ end if;
+ when Key_Cursor_Up =>
+ if Top_Line.Prev /= null then
+ Move_Cursor (W, 0, 0);
+ Scroll (W, -1);
+ Top_Line := Top_Line.Prev;
+ Current := Current.Prev;
+ Add (W, Top_Line.Line.all);
+ end if;
+ when QUIT_CODE => exit;
+ when others => null;
+ end case;
+ end if;
+ end loop;
+ else
+ loop
+ K := Filter_Key;
+ exit when K = QUIT_CODE;
+ end loop;
+ end if;
+ end if;
+
+ Clear (W);
+
+ if Frame /= Null_Window then
+ Clear (Frame);
+ Delete (P);
+ Delete (W);
+ Delete (Frame);
+ Pop_Environment;
+ end if;
+
+ Update_Panels;
+ Update_Screen;
+
+ Release_Help (Help);
+
+ end Explain;
+
+ function Search (Key : String) return Help_Line_Access
+ is
+ Last : Natural;
+ Buffer : String (1 .. 256);
+ Root : Help_Line_Access := null;
+ Current : Help_Line_Access;
+ Tail : Help_Line_Access := null;
+
+ function Next_Line return Boolean;
+
+ function Next_Line return Boolean
+ is
+ H_End : constant String := "#END";
+ begin
+ Get_Line (F, Buffer, Last);
+ if Last = H_End'Length and then H_End = Buffer (1 .. Last) then
+ return False;
+ else
+ return True;
+ end if;
+ end Next_Line;
+ begin
+ Reset (F);
+ Outer :
+ loop
+ exit when not Next_Line;
+ if Last = (1 + Key'Length) and then Key = Buffer (2 .. Last)
+ and then Buffer (1) = '#' then
+ loop
+ exit when not Next_Line;
+ exit when Buffer (1) = '#';
+ Current := new Help_Line'(null, null,
+ new String'(Buffer (1 .. Last)));
+ if Tail = null then
+ Release_Help (Root);
+ Root := Current;
+ else
+ Tail.Next := Current;
+ Current.Prev := Tail;
+ end if;
+ Tail := Current;
+ end loop;
+ exit Outer;
+ end if;
+ end loop Outer;
+ return Root;
+ end Search;
+
+ procedure Release_Help (Root : in out Help_Line_Access)
+ is
+ Next : Help_Line_Access;
+ begin
+ loop
+ exit when Root = null;
+ Next := Root.Next;
+ Release_String (Root.Line);
+ Release_Help_Line (Root);
+ Root := Next;
+ end loop;
+ end Release_Help;
+
+ procedure Explain_Context
+ is
+ begin
+ Explain (Context);
+ end Explain_Context;
+
+ procedure Notepad (Key : in String)
+ is
+ H : constant Help_Line_Access := Search (Key);
+ T : Help_Line_Access := H;
+ N : Line_Count := 1;
+ L : Line_Position := 0;
+ W : Window;
+ P : Panel;
+ begin
+ if H /= null then
+ loop
+ T := T.Next;
+ exit when T = null;
+ N := N + 1;
+ end loop;
+ W := New_Window (N + 2, Columns, Lines - N - 2, 0);
+ if Has_Colors then
+ Set_Background (Win => W,
+ Ch => (Ch => ' ',
+ Color => Notepad_Color,
+ Attr => Normal_Video));
+ Set_Character_Attributes (Win => W,
+ Attr => Normal_Video,
+ Color => Notepad_Color);
+ Erase (W);
+ end if;
+ Box (W);
+ Window_Title (W, "Notepad");
+ P := New_Panel (W);
+ T := H;
+ loop
+ Add (W, L + 1, 1, T.Line.all, Integer (Columns - 2));
+ L := L + 1;
+ T := T.Next;
+ exit when T = null;
+ end loop;
+ T := H;
+ Release_Help (T);
+ Refresh_Without_Update (W);
+ Notepad_To_Context (P);
+ end if;
+ end Notepad;
+
+begin
+ Open (F, In_File, File_Name);
+end Sample.Explanation;
+
diff --git a/ncurses-5.2/Ada95/samples/sample-explanation.ads b/ncurses-5.2/Ada95/samples/sample-explanation.ads
new file mode 100644
index 0000000..056b5af
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-explanation.ads
@@ -0,0 +1,59 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Explanation --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- Poor mans help system. This scans a sequential file for key lines and
+-- then reads the lines up to the next key. Those lines are presented in
+-- a window as help or explanation.
+--
+package Sample.Explanation is
+
+ procedure Explain (Key : in String);
+ -- Retrieve the text associated with this key and display it.
+
+ procedure Explain_Context;
+ -- Explain the current context.
+
+ procedure Notepad (Key : in String);
+ -- Put a note on the screen and maintain it with the context
+
+ Explanation_Not_Found : exception;
+ Explanation_Error : exception;
+
+end Sample.Explanation;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo-aux.adb b/ncurses-5.2/Ada95/samples/sample-form_demo-aux.adb
new file mode 100644
index 0000000..92c8868
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo-aux.adb
@@ -0,0 +1,259 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo.Aux --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
+
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Helpers; use Sample.Helpers;
+with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
+with Sample.Explanation; use Sample.Explanation;
+
+package body Sample.Form_Demo.Aux is
+
+ procedure Geometry (F : in Form;
+ L : out Line_Count; -- Lines used for menu
+ C : out Column_Count; -- Columns used for menu
+ Y : out Line_Position; -- Proposed Line for menu
+ X : out Column_Position) -- Proposed Column for menu
+ is
+ begin
+ Scale (F, L, C);
+
+ L := L + 2; -- count for frame at top and bottom
+ C := C + 2; -- "
+
+ -- Calculate horizontal coordinate at the screen center
+ X := (Columns - C) / 2;
+ Y := 1; -- start always in line 1
+ end Geometry;
+
+ function Create (F : Form;
+ Title : String;
+ Lin : Line_Position;
+ Col : Column_Position) return Panel
+ is
+ W, S : Window;
+ L : Line_Count;
+ C : Column_Count;
+ Y : Line_Position;
+ X : Column_Position;
+ Pan : Panel;
+ begin
+ Geometry (F, L, C, Y, X);
+ W := New_Window (L, C, Lin, Col);
+ Set_Meta_Mode (W);
+ Set_KeyPad_Mode (W);
+ if Has_Colors then
+ Set_Background (Win => W,
+ Ch => (Ch => ' ',
+ Color => Default_Colors,
+ Attr => Normal_Video));
+ Set_Character_Attributes (Win => W,
+ Color => Default_Colors,
+ Attr => Normal_Video);
+ Erase (W);
+ end if;
+ S := Derived_Window (W, L - 2, C - 2, 1, 1);
+ Set_Meta_Mode (S);
+ Set_KeyPad_Mode (S);
+ Box (W);
+ Set_Window (F, W);
+ Set_Sub_Window (F, S);
+ if Title'Length > 0 then
+ Window_Title (W, Title);
+ end if;
+ Pan := New_Panel (W);
+ Post (F);
+ return Pan;
+ end Create;
+
+ procedure Destroy (F : in Form;
+ P : in out Panel)
+ is
+ W, S : Window;
+ begin
+ W := Get_Window (F);
+ S := Get_Sub_Window (F);
+ Post (F, False);
+ Erase (W);
+ Delete (P);
+ Set_Window (F, Null_Window);
+ Set_Sub_Window (F, Null_Window);
+ Delete (S);
+ Delete (W);
+ Update_Panels;
+ end Destroy;
+
+ function Get_Request (F : Form;
+ P : Panel;
+ Handle_CRLF : Boolean := True) return Key_Code
+ is
+ W : constant Window := Get_Window (F);
+ K : Real_Key_Code;
+ Ch : Character;
+ begin
+ Top (P);
+ loop
+ K := Get_Key (W);
+ if K in Special_Key_Code'Range then
+ case K is
+ when HELP_CODE => Explain_Context;
+ when EXPLAIN_CODE => Explain ("FORMKEYS");
+ when Key_Home => return F_First_Field;
+ when Key_End => return F_Last_Field;
+ when QUIT_CODE => return QUIT;
+ when Key_Cursor_Down => return F_Down_Char;
+ when Key_Cursor_Up => return F_Up_Char;
+ when Key_Cursor_Left => return F_Previous_Char;
+ when Key_Cursor_Right => return F_Next_Char;
+ when Key_Next_Page => return F_Next_Page;
+ when Key_Previous_Page => return F_Previous_Page;
+ when Key_Backspace => return F_Delete_Previous;
+ when Key_Clear_Screen => return F_Clear_Field;
+ when Key_Clear_End_Of_Line => return F_Clear_EOF;
+ when others => return K;
+ end case;
+ elsif K in Normal_Key_Code'Range then
+ Ch := Character'Val (K);
+ case Ch is
+ when CAN => return QUIT; -- CTRL-X
+
+ when ACK => return F_Next_Field; -- CTRL-F
+ when STX => return F_Previous_Field; -- CTRL-B
+ when FF => return F_Left_Field; -- CTRL-L
+ when DC2 => return F_Right_Field; -- CTRL-R
+ when NAK => return F_Up_Field; -- CTRL-U
+ when EOT => return F_Down_Field; -- CTRL-D
+
+ when ETB => return F_Next_Word; -- CTRL-W
+ when DC4 => return F_Previous_Word; -- CTRL-T
+
+ when SOH => return F_Begin_Field; -- CTRL-A
+ when ENQ => return F_End_Field; -- CTRL-E
+
+ when HT => return F_Insert_Char; -- CTRL-I
+ when SI => return F_Insert_Line; -- CTRL-O
+ when SYN => return F_Delete_Char; -- CTRL-V
+ when BS => return F_Delete_Previous; -- CTRL-H
+ when EM => return F_Delete_Line; -- CTRL-Y
+ when BEL => return F_Delete_Word; -- CTRL-G
+ when VT => return F_Clear_EOF; -- CTRL-K
+
+ when SO => return F_Next_Choice; -- CTRL-N
+ when DLE => return F_Previous_Choice; -- CTRL-P
+
+ when CR | LF =>
+ if Handle_CRLF then
+ return F_New_Line;
+ else
+ return K;
+ end if;
+ when others => return K;
+ end case;
+ else
+ return K;
+ end if;
+ end loop;
+ end Get_Request;
+
+ function Make (Top : Line_Position;
+ Left : Column_Position;
+ Text : String) return Field
+ is
+ Fld : Field;
+ C : Column_Count := Column_Count (Text'Length);
+ begin
+ Fld := New_Field (1, C, Top, Left);
+ Set_Buffer (Fld, 0, Text);
+ Switch_Options (Fld, (Active => True, others => False), False);
+ if Has_Colors then
+ Set_Background (Fld => Fld, Color => Default_Colors);
+ end if;
+ return Fld;
+ end Make;
+
+ function Make (Height : Line_Count := 1;
+ Width : Column_Count;
+ Top : Line_Position;
+ Left : Column_Position;
+ Off_Screen : Natural := 0) return Field
+ is
+ Fld : Field := New_Field (Height, Width, Top, Left, Off_Screen);
+ begin
+ if Has_Colors then
+ Set_Foreground (Fld => Fld, Color => Form_Fore_Color);
+ Set_Background (Fld => Fld, Color => Form_Back_Color);
+ else
+ Set_Background (Fld, (Reverse_Video => True, others => False));
+ end if;
+ return Fld;
+ end Make;
+
+ function Default_Driver (F : Form;
+ K : Key_Code;
+ P : Panel) return Boolean
+ is
+ begin
+ if K in User_Key_Code'Range and then K = QUIT then
+ if Driver (F, F_Validate_Field) = Form_Ok then
+ return True;
+ end if;
+ end if;
+ return False;
+ end Default_Driver;
+
+ function Count_Active (F : Form) return Natural
+ is
+ N : Natural := 0;
+ O : Field_Option_Set;
+ H : constant Natural := Field_Count (F);
+ begin
+ if H > 0 then
+ for I in 1 .. H loop
+ Get_Options (Fields (F, I), O);
+ if O.Active then
+ N := N + 1;
+ end if;
+ end loop;
+ end if;
+ return N;
+ end Count_Active;
+
+end Sample.Form_Demo.Aux;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo-aux.ads b/ncurses-5.2/Ada95/samples/sample-form_demo-aux.ads
new file mode 100644
index 0000000..d3e6d8d
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo-aux.ads
@@ -0,0 +1,92 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo.Aux --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Forms; use Terminal_Interface.Curses.Forms;
+
+package Sample.Form_Demo.Aux is
+
+ procedure Geometry (F : in Form;
+ L : out Line_Count;
+ C : out Column_Count;
+ Y : out Line_Position;
+ X : out Column_Position);
+ -- Calculate the geometry for a panel beeing able to be used to display
+ -- the menu.
+
+ function Create (F : Form;
+ Title : String;
+ Lin : Line_Position;
+ Col : Column_Position) return Panel;
+ -- Create a panel decorated with a frame and the title at the specified
+ -- position. The dimension of the panel is derived from the menus layout.
+
+ procedure Destroy (F : in Form;
+ P : in out Panel);
+ -- Destroy all the windowing structures associated with this menu and
+ -- panel.
+
+ function Get_Request (F : Form;
+ P : Panel;
+ Handle_CRLF : Boolean := True) return Key_Code;
+ -- Centralized request driver for all menus in this sample. This
+ -- gives us a common key binding for all menus.
+
+ function Make (Top : Line_Position;
+ Left : Column_Position;
+ Text : String) return Field;
+ -- create a label
+
+ function Make (Height : Line_Count := 1;
+ Width : Column_Count;
+ Top : Line_Position;
+ Left : Column_Position;
+ Off_Screen : Natural := 0) return Field;
+ -- create a editable field
+
+ function Default_Driver (F : Form;
+ K : Key_Code;
+ P : Panel) return Boolean;
+
+ function Count_Active (F : Form) return Natural;
+ -- Count the number of active fields in the form
+
+end Sample.Form_Demo.Aux;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo-handler.adb b/ncurses-5.2/Ada95/samples/sample-form_demo-handler.adb
new file mode 100644
index 0000000..6cffc9c
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo-handler.adb
@@ -0,0 +1,97 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo.Handler --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Sample.Form_Demo.Aux;
+
+package body Sample.Form_Demo.Handler is
+
+ package Aux renames Sample.Form_Demo.Aux;
+
+ procedure Drive_Me (F : in Form;
+ Title : in String := "")
+ is
+ L : Line_Count;
+ C : Column_Count;
+ Y : Line_Position;
+ X : Column_Position;
+ begin
+ Aux.Geometry (F, L, C, Y, X);
+ Drive_Me (F, Y, X, Title);
+ end Drive_Me;
+
+ procedure Drive_Me (F : in Form;
+ Lin : in Line_Position;
+ Col : in Column_Position;
+ Title : in String := "")
+ is
+ Pan : Panel := Aux.Create (F, Title, Lin, Col);
+ V : Cursor_Visibility := Normal;
+ Handle_CRLF : Boolean := True;
+
+ begin
+ Set_Cursor_Visibility (V);
+ if Aux.Count_Active (F) = 1 then
+ Handle_CRLF := False;
+ end if;
+ loop
+ declare
+ K : Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF);
+ R : Driver_Result;
+ begin
+ if (K = 13 or else K = 10) and then not Handle_CRLF then
+ R := Unknown_Request;
+ else
+ R := Driver (F, K);
+ end if;
+ case R is
+ when Form_Ok => null;
+ when Unknown_Request =>
+ if My_Driver (F, K, Pan) then
+ exit;
+ end if;
+ when others => Beep;
+ end case;
+ end;
+ end loop;
+ Set_Cursor_Visibility (V);
+ Aux.Destroy (F, Pan);
+ end Drive_Me;
+
+end Sample.Form_Demo.Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo-handler.ads b/ncurses-5.2/Ada95/samples/sample-form_demo-handler.ads
new file mode 100644
index 0000000..9f8da7d
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo-handler.ads
@@ -0,0 +1,64 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo.Handler --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Forms;
+use Terminal_Interface.Curses.Forms;
+
+generic
+ with function My_Driver (Frm : Form;
+ K : Key_Code;
+ Pan : Panel) return Boolean;
+package Sample.Form_Demo.Handler is
+
+ procedure Drive_Me (F : in Form;
+ Lin : in Line_Position;
+ Col : in Column_Position;
+ Title : in String := "");
+ -- Position the menu at the given point and drive it.
+
+ procedure Drive_Me (F : in Form;
+ Title : in String := "");
+ -- Center menu and drive it.
+
+end Sample.Form_Demo.Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo.adb b/ncurses-5.2/Ada95/samples/sample-form_demo.adb
new file mode 100644
index 0000000..ec4a762
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo.adb
@@ -0,0 +1,134 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
+with Terminal_Interface.Curses.Forms.Field_User_Data;
+with Terminal_Interface.Curses.Forms.Form_User_Data;
+with Sample.My_Field_Type; use Sample.My_Field_Type;
+with Sample.Explanation; use Sample.Explanation;
+with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux;
+with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
+with Sample.Form_Demo.Handler;
+
+with Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada;
+with Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
+use Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
+with Terminal_Interface.Curses.Forms.Field_Types.IntField;
+use Terminal_Interface.Curses.Forms.Field_Types.IntField;
+
+package body Sample.Form_Demo is
+
+ type User_Data is
+ record
+ Data : Integer;
+ end record;
+ type User_Access is access User_Data;
+
+ package Fld_U is new
+ Terminal_Interface.Curses.Forms.Field_User_Data (User_Data,
+ User_Access);
+
+ package Frm_U is new
+ Terminal_Interface.Curses.Forms.Form_User_Data (User_Data,
+ User_Access);
+
+ type Weekday is (Sunday, Monday, Tuesday, Wednesday, Thursday,
+ Friday, Saturday);
+
+ package Weekday_Enum is new
+ Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada (Weekday);
+
+ Enum_Field : constant Enumeration_Field :=
+ Weekday_Enum.Create;
+
+ procedure Demo
+ is
+
+ Mft : My_Data := (Ch => 'X');
+
+ FA : Field_Array_Access := new Field_Array'
+ (Make (0, 14, "Sample Entry Form"),
+ Make (2, 0, "WeekdayEnumeration"),
+ Make (2, 20, "Numeric 1-10"),
+ Make (2, 34, "Only 'X'"),
+ Make (5, 0, "Multiple Lines offscreen(Scroll)"),
+ Make (Width => 18, Top => 3, Left => 0),
+ Make (Width => 12, Top => 3, Left => 20),
+ Make (Width => 12, Top => 3, Left => 34),
+ Make (Width => 46, Top => 6, Left => 0, Height => 4, Off_Screen => 2),
+ Null_Field
+ );
+
+ Frm : Terminal_Interface.Curses.Forms.Form := Create (FA);
+
+ I_F : constant Integer_Field := (Precision => 0,
+ Lower_Limit => 1,
+ Upper_Limit => 10);
+
+ F1, F2 : User_Access;
+
+ package Fh is new Sample.Form_Demo.Handler (Default_Driver);
+
+ begin
+ Push_Environment ("FORM00");
+ Notepad ("FORM-PAD00");
+ Default_Labels;
+
+ Set_Field_Type (FA (6), Enum_Field);
+ Set_Field_Type (FA (7), I_F);
+ Set_Field_Type (FA (8), Mft);
+
+ F1 := new User_Data'(Data => 4711);
+ Fld_U.Set_User_Data (FA (1), F1);
+
+ Fh.Drive_Me (Frm);
+
+ Fld_U.Get_User_Data (FA (1), F2);
+ pragma Assert (F1 = F2);
+ pragma Assert (F1.Data = F2.Data);
+
+ Pop_Environment;
+ Delete (Frm);
+
+ Free (FA, True);
+ end Demo;
+
+end Sample.Form_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-form_demo.ads b/ncurses-5.2/Ada95/samples/sample-form_demo.ads
new file mode 100644
index 0000000..61d9cbf
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-form_demo.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Form_Demo --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Form_Demo is
+
+ procedure Demo;
+
+end Sample.Form_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-function_key_setting.adb b/ncurses-5.2/Ada95/samples/sample-function_key_setting.adb
new file mode 100644
index 0000000..3579153
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-function_key_setting.adb
@@ -0,0 +1,213 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Function_Key_Setting --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Unchecked_Deallocation;
+with Sample.Manifest; use Sample.Manifest;
+
+-- This package implements a simple stack of function key label environments.
+--
+package body Sample.Function_Key_Setting is
+
+ Max_Label_Length : constant Positive := 8;
+ Number_Of_Keys : Label_Number := Label_Number'Last;
+ Justification : Label_Justification := Left;
+
+ subtype Label is String (1 .. Max_Label_Length);
+ type Label_Array is array (Label_Number range <>) of Label;
+
+ type Key_Environment (N : Label_Number := Label_Number'Last);
+ type Env_Ptr is access Key_Environment;
+ pragma Controlled (Env_Ptr);
+
+ type String_Access is access String;
+ pragma Controlled (String_Access);
+
+ Active_Context : String_Access := new String'("MAIN");
+ Active_Notepad : Panel := Null_Panel;
+
+ type Key_Environment (N : Label_Number := Label_Number'Last) is
+ record
+ Prev : Env_Ptr;
+ Help : String_Access;
+ Notepad : Panel;
+ Labels : Label_Array (1 .. N);
+ end record;
+
+ procedure Release_String is
+ new Ada.Unchecked_Deallocation (String,
+ String_Access);
+
+ procedure Release_Environment is
+ new Ada.Unchecked_Deallocation (Key_Environment,
+ Env_Ptr);
+
+ Top_Of_Stack : Env_Ptr := null;
+
+ procedure Push_Environment (Key : in String;
+ Reset : in Boolean := True)
+ is
+ P : constant Env_Ptr := new Key_Environment (Number_Of_Keys);
+ begin
+ -- Store the current labels in the environment
+ for I in 1 .. Number_Of_Keys loop
+ Get_Soft_Label_Key (I, P.Labels (I));
+ if Reset then
+ Set_Soft_Label_Key (I, " ");
+ end if;
+ end loop;
+ P.Prev := Top_Of_Stack;
+ -- now store active help context and notepad
+ P.Help := Active_Context;
+ P.Notepad := Active_Notepad;
+ -- The notepad must now vanish and the new notepad is empty.
+ if (P.Notepad /= Null_Panel) then
+ Hide (P.Notepad);
+ Update_Panels;
+ end if;
+ Active_Notepad := Null_Panel;
+ Active_Context := new String'(Key);
+
+ Top_Of_Stack := P;
+ if Reset then
+ Refresh_Soft_Label_Keys_Without_Update;
+ end if;
+ end Push_Environment;
+
+ procedure Pop_Environment
+ is
+ P : Env_Ptr := Top_Of_Stack;
+ begin
+ if Top_Of_Stack = null then
+ raise Function_Key_Stack_Error;
+ else
+ for I in 1 .. Number_Of_Keys loop
+ Set_Soft_Label_Key (I, P.Labels (I), Justification);
+ end loop;
+ pragma Assert (Active_Context /= null);
+ Release_String (Active_Context);
+ Active_Context := P.Help;
+ Refresh_Soft_Label_Keys_Without_Update;
+ Notepad_To_Context (P.Notepad);
+ Top_Of_Stack := P.Prev;
+ Release_Environment (P);
+ end if;
+ end Pop_Environment;
+
+ function Context return String
+ is
+ begin
+ if Active_Context /= null then
+ return Active_Context.all;
+ else
+ return "";
+ end if;
+ end Context;
+
+ function Find_Context (Key : String) return Boolean
+ is
+ P : Env_Ptr := Top_Of_Stack;
+ begin
+ if Active_Context.all = Key then
+ return True;
+ else
+ loop
+ exit when P = null;
+ if P.Help.all = Key then
+ return True;
+ else
+ P := P.Prev;
+ end if;
+ end loop;
+ return False;
+ end if;
+ end Find_Context;
+
+ procedure Notepad_To_Context (Pan : in Panel)
+ is
+ W : Window;
+ begin
+ if Active_Notepad /= Null_Panel then
+ W := Get_Window (Active_Notepad);
+ Clear (W);
+ Delete (Active_Notepad);
+ Delete (W);
+ end if;
+ Active_Notepad := Pan;
+ if Pan /= Null_Panel then
+ Top (Pan);
+ end if;
+ Update_Panels;
+ Update_Screen;
+ end Notepad_To_Context;
+
+ procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style;
+ Just : Label_Justification := Left)
+ is
+ begin
+ case Mode is
+ when PC_Style .. PC_Style_With_Index
+ => Number_Of_Keys := 12;
+ when others
+ => Number_Of_Keys := 8;
+ end case;
+ Init_Soft_Label_Keys (Mode);
+ Justification := Just;
+ end Initialize;
+
+ procedure Default_Labels
+ is
+ begin
+ Set_Soft_Label_Key (FKEY_QUIT, "Quit");
+ Set_Soft_Label_Key (FKEY_HELP, "Help");
+ Set_Soft_Label_Key (FKEY_EXPLAIN, "Keys");
+ Refresh_Soft_Label_Keys_Without_Update;
+ end Default_Labels;
+
+ function Notepad_Window return Window
+ is
+ begin
+ if Active_Notepad /= Null_Panel then
+ return Get_Window (Active_Notepad);
+ else
+ return Null_Window;
+ end if;
+ end Notepad_Window;
+
+end Sample.Function_Key_Setting;
diff --git a/ncurses-5.2/Ada95/samples/sample-function_key_setting.ads b/ncurses-5.2/Ada95/samples/sample-function_key_setting.ads
new file mode 100644
index 0000000..eb375d3
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-function_key_setting.ads
@@ -0,0 +1,82 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Function_Key_Setting --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+
+-- This package implements a simple stack of function key label environments.
+--
+package Sample.Function_Key_Setting is
+
+ procedure Push_Environment (Key : in String;
+ Reset : in Boolean := True);
+ -- Push the definition of the current function keys on an internal
+ -- stack. If the reset flag is true, all labels are reset while
+ -- pushed, so the new environment can assume a tabula rasa.
+ -- The Key defines the new Help Context associated with the new
+ -- Environment. This saves also the currently active Notepad.
+
+ procedure Pop_Environment;
+ -- Pop the Definitions from the stack and make them the current ones.
+ -- This also restores the Help context and the previous Notepad.
+
+ procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style;
+ Just : Label_Justification := Left);
+ -- Initialize the environment
+
+ function Context return String;
+ -- Return the current context identitfier
+
+ function Find_Context (Key : String) return Boolean;
+ -- Look for a context, return true if it is in the stack,
+ -- false otherwise.
+
+ procedure Notepad_To_Context (Pan : in Panel);
+ -- Add a panel representing a notepad to the current context.
+
+ Function_Key_Stack_Error : exception;
+
+ procedure Default_Labels;
+ -- Set the default labels used in all environments
+
+ function Notepad_Window return Window;
+ -- Return the current notepad window or Null_Window if there is none.
+
+end Sample.Function_Key_Setting;
diff --git a/ncurses-5.2/Ada95/samples/sample-header_handler.adb b/ncurses-5.2/Ada95/samples/sample-header_handler.adb
new file mode 100644
index 0000000..77cd187
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-header_handler.adb
@@ -0,0 +1,180 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Header_Handler --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Calendar; use Ada.Calendar;
+with Terminal_Interface.Curses.Text_IO.Integer_IO;
+with Sample.Manifest; use Sample.Manifest;
+
+-- This package handles the painting of the header line of the screen.
+--
+package body Sample.Header_Handler is
+
+ package Int_IO is new
+ Terminal_Interface.Curses.Text_IO.Integer_IO (Integer);
+ use Int_IO;
+
+ Header_Window : Window := Null_Window;
+
+ Display_Hour : Integer := -1; -- hour last displayed
+ Display_Min : Integer := -1; -- minute last displayed
+ Display_Day : Integer := -1; -- day last displayed
+ Display_Month : Integer := -1; -- month last displayed
+
+ -- This is the routine handed over to the curses library to be called
+ -- as initialization routine when ripping of the header lines from
+ -- the screen. This routine must follow C conventions.
+ function Init_Header_Window (Win : Window;
+ Columns : Column_Count) return Integer;
+ pragma Convention (C, Init_Header_Window);
+
+ procedure Internal_Update_Header_Window (Do_Update : in Boolean);
+
+
+ -- The initialization must be called before Init_Screen. It steals two
+ -- lines from the top of the screen.
+ procedure Init_Header_Handler
+ is
+ begin
+ Rip_Off_Lines (2, Init_Header_Window'Access);
+ end Init_Header_Handler;
+
+ procedure N_Out (N : in Integer);
+
+ -- Emit a two digit number and ensure that a leading zero is generated if
+ -- necessary.
+ procedure N_Out (N : in Integer)
+ is
+ begin
+ if N < 10 then
+ Add (Header_Window, '0');
+ Put (Header_Window, N, 1);
+ else
+ Put (Header_Window, N, 2);
+ end if;
+ end N_Out;
+
+ -- Paint the header window. The input parameter is a flag indicating
+ -- whether or not the screen should be updated physically after painting.
+ procedure Internal_Update_Header_Window (Do_Update : in Boolean)
+ is
+ type Month_Name_Array is
+ array (Month_Number'First .. Month_Number'Last) of String (1 .. 9);
+
+ Month_Names : constant Month_Name_Array :=
+ ("January ",
+ "February ",
+ "March ",
+ "April ",
+ "May ",
+ "June ",
+ "July ",
+ "August ",
+ "September",
+ "October ",
+ "November ",
+ "December ");
+
+ Now : Time := Clock;
+ Sec : Integer := Integer (Seconds (Now));
+ Hour : Integer := Sec / 3600;
+ Minute : Integer := (Sec - Hour * 3600) / 60;
+ Mon : Month_Number := Month (Now);
+ D : Day_Number := Day (Now);
+ begin
+ if Header_Window /= Null_Window then
+ if Minute /= Display_Min or else Hour /= Display_Hour
+ or else Display_Day /= D or else Display_Month /= Mon then
+ Move_Cursor (Header_Window, 0, 0);
+ N_Out (D); Add (Header_Window, '.');
+ Add (Header_Window, Month_Names (Mon));
+ Move_Cursor (Header_Window, 1, 0);
+ N_Out (Hour); Add (Header_Window, ':');
+ N_Out (Minute);
+ Display_Min := Minute;
+ Display_Hour := Hour;
+ Display_Month := Mon;
+ Display_Day := D;
+ Refresh_Without_Update (Header_Window);
+ if Do_Update then
+ Update_Screen;
+ end if;
+ end if;
+ end if;
+ end Internal_Update_Header_Window;
+
+ -- This routine is called in the keyboard input timeout handler. So it will
+ -- periodically update the header line of the screen.
+ procedure Update_Header_Window
+ is
+ begin
+ Internal_Update_Header_Window (True);
+ end Update_Header_Window;
+
+ function Init_Header_Window (Win : Window;
+ Columns : Column_Count) return Integer
+ is
+ Title : constant String := "Ada 95 ncurses Binding Sample";
+ Pos : Column_Position;
+ begin
+ Header_Window := Win;
+ if Win /= Null_Window then
+ if Has_Colors then
+ Set_Background (Win => Win,
+ Ch => (Ch => ' ',
+ Color => Header_Color,
+ Attr => Normal_Video));
+ Set_Character_Attributes (Win => Win,
+ Attr => Normal_Video,
+ Color => Header_Color);
+ Erase (Win);
+ end if;
+ Leave_Cursor_After_Update (Win, True);
+ Pos := Columns - Column_Position (Title'Length);
+ Add (Win, 0, Pos / 2, Title);
+ -- In this phase we must not allow a physical update, because
+ -- ncurses isn´t properly initialized at this point.
+ Internal_Update_Header_Window (False);
+ return 0;
+ else
+ return -1;
+ end if;
+ end Init_Header_Window;
+
+end Sample.Header_Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-header_handler.ads b/ncurses-5.2/Ada95/samples/sample-header_handler.ads
new file mode 100644
index 0000000..35973b3
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-header_handler.ads
@@ -0,0 +1,53 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Header_Handler --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+-- This package handles the painting of the header line of the screen.
+--
+package Sample.Header_Handler is
+
+ procedure Init_Header_Handler;
+ -- Initialize the handler for the headerlines.
+
+ procedure Update_Header_Window;
+ -- Update the information in the header window
+
+end Sample.Header_Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-helpers.adb b/ncurses-5.2/Ada95/samples/sample-helpers.adb
new file mode 100644
index 0000000..7b15895
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-helpers.adb
@@ -0,0 +1,69 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Helpers --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+with Sample.Explanation; use Sample.Explanation;
+
+-- This package contains some conveniant helper routines used throughout
+-- this example.
+--
+package body Sample.Helpers is
+
+ procedure Window_Title (Win : in Window;
+ Title : in String)
+ is
+ Height : Line_Count;
+ Width : Column_Count;
+ Pos : Column_Position := 0;
+ begin
+ Get_Size (Win, Height, Width);
+ if Title'Length < Width then
+ Pos := (Width - Title'Length) / 2;
+ end if;
+ Add (Win, 0, Pos, Title);
+ end Window_Title;
+
+ procedure Not_Implemented is
+ begin
+ Explain ("NOTIMPL");
+ end Not_Implemented;
+
+end Sample.Helpers;
diff --git a/ncurses-5.2/Ada95/samples/sample-helpers.ads b/ncurses-5.2/Ada95/samples/sample-helpers.ads
new file mode 100644
index 0000000..f8dc0d9
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-helpers.ads
@@ -0,0 +1,54 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Helpers --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+-- This package contains some conveniant helper routines used throughout
+-- this example.
+--
+package Sample.Helpers is
+
+ procedure Window_Title (Win : in Window;
+ Title : in String);
+ -- Put a title string into the first line of the window
+
+ procedure Not_Implemented;
+
+end Sample.Helpers;
diff --git a/ncurses-5.2/Ada95/samples/sample-keyboard_handler.adb b/ncurses-5.2/Ada95/samples/sample-keyboard_handler.adb
new file mode 100644
index 0000000..8dfda23
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-keyboard_handler.adb
@@ -0,0 +1,191 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Keyboard_Handler --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Strings; use Ada.Strings;
+with Ada.Strings.Fixed; use Ada.Strings.Fixed;
+with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
+with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
+with Ada.Characters.Handling; use Ada.Characters.Handling;
+
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
+with Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
+use Terminal_Interface.Curses.Forms.Field_Types.Enumeration;
+
+with Sample.Header_Handler; use Sample.Header_Handler;
+with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux;
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Form_Demo.Handler;
+
+-- This package contains a centralized keyboard handler used throughout
+-- this example. The handler establishes a timeout mechanism that provides
+-- periodical updates of the common header lines used in this example.
+--
+
+package body Sample.Keyboard_Handler is
+
+ In_Command : Boolean := False;
+
+ function Get_Key (Win : Window := Standard_Window) return Real_Key_Code
+ is
+ K : Real_Key_Code;
+
+ function Command return Real_Key_Code;
+
+
+ function Command return Real_Key_Code
+ is
+ function My_Driver (F : Form;
+ C : Key_Code;
+ P : Panel) return Boolean;
+ package Fh is new Sample.Form_Demo.Handler (My_Driver);
+
+ type Label_Array is array (Label_Number) of String (1 .. 8);
+
+ Labels : Label_Array;
+
+ FA : Field_Array_Access := new Field_Array'
+ (Make (0, 0, "Command:"),
+ Make (Top => 0, Left => 9, Width => Columns - 11),
+ Null_Field);
+
+ K : Real_Key_Code := Key_None;
+ N : Natural := 0;
+
+ function My_Driver (F : Form;
+ C : Key_Code;
+ P : Panel) return Boolean
+ is
+ Ch : Character;
+ begin
+ if C in User_Key_Code'Range and then C = QUIT then
+ if Driver (F, F_Validate_Field) = Form_Ok then
+ K := Key_None;
+ return True;
+ end if;
+ elsif C in Normal_Key_Code'Range then
+ Ch := Character'Val (C);
+ if (Ch = LF or else Ch = CR) then
+ if Driver (F, F_Validate_Field) = Form_Ok then
+ declare
+ Buffer : String (1 .. Positive (Columns - 11));
+ Cmdc : String (1 .. 8);
+ begin
+ Get_Buffer (Fld => FA (2), Str => Buffer);
+ Trim (Buffer, Left);
+ if Buffer (1) /= ' ' then
+ Cmdc := To_Upper (Buffer (Cmdc'Range));
+ for I in Labels'Range loop
+ if Cmdc = Labels (I) then
+ K := Function_Key_Code
+ (Function_Key_Number (I));
+ exit;
+ end if;
+ end loop;
+ end if;
+ return True;
+ end;
+ end if;
+ end if;
+ end if;
+ return False;
+ end My_Driver;
+
+ begin
+ In_Command := True;
+ for I in Label_Number'Range loop
+ Get_Soft_Label_Key (I, Labels (I));
+ Trim (Labels (I), Left);
+ Translate (Labels (I), Upper_Case_Map);
+ if Labels (I) (1) /= ' ' then
+ N := N + 1;
+ end if;
+ end loop;
+ if N > 0 then -- some labels were really set
+ declare
+ Enum_Info : Enumeration_Info (N);
+ Enum_Field : Enumeration_Field;
+ J : Positive := Enum_Info.Names'First;
+
+ Frm : Form := Create (FA);
+
+ begin
+ for I in Label_Number'Range loop
+ if Labels (I) (1) /= ' ' then
+ Enum_Info.Names (J) := new String'(Labels (I));
+ J := J + 1;
+ end if;
+ end loop;
+ Enum_Field := Create (Enum_Info, True);
+ Set_Field_Type (FA (2), Enum_Field);
+ Set_Background (FA (2), Normal_Video);
+
+ Fh.Drive_Me (Frm, Lines - 3, 0);
+ Delete (Frm);
+ Update_Panels; Update_Screen;
+ end;
+ end if;
+ Free (FA, True);
+ In_Command := False;
+ return K;
+ end Command;
+
+ begin
+ Set_Timeout_Mode (Win, Delayed, 30000);
+ loop
+ K := Get_Keystroke (Win);
+ if K = Key_None then -- a timeout occured
+ Update_Header_Window;
+ elsif K = 3 and then not In_Command then -- CTRL-C
+ K := Command;
+ exit when K /= Key_None;
+ else
+ exit;
+ end if;
+ end loop;
+ return K;
+ end Get_Key;
+
+ procedure Init_Keyboard_Handler is
+ begin
+ null;
+ end Init_Keyboard_Handler;
+
+end Sample.Keyboard_Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-keyboard_handler.ads b/ncurses-5.2/Ada95/samples/sample-keyboard_handler.ads
new file mode 100644
index 0000000..5601aa4
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-keyboard_handler.ads
@@ -0,0 +1,55 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Keyboard_Handler --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+-- This package contains a centralized keyboard handler used throughout
+-- this example. The handler establishes a timeout mechanism that provides
+-- periodical updates of the common header lines used in this example.
+--
+package Sample.Keyboard_Handler is
+
+ function Get_Key (Win : Window := Standard_Window) return Real_Key_Code;
+ -- The central routine for handling keystrokes.
+
+ procedure Init_Keyboard_Handler;
+ -- Initialize the keyboard
+
+end Sample.Keyboard_Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-manifest.ads b/ncurses-5.2/Ada95/samples/sample-manifest.ads
new file mode 100644
index 0000000..7ed79e1
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-manifest.ads
@@ -0,0 +1,67 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Manifest --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+
+package Sample.Manifest is
+
+ QUIT : constant User_Key_Code := User_Key_Code'First;
+ SELECT_ITEM : constant User_Key_Code := QUIT + 1;
+
+ FKEY_HELP : constant Label_Number := 1;
+ HELP_CODE : constant Special_Key_Code := Key_F1;
+ FKEY_EXPLAIN : constant Label_Number := 2;
+ EXPLAIN_CODE : constant Special_Key_Code := Key_F2;
+ FKEY_QUIT : constant Label_Number := 3;
+ QUIT_CODE : constant Special_Key_Code := Key_F3;
+
+ Menu_Marker : constant String := "=> ";
+
+ Default_Colors : constant Redefinable_Color_Pair := 1;
+ Menu_Fore_Color : constant Redefinable_Color_Pair := 2;
+ Menu_Back_Color : constant Redefinable_Color_Pair := 3;
+ Menu_Grey_Color : constant Redefinable_Color_Pair := 4;
+ Form_Fore_Color : constant Redefinable_Color_Pair := 5;
+ Form_Back_Color : constant Redefinable_Color_Pair := 6;
+ Notepad_Color : constant Redefinable_Color_Pair := 7;
+ Help_Color : constant Redefinable_Color_Pair := 8;
+ Header_Color : constant Redefinable_Color_Pair := 9;
+
+end Sample.Manifest;
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.adb b/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.adb
new file mode 100644
index 0000000..2c1931c
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.adb
@@ -0,0 +1,204 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo.Aux --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Characters.Latin_1; use Ada.Characters.Latin_1;
+
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Helpers; use Sample.Helpers;
+with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
+with Sample.Explanation; use Sample.Explanation;
+
+package body Sample.Menu_Demo.Aux is
+
+ procedure Geometry (M : in Menu;
+ L : out Line_Count;
+ C : out Column_Count;
+ Y : out Line_Position;
+ X : out Column_Position;
+ Fy : out Line_Position;
+ Fx : out Column_Position);
+
+ procedure Geometry (M : in Menu;
+ L : out Line_Count; -- Lines used for menu
+ C : out Column_Count; -- Columns used for menu
+ Y : out Line_Position; -- Proposed Line for menu
+ X : out Column_Position; -- Proposed Column for menu
+ Fy : out Line_Position; -- Vertical inner frame
+ Fx : out Column_Position) -- Horiz. inner frame
+ is
+ Spc_Desc : Column_Position; -- spaces between description and item
+ begin
+ Set_Mark (M, Menu_Marker);
+
+ Spacing (M, Spc_Desc, Fy, Fx);
+ Scale (M, L, C);
+
+ Fx := Fx + Column_Position (Fy - 1); -- looks a bit nicer
+
+ L := L + 2 * Fy; -- count for frame at top and bottom
+ C := C + 2 * Fx; -- "
+
+ -- Calculate horizontal coordinate at the screen center
+ X := (Columns - C) / 2;
+ Y := 1; -- always startin line 1
+
+ end Geometry;
+
+ procedure Geometry (M : in Menu;
+ L : out Line_Count; -- Lines used for menu
+ C : out Column_Count; -- Columns used for menu
+ Y : out Line_Position; -- Proposed Line for menu
+ X : out Column_Position) -- Proposed Column for menu
+ is
+ Fy : Line_Position;
+ Fx : Column_Position;
+ begin
+ Geometry (M, L, C, Y, X, Fy, Fx);
+ end Geometry;
+
+ function Create (M : Menu;
+ Title : String;
+ Lin : Line_Position;
+ Col : Column_Position) return Panel
+ is
+ W, S : Window;
+ L : Line_Count;
+ C : Column_Count;
+ Y, Fy : Line_Position;
+ X, Fx : Column_Position;
+ Pan : Panel;
+ begin
+ Geometry (M, L, C, Y, X, Fy, Fx);
+ W := New_Window (L, C, Lin, Col);
+ Set_Meta_Mode (W);
+ Set_KeyPad_Mode (W);
+ if Has_Colors then
+ Set_Background (Win => W,
+ Ch => (Ch => ' ',
+ Color => Menu_Back_Color,
+ Attr => Normal_Video));
+ Set_Foreground (Men => M, Color => Menu_Fore_Color);
+ Set_Background (Men => M, Color => Menu_Back_Color);
+ Set_Grey (Men => M, Color => Menu_Grey_Color);
+ Erase (W);
+ end if;
+ S := Derived_Window (W, L - Fy, C - Fx, Fy, Fx);
+ Set_Meta_Mode (S);
+ Set_KeyPad_Mode (S);
+ Box (W);
+ Set_Window (M, W);
+ Set_Sub_Window (M, S);
+ if Title'Length > 0 then
+ Window_Title (W, Title);
+ end if;
+ Pan := New_Panel (W);
+ Post (M);
+ return Pan;
+ end Create;
+
+ procedure Destroy (M : in Menu;
+ P : in out Panel)
+ is
+ W, S : Window;
+ begin
+ W := Get_Window (M);
+ S := Get_Sub_Window (M);
+ Post (M, False);
+ Erase (W);
+ Delete (P);
+ Set_Window (M, Null_Window);
+ Set_Sub_Window (M, Null_Window);
+ Delete (S);
+ Delete (W);
+ Update_Panels;
+ end Destroy;
+
+ function Get_Request (M : Menu; P : Panel) return Key_Code
+ is
+ W : constant Window := Get_Window (M);
+ K : Real_Key_Code;
+ Ch : Character;
+ begin
+ Top (P);
+ loop
+ K := Get_Key (W);
+ if K in Special_Key_Code'Range then
+ case K is
+ when HELP_CODE => Explain_Context;
+ when EXPLAIN_CODE => Explain ("MENUKEYS");
+ when Key_Home => return REQ_FIRST_ITEM;
+ when QUIT_CODE => return QUIT;
+ when Key_Cursor_Down => return REQ_DOWN_ITEM;
+ when Key_Cursor_Up => return REQ_UP_ITEM;
+ when Key_Cursor_Left => return REQ_LEFT_ITEM;
+ when Key_Cursor_Right => return REQ_RIGHT_ITEM;
+ when Key_End => return REQ_LAST_ITEM;
+ when Key_Backspace => return REQ_BACK_PATTERN;
+ when Key_Next_Page => return REQ_SCR_DPAGE;
+ when Key_Previous_Page => return REQ_SCR_UPAGE;
+ when others => return K;
+ end case;
+ elsif K in Normal_Key_Code'Range then
+ Ch := Character'Val (K);
+ case Ch is
+ when CAN => return QUIT; -- CTRL-X
+ when SO => return REQ_NEXT_ITEM; -- CTRL-N
+ when DLE => return REQ_PREV_ITEM; -- CTRL-P
+ when NAK => return REQ_SCR_ULINE; -- CTRL-U
+ when EOT => return REQ_SCR_DLINE; -- CTRL-D
+ when ACK => return REQ_SCR_DPAGE; -- CTRL-F
+ when STX => return REQ_SCR_UPAGE; -- CTRL-B
+ when EM => return REQ_CLEAR_PATTERN; -- CTRL-Y
+ when BS => return REQ_BACK_PATTERN; -- CTRL-H
+ when SOH => return REQ_NEXT_MATCH; -- CTRL-A
+ when ENQ => return REQ_PREV_MATCH; -- CTRL-E
+ when DC4 => return REQ_TOGGLE_ITEM; -- CTRL-T
+
+ when CR | LF => return SELECT_ITEM;
+ when others => return K;
+ end case;
+ else
+ return K;
+ end if;
+ end loop;
+ end Get_Request;
+
+end Sample.Menu_Demo.Aux;
+
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.ads b/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.ads
new file mode 100644
index 0000000..88de9bd
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo-aux.ads
@@ -0,0 +1,71 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo.Aux --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Menus; use Terminal_Interface.Curses.Menus;
+
+package Sample.Menu_Demo.Aux is
+
+ procedure Geometry (M : in Menu;
+ L : out Line_Count;
+ C : out Column_Count;
+ Y : out Line_Position;
+ X : out Column_Position);
+ -- Calculate the geometry for a panel beeing able to be used to display
+ -- the menu.
+
+ function Create (M : Menu;
+ Title : String;
+ Lin : Line_Position;
+ Col : Column_Position) return Panel;
+ -- Create a panel decorated with a frame and the title at the specified
+ -- position. The dimension of the panel is derived from the menus layout.
+
+ procedure Destroy (M : in Menu;
+ P : in out Panel);
+ -- Destroy all the windowing structures associated with this menu and
+ -- panel.
+
+ function Get_Request (M : Menu; P : Panel) return Key_Code;
+ -- Centralized request driver for all menus in this sample. This
+ -- gives us a common key binding for all menus.
+
+end Sample.Menu_Demo.Aux;
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.adb b/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.adb
new file mode 100644
index 0000000..90f4e39
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.adb
@@ -0,0 +1,107 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo.Handler --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Sample.Menu_Demo.Aux;
+with Sample.Manifest; use Sample.Manifest;
+with Terminal_Interface.Curses.Mouse; use Terminal_Interface.Curses.Mouse;
+
+package body Sample.Menu_Demo.Handler is
+
+ package Aux renames Sample.Menu_Demo.Aux;
+
+ procedure Drive_Me (M : in Menu;
+ Title : in String := "")
+ is
+ L : Line_Count;
+ C : Column_Count;
+ Y : Line_Position;
+ X : Column_Position;
+ begin
+ Aux.Geometry (M, L, C, Y, X);
+ Drive_Me (M, Y, X, Title);
+ end Drive_Me;
+
+ procedure Drive_Me (M : in Menu;
+ Lin : in Line_Position;
+ Col : in Column_Position;
+ Title : in String := "")
+ is
+ Mask : Event_Mask := No_Events;
+ Old : Event_Mask;
+ Pan : Panel := Aux.Create (M, Title, Lin, Col);
+ V : Cursor_Visibility := Invisible;
+ begin
+ -- We are only interested in Clicks with the left button
+ Register_Reportable_Events (Left, All_Clicks, Mask);
+ Old := Start_Mouse (Mask);
+ Set_Cursor_Visibility (V);
+ loop
+ declare
+ K : Key_Code := Aux.Get_Request (M, Pan);
+ R : Driver_Result := Driver (M, K);
+ begin
+ case R is
+ when Menu_Ok => null;
+ when Unknown_Request =>
+ declare
+ I : constant Item := Current (M);
+ O : Item_Option_Set;
+ begin
+ if K = Key_Mouse then
+ K := SELECT_ITEM;
+ end if;
+ Get_Options (I, O);
+ if K = SELECT_ITEM and then not O.Selectable then
+ Beep;
+ else
+ if My_Driver (M, K, Pan) then
+ exit;
+ end if;
+ end if;
+ end;
+ when others => Beep;
+ end case;
+ end;
+ end loop;
+ End_Mouse (Old);
+ Aux.Destroy (M, Pan);
+ end Drive_Me;
+
+end Sample.Menu_Demo.Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.ads b/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.ads
new file mode 100644
index 0000000..7e58ace
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo-handler.ads
@@ -0,0 +1,64 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo.Handler --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Menus;
+use Terminal_Interface.Curses.Menus;
+
+generic
+ with function My_Driver (Men : Menu;
+ K : Key_Code;
+ Pan : Panel) return Boolean;
+package Sample.Menu_Demo.Handler is
+
+ procedure Drive_Me (M : in Menu;
+ Lin : in Line_Position;
+ Col : in Column_Position;
+ Title : in String := "");
+ -- Position the menu at the given point and drive it.
+
+ procedure Drive_Me (M : in Menu;
+ Title : in String := "");
+ -- Center menu and drive it.
+
+end Sample.Menu_Demo.Handler;
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo.adb b/ncurses-5.2/Ada95/samples/sample-menu_demo.adb
new file mode 100644
index 0000000..3a2c21e
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo.adb
@@ -0,0 +1,390 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- 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.Menus; use Terminal_Interface.Curses.Menus;
+with Terminal_Interface.Curses.Menus.Menu_User_Data;
+with Terminal_Interface.Curses.Menus.Item_User_Data;
+
+with Sample.Manifest; use Sample.Manifest;
+with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
+with Sample.Menu_Demo.Handler;
+with Sample.Helpers; use Sample.Helpers;
+with Sample.Explanation; use Sample.Explanation;
+
+package body Sample.Menu_Demo is
+
+ package Spacing_Demo is
+ procedure Spacing_Test;
+ end Spacing_Demo;
+
+ package body Spacing_Demo is
+
+ procedure Spacing_Test
+ is
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ P : Panel) return Boolean;
+
+ procedure Set_Option_Key;
+ procedure Set_Select_Key;
+ procedure Set_Description_Key;
+ procedure Set_Hide_Key;
+
+ package Mh is new Sample.Menu_Demo.Handler (My_Driver);
+
+ I : Item_Array_Access := new Item_Array'
+ (New_Item ("January", "31 Days"),
+ New_Item ("February", "28/29 Days"),
+ New_Item ("March", "31 Days"),
+ New_Item ("April", "30 Days"),
+ New_Item ("May", "31 Days"),
+ New_Item ("June", "30 Days"),
+ New_Item ("July", "31 Days"),
+ New_Item ("August", "31 Days"),
+ New_Item ("September", "30 Days"),
+ New_Item ("October", "31 Days"),
+ New_Item ("November", "30 Days"),
+ New_Item ("December", "31 Days"),
+ Null_Item);
+
+ M : Menu := New_Menu (I);
+ Flip_State : Boolean := True;
+ Hide_Long : Boolean := False;
+
+ type Format_Code is (Four_By_1, Four_By_2, Four_By_3);
+ type Operations is (Flip, Reorder, Reformat, Reselect, Describe);
+
+ type Change is array (Operations) of Boolean;
+ pragma Pack (Change);
+ No_Change : constant Change := Change'(others => False);
+
+ Current_Format : Format_Code := Four_By_1;
+ To_Change : Change := No_Change;
+
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ P : Panel) return Boolean
+ is
+ begin
+ To_Change := No_Change;
+ if K in User_Key_Code'Range then
+ if K = QUIT then
+ return True;
+ end if;
+ end if;
+ if K in Special_Key_Code'Range then
+ case K is
+ when Key_F4 =>
+ To_Change (Flip) := True;
+ return True;
+ when Key_F5 =>
+ To_Change (Reformat) := True;
+ Current_Format := Four_By_1;
+ return True;
+ when Key_F6 =>
+ To_Change (Reformat) := True;
+ Current_Format := Four_By_2;
+ return True;
+ when Key_F7 =>
+ To_Change (Reformat) := True;
+ Current_Format := Four_By_3;
+ return True;
+ when Key_F8 =>
+ To_Change (Reorder) := True;
+ return True;
+ when Key_F9 =>
+ To_Change (Reselect) := True;
+ return True;
+ when Key_F10 =>
+ if Current_Format /= Four_By_3 then
+ To_Change (Describe) := True;
+ return True;
+ else
+ return False;
+ end if;
+ when Key_F11 =>
+ Hide_Long := not Hide_Long;
+ declare
+ O : Item_Option_Set;
+ begin
+ for J in I'Range loop
+ Get_Options (I (J), O);
+ O.Selectable := True;
+ if Hide_Long then
+ case J is
+ when 1 | 3 | 5 | 7 | 8 | 10 | 12 =>
+ O.Selectable := False;
+ when others => null;
+ end case;
+ end if;
+ Set_Options (I (J), O);
+ end loop;
+ end;
+ return False;
+ when others => null;
+ end case;
+ end if;
+ return False;
+ end My_Driver;
+
+ procedure Set_Option_Key
+ is
+ O : Menu_Option_Set;
+ begin
+ if Current_Format = Four_By_1 then
+ Set_Soft_Label_Key (8, "");
+ else
+ Get_Options (M, O);
+ if O.Row_Major_Order then
+ Set_Soft_Label_Key (8, "O-Col");
+ else
+ Set_Soft_Label_Key (8, "O-Row");
+ end if;
+ end if;
+ Refresh_Soft_Label_Keys_Without_Update;
+ end Set_Option_Key;
+
+ procedure Set_Select_Key
+ is
+ O : Menu_Option_Set;
+ begin
+ Get_Options (M, O);
+ if O.One_Valued then
+ Set_Soft_Label_Key (9, "Multi");
+ else
+ Set_Soft_Label_Key (9, "Singl");
+ end if;
+ Refresh_Soft_Label_Keys_Without_Update;
+ end Set_Select_Key;
+
+ procedure Set_Description_Key
+ is
+ O : Menu_Option_Set;
+ begin
+ if Current_Format = Four_By_3 then
+ Set_Soft_Label_Key (10, "");
+ else
+ Get_Options (M, O);
+ if O.Show_Descriptions then
+ Set_Soft_Label_Key (10, "-Desc");
+ else
+ Set_Soft_Label_Key (10, "+Desc");
+ end if;
+ end if;
+ Refresh_Soft_Label_Keys_Without_Update;
+ end Set_Description_Key;
+
+ procedure Set_Hide_Key
+ is
+ begin
+ if Hide_Long then
+ Set_Soft_Label_Key (11, "Enab");
+ else
+ Set_Soft_Label_Key (11, "Disab");
+ end if;
+ Refresh_Soft_Label_Keys_Without_Update;
+ end Set_Hide_Key;
+
+ begin
+ Push_Environment ("MENU01");
+ Notepad ("MENU-PAD01");
+ Default_Labels;
+ Set_Soft_Label_Key (4, "Flip");
+ Set_Soft_Label_Key (5, "4x1");
+ Set_Soft_Label_Key (6, "4x2");
+ Set_Soft_Label_Key (7, "4x3");
+ Set_Option_Key;
+ Set_Select_Key;
+ Set_Description_Key;
+ Set_Hide_Key;
+
+ Set_Format (M, 4, 1);
+ loop
+ Mh.Drive_Me (M);
+ exit when To_Change = No_Change;
+ if To_Change (Flip) then
+ if Flip_State then
+ Flip_State := False;
+ Set_Spacing (M, 3, 2, 0);
+ else
+ Flip_State := True;
+ Set_Spacing (M);
+ end if;
+ elsif To_Change (Reformat) then
+ case Current_Format is
+ when Four_By_1 => Set_Format (M, 4, 1);
+ when Four_By_2 => Set_Format (M, 4, 2);
+ when Four_By_3 =>
+ declare
+ O : Menu_Option_Set;
+ begin
+ Get_Options (M, O);
+ O.Show_Descriptions := False;
+ Set_Options (M, O);
+ Set_Format (M, 4, 3);
+ end;
+ end case;
+ Set_Option_Key;
+ Set_Description_Key;
+ elsif To_Change (Reorder) then
+ declare
+ O : Menu_Option_Set;
+ begin
+ Get_Options (M, O);
+ O.Row_Major_Order := not O.Row_Major_Order;
+ Set_Options (M, O);
+ Set_Option_Key;
+ end;
+ elsif To_Change (Reselect) then
+ declare
+ O : Menu_Option_Set;
+ begin
+ Get_Options (M, O);
+ O.One_Valued := not O.One_Valued;
+ Set_Options (M, O);
+ Set_Select_Key;
+ end;
+ elsif To_Change (Describe) then
+ declare
+ O : Menu_Option_Set;
+ begin
+ Get_Options (M, O);
+ O.Show_Descriptions := not O.Show_Descriptions;
+ Set_Options (M, O);
+ Set_Description_Key;
+ end;
+ else
+ null;
+ end if;
+ end loop;
+ Set_Spacing (M);
+ Flip_State := True;
+
+ Pop_Environment;
+ pragma Assert (Get_Index (Items (M, 1)) = Get_Index (I (1)));
+ Delete (M);
+ Free (I, True);
+ end Spacing_Test;
+ end Spacing_Demo;
+
+ procedure Demo
+ is
+ -- We use this datatype only to test the instantiation of
+ -- the Menu_User_Data generic package. No functionality
+ -- behind it.
+ type User_Data is new Integer;
+ type User_Data_Access is access User_Data;
+
+ -- Those packages are only instantiated to test the usability.
+ -- No real functionality is shown in the demo.
+ package MUD is new Menu_User_Data (User_Data, User_Data_Access);
+ package IUD is new Item_User_Data (User_Data, User_Data_Access);
+
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ P : Panel) return Boolean;
+
+ package Mh is new Sample.Menu_Demo.Handler (My_Driver);
+
+ Itm : Item_Array_Access := new Item_Array'
+ (New_Item ("Menu Layout Options"),
+ New_Item ("Demo of Hook functions"),
+ Null_Item);
+ M : Menu := New_Menu (Itm);
+
+ U1 : User_Data_Access := new User_Data'(4711);
+ U2 : User_Data_Access;
+ U3 : User_Data_Access := new User_Data'(4712);
+ U4 : User_Data_Access;
+
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ P : Panel) return Boolean
+ is
+ Idx : constant Positive := Get_Index (Current (M));
+ begin
+ if K in User_Key_Code'Range then
+ if K = QUIT then
+ return True;
+ elsif K = SELECT_ITEM then
+ if Idx in Itm'Range then
+ Hide (P);
+ Update_Panels;
+ end if;
+ case Idx is
+ when 1 => Spacing_Demo.Spacing_Test;
+ when others => Not_Implemented;
+ end case;
+ if Idx in Itm'Range then
+ Top (P);
+ Show (P);
+ Update_Panels;
+ Update_Screen;
+ end if;
+ end if;
+ end if;
+ return False;
+ end My_Driver;
+ begin
+ Push_Environment ("MENU00");
+ Notepad ("MENU-PAD00");
+ Default_Labels;
+ Refresh_Soft_Label_Keys_Without_Update;
+ Set_Pad_Character (M, '|');
+
+ MUD.Set_User_Data (M, U1);
+ IUD.Set_User_Data (Itm (1), U3);
+
+ Mh.Drive_Me (M);
+
+ MUD.Get_User_Data (M, U2);
+ pragma Assert (U1 = U2 and U1.all = 4711);
+
+ IUD.Get_User_Data (Itm (1), U4);
+ pragma Assert (U3 = U4 and U3.all = 4712);
+
+ Pop_Environment;
+ Delete (M);
+ Free (Itm, True);
+ end Demo;
+
+end Sample.Menu_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-menu_demo.ads b/ncurses-5.2/Ada95/samples/sample-menu_demo.ads
new file mode 100644
index 0000000..d147789
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-menu_demo.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Menu_Demo --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Menu_Demo is
+
+ procedure Demo;
+
+end Sample.Menu_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-my_field_type.adb b/ncurses-5.2/Ada95/samples/sample-my_field_type.adb
new file mode 100644
index 0000000..42937a3
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-my_field_type.adb
@@ -0,0 +1,65 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.My_Field_Type --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
+
+-- This is a very simple user defined field type. It accepts only a
+-- defined character as input into the field.
+--
+package body Sample.My_Field_Type is
+
+ -- That's simple. There are no field validity checks.
+ function Field_Check (Fld : Field;
+ Typ : My_Data) return Boolean
+ is
+ begin
+ return True;
+ end Field_Check;
+
+ -- Check exactly against the specified character.
+ function Character_Check (Ch : Character;
+ Typ : My_Data) return Boolean
+ is
+ C : constant Character := Typ.Ch;
+ begin
+ return Ch = C;
+ end Character_Check;
+
+end Sample.My_Field_Type;
diff --git a/ncurses-5.2/Ada95/samples/sample-my_field_type.ads b/ncurses-5.2/Ada95/samples/sample-my_field_type.ads
new file mode 100644
index 0000000..d35e475
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-my_field_type.ads
@@ -0,0 +1,62 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.My_Field_Type --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
+with Terminal_Interface.Curses.Forms.Field_Types.User;
+use Terminal_Interface.Curses.Forms.Field_Types.User;
+
+-- This is a very simple user defined field type. It accepts only a
+-- defined character as input into the field.
+--
+package Sample.My_Field_Type is
+
+ type My_Data is new User_Defined_Field_Type with
+ record
+ Ch : Character;
+ end record;
+
+ function Field_Check (Fld : Field;
+ Typ : My_Data) return Boolean;
+
+ function Character_Check (Ch : Character;
+ Typ : My_Data) return Boolean;
+
+end Sample.My_Field_Type;
+
diff --git a/ncurses-5.2/Ada95/samples/sample-text_io_demo.adb b/ncurses-5.2/Ada95/samples/sample-text_io_demo.adb
new file mode 100644
index 0000000..743c161
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-text_io_demo.adb
@@ -0,0 +1,180 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Text_IO_Demo --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Ada.Numerics.Generic_Elementary_Functions;
+with Ada.Numerics.Complex_Types;
+use Ada.Numerics.Complex_Types;
+
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+with Terminal_Interface.Curses.Text_IO;
+use Terminal_Interface.Curses.Text_IO;
+with Terminal_Interface.Curses.Text_IO.Integer_IO;
+with Terminal_Interface.Curses.Text_IO.Float_IO;
+with Terminal_Interface.Curses.Text_IO.Enumeration_IO;
+with Terminal_Interface.Curses.Text_IO.Complex_IO;
+with Terminal_Interface.Curses.Text_IO.Fixed_IO;
+with Terminal_Interface.Curses.Text_IO.Decimal_IO;
+with Terminal_Interface.Curses.Text_IO.Modular_IO;
+
+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.Explanation; use Sample.Explanation;
+
+package body Sample.Text_IO_Demo is
+
+ type Weekday is (Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday);
+
+ type Fix is delta 0.1 range 0.0 .. 4.0;
+ type Dec is delta 0.01 digits 5 range 0.0 .. 4.0;
+ type Md is mod 5;
+
+ package Math is new
+ Ada.Numerics.Generic_Elementary_Functions (Float);
+
+ package Int_IO is new
+ Terminal_Interface.Curses.Text_IO.Integer_IO (Integer);
+ use Int_IO;
+
+ package Real_IO is new
+ Terminal_Interface.Curses.Text_IO.Float_IO (Float);
+ use Real_IO;
+
+ package Enum_IO is new
+ Terminal_Interface.Curses.Text_IO.Enumeration_IO (Weekday);
+ use Enum_IO;
+
+ package C_IO is new
+ Terminal_Interface.Curses.Text_IO.Complex_IO (Ada.Numerics.Complex_Types);
+ use C_IO;
+
+ package F_IO is new
+ Terminal_Interface.Curses.Text_IO.Fixed_IO (Fix);
+ use F_IO;
+
+ package D_IO is new
+ Terminal_Interface.Curses.Text_IO.Decimal_IO (Dec);
+ use D_IO;
+
+ package M_IO is new
+ Terminal_Interface.Curses.Text_IO.Modular_IO (Md);
+ use M_IO;
+
+ procedure Demo
+ is
+ W : Window;
+ P : Panel := Create (Standard_Window);
+ K : Real_Key_Code;
+ Im : Complex := (0.0, 1.0);
+ Fx : Fix := 3.14;
+ Dc : Dec := 2.72;
+ L : Md;
+
+ begin
+ Push_Environment ("TEXTIO");
+ Default_Labels;
+ Notepad ("TEXTIO-PAD00");
+
+ Set_Echo_Mode (False);
+ Set_Meta_Mode;
+ Set_KeyPad_Mode;
+ W := Sub_Window (Standard_Window, Lines - 2, Columns - 2, 1, 1);
+ Box;
+ Refresh_Without_Update;
+ Set_Meta_Mode (W);
+ Set_KeyPad_Mode (W);
+ Immediate_Update_Mode (W, True);
+
+ Set_Window (W);
+
+ for I in 1 .. 10 loop
+ Put ("Square root of ");
+ Put (Item => I, Width => 5);
+ Put (" is ");
+ Put (Item => Math.Sqrt (Float (I)), Exp => 0, Aft => 7);
+ New_Line;
+ end loop;
+
+ for W in Weekday loop
+ Put (Item => W); Put (' ');
+ end loop;
+ New_Line;
+
+ L := Md'First;
+ for I in 1 .. 2 loop
+ for J in Md'Range loop
+ Put (L); Put (' ');
+ L := L + 1;
+ end loop;
+ end loop;
+ New_Line;
+
+ Put (Im); New_Line;
+ Put (Fx); New_Line;
+ Put (Dc); New_Line;
+
+ loop
+ K := Get_Key;
+ if K in Special_Key_Code'Range then
+ case K is
+ when QUIT_CODE => exit;
+ when HELP_CODE => Explain_Context;
+ when EXPLAIN_CODE => Explain ("TEXTIOKEYS");
+ when others => null;
+ end case;
+ end if;
+ end loop;
+
+ Set_Window (Null_Window);
+ Erase; Refresh_Without_Update;
+ Delete (P);
+ Delete (W);
+
+ Pop_Environment;
+ end Demo;
+
+end Sample.Text_IO_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample-text_io_demo.ads b/ncurses-5.2/Ada95/samples/sample-text_io_demo.ads
new file mode 100644
index 0000000..171bc58
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample-text_io_demo.ads
@@ -0,0 +1,45 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample.Text_IO_Demo --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample.Text_IO_Demo is
+
+ procedure Demo;
+
+end Sample.Text_IO_Demo;
diff --git a/ncurses-5.2/Ada95/samples/sample.adb b/ncurses-5.2/Ada95/samples/sample.adb
new file mode 100644
index 0000000..4dd064d
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample.adb
@@ -0,0 +1,218 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Text_IO;
+
+with Ada.Exceptions; use Ada.Exceptions;
+
+with Terminal_Interface.Curses; use Terminal_Interface.Curses;
+with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
+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 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.Header_Handler; use Sample.Header_Handler;
+with Sample.Explanation; use Sample.Explanation;
+
+with Sample.Menu_Demo.Handler;
+with Sample.Curses_Demo;
+with Sample.Form_Demo;
+with Sample.Menu_Demo;
+with Sample.Text_IO_Demo;
+
+with GNAT.OS_Lib;
+
+package body Sample is
+
+ type User_Data is
+ record
+ Data : Integer;
+ end record;
+ type User_Access is access User_Data;
+
+ package Ud is new
+ Terminal_Interface.Curses.Menus.Menu_User_Data
+ (User_Data, User_Access);
+
+ package Id is new
+ Terminal_Interface.Curses.Menus.Item_User_Data
+ (User_Data, User_Access);
+
+ procedure Whow is
+ procedure Main_Menu;
+ procedure Main_Menu
+ is
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ Pan : Panel) return Boolean;
+
+ package Mh is new Sample.Menu_Demo.Handler (My_Driver);
+
+ 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"),
+ Null_Item);
+
+ M : Menu := New_Menu (I);
+
+ D1, D2 : User_Access;
+ I1, I2 : User_Access;
+
+ function My_Driver (M : Menu;
+ K : Key_Code;
+ Pan : Panel) return Boolean
+ is
+ Idx : constant Positive := Get_Index (Current (M));
+ begin
+ if K in User_Key_Code'Range then
+ if K = QUIT then
+ return True;
+ elsif K = SELECT_ITEM then
+ if Idx in 1 .. 4 then
+ Hide (Pan);
+ Update_Panels;
+ end if;
+ case Idx is
+ when 1 => Sample.Curses_Demo.Demo;
+ when 2 => Sample.Menu_Demo.Demo;
+ when 3 => Sample.Form_Demo.Demo;
+ when 4 => Sample.Text_IO_Demo.Demo;
+ when others => null;
+ end case;
+ if Idx in 1 .. 4 then
+ Top (Pan);
+ Show (Pan);
+ Update_Panels;
+ Update_Screen;
+ end if;
+ end if;
+ end if;
+ return False;
+ end My_Driver;
+
+ begin
+
+ if (1 + Item_Count (M)) /= I'Length then
+ raise Constraint_Error;
+ end if;
+
+ D1 := new User_Data'(Data => 4711);
+ Ud.Set_User_Data (M, D1);
+
+ I1 := new User_Data'(Data => 1174);
+ Id.Set_User_Data (I (1), I1);
+
+ Set_Spacing (Men => M, Row => 2);
+
+ Default_Labels;
+ Notepad ("MAINPAD");
+
+ Mh.Drive_Me (M, " Demo ");
+
+ Ud.Get_User_Data (M, D2);
+ pragma Assert (D1 = D2);
+ pragma Assert (D1.Data = D2.Data);
+
+ Id.Get_User_Data (I (1), I2);
+ pragma Assert (I1 = I2);
+ pragma Assert (I1.Data = I2.Data);
+
+ Delete (M);
+ Free (I, True);
+ end Main_Menu;
+
+ begin
+ Initialize (PC_Style_With_Index);
+ Init_Header_Handler;
+ Init_Screen;
+
+ if Has_Colors then
+ Start_Color;
+
+ Init_Pair (Pair => Default_Colors, Fore => Black, Back => White);
+ Init_Pair (Pair => Menu_Back_Color, Fore => Black, Back => Cyan);
+ Init_Pair (Pair => Menu_Fore_Color, Fore => Red, Back => Cyan);
+ Init_Pair (Pair => Menu_Grey_Color, Fore => White, Back => Cyan);
+ Init_Pair (Pair => Notepad_Color, Fore => Black, Back => Yellow);
+ Init_Pair (Pair => Help_Color, Fore => Blue, Back => Cyan);
+ Init_Pair (Pair => Form_Back_Color, Fore => Black, Back => Cyan);
+ Init_Pair (Pair => Form_Fore_Color, Fore => Red, Back => Cyan);
+ Init_Pair (Pair => Header_Color, Fore => Black, Back => Green);
+
+ Set_Background (Ch => (Color => Default_Colors,
+ Attr => Normal_Video,
+ Ch => ' '));
+ Set_Character_Attributes (Attr => Normal_Video,
+ Color => Default_Colors);
+ Erase;
+
+ Set_Soft_Label_Key_Attributes (Color => Header_Color);
+ -- This propagates the attributes to the label window
+ Clear_Soft_Label_Keys; Restore_Soft_Label_Keys;
+ end if;
+
+ Init_Keyboard_Handler;
+
+ Set_Echo_Mode (False);
+ Set_Raw_Mode;
+ Set_Meta_Mode;
+ Set_KeyPad_Mode;
+
+ -- Initialize the Function Key Environment
+ -- We have some fixed key throughout this sample
+ Main_Menu;
+ End_Windows;
+
+ exception
+ when Event : others =>
+ Terminal_Interface.Curses.End_Windows;
+ Text_IO.Put ("Exception: ");
+ Text_IO.Put (Exception_Name (Event));
+ Text_IO.New_Line;
+ GNAT.OS_Lib.OS_Exit (1);
+
+ end Whow;
+
+end Sample;
diff --git a/ncurses-5.2/Ada95/samples/sample.ads b/ncurses-5.2/Ada95/samples/sample.ads
new file mode 100644
index 0000000..7558876
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/sample.ads
@@ -0,0 +1,43 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Sample --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+package Sample is
+ procedure Whow;
+end Sample;
diff --git a/ncurses-5.2/Ada95/samples/status.adb b/ncurses-5.2/Ada95/samples/status.adb
new file mode 100644
index 0000000..0bdbad2
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/status.adb
@@ -0,0 +1,56 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Status --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- This package has been contributed by Laurent Pautet <pautet@gnat.com> --
+-- --
+package body Status is
+
+ protected body Process is
+ procedure Stop is
+ begin
+ Done := True;
+ end Stop;
+ function Continue return Boolean is
+ begin
+ return not Done;
+ end Continue;
+ end Process;
+
+end Status;
diff --git a/ncurses-5.2/Ada95/samples/status.ads b/ncurses-5.2/Ada95/samples/status.ads
new file mode 100644
index 0000000..90e1a1b
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/status.ads
@@ -0,0 +1,59 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Status --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+-- This package has been contributed by Laurent Pautet <pautet@gnat.com> --
+-- --
+with Ada.Interrupts.Names;
+
+package Status is
+
+ pragma Warnings (Off); -- the next pragma exists since 3.11p
+ pragma Unreserve_All_Interrupts;
+ pragma Warnings (On);
+
+ protected Process is
+ procedure Stop;
+ function Continue return Boolean;
+ pragma Attach_Handler (Stop, Ada.Interrupts.Names.SIGINT);
+ private
+ Done : Boolean := False;
+ end Process;
+
+end Status;
diff --git a/ncurses-5.2/Ada95/samples/tour.adb b/ncurses-5.2/Ada95/samples/tour.adb
new file mode 100644
index 0000000..2398b6e
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/tour.adb
@@ -0,0 +1,46 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- tour --
+-- --
+-- B O D Y --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+with Sample; use Sample;
+
+procedure Tour is
+begin
+ Whow;
+end Tour;
diff --git a/ncurses-5.2/Ada95/samples/tour.ads b/ncurses-5.2/Ada95/samples/tour.ads
new file mode 100644
index 0000000..4eea20b
--- /dev/null
+++ b/ncurses-5.2/Ada95/samples/tour.ads
@@ -0,0 +1,41 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT ncurses Binding Samples --
+-- --
+-- Tour --
+-- --
+-- S P E C --
+-- --
+------------------------------------------------------------------------------
+-- Copyright (c) 1998 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 above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- 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. --
+-- --
+-- 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 <juergen.pfeifer@gmx.net> 1996
+-- Version Control
+-- $Revision$
+-- Binding Version 01.00
+------------------------------------------------------------------------------
+procedure Tour;