]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/samples/sample-my_field_type.adb
ncurses 4.1
[ncurses.git] / Ada95 / samples / sample-my_field_type.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                       GNAT ncurses Binding Samples                       --
4 --                                                                          --
5 --                           Sample.My_Field_Type                           --
6 --                                                                          --
7 --                                 B O D Y                                  --
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.2 $
26 ------------------------------------------------------------------------------
27 with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms;
28
29 --  This is a very simple user defined field type. It accepts only a
30 --  defined character as input into the field.
31 --
32 package body Sample.My_Field_Type is
33
34    --  That's simple. There are no field validity checks.
35    function F_Check (Fld : Field; Info : My_Access) return Boolean
36    is
37    begin
38       return True;
39    end F_Check;
40
41    --  Check exactly against the specified character.
42    function C_Check (Ch : Character; Info : My_Access) return Boolean
43    is
44       C : constant Character := Info.Ch;
45    begin
46       return Ch = C;
47    end C_Check;
48
49 end Sample.My_Field_Type;