]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_attr.3x
ncurses 6.4 - patch 20231001
[ncurses.git] / man / curs_attr.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright 2018-2022,2023 Thomas E. Dickey                                *
4 .\" Copyright 1998-2016,2017 Free Software Foundation, Inc.                  *
5 .\"                                                                          *
6 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
7 .\" copy of this software and associated documentation files (the            *
8 .\" "Software"), to deal in the Software without restriction, including      *
9 .\" without limitation the rights to use, copy, modify, merge, publish,      *
10 .\" distribute, distribute with modifications, sublicense, and/or sell       *
11 .\" copies of the Software, and to permit persons to whom the Software is    *
12 .\" furnished to do so, subject to the following conditions:                 *
13 .\"                                                                          *
14 .\" The above copyright notice and this permission notice shall be included  *
15 .\" in all copies or substantial portions of the Software.                   *
16 .\"                                                                          *
17 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24 .\"                                                                          *
25 .\" Except as contained in this notice, the name(s) of the above copyright   *
26 .\" holders shall not be used in advertising or otherwise to promote the     *
27 .\" sale, use or other dealings in this Software without prior written       *
28 .\" authorization.                                                           *
29 .\"***************************************************************************
30 .\"
31 .\" $Id: curs_attr.3x,v 1.86 2023/09/30 21:38:11 tom Exp $
32 .TH curs_attr 3X 2023-09-30 "ncurses 6.4" "Library calls"
33 .ie \n(.g .ds `` \(lq
34 .el       .ds `` ``
35 .ie \n(.g .ds '' \(rq
36 .el       .ds '' ''
37 .ie n .ds CW R
38 .el   \{
39 .ie \n(.g .ds CW CR
40 .el       .ds CW CW
41 .\}
42 .de NS
43 .ie n  .sp
44 .el    .sp .5
45 .ie n  .in +4
46 .el    .in +2
47 .nf
48 .ft \*(CW
49 ..
50 .de NE
51 .fi
52 .ft R
53 .ie n  .in -4
54 .el    .in -2
55 ..
56 .de bP
57 .ie n  .IP \(bu 4
58 .el    .IP \(bu 2
59 ..
60 .\" ---------------------------------------------------------------------------
61 .SH NAME
62 \fB\%attr_get\fP,
63 \fB\%wattr_get\fP,
64 \fB\%attr_set\fP,
65 \fB\%wattr_set\fP,
66 \fB\%attr_off\fP,
67 \fB\%wattr_off\fP,
68 \fB\%attr_on\fP,
69 \fB\%wattr_on\fP,
70 \fB\%attroff\fP,
71 \fB\%wattroff\fP,
72 \fB\%attron\fP,
73 \fB\%wattron\fP,
74 \fB\%attrset\fP,
75 \fB\%wattrset\fP,
76 \fB\%chgat\fP,
77 \fB\%wchgat\fP,
78 \fB\%mvchgat\fP,
79 \fB\%mvwchgat\fP,
80 \fB\%color_set\fP,
81 \fB\%wcolor_set\fP,
82 \fB\%standend\fP,
83 \fB\%wstandend\fP,
84 \fB\%standout\fP,
85 \fB\%wstandout\fP \-
86 manipulate attributes of character cells in \fIcurses\fR windows
87 .\" ---------------------------------------------------------------------------
88 .SH SYNOPSIS
89 \fB#include <curses.h>\fP
90 .sp
91 \fBint attr_get(attr_t *\fIattrs\fB, short *\fIpair\fB, void *\fIopts\fB);\fR
92 .br
93 \fBint wattr_get(WINDOW *\fIwin\fB, attr_t *\fIattrs\fB, short *\fIpair\fB,\fR \fBvoid *\fIopts\fB);\fR
94 .br
95 \fBint attr_set(attr_t \fIattrs\fB, short \fIpair\fB, void *\fIopts\fB);\fR
96 .br
97 \fBint wattr_set(WINDOW *\fIwin\fB, attr_t \fIattrs\fB, short \fIpair\fB, void *\fIopts\fB);\fR
98 .sp
99 \fBint attr_off(attr_t \fIattrs\fB, void *\fIopts\fB);\fR
100 .br
101 \fBint wattr_off(WINDOW *\fIwin\fB, attr_t \fIattrs\fB, void *\fIopts\fB);\fR
102 .br
103 \fBint attr_on(attr_t \fIattrs\fB, void *\fIopts\fB);\fR
104 .br
105 \fBint wattr_on(WINDOW *\fIwin\fB, attr_t \fIattrs\fB, void *\fIopts\fB);\fR
106 .sp
107 \fBint attroff(int \fIattrs);\fR
108 .br
109 \fBint wattroff(WINDOW *\fIwin\fB, int \fIattrs\fB);\fR
110 .br
111 \fBint attron(int \fIattrs\fB);\fR
112 .br
113 \fBint wattron(WINDOW *\fIwin\fB, int \fIattrs\fB);\fR
114 .br
115 \fBint attrset(int \fIattrs\fB);\fR
116 .br
117 \fBint wattrset(WINDOW *\fIwin\fB, int \fIattrs\fB);\fR
118 .sp
119 \fBint chgat(int \fIn\fB, attr_t \fIattr\fB, short \fIpair\fB,\fR \fBconst void *\fIopts\fB);\fR
120 .br
121 \fBint wchgat(WINDOW *\fIwin\fB,\fR
122       \fBint \fIn\fB, attr_t \fIattr\fB,\fR \fBshort \fIpair\fB, const void *\fIopts\fB);\fR
123 .br
124 \fBint mvchgat(int \fIy\fB, int \fIx\fB,\fR
125       \fBint \fIn\fB, attr_t \fIattr\fB,\fR \fBshort \fIpair\fB, const void *\fIopts\fB);\fR
126 .br
127 \fBint mvwchgat(WINDOW *\fIwin, int \fIy, int \fIx\fB,\fR
128       \fBint \fIn,\fR \fBattr_t \fIattr\fB, short \fIpair\fB, const void *\fIopts\fB);\fR
129 .sp
130 \fBint color_set(short \fIpair\fB, void* \fIopts\fB);\fR
131 .br
132 \fBint wcolor_set(WINDOW *\fIwin\fB, short \fIpair\fB,\fR \fBvoid* \fIopts);\fR
133 .sp
134 \fBint standend(void);\fP
135 .br
136 \fBint wstandend(WINDOW *\fIwin\fB);\fR
137 .br
138 \fBint standout(void);\fP
139 .br
140 \fBint wstandout(WINDOW *\fIwin\fB);\fR
141 .\" ---------------------------------------------------------------------------
142 .SH DESCRIPTION
143 These routines manipulate the current attributes of the named window,
144 which then apply to all characters that are written into
145 the window with \fBwaddch\fP, \fBwaddstr\fP and \fBwprintw\fP.
146 Attributes are
147 a property of the character, and move with the character through any scrolling
148 and insert/delete line/character operations.
149 To the extent possible, they are
150 displayed as appropriate modifications to the graphic rendition of characters
151 put on the screen.
152 .PP
153 These routines do not affect the attributes used
154 when erasing portions of the window.
155 See \fBcurs_bkgd\fP(3X) for functions which modify the attributes used for
156 erasing and clearing.
157 .PP
158 Routines which do not have a \fBWINDOW*\fP parameter apply to \fBstdscr\fP.
159 For example,
160 \fBattr_set\fP is the \fBstdscr\fP variant of \fBwattr_set\fP.
161 .\" ---------------------------------------------------------------------------
162 .SS Window attributes
163 There are two sets of functions:
164 .bP
165 functions for manipulating the window attributes and color:
166 \fBwattr_set\fP and \fBwattr_get\fP.
167 .bP
168 functions for manipulating only the window attributes (not color):
169 \fBwattr_on\fP and \fBwattr_off\fP.
170 .PP
171 The \fBwattr_set\fP function sets the current attributes
172 of the given window to \fIattrs\fP, with color specified by \fIpair\fP.
173 .PP
174 Use \fBwattr_get\fP to retrieve attributes for the given window.
175 .PP
176 Use \fBattr_on\fP and \fBwattr_on\fP to turn on window attributes, i.e.,
177 values OR'd together in \fIattr\fP,
178 without affecting other attributes.
179 Use \fBattr_off\fP and \fBwattr_off\fP to turn off window attributes,
180 again values OR'd together in \fIattr\fP,
181 without affecting other attributes.
182 .\" ---------------------------------------------------------------------------
183 .SS Legacy window attributes
184 The X/Open window attribute routines which \fIset\fP or \fIget\fP,
185 turn \fIon\fP or \fIoff\fP
186 are extensions of older routines
187 which assume that color pairs are OR'd into the attribute parameter.
188 These newer routines use similar names, because
189 X/Open simply added an underscore (\fB_\fP) for the newer names.
190 .PP
191 The \fBint\fP datatype used in the legacy routines is treated as if
192 it is the same size as \fBchtype\fP (used by \fBaddch\fP(3X)).
193 It holds the common video attributes (such as bold, reverse),
194 as well as a few bits for color.
195 Those bits correspond to the \fBA_COLOR\fP symbol.
196 The \fBCOLOR_PAIR\fP macro provides a value which can be OR'd into
197 the attribute parameter.
198 For example,
199 as long as that value fits into the \fBA_COLOR\fP mask,
200 then these calls produce similar results:
201 .NS
202 attrset(A_BOLD | COLOR_PAIR(\fIpair\fP));
203 attr_set(A_BOLD, \fIpair\fP, NULL);
204 .NE
205 .PP
206 However, if the value does not fit, then the \fBCOLOR_PAIR\fP macro
207 uses only the bits that fit.
208 For example, because in ncurses \fBA_COLOR\fP has eight (8) bits,
209 then \fBCOLOR_PAIR(\fI259\fB)\fR is 4
210 (i.e., 259 is 4 more than the limit 255).
211 .PP
212 The \fBPAIR_NUMBER\fP macro extracts a pair number from an \fBint\fP
213 (or \fBchtype\fP).
214 For example, the \fIinput\fP and \fIoutput\fP values in these statements
215 would be the same:
216 .NS
217 int value = A_BOLD | COLOR_PAIR(\fIinput\fP);
218 int \fIoutput\fP = PAIR_NUMBER(value);
219 .NE
220 .PP
221 The \fBattrset\fP routine is a legacy feature predating SVr4 curses
222 but kept in X/Open Curses for the same reason that SVr4 curses kept it:
223 compatibility.
224 .PP
225 The remaining \fBattr\fP* functions operate exactly like the corresponding
226 \fBattr_\fP* functions, except that they take arguments of type \fBint\fP
227 rather than \fBattr_t\fP.
228 .PP
229 There is no corresponding \fBattrget\fP function as such in X/Open Curses,
230 although ncurses provides \fBgetattrs\fP (see curs_legacy(3X)).
231 .\" ---------------------------------------------------------------------------
232 .SS Change character rendition
233 The routine \fBchgat\fP changes the attributes of a given number of characters
234 starting at the current cursor location of \fBstdscr\fP.
235 It does not update
236 the cursor and does not perform wrapping.
237 A character count of \-1 or greater
238 than the remaining window width means to change attributes all the way to the
239 end of the current line.
240 The \fBwchgat\fP function generalizes this to any window;
241 the \fBmvwchgat\fP function does a cursor move before acting.
242 .PP
243 In these functions,
244 the color \fIpair\fP argument is a color-pair index
245 (as in the first argument of \fBinit_pair\fP, see \fBcurs_color\fP(3X)).
246 .\" ---------------------------------------------------------------------------
247 .SS Change window color
248 The routine \fBcolor_set\fP sets the current color of the given window to the
249 foreground/background combination described by the color \fIpair\fP parameter.
250 .\" ---------------------------------------------------------------------------
251 .SS Standout
252 The routine \fBstandout\fP is
253 the same as \fBattron(A_STANDOUT)\fP.
254 The routine \fBstandend\fP is the same
255 as \fBattrset(A_NORMAL)\fP or \fBattrset(0)\fP, that is, it turns off all
256 attributes.
257 .PP
258 X/Open does not mark these \*(``restricted\*('', because
259 .bP
260 they have well established legacy use, and
261 .bP
262 there is no ambiguity about the way the attributes
263 might be combined with a color pair.
264 .\" ---------------------------------------------------------------------------
265 .SH VIDEO ATTRIBUTES
266 The following video attributes, defined in \fB<curses.h>\fP, can be passed to
267 the routines \fBattron\fP, \fBattroff\fP, and \fBattrset\fP, or OR'd with the
268 characters passed to \fBaddch\fP (see \fBcurs_addch\fP(3X)).
269 .PP
270 .RS
271 .TS
272 l l
273 _ _ _
274 l l .
275 \fBName\fP      \fBDescription\fP
276 \fBA_NORMAL\fP  Normal display (no highlight)
277 \fBA_STANDOUT\fP        Best highlighting mode of the terminal.
278 \fBA_UNDERLINE\fP       Underlining
279 \fBA_REVERSE\fP Reverse video
280 \fBA_BLINK\fP   Blinking
281 \fBA_DIM\fP     Half bright
282 \fBA_BOLD\fP    Extra bright or bold
283 \fBA_PROTECT\fP Protected mode
284 \fBA_INVIS\fP   Invisible or blank mode
285 \fBA_ALTCHARSET\fP      Alternate character set
286 \fBA_ITALIC\fP  Italics (non-X/Open extension)
287 \fBA_CHARTEXT\fP        Bit-mask to extract a character
288 \fBA_COLOR\fP   Bit-mask to extract a color (legacy routines)
289 .TE
290 .RE
291 .PP
292 These video attributes are supported by \fBattr_on\fP and related functions
293 (which also support the attributes recognized by \fBattron\fP, etc.):
294 .PP
295 .RS
296 .TS
297 l l
298 _ _ _
299 l l .
300 \fBName\fP      \fBDescription\fP
301 \fBWA_HORIZONTAL\fP     Horizontal highlight
302 \fBWA_LEFT\fP   Left highlight
303 \fBWA_LOW\fP    Low highlight
304 \fBWA_RIGHT\fP  Right highlight
305 \fBWA_TOP\fP    Top highlight
306 \fBWA_VERTICAL\fP       Vertical highlight
307 .TE
308 .RE
309 .PP
310 The return values of many of these routines are not meaningful (they are
311 implemented as macro-expanded assignments and simply return their argument).
312 The SVr4 manual page claims (falsely) that these routines always return \fB1\fP.
313 .\" ---------------------------------------------------------------------------
314 .SH NOTES
315 These functions may be macros:
316 .sp
317 .RS
318 \fBattroff\fP, \fBwattroff\fP, \fBattron\fP, \fBwattron\fP,
319 \fBattrset\fP, \fBwattrset\fP, \fBstandend\fP and \fBstandout\fP.
320 .RE
321 .PP
322 Color pair values can only be OR'd with attributes if the pair
323 number is less than 256.
324 The alternate functions such as \fBcolor_set\fP can pass a color pair
325 value directly.
326 However, ncurses ABI 4 and 5 simply OR this value
327 within the alternate functions.
328 You must use ncurses ABI 6 to support more than 256 color pairs.
329 .\" ---------------------------------------------------------------------------
330 .SH HISTORY
331 X/Open Curses is largely based on SVr4 curses,
332 adding support for \*(``wide-characters\*('' (not specific to Unicode).
333 Some of the X/Open differences from SVr4 curses address the way
334 video attributes can be applied to wide-characters.
335 But aside from that, \fBattrset\fP and \fBattr_set\fP are similar.
336 SVr4 curses provided the basic features for manipulating video attributes.
337 However, earlier versions of curses provided a part of these features.
338 .PP
339 As seen in 2.8BSD, curses assumed 7-bit characters,
340 using the eighth bit of a byte to represent the \fIstandout\fP
341 feature (often implemented as bold and/or reverse video).
342 The BSD curses library provided functions \fBstandout\fP and \fBstandend\fP
343 which were carried along into X/Open Curses due to their pervasive use
344 in legacy applications.
345 .PP
346 Some terminals in the 1980s could support a variety of video attributes,
347 although the BSD curses library could do nothing with those.
348 System V (1983) provided an improved curses library.
349 It defined the \fBA_\fP symbols for use by applications to manipulate the
350 other attributes.
351 There are few useful references for the chronology.
352 .PP
353 Goodheart's book
354 \fIUNIX Curses Explained\fP (1991) describes SVr3 (1987),
355 commenting on several functions:
356 .bP
357 the \fBattron\fP, \fBattroff\fP, \fBattrset\fP functions
358 (and most of the functions found in SVr4 but not in BSD curses) were
359 introduced by System V,
360 .bP
361 the alternate character set feature with \fBA_ALTCHARSET\fP was
362 added in SVr2 and improved in SVr3 (by adding \fBacs_map[]\fP),
363 .bP
364 \fBstart_color\fP and related color-functions were introduced by System V.3.2,
365 .bP
366 pads, soft-keys were added in SVr3, and
367 .PP
368 Goodheart did not mention the background character or the \fBcchar_t\fP type.
369 Those are respectively SVr4 and X/Open features.
370 He did mention the \fBA_\fP constants, but did not indicate their values.
371 Those were not the same in different systems,
372 even for those marked as System V.
373 .PP
374 Different Unix systems used different sizes for the bit-fields in \fBchtype\fP
375 for \fIcharacters\fP and \fIcolors\fP, and took into account the different
376 integer sizes (32-bit versus 64-bit).
377 .PP
378 This table showing the number of bits for \fBA_COLOR\fP
379 and \fBA_CHARTEXT\fP
380 was gleaned from the curses header files for
381 various operating systems and architectures.
382 The inferred architecture and notes reflect
383 the format and size of the defined constants
384 as well as clues such as the alternate character set implementation.
385 A 32-bit library can be used on a 64-bit system,
386 but not necessarily the reverse.
387 .PP
388 .RS
389 .TS
390 l l l l l l
391 _ _ _ _ _ _
392 l l l l l l .
393 \fBYear\fP      \fBSystem\fP    \fBArch\fP      \fBColor\fP     \fBChar\fP      \fBNotes\fP
394 1992    Solaris 5.2     32      6       17      SVr4 curses
395 1992    HPUX 9  32      no      8       SVr2 curses
396 1992    AIX 3.2 32      no      23      SVr2 curses
397 1994    OSF/1 r3        32      no      23      SVr2 curses
398 1995    HP-UX 10.00     32      6       16      SVr3 \*(``curses_colr\*(''
399 1995    HP-UX 10.00     32      6       8       SVr4, X/Open curses
400 1995    Solaris 5.4     32/64   7       16      X/Open curses
401 1996    AIX 4.2 32      7       16      X/Open curses
402 1996    OSF/1 r4        32      6       16      X/Open curses
403 1997    HP-UX 11.00     32      6       8       X/Open curses
404 2000    U/Win   32/64   7/31    16      uses \fBchtype\fP
405 .TE
406 .RE
407 .PP
408 Notes:
409 .RS 3
410 .PP
411 Regarding HP-UX,
412 .bP
413 HP-UX 10.20 (1996) added support for 64-bit PA-RISC processors in 1996.
414 .bP
415 HP-UX 10.30 (1997) marked \*(``curses_colr\*('' obsolete.
416 That version of curses was dropped with HP-UX 11.30 in 2006.
417 .PP
418 Regarding OSF/1 (and Tru64),
419 .bP
420 These used 64-bit hardware.
421 Like ncurses, the OSF/1 curses interface is not customized for 32-bit
422 and 64-bit versions.
423 .bP
424 Unlike other systems which evolved from AT&T code,
425 OSF/1 provided a new implementation for X/Open curses.
426 .PP
427 Regarding Solaris,
428 .bP
429 The initial release of Solaris was in 1992.
430 .bP
431 The \fIxpg4\fP (X/Open) curses was developed by MKS from 1990 to 1995.
432 Sun's copyright began in 1996.
433 .bP
434 Sun updated the X/Open curses interface
435 after 64-bit support was introduced in 1997,
436 but did not modify the SVr4 curses interface.
437 .PP
438 Regarding U/Win,
439 .bP
440 Development of the curses library began in 1991, stopped in 2000.
441 .bP
442 Color support was added in 1998.
443 .bP
444 The library uses only \fBchtype\fP (no \fBcchar_t\fP).
445 .RE
446 .PP
447 Once X/Open curses was adopted in the mid-1990s, the constraint of
448 a 32-bit interface with many colors and wide-characters for \fBchtype\fP
449 became a moot point.
450 The \fBcchar_t\fP structure (whose size and
451 members are not specified in X/Open Curses) could be extended as needed.
452 .PP
453 Other interfaces are rarely used now:
454 .bP
455 BSD curses was improved slightly in 1993/1994 using Keith Bostic's
456 modification to make the library 8-bit clean for \fBnvi\fP(1).
457 He moved \fIstandout\fP attribute to a structure member.
458 .IP
459 The resulting 4.4BSD curses was replaced by ncurses over the next ten years.
460 .bP
461 U/Win is rarely used now.
462 .\" ---------------------------------------------------------------------------
463 .SH EXTENSIONS
464 This implementation provides the \fBA_ITALIC\fP attribute for terminals
465 which have the \fBenter_italics_mode\fP (\fBsitm\fP)
466 and \fBexit_italics_mode\fP (\fBritm\fP) capabilities.
467 Italics are not mentioned in X/Open Curses.
468 Unlike the other video attributes, \fBA_ITALIC\fP is unrelated
469 to the \fBset_attributes\fP capabilities.
470 This implementation makes the assumption that
471 \fBexit_attribute_mode\fP may also reset italics.
472 .PP
473 Each of the functions added by XSI Curses has a parameter \fIopts\fP,
474 which X/Open Curses still (after more than twenty years) documents
475 as reserved for future use, saying that it should be \fBNULL\fP.
476 This implementation uses that parameter in ABI 6 for the functions which
477 have a color-pair parameter to support \fIextended color pairs\fP:
478 .bP
479 For functions which modify the color, e.g.,
480 \fBwattr_set\fP and \fBwattr_on\fP,
481 if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
482 and used to set the color pair instead of the \fBshort\fP \fIpair\fP parameter.
483 .bP
484 For functions which retrieve the color, e.g.,
485 \fBwattr_get\fP,
486 if \fIopts\fP is set it is treated as a pointer to \fBint\fP,
487 and used to retrieve the color pair as an \fBint\fP value,
488 in addition to
489 retrieving it via the standard pointer to \fBshort\fP parameter.
490 .bP
491 For functions which turn attributes off, e.g.,
492 \fBwattr_off\fP,
493 the \fIopts\fP parameter is ignored except
494 except to check that it is \fBNULL\fP.
495 .\" ---------------------------------------------------------------------------
496 .SH PORTABILITY
497 These functions are supported in the XSI Curses standard, Issue 4.
498 The standard defined the dedicated type for highlights,
499 \fBattr_t\fP, which was not defined in SVr4 curses.
500 The functions taking \fBattr_t\fP arguments were not supported under SVr4.
501 .PP
502 Very old versions of this library did not force an update of the screen
503 when changing the attributes.
504 Use \fBtouchwin\fP to force the screen to match the updated attributes.
505 .PP
506 The XSI Curses standard states that whether the traditional functions
507 \fBattron\fP/\fBattroff\fP/\fBattrset\fP can manipulate attributes other than
508 \fBA_BLINK\fP, \fBA_BOLD\fP, \fBA_DIM\fP, \fBA_REVERSE\fP, \fBA_STANDOUT\fP, or
509 \fBA_UNDERLINE\fP is \*(``unspecified\*(''.
510 Under this implementation as well as
511 SVr4 curses, these functions correctly manipulate all other highlights
512 (specifically, \fBA_ALTCHARSET\fP, \fBA_PROTECT\fP, and \fBA_INVIS\fP).
513 .PP
514 XSI Curses added these entry points:
515 .sp
516 .RS
517 \fBattr_get\fP, \fBattr_on\fP,
518 \fBattr_off\fP, \fBattr_set\fP, \fBwattr_on\fP, \fBwattr_off\fP,
519 \fBwattr_get\fP, \fBwattr_set\fP
520 .RE
521 .PP
522 The new functions are intended to work with
523 a new series of highlight macros prefixed with \fBWA_\fP.
524 The older macros have direct counterparts in the newer set of names:
525 .PP
526 .RS
527 .ne 9
528 .TS
529 l l
530 _ _ _
531 l l .
532 \fBName\fP      \fBDescription\fP
533 \fBWA_NORMAL\fP Normal display (no highlight)
534 \fBWA_STANDOUT\fP       Best highlighting mode of the terminal.
535 \fBWA_UNDERLINE\fP      Underlining
536 \fBWA_REVERSE\fP        Reverse video
537 \fBWA_BLINK\fP  Blinking
538 \fBWA_DIM\fP    Half bright
539 \fBWA_BOLD\fP   Extra bright or bold
540 \fBWA_ALTCHARSET\fP     Alternate character set
541 .TE
542 .RE
543 .PP
544 XSI curses does not assign values to these symbols,
545 nor does it state whether or not they are related to the
546 similarly-named A_NORMAL, etc.:
547 .bP
548 The XSI curses standard specifies that each pair of corresponding \fBA_\fP
549 and \fBWA_\fP-using functions operates on the same current-highlight
550 information.
551 .bP
552 However, in some implementations, those symbols have unrelated values.
553 .IP
554 For example, the Solaris \fIxpg4\fP (X/Open) curses declares
555 \fBattr_t\fP to be an unsigned short integer (16-bits),
556 while \fBchtype\fP is a unsigned integer (32-bits).
557 The \fBWA_\fP symbols in this case are different from the \fBA_\fP symbols
558 because they are used for a smaller datatype which does not
559 represent \fBA_CHARTEXT\fP or \fBA_COLOR\fP.
560 .IP
561 In this implementation (as in many others), the values happen to be
562 the same because it simplifies copying information between
563 \fBchtype\fP and \fBcchar_t\fP variables.
564 .bP
565 Because ncurses's \fBattr_t\fP can hold a color pair
566 (in the \fBA_COLOR\fP field),
567 a call to
568 \fBwattr_on\fP,
569 \fBwattr_off\fP, or
570 \fBwattr_set\fP
571 may alter the window's color.
572 If the color pair information in the attribute parameter is zero,
573 no change is made to the window's color.
574 .IP
575 This is consistent with SVr4 curses;
576 X/Open Curses does not specify this.
577 .PP
578 The XSI standard extended conformance level adds new highlights
579 \fBA_HORIZONTAL\fP, \fBA_LEFT\fP, \fBA_LOW\fP, \fBA_RIGHT\fP, \fBA_TOP\fP,
580 \fBA_VERTICAL\fP (and corresponding \fBWA_\fP macros for each).
581 As of August 2013,
582 no known terminal provides these highlights
583 (i.e., via the \fBsgr1\fP capability).
584 .\" ---------------------------------------------------------------------------
585 .SH RETURN VALUE
586 All routines return the integer \fBOK\fP on success, or \fBERR\fP on failure.
587 .PP
588 X/Open does not define any error conditions.
589 .PP
590 This implementation
591 .bP
592 returns an error if the window pointer is null.
593 .bP
594 returns an error if the color pair parameter
595 for \fBwcolor_set\fP is outside the range 0..COLOR_PAIRS\-1.
596 .bP
597 does not return an error if either of the parameters of \fBwattr_get\fP
598 used for retrieving attribute or color-pair values is \fBNULL\fP.
599 .PP
600 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
601 \fBwmove\fP, and return an error if the position is outside the window,
602 or if the window pointer is null.
603 .\" ---------------------------------------------------------------------------
604 .SH SEE ALSO
605 \fB\%curses\fP(3X),
606 \fB\%curs_addch\fP(3X),
607 \fB\%curs_addstr\fP(3X),
608 \fB\%curs_bkgd\fP(3X),
609 \fB\%curs_printw\fP(3X),
610 \fB\%curs_variables\fP(3X)