]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/samples/sample-my_field_type.ads
ncurses 4.1
[ncurses.git] / Ada95 / samples / sample-my_field_type.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                       GNAT ncurses Binding Samples                       --
4 --                                                                          --
5 --                           Sample.My_Field_Type                           --
6 --                                                                          --
7 --                                 S P E C                                  --
8 --                                                                          --
9 --  Version 00.92                                                           --
10 --                                                                          --
11 --  The ncurses Ada95 binding is copyrighted 1996 by                        --
12 --  Juergen Pfeifer, Email: Juergen.Pfeifer@T-Online.de                     --
13 --                                                                          --
14 --  Permission is hereby granted to reproduce and distribute this           --
15 --  binding by any means and for any fee, whether alone or as part          --
16 --  of a larger distribution, in source or in binary form, PROVIDED         --
17 --  this notice is included with any such distribution, and is not          --
18 --  removed from any of its header files. Mention of ncurses and the        --
19 --  author of this binding in any applications linked with it is            --
20 --  highly appreciated.                                                     --
21 --                                                                          --
22 --  This binding comes AS IS with no warranty, implied or expressed.        --
23 ------------------------------------------------------------------------------
24 --  Version Control
25 --  $Revision: 1.3 $
26 ------------------------------------------------------------------------------
27 with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
28 with Terminal_Interface.Curses.Forms.Field_Types;
29
30 --  This is a very simple user defined field type. It accepts only a
31 --  defined character as input into the field.
32 --
33 package Sample.My_Field_Type is
34
35    type My_Data is new Ada_Defined_Field_Type with
36       record
37         Ch : Character;
38       end record;
39    type My_Access is access My_Data;
40
41 private
42
43    function F_Check (Fld : Field;     Info : My_Access) return Boolean;
44    function C_Check (Ch  : Character; Info : My_Access) return Boolean;
45
46    package One_Character_Only is new
47      Terminal_Interface.Curses.Forms.Field_Types
48      (My_Data, My_Access, F_Check, C_Check);
49
50 end Sample.My_Field_Type;
51