curs_attr.3x.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
  2. <!--
  3. * t
  4. ****************************************************************************
  5. * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
  6. * *
  7. * Permission is hereby granted, free of charge, to any person obtaining a *
  8. * copy of this software and associated documentation files (the *
  9. * "Software"), to deal in the Software without restriction, including *
  10. * without limitation the rights to use, copy, modify, merge, publish, *
  11. * distribute, distribute with modifications, sublicense, and/or sell *
  12. * copies of the Software, and to permit persons to whom the Software is *
  13. * furnished to do so, subject to the following conditions: *
  14. * *
  15. * The above copyright notice and this permission notice shall be included *
  16. * in all copies or substantial portions of the Software. *
  17. * *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  20. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  21. * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  22. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  23. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  24. * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  25. * *
  26. * Except as contained in this notice, the name(s) of the above copyright *
  27. * holders shall not be used in advertising or otherwise to promote the *
  28. * sale, use or other dealings in this Software without prior written *
  29. * authorization. *
  30. ****************************************************************************
  31. * @Id: curs_attr.3x,v 1.31 2007/03/17 20:30:33 tom Exp @
  32. -->
  33. <HTML>
  34. <HEAD>
  35. <TITLE>curs_attr 3x</TITLE>
  36. <link rev=made href="mailto:bug-ncurses@gnu.org">
  37. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  38. </HEAD>
  39. <BODY>
  40. <H1>curs_attr 3x</H1>
  41. <HR>
  42. <PRE>
  43. <!-- Manpage converted by man2html 3.0.1 -->
  44. <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG> <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
  45. </PRE>
  46. <H2>NAME</H2><PRE>
  47. <STRONG>attroff</STRONG>, <STRONG>wattroff</STRONG>, <STRONG>attron</STRONG>, <STRONG>wattron</STRONG>, <STRONG>attrset</STRONG>, <STRONG>wattrset</STRONG>,
  48. <STRONG>color_set</STRONG>, <STRONG>wcolor_set</STRONG>, <STRONG>standend</STRONG>, <STRONG>wstandend</STRONG>, <STRONG>standout</STRONG>,
  49. <STRONG>wstandout</STRONG>, <STRONG>attr_get</STRONG>, <STRONG>wattr_get</STRONG>, <STRONG>attr_off</STRONG>, <STRONG>wattr_off</STRONG>,
  50. <STRONG>attr_on</STRONG>, <STRONG>wattr_on</STRONG>, <STRONG>attr_set</STRONG>, <STRONG>wattr_set</STRONG>, <STRONG>chgat</STRONG>, <STRONG>wchgat</STRONG>,
  51. <STRONG>mvchgat</STRONG>, <STRONG>mvwchgat</STRONG>, <STRONG>PAIR_NUMBER</STRONG> - <STRONG>curses</STRONG> character and
  52. window attribute control routines
  53. </PRE>
  54. <H2>SYNOPSIS</H2><PRE>
  55. <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
  56. <STRONG>int</STRONG> <STRONG>attroff(int</STRONG> <STRONG>attrs);</STRONG>
  57. <STRONG>int</STRONG> <STRONG>wattroff(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
  58. <STRONG>int</STRONG> <STRONG>attron(int</STRONG> <STRONG>attrs);</STRONG>
  59. <STRONG>int</STRONG> <STRONG>wattron(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
  60. <STRONG>int</STRONG> <STRONG>attrset(int</STRONG> <STRONG>attrs);</STRONG>
  61. <STRONG>int</STRONG> <STRONG>wattrset(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>attrs);</STRONG>
  62. <STRONG>int</STRONG> <STRONG>color_set(short</STRONG> <STRONG>color_pair_number,</STRONG> <STRONG>void*</STRONG> <STRONG>opts);</STRONG>
  63. <STRONG>int</STRONG> <STRONG>wcolor_set(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>short</STRONG> <STRONG>color_pair_number,</STRONG>
  64. <STRONG>void*</STRONG> <STRONG>opts);</STRONG>
  65. <STRONG>int</STRONG> <STRONG>standend(void);</STRONG>
  66. <STRONG>int</STRONG> <STRONG>wstandend(WINDOW</STRONG> <STRONG>*win);</STRONG>
  67. <STRONG>int</STRONG> <STRONG>standout(void);</STRONG>
  68. <STRONG>int</STRONG> <STRONG>wstandout(WINDOW</STRONG> <STRONG>*win);</STRONG>
  69. <STRONG>int</STRONG> <STRONG>attr_get(attr_t</STRONG> <STRONG>*attrs,</STRONG> <STRONG>short</STRONG> <STRONG>*pair,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  70. <STRONG>int</STRONG> <STRONG>wattr_get(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>*attrs,</STRONG> <STRONG>short</STRONG> <STRONG>*pair,</STRONG>
  71. <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  72. <STRONG>int</STRONG> <STRONG>attr_off(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  73. <STRONG>int</STRONG> <STRONG>wattr_off(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  74. <STRONG>int</STRONG> <STRONG>attr_on(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  75. <STRONG>int</STRONG> <STRONG>wattr_on(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  76. <STRONG>int</STRONG> <STRONG>attr_set(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>short</STRONG> <STRONG>pair,</STRONG> <STRONG>void</STRONG> <STRONG>*opts);</STRONG>
  77. <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>
  78. <STRONG>*opts);</STRONG>
  79. <STRONG>int</STRONG> <STRONG>chgat(int</STRONG> <STRONG>n,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG> <STRONG>short</STRONG> <STRONG>color,</STRONG>
  80. <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
  81. <STRONG>int</STRONG> <STRONG>wchgat(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>n,</STRONG> <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG>
  82. <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
  83. <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>
  84. <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
  85. <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>
  86. <STRONG>attr_t</STRONG> <STRONG>attr,</STRONG> <STRONG>short</STRONG> <STRONG>color,</STRONG> <STRONG>const</STRONG> <STRONG>void</STRONG> <STRONG>*opts)</STRONG>
  87. </PRE>
  88. <H2>DESCRIPTION</H2><PRE>
  89. These routines manipulate the current attributes of the
  90. named window. The current attributes of a window apply to
  91. all characters that are written into the window with <STRONG>wadd-</STRONG>
  92. <STRONG>ch</STRONG>, <STRONG>waddstr</STRONG> and <STRONG>wprintw</STRONG>. Attributes are a property of the
  93. character, and move with the character through any
  94. scrolling and insert/delete line/character operations. To
  95. the extent possible, they are displayed as appropriate
  96. modifications to the graphic rendition of characters put
  97. on the screen.
  98. The routine <STRONG>attrset</STRONG> sets the current attributes of the
  99. given window to <EM>attrs</EM>. The routine <STRONG>attroff</STRONG> turns off the
  100. named attributes without turning any other attributes on
  101. or off. The routine <STRONG>attron</STRONG> turns on the named attributes
  102. without affecting any others. The routine <STRONG>standout</STRONG> is the
  103. same as <STRONG>attron(A_STANDOUT)</STRONG>. The routine <STRONG>standend</STRONG> is the
  104. same as <STRONG>attrset(A_NORMAL)</STRONG> or <STRONG>attrset(0)</STRONG>, that is, it turns
  105. off all attributes.
  106. The <STRONG>attrset</STRONG> and related routines do not affect the at-
  107. tributes used when erasing portions of the window. See
  108. <STRONG><A HREF="curs_bkgd.3x.html">curs_bkgd(3x)</A></STRONG> for functions which modify the attributes
  109. used for erasing and clearing.
  110. The routine <STRONG>color_set</STRONG> sets the current color of the given
  111. window to the foreground/background combination described
  112. by the color_pair_number. The parameter opts is reserved
  113. for future use, applications must supply a null pointer.
  114. The routine <STRONG>wattr_get</STRONG> returns the current attribute and
  115. color pair for the given window; <STRONG>attr_get</STRONG> returns the cur-
  116. rent attribute and color pair for <STRONG>stdscr</STRONG>. The remaining
  117. <STRONG>attr_</STRONG>* functions operate exactly like the corresponding
  118. <STRONG>attr</STRONG>* functions, except that they take arguments of type
  119. <STRONG>attr_t</STRONG> rather than <STRONG>int</STRONG>.
  120. The routine <STRONG>chgat</STRONG> changes the attributes of a given number
  121. of characters starting at the current cursor location of
  122. <STRONG>stdscr</STRONG>. It does not update the cursor and does not per-
  123. form wrapping. A character count of -1 or greater than
  124. the remaining window width means to change attributes all
  125. the way to the end of the current line. The <STRONG>wchgat</STRONG> func-
  126. tion generalizes this to any window; the <STRONG>mvwchgat</STRONG> function
  127. does a cursor move before acting. In these functions, the
  128. color argument is a color-pair index (as in the first ar-
  129. 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-
  130. ment is not presently used, but is reserved for the future
  131. (leave it <STRONG>NULL</STRONG>).
  132. <STRONG>Attributes</STRONG>
  133. The following video attributes, defined in <STRONG>&lt;curses.h&gt;</STRONG>, can
  134. be passed to the routines <STRONG>attron</STRONG>, <STRONG>attroff</STRONG>, and <STRONG>attrset</STRONG>, or
  135. OR'd with the characters passed to <STRONG>addch</STRONG>.
  136. <STRONG>A_NORMAL</STRONG> Normal display (no highlight)
  137. <STRONG>A_STANDOUT</STRONG> Best highlighting mode of the terminal.
  138. <STRONG>A_UNDERLINE</STRONG> Underlining
  139. <STRONG>A_REVERSE</STRONG> Reverse video
  140. <STRONG>A_BLINK</STRONG> Blinking
  141. <STRONG>A_DIM</STRONG> Half bright
  142. <STRONG>A_BOLD</STRONG> Extra bright or bold
  143. <STRONG>A_PROTECT</STRONG> Protected mode
  144. <STRONG>A_INVIS</STRONG> Invisible or blank mode
  145. <STRONG>A_ALTCHARSET</STRONG> Alternate character set
  146. <STRONG>A_CHARTEXT</STRONG> Bit-mask to extract a character
  147. <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG> Color-pair number <EM>n</EM>
  148. The following macro is the reverse of <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG>:
  149. <STRONG>PAIR_NUMBER(</STRONG><EM>attrs</EM>) Returns the pair number associated
  150. with the <STRONG>COLOR_PAIR(</STRONG><EM>n</EM><STRONG>)</STRONG> attribute.
  151. The return values of many of these routines are not mean-
  152. ingful (they are implemented as macro-expanded assignments
  153. and simply return their argument). The SVr4 manual page
  154. claims (falsely) that these routines always return <STRONG>1</STRONG>.
  155. </PRE>
  156. <H2>NOTES</H2><PRE>
  157. Note that <STRONG>attroff</STRONG>, <STRONG>wattroff</STRONG>, <STRONG>attron</STRONG>, <STRONG>wattron</STRONG>, <STRONG>attrset</STRONG>,
  158. <STRONG>wattrset</STRONG>, <STRONG>standend</STRONG> and <STRONG>standout</STRONG> may be macros.
  159. <STRONG>COLOR_PAIR</STRONG> values can only be OR'd with attributes if the
  160. pair number is less than 256. The alternate functions
  161. such as <STRONG>color_set</STRONG> can pass a color pair value directly.
  162. However, ncurses ABI 4 and 5 simply OR this value within
  163. the alternate functions. You must use ncurses ABI 6 to
  164. support more than 256 color pairs.
  165. </PRE>
  166. <H2>PORTABILITY</H2><PRE>
  167. These functions are supported in the XSI Curses standard,
  168. Issue 4. The standard defined the dedicated type for
  169. highlights, <STRONG>attr_t</STRONG>, which is not defined in SVr4 curses.
  170. The functions taking <STRONG>attr_t</STRONG> arguments are not supported
  171. under SVr4.
  172. The XSI Curses standard states that whether the tradition-
  173. al functions <STRONG>attron</STRONG>/<STRONG>attroff</STRONG>/<STRONG>attrset</STRONG> can manipulate at-
  174. tributes other than <STRONG>A_BLINK</STRONG>, <STRONG>A_BOLD</STRONG>, <STRONG>A_DIM</STRONG>, <STRONG>A_REVERSE</STRONG>,
  175. <STRONG>A_STANDOUT</STRONG>, or <STRONG>A_UNDERLINE</STRONG> is "unspecified". Under this
  176. implementation as well as SVr4 curses, these functions
  177. correctly manipulate all other highlights (specifically,
  178. <STRONG>A_ALTCHARSET</STRONG>, <STRONG>A_PROTECT</STRONG>, and <STRONG>A_INVIS</STRONG>).
  179. XSI Curses added the new entry points, <STRONG>attr_get</STRONG>, <STRONG>attr_on</STRONG>,
  180. <STRONG>attr_off</STRONG>, <STRONG>attr_set</STRONG>, <STRONG>wattr_on</STRONG>, <STRONG>wattr_off</STRONG>, <STRONG>wattr_get</STRONG>, <STRONG>wat-</STRONG>
  181. <STRONG>tr_set</STRONG>. These are intended to work with a new series of
  182. highlight macros prefixed with <STRONG>WA_</STRONG>.
  183. Older versions of this library did not force an update of
  184. the screen when changing the attributes. Use <STRONG>touchwin</STRONG> to
  185. force the screen to match the updated attributes.
  186. <STRONG>WA_NORMAL</STRONG> Normal display (no highlight)
  187. <STRONG>WA_STANDOUT</STRONG> Best highlighting mode of the terminal.
  188. <STRONG>WA_UNDERLINE</STRONG> Underlining
  189. <STRONG>WA_REVERSE</STRONG> Reverse video
  190. <STRONG>WA_BLINK</STRONG> Blinking
  191. <STRONG>WA_DIM</STRONG> Half bright
  192. <STRONG>WA_BOLD</STRONG> Extra bright or bold
  193. <STRONG>WA_ALTCHARSET</STRONG> Alternate character set
  194. The XSI curses standard specifies that each pair of corre-
  195. sponding <STRONG>A_</STRONG> and <STRONG>WA_</STRONG>-using functions operates on the same
  196. current-highlight information.
  197. The XSI standard extended conformance level adds new high-
  198. 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>
  199. <STRONG>TICAL</STRONG> (and corresponding <STRONG>WA_</STRONG> macros for each) which this
  200. implementation does not yet support.
  201. </PRE>
  202. <H2>RETURN VALUE</H2><PRE>
  203. All routines return the integer <STRONG>OK</STRONG> on success, or <STRONG>ERR</STRONG> on
  204. failure.
  205. X/Open does not define any error conditions.
  206. This implementation returns an error if the window pointer
  207. is null. The <STRONG>wcolor_set</STRONG> function returns an error if the
  208. color pair parameter is outside the range 0..COL-
  209. OR_PAIRS-1. This implementation also provides <STRONG>getattrs</STRONG>
  210. for compatibility with older versions of curses.
  211. </PRE>
  212. <H2>SEE ALSO</H2><PRE>
  213. <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>,
  214. <STRONG><A HREF="curs_bkgd.3x.html">curs_bkgd(3x)</A></STRONG>, <STRONG><A HREF="curs_printw.3x.html">curs_printw(3x)</A></STRONG>
  215. <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>
  216. </PRE>
  217. <HR>
  218. <ADDRESS>
  219. Man(1) output converted with
  220. <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
  221. </ADDRESS>
  222. </BODY>
  223. </HTML>