1 ------------------------------------------------------------------------------
3 -- GNAT ncurses Binding Samples --
9 ------------------------------------------------------------------------------
10 -- Copyright (c) 2000,2006 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 -- $Date: 2006/06/25 14:24:40 $
40 -- Binding Version 01.00
41 ------------------------------------------------------------------------------
42 with Terminal_Interface
.Curses
; use Terminal_Interface
.Curses
;
43 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");
78 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
79 Set_Background
(Ch
=> current
);
83 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
84 Set_Background
(Ch
=> current
);
85 xAdd
(6, 6, "underline");
88 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
89 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
90 Set_Background
(Ch
=> current
);
91 xAdd
(6, 45, "bold underline");
94 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
95 Set_Background
(Ch
=> current
);
99 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
100 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
101 Set_Background
(Ch
=> current
);
102 xAdd
(8, 40, "bold blink");
105 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
106 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
107 Set_Background
(Ch
=> current
);
108 xAdd
(10, 6, "underline blink");
111 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
112 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
113 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
114 Set_Background
(Ch
=> current
);
115 xAdd
(10, 45, "bold underline blink");
118 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
119 Set_Background
(Ch
=> current
);
120 xAdd
(12, 1, "negative");
123 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
124 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
125 Set_Background
(Ch
=> current
);
126 xAdd
(12, 40, "bold negative");
129 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
130 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
131 Set_Background
(Ch
=> current
);
132 xAdd
(14, 6, "underline negative");
135 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
136 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
137 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
138 Set_Background
(Ch
=> current
);
139 xAdd
(14, 45, "bold underline negative");
142 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
143 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
144 Set_Background
(Ch
=> current
);
145 xAdd
(16, 1, "blink negative");
148 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
149 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
150 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
151 Set_Background
(Ch
=> current
);
152 xAdd
(16, 40, "bold blink negative");
155 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
156 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
157 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
158 Set_Background
(Ch
=> current
);
159 xAdd
(18, 6, "underline blink negative");
162 current
.Attr
.Bold_Character
:= not current
.Attr
.Bold_Character
;
163 current
.Attr
.Under_Line
:= not current
.Attr
.Under_Line
;
164 current
.Attr
.Blink
:= not current
.Attr
.Blink
;
165 current
.Attr
.Reverse_Video
:= not current
.Attr
.Reverse_Video
;
166 Set_Background
(Ch
=> current
);
167 xAdd
(18, 45, "bold underline blink negative");
169 Set_Background
(Ch
=> normal
);
170 Move_Cursor
(Line
=> Lines
- 2, Column
=> 1);
174 Add
(Str
=> "Light");
176 Add
(Str
=> " background. ");
177 Clear_To_End_Of_Line
;
181 Set_Background
(Ch
=> Blank2
);
185 end ncurses2
.test_sgr_attributes
;