1*51ffecc1SBen Gras.\" $NetBSD: curses_attributes.3,v 1.8 2008/04/30 13:10:51 martin Exp $ 2*51ffecc1SBen Gras.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 3*51ffecc1SBen Gras.\" All rights reserved. 4*51ffecc1SBen Gras.\" 5*51ffecc1SBen Gras.\" This code is derived from software contributed to The NetBSD Foundation 6*51ffecc1SBen Gras.\" by Julian Coleman. 7*51ffecc1SBen Gras.\" 8*51ffecc1SBen Gras.\" Redistribution and use in source and binary forms, with or without 9*51ffecc1SBen Gras.\" modification, are permitted provided that the following conditions 10*51ffecc1SBen Gras.\" are met: 11*51ffecc1SBen Gras.\" 1. Redistributions of source code must retain the above copyright 12*51ffecc1SBen Gras.\" notice, this list of conditions and the following disclaimer. 13*51ffecc1SBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 14*51ffecc1SBen Gras.\" notice, this list of conditions and the following disclaimer in the 15*51ffecc1SBen Gras.\" documentation and/or other materials provided with the distribution. 16*51ffecc1SBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17*51ffecc1SBen Gras.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18*51ffecc1SBen Gras.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19*51ffecc1SBen Gras.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20*51ffecc1SBen Gras.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21*51ffecc1SBen Gras.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22*51ffecc1SBen Gras.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23*51ffecc1SBen Gras.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24*51ffecc1SBen Gras.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25*51ffecc1SBen Gras.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26*51ffecc1SBen Gras.\" POSSIBILITY OF SUCH DAMAGE. 27*51ffecc1SBen Gras.\" 28*51ffecc1SBen Gras.Dd March 14, 2008 29*51ffecc1SBen Gras.Dt CURSES_ATTRIBUTES 3 30*51ffecc1SBen Gras.Os 31*51ffecc1SBen Gras.Sh NAME 32*51ffecc1SBen Gras.Nm curses_attributes , 33*51ffecc1SBen Gras.Nm attron , 34*51ffecc1SBen Gras.Nm attroff , 35*51ffecc1SBen Gras.Nm attrset , 36*51ffecc1SBen Gras.Nm color_set , 37*51ffecc1SBen Gras.Nm getattrs , 38*51ffecc1SBen Gras.Nm termattrs , 39*51ffecc1SBen Gras.Nm wattron , 40*51ffecc1SBen Gras.Nm wattroff , 41*51ffecc1SBen Gras.Nm wattrset , 42*51ffecc1SBen Gras.Nm wcolor_set , 43*51ffecc1SBen Gras.Nm attr_on , 44*51ffecc1SBen Gras.Nm attr_off , 45*51ffecc1SBen Gras.Nm attr_set , 46*51ffecc1SBen Gras.Nm attr_get , 47*51ffecc1SBen Gras.Nm term_attrs , 48*51ffecc1SBen Gras.Nm wattr_on , 49*51ffecc1SBen Gras.Nm wattr_off , 50*51ffecc1SBen Gras.Nm wattr_set , 51*51ffecc1SBen Gras.Nm wattr_get 52*51ffecc1SBen Gras.Nd curses general attribute manipulation routines 53*51ffecc1SBen Gras.Sh LIBRARY 54*51ffecc1SBen Gras.Lb libcurses 55*51ffecc1SBen Gras.Sh SYNOPSIS 56*51ffecc1SBen Gras.In curses.h 57*51ffecc1SBen Gras.Ft int 58*51ffecc1SBen Gras.Fn attron "int attr" 59*51ffecc1SBen Gras.Ft int 60*51ffecc1SBen Gras.Fn attroff "int attr" 61*51ffecc1SBen Gras.Ft int 62*51ffecc1SBen Gras.Fn attrset "int attr" 63*51ffecc1SBen Gras.Ft int 64*51ffecc1SBen Gras.Fn color_set "short pair" "void *opt" 65*51ffecc1SBen Gras.Ft chtype 66*51ffecc1SBen Gras.Fn getattrs "WINDOW *win" 67*51ffecc1SBen Gras.Ft chtype 68*51ffecc1SBen Gras.Fn termattrs "void" 69*51ffecc1SBen Gras.Ft int 70*51ffecc1SBen Gras.Fn wcolor_set "WINDOW *win" "short pair" "void *opt" 71*51ffecc1SBen Gras.Ft int 72*51ffecc1SBen Gras.Fn wattron "WINDOW * win" "int attr" 73*51ffecc1SBen Gras.Ft int 74*51ffecc1SBen Gras.Fn wattroff "WINDOW * win" "int attr" 75*51ffecc1SBen Gras.Ft int 76*51ffecc1SBen Gras.Fn wattrset "WINDOW * win" "int attr" 77*51ffecc1SBen Gras.Ft int 78*51ffecc1SBen Gras.Fn attr_on "attr_t attr" "void *opt" 79*51ffecc1SBen Gras.Ft int 80*51ffecc1SBen Gras.Fn attr_off "attr_t attr" "void *opt" 81*51ffecc1SBen Gras.Ft int 82*51ffecc1SBen Gras.Fn attr_set "attr_t attr" "short pair" "void *opt" 83*51ffecc1SBen Gras.Ft int 84*51ffecc1SBen Gras.Fn attr_get "attr_t *attr" "short *pair" "void *opt" 85*51ffecc1SBen Gras.Ft attr_t 86*51ffecc1SBen Gras.Fn term_attrs "void" 87*51ffecc1SBen Gras.Ft int 88*51ffecc1SBen Gras.Fn wattr_on "WINDOW *win" "attr_t attr" "void *opt" 89*51ffecc1SBen Gras.Ft int 90*51ffecc1SBen Gras.Fn wattr_off "WINDOW *win" "attr_t attr" "void *opt" 91*51ffecc1SBen Gras.Ft int 92*51ffecc1SBen Gras.Fn wattr_set "WINDOW *win" "attr_t attr" "short pair" "void *opt" 93*51ffecc1SBen Gras.Ft int 94*51ffecc1SBen Gras.Fn wattr_get "WINDOW *win" "attr_t *attr" "short *pair" "void *opt" 95*51ffecc1SBen Gras.Sh DESCRIPTION 96*51ffecc1SBen GrasThese functions manipulate attributes on 97*51ffecc1SBen Gras.Dv stdscr 98*51ffecc1SBen Grasor on the specified window. 99*51ffecc1SBen GrasThe attributes that can be manipulated are: 100*51ffecc1SBen Gras.Pp 101*51ffecc1SBen Gras.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent 102*51ffecc1SBen Gras.It A_NORMAL 103*51ffecc1SBen Grasno special attributes are applied 104*51ffecc1SBen Gras.It A_STANDOUT 105*51ffecc1SBen Grascharacters are displayed in standout mode 106*51ffecc1SBen Gras.It A_UNDERLINE 107*51ffecc1SBen Grascharacters are displayed underlined 108*51ffecc1SBen Gras.It A_REVERSE 109*51ffecc1SBen Grascharacters are displayed in inverse video 110*51ffecc1SBen Gras.It A_BLINK 111*51ffecc1SBen Grascharacters blink 112*51ffecc1SBen Gras.It A_DIM 113*51ffecc1SBen Grascharacters are displayed at a lower intensity 114*51ffecc1SBen Gras.It A_BOLD 115*51ffecc1SBen Grascharacters are displayed at a higher intensity 116*51ffecc1SBen Gras.It A_INVIS 117*51ffecc1SBen Grascharacters are added invisibly 118*51ffecc1SBen Gras.It A_PROTECT 119*51ffecc1SBen Grascharacters are protected from modification 120*51ffecc1SBen Gras.It A_ALTCHARSET 121*51ffecc1SBen Grascharacters are displayed using the alternate character set (ACS) 122*51ffecc1SBen Gras.It COLOR_PAIR(n) 123*51ffecc1SBen Grascharacters are displayed using color pair n. 124*51ffecc1SBen Gras.El 125*51ffecc1SBen Gras.Pp 126*51ffecc1SBen GrasThe 127*51ffecc1SBen Gras.Fn attron 128*51ffecc1SBen Grasfunction turns on the attributes specified in 129*51ffecc1SBen Gras.Fa attr 130*51ffecc1SBen Grason 131*51ffecc1SBen Gras.Dv stdscr , 132*51ffecc1SBen Graswhile the 133*51ffecc1SBen Gras.Fn attroff 134*51ffecc1SBen Grasfunction turns off the attributes specified in 135*51ffecc1SBen Gras.Fa attr 136*51ffecc1SBen Grason 137*51ffecc1SBen Gras.Dv stdscr . 138*51ffecc1SBen Gras.Pp 139*51ffecc1SBen GrasThe function 140*51ffecc1SBen Gras.Fn attrset 141*51ffecc1SBen Grassets the attributes of 142*51ffecc1SBen Gras.Dv stdscr 143*51ffecc1SBen Grasto those specified in 144*51ffecc1SBen Gras.Fa attr , 145*51ffecc1SBen Grasturning off any others. 146*51ffecc1SBen GrasTo turn off all the attributes (including color and alternate character set), 147*51ffecc1SBen Grasuse 148*51ffecc1SBen Gras.Fn attrset A_NORMAL . 149*51ffecc1SBen Gras.Pp 150*51ffecc1SBen GrasMultiple attributes can be manipulated by combining the attributes 151*51ffecc1SBen Grasusing a logical 152*51ffecc1SBen Gras.Em OR . 153*51ffecc1SBen GrasFor example, 154*51ffecc1SBen Gras.Fn attron "A_REVERSE | A_BOLD" 155*51ffecc1SBen Graswill turn on both inverse video and higher intensity. 156*51ffecc1SBen Gras.Pp 157*51ffecc1SBen GrasThe function 158*51ffecc1SBen Gras.Fn color_set 159*51ffecc1SBen Grassets the color pair attribute to the pair specified in 160*51ffecc1SBen Gras.Fa pair . 161*51ffecc1SBen Gras.Pp 162*51ffecc1SBen GrasThe function 163*51ffecc1SBen Gras.Fn getattrs 164*51ffecc1SBen Grasreturns the attributes that are currently applied to window specified by 165*51ffecc1SBen Gras.Fa win . 166*51ffecc1SBen Gras.Pp 167*51ffecc1SBen GrasThe function 168*51ffecc1SBen Gras.Fn termattrs 169*51ffecc1SBen Grasreturns the logical 170*51ffecc1SBen Gras.Em OR 171*51ffecc1SBen Grasof attributes that can be applied to the screen. 172*51ffecc1SBen Gras.Pp 173*51ffecc1SBen GrasThe functions 174*51ffecc1SBen Gras.Fn wattron , 175*51ffecc1SBen Gras.Fn wattroff , 176*51ffecc1SBen Gras.Fn wattrset , 177*51ffecc1SBen Grasand 178*51ffecc1SBen Gras.Fn wcolor_set 179*51ffecc1SBen Grasare equivalent to 180*51ffecc1SBen Gras.Fn attron , 181*51ffecc1SBen Gras.Fn attroff 182*51ffecc1SBen Gras.Fn attrset , 183*51ffecc1SBen Grasand 184*51ffecc1SBen Gras.Fn color_set 185*51ffecc1SBen Grasrespectively, excepting that the attributes are applied to the window 186*51ffecc1SBen Grasspecified by 187*51ffecc1SBen Gras.Fa win . 188*51ffecc1SBen Gras.Pp 189*51ffecc1SBen GrasThe following functions additionally manipulate wide attributes on 190*51ffecc1SBen Gras.Dv stdscr 191*51ffecc1SBen Grasor on the specified window. 192*51ffecc1SBen GrasThe additional wide attributes that can be manipulated are: 193*51ffecc1SBen Gras.Pp 194*51ffecc1SBen Gras.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent 195*51ffecc1SBen Gras.It WA_STANDOUT 196*51ffecc1SBen Grascharacters are displayed in standout mode 197*51ffecc1SBen Gras.It WA_UNDERLINE 198*51ffecc1SBen Grascharacters are displayed underlined 199*51ffecc1SBen Gras.It WA_REVERSE 200*51ffecc1SBen Grascharacters are displayed in inverse video 201*51ffecc1SBen Gras.It WA_BLINK 202*51ffecc1SBen Grascharacters blink 203*51ffecc1SBen Gras.It WA_DIM 204*51ffecc1SBen Grascharacters are displayed at a lower intensity 205*51ffecc1SBen Gras.It WA_BOLD 206*51ffecc1SBen Grascharacters are displayed at a higher intensity 207*51ffecc1SBen Gras.It WA_INVIS 208*51ffecc1SBen Grascharacters are added invisibly 209*51ffecc1SBen Gras.It WA_PROTECT 210*51ffecc1SBen Grascharacters are protected from modification 211*51ffecc1SBen Gras.It WA_ALTCHARSET 212*51ffecc1SBen Grascharacters are displayed using the alternate character set (ACS) 213*51ffecc1SBen Gras.It WA_LOW 214*51ffecc1SBen Grascharacters are displayed with low highlight 215*51ffecc1SBen Gras.It WA_TOP 216*51ffecc1SBen Grascharacters are displayed with top highlight 217*51ffecc1SBen Gras.It WA_HORIZONTAL 218*51ffecc1SBen Grascharacters are displayed with horizontal highlight 219*51ffecc1SBen Gras.It WA_VERTICAL 220*51ffecc1SBen Grascharacters are displayed with vertical highlight 221*51ffecc1SBen Gras.It WA_LEFT 222*51ffecc1SBen Grascharacters are displayed with left highlight 223*51ffecc1SBen Gras.It WA_RIGHT 224*51ffecc1SBen Grascharacters are displayed with right highlight 225*51ffecc1SBen Gras.El 226*51ffecc1SBen Gras.Pp 227*51ffecc1SBen GrasThe 228*51ffecc1SBen Gras.Fn attr_on 229*51ffecc1SBen Grasfunction turns on the wide attributes specified in 230*51ffecc1SBen Gras.Fa attr 231*51ffecc1SBen Grason 232*51ffecc1SBen Gras.Dv stdscr , 233*51ffecc1SBen Graswhile the 234*51ffecc1SBen Gras.Fn attr_off 235*51ffecc1SBen Grasfunction turns off the wide attributes specified in 236*51ffecc1SBen Gras.Fa attr 237*51ffecc1SBen Grason 238*51ffecc1SBen Gras.Dv stdscr . 239*51ffecc1SBen Gras.Pp 240*51ffecc1SBen GrasThe function 241*51ffecc1SBen Gras.Fn attr_set 242*51ffecc1SBen Grassets the wide attributes of 243*51ffecc1SBen Gras.Dv stdscr 244*51ffecc1SBen Grasto those specified in 245*51ffecc1SBen Gras.Fa attr 246*51ffecc1SBen Grasand 247*51ffecc1SBen Gras.Fa pair , 248*51ffecc1SBen Grasturning off any others. 249*51ffecc1SBen GrasNote that a color pair specified in 250*51ffecc1SBen Gras.Fa pair 251*51ffecc1SBen Graswill override any color pair specified in 252*51ffecc1SBen Gras.Fa attr . 253*51ffecc1SBen Gras.Pp 254*51ffecc1SBen GrasThe function 255*51ffecc1SBen Gras.Fn attr_get 256*51ffecc1SBen Grassets 257*51ffecc1SBen Gras.Fa attr 258*51ffecc1SBen Grasto the wide attributes and 259*51ffecc1SBen Gras.Fa pair 260*51ffecc1SBen Grasto the color pair currently applied to 261*51ffecc1SBen Gras.Dv stdscr . 262*51ffecc1SBen GrasEither of 263*51ffecc1SBen Gras.Fa attr 264*51ffecc1SBen Grasand 265*51ffecc1SBen Gras.Fa pair 266*51ffecc1SBen Grascan be 267*51ffecc1SBen Gras.Dv NULL , 268*51ffecc1SBen Grasif the relevant value is of no interest. 269*51ffecc1SBen Gras.Pp 270*51ffecc1SBen GrasThe function 271*51ffecc1SBen Gras.Fn term_attrs 272*51ffecc1SBen Grasreturns the logical 273*51ffecc1SBen Gras.Em OR 274*51ffecc1SBen Grasof wide attributes that can be applied to the screen. 275*51ffecc1SBen Gras.Pp 276*51ffecc1SBen GrasThe functions 277*51ffecc1SBen Gras.Fn wattr_on , 278*51ffecc1SBen Gras.Fn wattr_off 279*51ffecc1SBen Grasand 280*51ffecc1SBen Gras.Fn wattr_set 281*51ffecc1SBen Grasare equivalent to 282*51ffecc1SBen Gras.Fn attr_on , 283*51ffecc1SBen Gras.Fn attr_off 284*51ffecc1SBen Grasand 285*51ffecc1SBen Gras.Fn attr_set 286*51ffecc1SBen Grasrespectively, excepting that the character is added to the window specified by 287*51ffecc1SBen Gras.Fa win . 288*51ffecc1SBen Gras.Pp 289*51ffecc1SBen GrasThe function 290*51ffecc1SBen Gras.Fn wattr_get 291*51ffecc1SBen Grasis equivalent to 292*51ffecc1SBen Gras.Fn attr_get , 293*51ffecc1SBen Grasexcepting that the wide attributes and color pair currently applied to 294*51ffecc1SBen Gras.Fa win 295*51ffecc1SBen Grasare set. 296*51ffecc1SBen Gras.Pp 297*51ffecc1SBen GrasThe following constants can be used to extract the components of a 298*51ffecc1SBen Gras.Dv chtype : 299*51ffecc1SBen Gras.Pp 300*51ffecc1SBen Gras.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent 301*51ffecc1SBen Gras.It A_ATTRIBUTES 302*51ffecc1SBen Grasbit-mask containing attributes part 303*51ffecc1SBen Gras.It A_CHARTEXT 304*51ffecc1SBen Grasbit-mask containing character part 305*51ffecc1SBen Gras.It A_COLOR 306*51ffecc1SBen Grasbit-mask containing color-pair part 307*51ffecc1SBen Gras.El 308*51ffecc1SBen Gras.Sh RETURN VALUES 309*51ffecc1SBen GrasThese functions return OK on success and ERR on failure. 310*51ffecc1SBen Gras.Sh SEE ALSO 311*51ffecc1SBen Gras.Xr curses_addch 3 , 312*51ffecc1SBen Gras.Xr curses_addchstr 3 , 313*51ffecc1SBen Gras.Xr curses_addstr 3 , 314*51ffecc1SBen Gras.Xr curses_background 3 , 315*51ffecc1SBen Gras.Xr curses_color 3 , 316*51ffecc1SBen Gras.Xr curses_insertch 3 , 317*51ffecc1SBen Gras.Xr curses_standout 3 , 318*51ffecc1SBen Gras.Xr curses_underscore 3 319*51ffecc1SBen Gras.Sh NOTES 320*51ffecc1SBen GrasThe 321*51ffecc1SBen Gras.Fa opt 322*51ffecc1SBen Grasargument is not currently used but is reserved for a future version of the 323*51ffecc1SBen Grasspecification. 324*51ffecc1SBen Gras.Sh STANDARDS 325*51ffecc1SBen GrasThe 326*51ffecc1SBen Gras.Nx 327*51ffecc1SBen GrasCurses library complies with the X/Open Curses specification, part of the 328*51ffecc1SBen GrasSingle Unix Specification. 329*51ffecc1SBen Gras.Pp 330*51ffecc1SBen GrasThe 331*51ffecc1SBen Gras.Fn getattrs 332*51ffecc1SBen Grasfunction 333*51ffecc1SBen Grasis a 334*51ffecc1SBen Gras.Nx 335*51ffecc1SBen Grasextension. 336*51ffecc1SBen Gras.Sh HISTORY 337*51ffecc1SBen GrasThese functions first appeared in 338*51ffecc1SBen Gras.Nx 1.5 . 339*51ffecc1SBen Gras.Sh BUGS 340*51ffecc1SBen GrasSome terminals do not support characters with both color and other attributes 341*51ffecc1SBen Grasset. 342*51ffecc1SBen GrasIn this case, the other attribute is displayed instead of the color attribute. 343