1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding Samples --
9 ------------------------------------------------------------------------------
10 -- Copyright (c) 2000 Free Software Foundation, Inc. --
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: --
20 -- The above copyright notice and this permission notice shall be included --
21 -- in all copies or substantial portions of the Software. --
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. --
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 --
35 ------------------------------------------------------------------------------
36 -- Author: Eugene V. Melaragno <aldomel@ix.netcom.com> 2000
39 -- Binding Version 01.00
40 ------------------------------------------------------------------------------
41 with Terminal_Interface.Curses; use Terminal_Interface.Curses;
42 with ncurses2.util; use ncurses2.util;
45 -- Graphic-rendition test (adapted from vttest)
47 procedure ncurses2.test_sgr_attributes is
49 procedure xAdd (l : Line_Position; c : Column_Position; s : String);
51 procedure xAdd (l : Line_Position; c : Column_Position; s : String) is
53 Add (Line => l, Column => c, Str => s);
56 normal, current : Attributed_Character;
58 for pass in reverse Boolean loop
60 normal := (Ch => ' ', Attr => Normal_Video, Color => 0);
62 normal := (Ch => ' ', Attr =>
63 (Reverse_Video => True, others => False), Color => 0);
66 -- Use non-default colors if possible to exercise bce a little
68 Init_Pair (1, White, Blue);
71 Set_Background (Ch => normal);
73 xAdd (1, 20, "Graphic rendition test pattern:");
75 xAdd (4, 1, "vanilla");
79 current.Attr.Bold_Character := not current.Attr.Bold_Character;
80 Set_Background (Ch => current);
84 current.Attr.Under_Line := not current.Attr.Under_Line;
85 Set_Background (Ch => current);
86 xAdd (6, 6, "underline");
89 current.Attr.Bold_Character := not current.Attr.Bold_Character;
90 current.Attr.Under_Line := not current.Attr.Under_Line;
91 Set_Background (Ch => current);
92 xAdd (6, 45, "bold underline");
95 current.Attr.Blink := not current.Attr.Blink;
96 Set_Background (Ch => current);
100 current.Attr.Blink := not current.Attr.Blink;
101 current.Attr.Bold_Character := not current.Attr.Bold_Character;
102 Set_Background (Ch => current);
103 xAdd (8, 40, "bold blink");
106 current.Attr.Under_Line := not current.Attr.Under_Line;
107 current.Attr.Blink := not current.Attr.Blink;
108 Set_Background (Ch => current);
109 xAdd (10, 6, "underline blink");
112 current.Attr.Bold_Character := not current.Attr.Bold_Character;
113 current.Attr.Under_Line := not current.Attr.Under_Line;
114 current.Attr.Blink := not current.Attr.Blink;
115 Set_Background (Ch => current);
116 xAdd (10, 45, "bold underline blink");
119 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
120 Set_Background (Ch => current);
121 xAdd (12, 1, "negative");
124 current.Attr.Bold_Character := not current.Attr.Bold_Character;
125 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
126 Set_Background (Ch => current);
127 xAdd (12, 40, "bold negative");
130 current.Attr.Under_Line := not current.Attr.Under_Line;
131 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
132 Set_Background (Ch => current);
133 xAdd (14, 6, "underline negative");
136 current.Attr.Bold_Character := not current.Attr.Bold_Character;
137 current.Attr.Under_Line := not current.Attr.Under_Line;
138 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
139 Set_Background (Ch => current);
140 xAdd (14, 45, "bold underline negative");
143 current.Attr.Blink := not current.Attr.Blink;
144 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
145 Set_Background (Ch => current);
146 xAdd (16, 1, "blink negative");
149 current.Attr.Bold_Character := not current.Attr.Bold_Character;
150 current.Attr.Blink := not current.Attr.Blink;
151 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
152 Set_Background (Ch => current);
153 xAdd (16, 40, "bold blink negative");
156 current.Attr.Under_Line := not current.Attr.Under_Line;
157 current.Attr.Blink := not current.Attr.Blink;
158 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
159 Set_Background (Ch => current);
160 xAdd (18, 6, "underline blink negative");
163 current.Attr.Bold_Character := not current.Attr.Bold_Character;
164 current.Attr.Under_Line := not current.Attr.Under_Line;
165 current.Attr.Blink := not current.Attr.Blink;
166 current.Attr.Reverse_Video := not current.Attr.Reverse_Video;
167 Set_Background (Ch => current);
168 xAdd (18, 45, "bold underline blink negative");
170 Set_Background (Ch => normal);
171 Move_Cursor (Line => Lines - 2, Column => 1);
175 Add (Str => "Light");
177 Add (Str => " background. ");
178 Clear_To_End_Of_Line;
182 Set_Background (Ch => Blank2);
186 end ncurses2.test_sgr_attributes;