]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/samples/sample-function_key_setting.ads
ncurses 4.1
[ncurses.git] / Ada95 / samples / sample-function_key_setting.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                       GNAT ncurses Binding Samples                       --
4 --                                                                          --
5 --                         Sample.Function_Key_Setting                      --
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.2 $
26 ------------------------------------------------------------------------------
27 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
28 with Terminal_Interface.Curses.Panels; use Terminal_Interface.Curses.Panels;
29
30 --  This package implements a simple stack of function key label environments.
31 --
32 package Sample.Function_Key_Setting is
33
34    procedure Push_Environment (Key   : in String;
35                                Reset : in Boolean := True);
36    --  Push the definition of the current function keys on an internal
37    --  stack. If the reset flag is true, all labels are reset while
38    --  pushed, so the new environment can assume a tabula rasa.
39    --  The Key defines the new Help Context associated with the new
40    --  Environment. This saves also the currently active Notepad.
41
42    procedure Pop_Environment;
43    --  Pop the Definitions from the stack and make them the current ones.
44    --  This also restores the Help context and the previous Notepad.
45
46    procedure Initialize (Mode : Soft_Label_Key_Format := PC_Style;
47                          Just : Label_Justification := Left);
48    --  Initialize the environment
49
50    function Context return String;
51    --  Return the current context identitfier
52
53    function Find_Context (Key : String) return Boolean;
54    --  Look for a context, return true if it is in the stack,
55    --  false otherwise.
56
57    procedure Notepad_To_Context (Pan : in Panel);
58    --  Add a panel representing a notepad to the current context.
59
60    Function_Key_Stack_Error : exception;
61
62    procedure Default_Labels;
63    --  Set the default labels used in all environments
64
65    function Notepad_Window return Window;
66    --  Return the current notepad window or Null_Window if there is none.
67
68 end Sample.Function_Key_Setting;