]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/samples/sample-helpers.adb
ncurses 4.1
[ncurses.git] / Ada95 / samples / sample-helpers.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                       GNAT ncurses Binding Samples                       --
4 --                                                                          --
5 --                              Sample.Helpers                              --
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; use Terminal_Interface.Curses;
28
29 with Sample.Explanation; use Sample.Explanation;
30
31 --  This package contains some conveniant helper routines used throughout
32 --  this example.
33 --
34 package body Sample.Helpers is
35
36    procedure Window_Title (Win   : in Window;
37                            Title : in String)
38    is
39       Height : Line_Count;
40       Width  : Column_Count;
41       Pos    : Column_Position := 0;
42    begin
43       Get_Size (Win, Height, Width);
44       if Title'Length < Width then
45          Pos := (Width - Title'Length) / 2;
46       end if;
47       Add (Win, 0, Pos, Title);
48    end Window_Title;
49
50    procedure Not_Implemented is
51    begin
52       Explain ("NOTIMPL");
53    end Not_Implemented;
54
55 end Sample.Helpers;