]> ncurses.scripts.mit.edu Git - ncurses.git/blob - Ada95/samples/sample-curses_demo-attributes.adb
ncurses 4.2
[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 ------------------------------------------------------------------------------
10 -- Copyright (c) 1998 Free Software Foundation, Inc.                        --
11 --                                                                          --
12 -- Permission is hereby granted, free of charge, to any person obtaining a  --
13 -- copy of this software and associated documentation files (the            --
14 -- "Software"), to deal in the Software without restriction, including      --
15 -- without limitation the rights to use, copy, modify, merge, publish,      --
16 -- distribute, distribute with modifications, sublicense, and/or sell       --
17 -- copies of the Software, and to permit persons to whom the Software is    --
18 -- furnished to do so, subject to the following conditions:                 --
19 --                                                                          --
20 -- The above copyright notice and this permission notice shall be included  --
21 -- in all copies or substantial portions of the Software.                   --
22 --                                                                          --
23 -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  --
24 -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               --
25 -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   --
26 -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   --
27 -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    --
28 -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    --
29 -- THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               --
30 --                                                                          --
31 -- Except as contained in this notice, the name(s) of the above copyright   --
32 -- holders shall not be used in advertising or otherwise to promote the     --
33 -- sale, use or other dealings in this Software without prior written       --
34 -- authorization.                                                           --
35 ------------------------------------------------------------------------------
36 --  Author: Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> 1996
37 --  Version Control
38 --  $Revision: 1.7 $
39 --  Binding Version 00.93
40 ------------------------------------------------------------------------------
41 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
42 with Terminal_Interface.Curses.Panels;  use Terminal_Interface.Curses.Panels;
43
44 with Sample.Manifest; use Sample.Manifest;
45 with Sample.Helpers; use Sample.Helpers;
46 with Sample.Function_Key_Setting; use Sample.Function_Key_Setting;
47 with Sample.Keyboard_Handler; use Sample.Keyboard_Handler;
48 with Sample.Header_Handler; use Sample.Header_Handler;
49 with Sample.Explanation; use Sample.Explanation;
50
51 with Sample.Menu_Demo.Handler;
52 with Sample.Curses_Demo.Mouse;
53
54 package body Sample.Curses_Demo.Attributes is
55
56    procedure Demo
57    is
58       P : Panel := Create (Standard_Window);
59       K : Real_Key_Code;
60    begin
61       Set_Meta_Mode;
62       Set_KeyPad_Mode;
63
64       Top (P);
65
66       Push_Environment ("ATTRIBDEMO");
67       Default_Labels;
68       Notepad ("ATTRIB-PAD00");
69
70       Set_Character_Attributes (Attr => (others => False));
71       Add (Line => 1, Column => Columns / 2 - 10,
72            Str => "This is NORMAL");
73
74       Set_Character_Attributes (Attr => (Stand_Out => True,
75                                           others => False));
76       Add (Line => 2, Column => Columns / 2 - 10,
77            Str => "This is Stand_Out");
78
79       Set_Character_Attributes (Attr => (Under_Line => True,
80                                           others => False));
81       Add (Line => 3, Column => Columns / 2 - 10,
82            Str => "This is Under_Line");
83
84       Set_Character_Attributes (Attr => (Reverse_Video => True,
85                                           others => False));
86       Add (Line => 4, Column => Columns / 2 - 10,
87            Str => "This is Reverse_Video");
88
89       Set_Character_Attributes (Attr => (Blink => True,
90                                           others => False));
91       Add (Line => 5, Column => Columns / 2 - 10,
92            Str => "This is Blink");
93
94       Set_Character_Attributes (Attr => (Dim_Character => True,
95                                           others => False));
96       Add (Line => 6, Column => Columns / 2 - 10,
97            Str => "This is Dim_Character");
98
99       Set_Character_Attributes (Attr => (Bold_Character => True,
100                                           others => False));
101       Add (Line => 7, Column => Columns / 2 - 10,
102            Str => "This is Bold_Character");
103
104       Refresh_Without_Update;
105       Update_Panels; Update_Screen;
106
107       loop
108          K := Get_Key;
109          if K in Special_Key_Code'Range then
110             case K is
111                when QUIT_CODE     => exit;
112                when HELP_CODE     => Explain_Context;
113                when EXPLAIN_CODE  => Explain ("ATTRIBKEYS");
114                when others        => null;
115             end case;
116          end if;
117       end loop;
118
119       Pop_Environment;
120       Clear;
121       Refresh_Without_Update;
122       Delete (P);
123       Update_Panels; Update_Screen;
124
125    end Demo;
126
127 end Sample.Curses_Demo.Attributes;