6189551294815e56081e670a4b4ee51ac17d0ae5
[ncurses.git] / doc / html / man / curs_attr.3x.html
1 <!-- 
2   * t
3   ****************************************************************************
4   * Copyright (c) 1998-2010,2013 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   * @Id: curs_attr.3x,v 1.39 2013/09/21 20:39:49 Sven.Joachim Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_attr 3x</TITLE>
38 <link rev=made href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
40 </HEAD>
41 <BODY>
42 <H1>curs_attr 3x</H1>
43 <HR>
44 <PRE>
45 <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>                                             <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
46
47
48
49
50 </PRE>
51 <H2><a name="h2-NAME">NAME</a></H2><PRE>
52        <STRONG>attroff</STRONG>, <STRONG>wattroff</STRONG>, <STRONG>attron</STRONG>, <STRONG>wattron</STRONG>, <STRONG>attrset</STRONG>, <STRONG>wattrset</STRONG>,
53        <STRONG>color_set</STRONG>, <STRONG>wcolor_set</STRONG>, <STRONG>standend</STRONG>, <STRONG>wstandend</STRONG>, <STRONG>standout</STRONG>,
54        <STRONG>wstandout</STRONG>, <STRONG>attr_get</STRONG>, <STRONG>wattr_get</STRONG>, <STRONG>attr_off</STRONG>, <STRONG>wattr_off</STRONG>,
55        <STRONG>attr_on</STRONG>, <STRONG>wattr_on</STRONG>, <STRONG>attr_set</STRONG>, <STRONG>wattr_set</STRONG>, <STRONG>chgat</STRONG>, <STRONG>wchgat</STRONG>,
56        <STRONG>mvchgat</STRONG>, <STRONG>mvwchgat</STRONG>, <STRONG>PAIR_NUMBER</STRONG> - <STRONG>curses</STRONG> character and
57        window attribute control routines
58
59
60 </PRE>
61 <H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
62        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
63        <STRONG>int</STRONG> <STRONG>attroff(int</STRONG> <STRONG>attrs);</STRONG>
64        <STRONG>int</STRONG> <STRONG>wattroff(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
65        <STRONG>int</STRONG> <STRONG>attron(int</STRONG> <STRONG>attrs);</STRONG>
66        <STRONG>int</STRONG> <STRONG>wattron(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
67        <STRONG>int</STRONG> <STRONG>attrset(int</STRONG> <STRONG>attrs);</STRONG>
68        <STRONG>int</STRONG> <STRONG>wattrset(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
69        <STRONG>int</STRONG> <STRONG>color_set(short</STRONG> <STRONG>color_pair_number,</STRONG> <STRONG>void*</STRONG> <STRONG>opts);</STRONG>
70        <STRONG>int</STRONG> <STRONG>wcolor_set(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>short</STRONG> <STRONG>color_pair_number,</STRONG>
71              <STRONG>void*</STRONG> <STRONG>opts);</STRONG>
72        <STRONG>int</STRONG> <STRONG>standend(void);</STRONG>
73        <STRONG>int</STRONG> <STRONG>wstandend(WINDOW</STRONG> <STRONG>*win);</STRONG>
74        <STRONG>int</STRONG> <STRONG>standout(void);</STRONG>
75        <STRONG>int</STRONG> <STRONG>wstandout(WINDOW</STRONG> <STRONG>*win);</STRONG>
76        <STRONG>int</STRONG> <STRONG>attr_get(attr_t</STRONG> <STRONG>*attrs,</STRONG> <STRONG>short</STRONG> <STRONG>*pair,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
77        <STRONG>int</STRONG> <STRONG>wattr_get(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>*attrs,</STRONG> <STRONG>short</STRONG> <STRONG>*pair,</STRONG>
78               <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
79        <STRONG>int</STRONG> <STRONG>attr_off(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
80        <STRONG>int</STRONG> <STRONG>wattr_off(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
81        <STRONG>int</STRONG> <STRONG>attr_on(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
82        <STRONG>int</STRONG> <STRONG>wattr_on(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
83        <STRONG>int</STRONG> <STRONG>attr_set(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>short</STRONG> <STRONG>pair,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
84        <STRONG>int</STRONG> <STRONG>wattr_set(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>short</STRONG> <STRONG>pair,</STRONG>  <STRONG>void</STRONG>
85        <STRONG>*opts);</STRONG>
86        <STRONG>int</STRONG> <STRONG>chgat(int</STRONG> <STRONG>n,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG> <STRONG>short</STRONG> <STRONG>color,</STRONG>
87              <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
88        <STRONG>int</STRONG> <STRONG>wchgat(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>n,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG>
89              <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
90        <STRONG>int</STRONG> <STRONG>mvchgat(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>int</STRONG> <STRONG>n,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG>
91              <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
92        <STRONG>int</STRONG> <STRONG>mvwchgat(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>int</STRONG> <STRONG>n,</STRONG>
93              <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG> <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
94
95
96 </PRE>
97 <H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
98        These  routines  manipulate  the current attributes of the
99        named window.  The current attributes of a window apply to
100        all characters that are written into the window with <STRONG>wadd-</STRONG>
101        <STRONG>ch</STRONG>, <STRONG>waddstr</STRONG> and <STRONG>wprintw</STRONG>.  Attributes are a property of the
102        character,   and  move  with  the  character  through  any
103        scrolling and insert/delete line/character operations.  To
104        the  extent  possible,  they  are displayed as appropriate
105        modifications to the graphic rendition of  characters  put
106        on the screen.
107
108        The  routine  <STRONG>attrset</STRONG>  sets  the current attributes of the
109        given window to <EM>attrs</EM>.  The routine <STRONG>attroff</STRONG> turns off  the
110        named  attributes  without turning any other attributes on
111        or off.  The routine <STRONG>attron</STRONG> turns on the named  attributes
112        without affecting any others.  The routine <STRONG>standout</STRONG> is the
113        same as <STRONG>attron(A_STANDOUT)</STRONG>.  The routine <STRONG>standend</STRONG>  is  the
114        same as <STRONG>attrset(A_NORMAL)</STRONG> or <STRONG>attrset(0)</STRONG>, that is, it turns
115        off all attributes.
116
117        The <STRONG>attrset</STRONG> and related routines do  not  affect  the  at-
118        tributes  used  when  erasing portions of the window.  See
119        <STRONG><A HREF="curs_bkgd.3x.html">curs_bkgd(3x)</A></STRONG> for functions which  modify  the  attributes
120        used for erasing and clearing.
121
122        The  routine <STRONG>color_set</STRONG> sets the current color of the given
123        window to the foreground/background combination  described
124        by  the  color_pair_number. The parameter opts is reserved
125        for future use, applications must supply a null pointer.
126
127        The routine <STRONG>wattr_get</STRONG> returns the  current  attribute  and
128        color pair for the given window; <STRONG>attr_get</STRONG> returns the cur-
129        rent attribute and color pair for <STRONG>stdscr</STRONG>.   The  remaining
130        <STRONG>attr_</STRONG>*  functions  operate  exactly like the corresponding
131        <STRONG>attr</STRONG>* functions, except that they take arguments  of  type
132        <STRONG>attr_t</STRONG> rather than <STRONG>int</STRONG>.
133
134        The routine <STRONG>chgat</STRONG> changes the attributes of a given number
135        of characters starting at the current cursor  location  of
136        <STRONG>stdscr</STRONG>.   It  does not update the cursor and does not per-
137        form wrapping.  A character count of -1  or  greater  than
138        the  remaining window width means to change attributes all
139        the way to the end of the current line.  The <STRONG>wchgat</STRONG>  func-
140        tion generalizes this to any window; the <STRONG>mvwchgat</STRONG> function
141        does a cursor move before acting.  In these functions, the
142        color  argument is a color-pair index (as in the first ar-
143        gument of <EM>init</EM><STRONG>_</STRONG><EM>pair</EM>, see <STRONG><A HREF="curs_color.3x.html">curs_color(3x)</A></STRONG>).  The <STRONG>opts</STRONG>  argu-
144        ment is not presently used, but is reserved for the future
145        (leave it <STRONG>NULL</STRONG>).
146
147
148 </PRE>
149 <H3><a name="h3-Attributes">Attributes</a></H3><PRE>
150        The following video attributes, defined in <STRONG>&lt;curses.h&gt;</STRONG>, can
151        be passed to the routines <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, and <STRONG>attrset</STRONG>, or
152        OR'd with the characters passed to <STRONG>addch</STRONG>.
153
154               <EM>Name</EM>            <EM>Description</EM>
155               ------------------------------------------------------------
156               <STRONG>A_NORMAL</STRONG>        Normal display (no highlight)
157               <STRONG>A_STANDOUT</STRONG>      Best highlighting mode of the terminal.
158               <STRONG>A_UNDERLINE</STRONG>     Underlining
159               <STRONG>A_REVERSE</STRONG>       Reverse video
160               <STRONG>A_BLINK</STRONG>         Blinking
161               <STRONG>A_DIM</STRONG>           Half bright
162               <STRONG>A_BOLD</STRONG>          Extra bright or bold
163               <STRONG>A_PROTECT</STRONG>       Protected mode
164               <STRONG>A_INVIS</STRONG>         Invisible or blank mode
165               <STRONG>A_ALTCHARSET</STRONG>    Alternate character set
166               <STRONG>A_ITALIC</STRONG>        Italics (non-X/Open extension)
167               <STRONG>A_CHARTEXT</STRONG>      Bit-mask to extract a character
168               <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG>   Color-pair number <EM>n</EM>
169
170        These video attributes are supported by <STRONG>attr_on</STRONG> and relat-
171        ed functions (which also support the attributes recognized
172        by <STRONG>attron</STRONG>, etc.):
173
174               <EM>Name</EM>            <EM>Description</EM>
175               -----------------------------------------
176               <STRONG>WA_HORIZONTAL</STRONG>   Horizontal highlight
177               <STRONG>WA_LEFT</STRONG>         Left highlight
178               <STRONG>WA_LOW</STRONG>          Low highlight
179               <STRONG>WA_RIGHT</STRONG>        Right highlight
180               <STRONG>WA_TOP</STRONG>          Top highlight
181               <STRONG>WA_VERTICAL</STRONG>     Vertical highlight
182
183        For consistency
184
185        The following macro is the reverse of <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG>:
186
187        <STRONG>PAIR_NUMBER(</STRONG><EM>attrs</EM>) Returns the pair number associated
188                           with the <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG> attribute.
189
190        The return values of many of these routines are not  mean-
191        ingful (they are implemented as macro-expanded assignments
192        and simply return their argument).  The SVr4  manual  page
193        claims (falsely) that these routines always return <STRONG>1</STRONG>.
194
195
196 </PRE>
197 <H2><a name="h2-NOTES">NOTES</a></H2><PRE>
198        Note  that  <STRONG>attroff</STRONG>,  <STRONG>wattroff</STRONG>,  <STRONG>attron</STRONG>, <STRONG>wattron</STRONG>, <STRONG>attrset</STRONG>,
199        <STRONG>wattrset</STRONG>, <STRONG>standend</STRONG> and <STRONG>standout</STRONG> may be macros.
200
201        <STRONG>COLOR_PAIR</STRONG> values can only be OR'd with attributes if  the
202        pair  number  is  less  than 256.  The alternate functions
203        such as <STRONG>color_set</STRONG> can pass a color  pair  value  directly.
204        However,  ncurses  ABI 4 and 5 simply OR this value within
205        the alternate functions.  You must use ncurses  ABI  6  to
206        support more than 256 color pairs.
207
208
209 </PRE>
210 <H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
211        These  functions are supported in the XSI Curses standard,
212        Issue 4.  The standard  defined  the  dedicated  type  for
213        highlights,  <STRONG>attr_t</STRONG>,  which is not defined in SVr4 curses.
214        The functions taking <STRONG>attr_t</STRONG> arguments  are  not  supported
215        under SVr4.
216
217        The XSI Curses standard states that whether the tradition-
218        al functions  <STRONG>attron</STRONG>/<STRONG>attroff</STRONG>/<STRONG>attrset</STRONG>  can  manipulate  at-
219        tributes  other  than  <STRONG>A_BLINK</STRONG>,  <STRONG>A_BOLD</STRONG>, <STRONG>A_DIM</STRONG>, <STRONG>A_REVERSE</STRONG>,
220        <STRONG>A_STANDOUT</STRONG>, or <STRONG>A_UNDERLINE</STRONG> is "unspecified".   Under  this
221        implementation  as  well  as  SVr4 curses, these functions
222        correctly manipulate all other  highlights  (specifically,
223        <STRONG>A_ALTCHARSET</STRONG>, <STRONG>A_PROTECT</STRONG>, and <STRONG>A_INVIS</STRONG>).
224
225        This  implementation  provides  the <STRONG>A_ITALIC</STRONG> attribute for
226        terminals which have the <EM>enter</EM><STRONG>_</STRONG><EM>italics</EM><STRONG>_</STRONG><EM>mode</EM> (sitm) and <EM>ex-</EM>
227        <EM>it</EM><STRONG>_</STRONG><EM>italics</EM><STRONG>_</STRONG><EM>mode</EM> (ritm) capabilities.  Italics are not men-
228        tioned in X/Open  Curses.   Unlike  the  other  video  at-
229        tributes,  <STRONG>I_ITALIC</STRONG> is unrelated to the <EM>set</EM><STRONG>_</STRONG><EM>attributes</EM> ca-
230        pabilities.  This implementation makes the assumption that
231        <EM>exit</EM><STRONG>_</STRONG><EM>attribute</EM><STRONG>_</STRONG><EM>mode</EM> may also reset italics.
232
233        XSI  Curses added the new entry points, <STRONG>attr_get</STRONG>, <STRONG>attr_on</STRONG>,
234        <STRONG>attr_off</STRONG>, <STRONG>attr_set</STRONG>, <STRONG>wattr_on</STRONG>, <STRONG>wattr_off</STRONG>,  <STRONG>wattr_get</STRONG>,  <STRONG>wat-</STRONG>
235        <STRONG>tr_set</STRONG>.   These  are intended to work with a new series of
236        highlight macros prefixed with <STRONG>WA_</STRONG>.  The older macros have
237        direct counterparts in the newer set of names:
238
239               <EM>Name</EM>            <EM>Description</EM>
240               ------------------------------------------------------------
241               <STRONG>WA_NORMAL</STRONG>       Normal display (no highlight)
242               <STRONG>WA_STANDOUT</STRONG>     Best highlighting mode of the terminal.
243               <STRONG>WA_UNDERLINE</STRONG>    Underlining
244               <STRONG>WA_REVERSE</STRONG>      Reverse video
245               <STRONG>WA_BLINK</STRONG>        Blinking
246               <STRONG>WA_DIM</STRONG>          Half bright
247               <STRONG>WA_BOLD</STRONG>         Extra bright or bold
248               <STRONG>WA_ALTCHARSET</STRONG>   Alternate character set
249
250        Older  versions of this library did not force an update of
251        the screen when changing the attributes.  Use <STRONG>touchwin</STRONG>  to
252        force the screen to match the updated attributes.
253
254        The XSI curses standard specifies that each pair of corre-
255        sponding <STRONG>A_</STRONG> and <STRONG>WA_</STRONG>-using functions operates on  the  same
256        current-highlight information.
257
258        The XSI standard extended conformance level adds new high-
259        lights <STRONG>A_HORIZONTAL</STRONG>, <STRONG>A_LEFT</STRONG>, <STRONG>A_LOW</STRONG>, <STRONG>A_RIGHT</STRONG>, <STRONG>A_TOP</STRONG>, <STRONG>A_VER-</STRONG>
260        <STRONG>TICAL</STRONG>  (and corresponding <STRONG>WA_</STRONG> macros for each).  As of Au-
261        gust 2013, no known  terminal  provides  these  highlights
262        (i.e., via the <STRONG>sgr1</STRONG> capability).
263
264
265 </PRE>
266 <H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
267        All  routines  return the integer <STRONG>OK</STRONG> on success, or <STRONG>ERR</STRONG> on
268        failure.
269
270        X/Open does not define any error conditions.
271
272        This implementation returns an error if the window pointer
273        is  null.  The <STRONG>wcolor_set</STRONG> function returns an error if the
274        color  pair  parameter  is  outside  the   range   0..COL-
275        OR_PAIRS-1.   This  implementation  also provides <STRONG>getattrs</STRONG>
276        for compatibility with older versions of curses.
277
278        Functions with a "mv" prefix first perform a cursor  move-
279        ment  using  <STRONG>wmove</STRONG>, and return an error if the position is
280        outside the window, or if the window pointer is null.
281
282
283 </PRE>
284 <H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
285        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,        <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>,        <STRONG><A HREF="curs_addstr.3x.html">curs_addstr(3x)</A></STRONG>,
286        <STRONG><A HREF="curs_bkgd.3x.html">curs_bkgd(3x)</A></STRONG>, <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>
287
288
289
290                                                           <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
291 </PRE>
292 <div class="nav">
293 <ul>
294 <li><a href="#h2-NAME">NAME</a></li>
295 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
296 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
297 <ul>
298 <li><a href="#h3-Attributes">Attributes</a></li>
299 </ul>
300 </li>
301 <li><a href="#h2-NOTES">NOTES</a></li>
302 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
303 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
304 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
305 </ul>
306 </div>
307 </BODY>
308 </HTML>