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