Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | '\" t |
| 2 | .\"*************************************************************************** |
| 3 | .\" Copyright (c) 1998-2006,2007 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.31 2007/03/17 20:30:33 tom Exp $ |
| 31 | .TH curs_attr 3X "" |
| 32 | .na |
| 33 | .hy 0 |
| 34 | .SH NAME |
| 35 | \fBattroff\fR, |
| 36 | \fBwattroff\fR, |
| 37 | \fBattron\fR, |
| 38 | \fBwattron\fR, |
| 39 | \fBattrset\fR, |
| 40 | \fBwattrset\fR, |
| 41 | \fBcolor_set\fR, |
| 42 | \fBwcolor_set\fR, |
| 43 | \fBstandend\fR, |
| 44 | \fBwstandend\fR, |
| 45 | \fBstandout\fR, |
| 46 | \fBwstandout\fR, |
| 47 | \fBattr_get\fR, |
| 48 | \fBwattr_get\fR, |
| 49 | \fBattr_off\fR, |
| 50 | \fBwattr_off\fR, |
| 51 | \fBattr_on\fR, |
| 52 | \fBwattr_on\fR, |
| 53 | \fBattr_set\fR, |
| 54 | \fBwattr_set\fR, |
| 55 | \fBchgat\fR, |
| 56 | \fBwchgat\fR, |
| 57 | \fBmvchgat\fR, |
| 58 | \fBmvwchgat\fR, |
| 59 | \fBPAIR_NUMBER\fR - \fBcurses\fR character and window attribute control routines |
| 60 | .ad |
| 61 | .hy |
| 62 | .SH SYNOPSIS |
| 63 | \fB#include <curses.h>\fR |
| 64 | .br |
| 65 | \fBint attroff(int attrs);\fR |
| 66 | .br |
| 67 | \fBint wattroff(WINDOW *win, int attrs);\fR |
| 68 | .br |
| 69 | \fBint attron(int attrs);\fR |
| 70 | .br |
| 71 | \fBint wattron(WINDOW *win, int attrs);\fR |
| 72 | .br |
| 73 | \fBint attrset(int attrs);\fR |
| 74 | .br |
| 75 | \fBint wattrset(WINDOW *win, int attrs);\fR |
| 76 | .br |
| 77 | \fBint color_set(short color_pair_number, void* opts);\fR |
| 78 | .br |
| 79 | \fBint wcolor_set(WINDOW *win, short color_pair_number,\fR |
| 80 | \fBvoid* opts);\fR |
| 81 | .br |
| 82 | \fBint standend(void);\fR |
| 83 | .br |
| 84 | \fBint wstandend(WINDOW *win);\fR |
| 85 | .br |
| 86 | \fBint standout(void);\fR |
| 87 | .br |
| 88 | \fBint wstandout(WINDOW *win);\fR |
| 89 | .br |
| 90 | \fBint attr_get(attr_t *attrs, short *pair, void *opts);\fR |
| 91 | .br |
| 92 | \fBint wattr_get(WINDOW *win, attr_t *attrs, short *pair,\fR |
| 93 | \fBvoid *opts);\fR |
| 94 | .br |
| 95 | \fBint attr_off(attr_t attrs, void *opts);\fR |
| 96 | .br |
| 97 | \fBint wattr_off(WINDOW *win, attr_t attrs, void *opts);\fR |
| 98 | .br |
| 99 | \fBint attr_on(attr_t attrs, void *opts);\fR |
| 100 | .br |
| 101 | \fBint wattr_on(WINDOW *win, attr_t attrs, void *opts);\fR |
| 102 | .br |
| 103 | \fBint attr_set(attr_t attrs, short pair, void *opts);\fR |
| 104 | .br |
| 105 | \fBint wattr_set(WINDOW *win, attr_t attrs, short pair, void *opts);\fR |
| 106 | .br |
| 107 | \fBint chgat(int n, attr_t attr, short color,\fR |
| 108 | \fBconst void *opts)\fR |
| 109 | .br |
| 110 | \fBint wchgat(WINDOW *win, int n, attr_t attr,\fR |
| 111 | \fBshort color, const void *opts)\fR |
| 112 | .br |
| 113 | \fBint mvchgat(int y, int x, int n, attr_t attr,\fR |
| 114 | \fBshort color, const void *opts)\fR |
| 115 | .br |
| 116 | \fBint mvwchgat(WINDOW *win, int y, int x, int n,\fR |
| 117 | \fBattr_t attr, short color, const void *opts)\fR |
| 118 | .br |
| 119 | .SH DESCRIPTION |
| 120 | These routines manipulate the current attributes of the named window. The |
| 121 | current attributes of a window apply to all characters that are written into |
| 122 | the window with \fBwaddch\fR, \fBwaddstr\fR and \fBwprintw\fR. Attributes are |
| 123 | a property of the character, and move with the character through any scrolling |
| 124 | and insert/delete line/character operations. To the extent possible, they are |
| 125 | displayed as appropriate modifications to the graphic rendition of characters |
| 126 | put on the screen. |
| 127 | .PP |
| 128 | The routine \fBattrset\fR sets the current attributes of the given window to |
| 129 | \fIattrs\fR. The routine \fBattroff\fR turns off the named attributes without |
| 130 | turning any other attributes on or off. The routine \fBattron\fR turns on the |
| 131 | named attributes without affecting any others. The routine \fBstandout\fR is |
| 132 | the same as \fBattron(A_STANDOUT)\fR. The routine \fBstandend\fR is the same |
| 133 | as \fBattrset(A_NORMAL)\fR or \fBattrset(0)\fR, that is, it turns off all |
| 134 | attributes. |
| 135 | .PP |
| 136 | The \fBattrset\fR and related routines do not affect the attributes used |
| 137 | when erasing portions of the window. |
| 138 | See \fBcurs_bkgd\fR(3X) for functions which modify the attributes used for |
| 139 | erasing and clearing. |
| 140 | .PP |
| 141 | The routine \fBcolor_set\fR sets the current color of the given window to the |
| 142 | foreground/background combination described by the color_pair_number. The |
| 143 | parameter opts is reserved for future use, applications must supply a null |
| 144 | pointer. |
| 145 | .PP |
| 146 | The routine \fBwattr_get\fR returns the current attribute and color pair for |
| 147 | the given window; \fBattr_get\fR returns the current attribute and color pair |
| 148 | for \fBstdscr\fR. |
| 149 | The remaining \fBattr_\fR* functions operate exactly like the corresponding |
| 150 | \fBattr\fR* functions, except that they take arguments of type \fBattr_t\fR |
| 151 | rather than \fBint\fR. |
| 152 | .PP |
| 153 | The routine \fBchgat\fR changes the attributes of a given number of characters |
| 154 | starting at the current cursor location of \fBstdscr\fR. It does not update |
| 155 | the cursor and does not perform wrapping. A character count of -1 or greater |
| 156 | than the remaining window width means to change attributes all the way to the |
| 157 | end of the current line. The \fBwchgat\fR function generalizes this to any |
| 158 | window; the \fBmvwchgat\fR function does a cursor move before acting. In these |
| 159 | functions, the color argument is a color-pair index (as in the first argument |
| 160 | of \fIinit_pair\fR, see \fBcurs_color\fR(3X)). The \fBopts\fR argument is not |
| 161 | presently used, but is reserved for the future (leave it \fBNULL\fR). |
| 162 | .SS Attributes |
| 163 | The following video attributes, defined in \fB<curses.h>\fR, can be passed to |
| 164 | the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'd with the |
| 165 | characters passed to \fBaddch\fR. |
| 166 | .PP |
| 167 | .TS |
| 168 | center ; |
| 169 | l l . |
| 170 | \fBA_NORMAL\fR Normal display (no highlight) |
| 171 | \fBA_STANDOUT\fR Best highlighting mode of the terminal. |
| 172 | \fBA_UNDERLINE\fR Underlining |
| 173 | \fBA_REVERSE\fR Reverse video |
| 174 | \fBA_BLINK\fR Blinking |
| 175 | \fBA_DIM\fR Half bright |
| 176 | \fBA_BOLD\fR Extra bright or bold |
| 177 | \fBA_PROTECT\fR Protected mode |
| 178 | \fBA_INVIS\fR Invisible or blank mode |
| 179 | \fBA_ALTCHARSET\fR Alternate character set |
| 180 | \fBA_CHARTEXT\fR Bit-mask to extract a character |
| 181 | \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR Color-pair number \fIn\fR |
| 182 | .TE |
| 183 | .PP |
| 184 | The following macro is the reverse of \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR: |
| 185 | .PP |
| 186 | .br |
| 187 | \fBPAIR_NUMBER(\fR\fIattrs\fR) Returns the pair number associated |
| 188 | with the \fBCOLOR_PAIR(\fR\fIn\fR\fB)\fR attribute. |
| 189 | .br |
| 190 | .PP |
| 191 | The return values of many of these routines are not meaningful (they are |
| 192 | implemented as macro-expanded assignments and simply return their argument). |
| 193 | The SVr4 manual page claims (falsely) that these routines always return \fB1\fR. |
| 194 | .SH NOTES |
| 195 | Note that \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, |
| 196 | \fBattrset\fR, \fBwattrset\fR, \fBstandend\fR and \fBstandout\fR may be macros. |
| 197 | .PP |
| 198 | \fBCOLOR_PAIR\fP values can only be OR'd with attributes if the pair |
| 199 | number is less than 256. |
| 200 | The alternate functions such as \fBcolor_set\fP can pass a color pair |
| 201 | value directly. |
| 202 | However, ncurses ABI 4 and 5 simply OR this value within the alternate functions. |
| 203 | You must use ncurses ABI 6 to support more than 256 color pairs. |
| 204 | .SH PORTABILITY |
| 205 | These functions are supported in the XSI Curses standard, Issue 4. The |
| 206 | standard defined the dedicated type for highlights, \fBattr_t\fR, which is not |
| 207 | defined in SVr4 curses. The functions taking \fBattr_t\fR arguments are |
| 208 | not supported under SVr4. |
| 209 | .PP |
| 210 | The XSI Curses standard states that whether the traditional functions |
| 211 | \fBattron\fR/\fBattroff\fR/\fBattrset\fR can manipulate attributes other than |
| 212 | \fBA_BLINK\fR, \fBA_BOLD\fR, \fBA_DIM\fR, \fBA_REVERSE\fR, \fBA_STANDOUT\fR, or |
| 213 | \fBA_UNDERLINE\fR is "unspecified". Under this implementation as well as |
| 214 | SVr4 curses, these functions correctly manipulate all other highlights |
| 215 | (specifically, \fBA_ALTCHARSET\fR, \fBA_PROTECT\fR, and \fBA_INVIS\fR). |
| 216 | .PP |
| 217 | XSI Curses added the new entry points, \fBattr_get\fR, \fBattr_on\fR, |
| 218 | \fBattr_off\fR, \fBattr_set\fR, \fBwattr_on\fR, \fBwattr_off\fR, |
| 219 | \fBwattr_get\fR, \fBwattr_set\fR. These are intended to work with |
| 220 | a new series of highlight macros prefixed with \fBWA_\fR. |
| 221 | .PP |
| 222 | Older versions of this library did not force an update of the screen |
| 223 | when changing the attributes. |
| 224 | Use \fBtouchwin\fR to force the screen to match the updated attributes. |
| 225 | .PP |
| 226 | .TS |
| 227 | center ; |
| 228 | l l . |
| 229 | \fBWA_NORMAL\fR Normal display (no highlight) |
| 230 | \fBWA_STANDOUT\fR Best highlighting mode of the terminal. |
| 231 | \fBWA_UNDERLINE\fR Underlining |
| 232 | \fBWA_REVERSE\fR Reverse video |
| 233 | \fBWA_BLINK\fR Blinking |
| 234 | \fBWA_DIM\fR Half bright |
| 235 | \fBWA_BOLD\fR Extra bright or bold |
| 236 | \fBWA_ALTCHARSET\fR Alternate character set |
| 237 | .TE |
| 238 | .PP |
| 239 | The XSI curses standard specifies that each pair of corresponding \fBA_\fR |
| 240 | and \fBWA_\fR-using functions operates on the same current-highlight |
| 241 | information. |
| 242 | .PP |
| 243 | The XSI standard extended conformance level adds new highlights |
| 244 | \fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR, |
| 245 | \fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each) which this |
| 246 | implementation does not yet support. |
| 247 | .SH RETURN VALUE |
| 248 | All routines return the integer \fBOK\fR on success, or \fBERR\fP on failure. |
| 249 | .PP |
| 250 | X/Open does not define any error conditions. |
| 251 | .PP |
| 252 | This implementation returns an error |
| 253 | if the window pointer is null. |
| 254 | The \fBwcolor_set\fP function returns an error if the color pair parameter |
| 255 | is outside the range 0..COLOR_PAIRS-1. |
| 256 | This implementation also provides |
| 257 | \fBgetattrs\fR |
| 258 | for compatibility with older versions of curses. |
| 259 | .SH SEE ALSO |
| 260 | \fBcurses\fR(3X), |
| 261 | \fBcurs_addch\fR(3X), |
| 262 | \fBcurs_addstr\fR(3X), |
| 263 | \fBcurs_bkgd\fR(3X), |
| 264 | \fBcurs_printw\fR(3X) |
| 265 | .\"# |
| 266 | .\"# The following sets edit modes for GNU EMACS |
| 267 | .\"# Local Variables: |
| 268 | .\"# mode:nroff |
| 269 | .\"# fill-column:79 |
| 270 | .\"# End: |