]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_attr.3x
3457ff2b26188cb6e6836c1e6ee6467de1a3ac27
[ncurses.git] / man / curs_attr.3x
1 '\" t
2 .\"***************************************************************************
3 .\" Copyright (c) 1998-2000,2002 Free Software Foundation, Inc.              *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_attr.3x,v 1.26 2002/09/21 19:50:06 tom Exp $
31 .TH curs_attr 3X ""
32 .SH NAME
33 \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR,
34 \fBattrset\fR, \fBwattrset\fR, \fBcolor_set\fR, \fBwcolor_set\fR,
35 \fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, \fBwstandout\fR,
36 \fBattr_get\fR, \fBwattr_get\fR,
37 \fBattr_off\fR, \fBwattr_off\fR,
38 \fBattr_on\fR, \fBwattr_on\fR,
39 \fBattr_set\fR, \fBwattr_set\fR,
40 \fBchgat\fR, \fBwchgat\fR,
41 \fBmvchgat\fR, \fBmvwchgat\fR,
42 \fBPAIR_NUMBER\fR - \fBcurses\fR character and window attribute control routines
43 .SH SYNOPSIS
44 \fB#include <curses.h>\fR
45 .br
46 \fBint attroff(int attrs);\fR
47 .br
48 \fBint wattroff(WINDOW *win, int attrs);\fR
49 .br
50 \fBint attron(int attrs);\fR
51 .br
52 \fBint wattron(WINDOW *win, int attrs);\fR
53 .br
54 \fBint attrset(int attrs);\fR
55 .br
56 \fBint wattrset(WINDOW *win, int attrs);\fR
57 .br
58 \fBint color_set(short color_pair_number, void* opts);\fR
59 .br
60 \fBint wcolor_set(WINDOW *win, short color_pair_number,\fR
61       \fBvoid* opts);\fR
62 .br
63 \fBint standend(void);\fR
64 .br
65 \fBint wstandend(WINDOW *win);\fR
66 .br
67 \fBint standout(void);\fR
68 .br
69 \fBint wstandout(WINDOW *win);\fR
70 .br
71 \fBint attr_get(attr_t *attrs, short *pair, void *opts);\fR
72 .br
73 \fBint wattr_get(WINDOW *win, attr_t *attrs, short *pair,\fR
74        \fBvoid *opts);\fR
75 .br
76 \fBint attr_off(attr_t attrs, void *opts);\fR
77 .br
78 \fBint wattr_off(WINDOW *win, attr_t attrs, void *opts);\fR
79 .br
80 \fBint attr_on(attr_t attrs, void *opts);\fR
81 .br
82 \fBint wattr_on(WINDOW *win, attr_t attrs, void *opts);\fR
83 .br
84 \fBint attr_set(attr_t attrs, short pair, void *opts);\fR
85 .br
86 \fBint wattr_set(WINDOW *win, attr_t attrs, short pair, void *opts);\fR
87 .br
88 \fBint chgat(int n, attr_t attr, short color,\fR
89       \fBconst void *opts)\fR
90 .br
91 \fBint wchgat(WINDOW *win, int n, attr_t attr,\fR
92       \fBshort color, const void *opts)\fR
93 .br
94 \fBint mvchgat(int y, int x, int n, attr_t attr,\fR
95       \fBshort color, const void *opts)\fR
96 .br
97 \fBint mvwchgat(WINDOW *win, int y, int x, int n,\fR
98       \fBattr_t attr, short color, const void *opts)\fR
99 .br
100 .SH DESCRIPTION
101 These routines manipulate the current attributes of the named window.  The
102 current attributes of a window apply to all characters that are written into
103 the window with \fBwaddch\fR, \fBwaddstr\fR and \fBwprintw\fR.  Attributes are
104 a property of the character, and move with the character through any scrolling
105 and insert/delete line/character operations.  To the extent possible, they are
106 displayed as appropriate modifications to the graphic rendition of characters
107 put on the screen.
108 .PP
109 The routine \fBattrset\fR sets the current attributes of the given window to
110 \fIattrs\fR.  The routine \fBattroff\fR turns off the named attributes without
111 turning any other attributes on or off.  The routine \fBattron\fR turns on the
112 named attributes without affecting any others.  The routine \fBstandout\fR is
113 the same as \fBattron(A_STANDOUT)\fR.  The routine \fBstandend\fR is the same
114 as \fBattrset(A_NORMAL)\fR or \fBattrset(0)\fR, that is, it turns off all
115 attributes.
116 .PP
117 The \fBattrset\fR and related routines do not affect the attributes used
118 when erasing portions of the window.
119 See \fBcurs_bkgd\fR(3X) for functions which modify the attributes used for
120 erasing and clearing.
121 .PP
122 The routine \fBcolor_set\fR sets the current color of the given window to the
123 foreground/background combination described by the color_pair_number. The
124 parameter opts is reserved for future use, applications must supply a null
125 pointer.
126 .PP
127 The routine \fBwattr_get\fR returns the current attribute and color pair for
128 the given window; \fBattr_get\fR returns the current attribute and color pair
129 for \fBstdscr\fR.
130 The remaining \fBattr_\fR* functions operate exactly like the corresponding
131 \fBattr\fR* functions, except that they take arguments of type \fBattr_t\fR
132 rather than \fBint\fR.
133 .PP
134 The routine \fBchgat\fR changes the attributes of a given number of characters
135 starting at the current cursor location of \fBstdscr\fR.  It does not update
136 the cursor and does not perform wrapping.  A character count of -1 or greater
137 than the remaining window width means to change attributes all the way to the
138 end of the current line.  The \fBwchgat\fR function generalizes this to any
139 window; the \fBmvwchgat\fR function does a cursor move before acting.  In these
140 functions, the color argument is a color-pair index (as in the first argument
141 of \fIinit_pair\fR, see \fBcurs_color\fR(3X)).  The \fBopts\fR argument is not
142 presently used, but is reserved for the future (leave it \fBNULL\fR).
143 Note that changing the attributes does not imply
144 that a subsequent \fBrefresh\fR will update the screen to match,
145 since the character values are not modified.
146 Use \fBtouchwin\fR to force the screen to match the updated attributes.
147 .SS Attributes
148 The following video attributes, defined in \fB<curses.h>\fR, can be passed to
149 the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'ed with the
150 characters passed to \fBaddch\fR.
151
152 .TS
153 center ;
154 l l .
155 \fBA_NORMAL\fR  Normal display (no highlight)
156 \fBA_STANDOUT\fR        Best highlighting mode of the terminal.
157 \fBA_UNDERLINE\fR       Underlining
158 \fBA_REVERSE\fR Reverse video
159 \fBA_BLINK\fR   Blinking
160 \fBA_DIM\fR     Half bright
161 \fBA_BOLD\fR    Extra bright or bold
162 \fBA_PROTECT\fR Protected mode
163 \fBA_INVIS\fR   Invisible or blank mode
164 \fBA_ALTCHARSET\fR      Alternate character set
165 \fBA_CHARTEXT\fR        Bit-mask to extract a character
166 \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR Color-pair number \fIn\fR
167 .TE
168
169 The following macro is the reverse of \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR:
170
171 .br
172 \fBPAIR_NUMBER(\fR\fIattrs\fR) Returns the pair number associated
173                    with the \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR attribute.
174 .br
175
176 The return values of many of these routines are not meaningful (they are
177 implemented as macro-expanded assignments and simply return their argument).
178 The SVr4 manual page claims (falsely) that these routines always return \fB1\fR.
179 .SH NOTES
180 Note that \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR,
181 \fBattrset\fR, \fBwattrset\fR, \fBstandend\fR and \fBstandout\fR may be macros.
182 .SH PORTABILITY
183 All these functions are supported in the XSI Curses standard, Issue 4.  The
184 standard defined the dedicated type for highlights, \fBattr_t\fR, which is not
185 defined in SVr4 curses. The functions taking \fBattr_t\fR arguments are
186 not supported under SVr4.
187 .PP
188 The XSI Curses standard states that whether the traditional functions
189 \fBattron\fR/\fBattroff\fR/\fBattrset\fR can manipulate attributes other than
190 \fBA_BLINK\fR, \fBA_BOLD\fR, \fBA_DIM\fR, \fBA_REVERSE\fR, \fBA_STANDOUT\fR, or
191 \fBA_UNDERLINE\fR is "unspecified".  Under this implementation as well as
192 SVr4 curses, these functions correctly manipulate all other highlights
193 (specifically, \fBA_ALTCHARSET\fR, \fBA_PROTECT\fR, and \fBA_INVIS\fR).
194 .PP
195 XSI Curses added the new entry points, \fBattr_get\fR, \fBattr_on\fR,
196 \fBattr_off\fR, \fBattr_set\fR, \fBwattr_on\fR, \fBwattr_off\fR,
197 \fBwattr_get\fR, \fBwattr_set\fR.  These are intended to work with
198 a new series of highlight macros prefixed with \fBWA_\fR.
199
200 .TS
201 center ;
202 l l .
203 \fBWA_NORMAL\fR Normal display (no highlight)
204 \fBWA_STANDOUT\fR       Best highlighting mode of the terminal.
205 \fBWA_UNDERLINE\fR      Underlining
206 \fBWA_REVERSE\fR        Reverse video
207 \fBWA_BLINK\fR  Blinking
208 \fBWA_DIM\fR    Half bright
209 \fBWA_BOLD\fR   Extra bright or bold
210 \fBWA_ALTCHARSET\fR     Alternate character set
211 .TE
212
213 The XSI curses standard specifies that each pair of corresponding \fBA_\fR
214 and \fBWA_\fR-using functions operates on the same current-highlight
215 information.
216 .PP
217 The XSI standard extended conformance level adds new highlights
218 \fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR,
219 \fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each) which this
220 curses does not yet support.
221 .SH SEE ALSO
222 \fBcurses\fR(3X),
223 \fBcurs_addch\fR(3X),
224 \fBcurs_addstr\fR(3X),
225 \fBcurs_bkgd\fR(3X),
226 \fBcurs_printw\fR(3X)
227 .\"#
228 .\"# The following sets edit modes for GNU EMACS
229 .\"# Local Variables:
230 .\"# mode:nroff
231 .\"# fill-column:79
232 .\"# End: