]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/ada_include/terminal_interface-curses-text_io-enumeration_io.adb
ncurses 4.1
[ncurses.git] / Ada95 / ada_include / terminal_interface-curses-text_io-enumeration_io.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                           GNAT ncurses Binding                           --
4 --                                                                          --
5 --             Terminal_Interface.Curses.Text_IO.Enumeration_IO             --
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.3 $
26 ------------------------------------------------------------------------------
27 with Ada.Text_IO;
28 with Ada.Characters.Handling; use Ada.Characters.Handling;
29 with Terminal_Interface.Curses.Text_IO.Aux;
30
31 package body Terminal_Interface.Curses.Text_IO.Enumeration_IO is
32
33    package Aux renames Terminal_Interface.Curses.Text_IO.Aux;
34    package EIO is new Ada.Text_IO.Enumeration_IO (Enum);
35
36    procedure Put
37      (Win   : in Window;
38       Item  : in Enum;
39       Width : in Field := Default_Width;
40       Set   : in Type_Set := Default_Setting)
41    is
42       Buf  : String (1 .. Field'Last);
43       Tset : Ada.Text_IO.Type_Set;
44    begin
45       if Set /= Mixed_Case then
46          Tset := Ada.Text_IO.Type_Set'Val (Type_Set'Pos (Set));
47       else
48          Tset := Ada.Text_IO.Lower_Case;
49       end if;
50       EIO.Put (Buf, Item, Tset);
51       if Set = Mixed_Case then
52          Buf (Buf'First) := To_Upper (Buf (Buf'First));
53       end if;
54       Aux.Put_Buf (Win, Buf, Width, True, True);
55    end Put;
56
57    procedure Put
58      (Item  : in Enum;
59       Width : in Field := Default_Width;
60       Set   : in Type_Set := Default_Setting)
61    is
62    begin
63       Put (Get_Window, Item, Width, Set);
64    end Put;
65
66 end Terminal_Interface.Curses.Text_IO.Enumeration_IO;