ncurses 4.1
[ncurses.git] / Ada95 / samples / sample-curses_demo-attributes.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                       GNAT ncurses Binding Samples                       --
4 --                                                                          --
5 --                       Sample.Curses_Demo.Attributes                      --
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.4 $
26 ------------------------------------------------------------------------------
27 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
28 with Terminal_Interface.Curses.Panels;  use Terminal_Interface.Curses.Panels;
29
30 with Sample.Manifest; use Sample.Manifest;
31 with Sample.Helpers; use Sample.Helpers;
32 with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
33 with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
34 with Sample.Header_Handler; use Sample.Header_Handler;
35 with Sample.Explanation; use Sample.Explanation;
36
37 with Sample.Menu_Demo.Handler;
38 with Sample.Curses_Demo.Mouse;
39
40 package body Sample.Curses_Demo.Attributes is
41
42    procedure Demo
43    is
44       P : Panel := Create (Standard_Window);
45       K : Real_Key_Code;
46    begin
47       Set_Meta_Mode;
48       Set_KeyPad_Mode;
49
50       Top (P);
51
52       Push_Environment ("ATTRIBDEMO");
53       Default_Labels;
54       Notepad ("ATTRIB-PAD00");
55
56       Set_Character_Attributes (Attr => (others => False));
57       Add (Line => 1, Column => Columns / 2 - 10,
58            Str => "This is NORMAL");
59
60       Set_Character_Attributes (Attr => (Stand_Out => True,
61                                           others => False));
62       Add (Line => 2, Column => Columns / 2 - 10,
63            Str => "This is Stand_Out");
64
65       Set_Character_Attributes (Attr => (Under_Line => True,
66                                           others => False));
67       Add (Line => 3, Column => Columns / 2 - 10,
68            Str => "This is Under_Line");
69
70       Set_Character_Attributes (Attr => (Reverse_Video => True,
71                                           others => False));
72       Add (Line => 4, Column => Columns / 2 - 10,
73            Str => "This is Reverse_Video");
74
75       Set_Character_Attributes (Attr => (Blink => True,
76                                           others => False));
77       Add (Line => 5, Column => Columns / 2 - 10,
78            Str => "This is Blink");
79
80       Set_Character_Attributes (Attr => (Dim_Character => True,
81                                           others => False));
82       Add (Line => 6, Column => Columns / 2 - 10,
83            Str => "This is Dim_Character");
84
85       Set_Character_Attributes (Attr => (Bold_Character => True,
86                                           others => False));
87       Add (Line => 7, Column => Columns / 2 - 10,
88            Str => "This is Bold_Character");
89
90       Refresh_Without_Update;
91       Update_Panels; Update_Screen;
92
93       loop
94          K := Get_Key;
95          if K in Special_Key_Code'Range then
96             case K is
97                when QUIT_CODE     => exit;
98                when HELP_CODE     => Explain_Context;
99                when EXPLAIN_CODE  => Explain ("ATTRIBKEYS");
100                when others        => null;
101             end case;
102          end if;
103       end loop;
104
105       Pop_Environment;
106       Clear;
107       Refresh_Without_Update;
108       Delete (P);
109       Update_Panels; Update_Screen;
110
111    end Demo;
112
113 end Sample.Curses_Demo.Attributes;