10d09ddde2422de40c4922e8390621a17bb15157
[dragonfly.git] / lib / libncurses / man / curs_add_wch.3
1 .\"***************************************************************************
2 .\" Copyright (c) 2001-2010,2011 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_add_wch.3x,v 1.14 2011/01/15 15:27:43 tom Exp $
30 .TH curs_add_wch 3 ""
31 .de bP
32 .IP \(bu 4
33 ..
34 .SH NAME
35 \fBadd_wch\fP,
36 \fBwadd_wch\fP,
37 \fBmvadd_wch\fP,
38 \fBmvwadd_wch\fP,
39 \fBecho_wchar\fP,
40 \fBwecho_wchar\fP \- add a complex character and rendition to a \fBcurses\fR window, then advance the cursor
41 .SH SYNOPSIS
42 .PP
43 \fB#include <curses.h>\fP
44 .sp
45 .B "int add_wch( const cchar_t *\fIwch\fB );"
46 .br
47 .B "int wadd_wch( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
48 .br
49 .B "int mvadd_wch( int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
50 .br
51 .B "int mvwadd_wch( WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, const cchar_t *\fIwch\fB );"
52 .br
53 .B "int echo_wchar( const cchar_t *\fIwch\fB );"
54 .br
55 .B "int wecho_wchar( WINDOW *\fIwin\fP, const cchar_t *\fIwch\fB );"
56 .br
57 .SH DESCRIPTION
58 .PP
59 The
60 \fBadd_wch\fP,
61 \fBwadd_wch\fP,
62 \fBmvadd_wch\fP, and
63 \fBmvwadd_wch\fP
64 functions put the complex character \fIwch\fP into the given
65 window at its current position,
66 which is then advanced.
67 These functions perform
68 wrapping and special-character processing as follows:
69 .bP
70 If \fIwch\fP refers to a spacing character,
71 then any previous character at that location is removed.
72 A new character specified by \fIwch\fP is
73 placed at that location with rendition specified by \fIwch\fP.
74 The cursor then advances to
75 the next spacing character on the screen.
76 .bP
77 If \fIwch\fP refers to a non-spacing character,
78 all previous characters at that location are preserved.
79 The non-spacing characters of \fIwch\fP
80 are added to the spacing complex character,
81 and the rendition specified by \fIwch\fP is ignored.
82 .bP
83 If the character part of \fIwch\fP is
84 a tab, newline, backspace or other control character,
85 the window is updated and the cursor moves as if \fBaddch\fR were called.
86 .PP
87 The \fBecho_wchar\fP
88 function is functionally equivalent to a call to
89 \fBadd_wch\fP
90 followed by a call to
91 \fBrefresh\fP.
92 Similarly, the
93 \fBwecho_wchar\fP
94 is functionally equivalent to a call to
95 \fBwadd_wch\fP
96 followed by a call to
97 \fBwrefresh\fP.
98 The knowledge
99 that only a single character is being output is taken into consideration and,
100 for non-control characters, a considerable performance gain might be seen
101 by using the *\fBecho\fP* functions instead of their equivalents.
102 .SS Line Graphics
103 Like \fBaddch\fP(3),
104 \fBaddch_wch\fP accepts symbols which make it simple to draw lines and other
105 frequently used special characters.
106 These symbols correspond to the same VT100 line-drawing set as
107 \fBaddch\fP(3).
108 .PP
109 .TS
110 l l l l
111 _ _ _ _
112 lw(1.5i) lw7 lw7 lw20.
113 \fIName\fR      \fIUnicode\fP   \fIDefault\fR   \fIDescription\fR
114 WACS_BLOCK      0x25ae  #       solid square block
115 WACS_BOARD      0x2592  #       board of squares
116 WACS_BTEE       0x2534  +       bottom tee
117 WACS_BULLET     0x00b7  o       bullet
118 WACS_CKBOARD    0x2592  :       checker board (stipple)
119 WACS_DARROW     0x2193  v       arrow pointing down
120 WACS_DEGREE     0x00b0  '       degree symbol
121 WACS_DIAMOND    0x25c6  +       diamond
122 WACS_GEQUAL     0x2265  >       greater-than-or-equal-to
123 WACS_HLINE      0x2500  \-      horizontal line
124 WACS_LANTERN    0x2603  #       lantern symbol
125 WACS_LARROW     0x2190  <       arrow pointing left
126 WACS_LEQUAL     0x2264  <       less-than-or-equal-to
127 WACS_LLCORNER   0x2514  +       lower left-hand corner
128 WACS_LRCORNER   0x2518  +       lower right-hand corner
129 WACS_LTEE       0x2524  +       left tee
130 WACS_NEQUAL     0x2260  !       not-equal
131 WACS_PI 0x03c0  *       greek pi
132 WACS_PLMINUS    0x00b1  #       plus/minus
133 WACS_PLUS       0x253c  +       plus
134 WACS_RARROW     0x2192  >       arrow pointing right
135 WACS_RTEE       0x251c  +       right tee
136 WACS_S1 0x23ba  \-      scan line 1
137 WACS_S3 0x23bb  \-      scan line 3
138 WACS_S7 0x23bc  \-      scan line 7
139 WACS_S9 0x23bd  \&_     scan line 9
140 WACS_STERLING   0x00a3  f       pound-sterling symbol
141 WACS_TTEE       0x252c  +       top tee
142 WACS_UARROW     0x2191          ^       arrow pointing up
143 WACS_ULCORNER   0x250c  +       upper left-hand corner
144 WACS_URCORNER   0x2510  +       upper right-hand corner
145 WACS_VLINE      0x2502  |       vertical line
146 .TE
147 .PP
148 The wide-character configuration of ncurses also defines symbols
149 for thick- and double-lines:
150 .PP
151 .TS
152 l l l l
153 _ _ _ _
154 lw(1.5i) lw7 lw7 lw20.
155 \fIName\fR      \fIUnicode\fP   \fIDefault\fR   \fIDescription\fR
156 WACS_T_ULCORNER 0x250f  +       thick upper left corner
157 WACS_T_LLCORNER 0x2517  +       thick lower left corner
158 WACS_T_URCORNER 0x2513  +       thick upper right corner
159 WACS_T_LRCORNER 0x251b  +       thick lower right corner
160 WACS_T_LTEE     0x252b  +       thick tee pointing right
161 WACS_T_RTEE     0x2523  +       thick tee pointing left
162 WACS_T_BTEE     0x253b  +       thick tee pointing up
163 WACS_T_TTEE     0x2533  +       thick tee pointing down
164 WACS_T_HLINE    0x2501  -       thick horizontal line
165 WACS_T_VLINE    0x2503  |       thick vertical line
166 WACS_T_PLUS     0x254b  +       thick large plus or crossover
167 WACS_D_ULCORNER 0x2554  +       double upper left corner
168 WACS_D_LLCORNER 0x255a  +       double lower left corner
169 WACS_D_URCORNER 0x2557  +       double upper right corner
170 WACS_D_LRCORNER 0x255d  +       double lower right corner
171 WACS_D_RTEE     0x2563  +       double tee pointing left
172 WACS_D_LTEE     0x2560  +       double tee pointing right
173 WACS_D_BTEE     0x2569  +       double tee pointing up
174 WACS_D_TTEE     0x2566  +       double tee pointing down
175 WACS_D_HLINE    0x2550  -       double horizontal line
176 WACS_D_VLINE    0x2551  |       double vertical line
177 WACS_D_PLUS     0x256c  +       double large plus or crossover
178 .TE
179 .SH RETURN VALUES
180 .PP
181 All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
182 .PP
183 Functions with a "mv" prefix first perform a cursor movement using
184 \fBwmove\fP, and return an error if the position is outside the window,
185 or if the window pointer is null.
186 .SH NOTES
187 .PP
188 Note that
189 \fBadd_wch\fP,
190 \fBmvadd_wch\fP,
191 \fBmvwadd_wch\fP, and
192 \fBecho_wchar\fP
193 may be macros.
194 .SH PORTABILITY
195 .PP
196 All of these functions are described in the XSI Curses standard, Issue 4.
197 The defaults specified for line-drawing characters apply in the POSIX locale.
198 .PP
199 X/Open Curses makes it clear that the WACS_ symbols should be defined as
200 a pointer to \fBcchar_t\fP data, e.g., in the discussion of \fBborder_set\fR.
201 A few implementations are problematic:
202 .bP
203 NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP.
204 .bP
205 HPUX curses equates some of the \fIACS_\fP symbols
206 to the analogous \fIWACS_\fP symbols as if the \fIACS_\fP symbols were
207 wide characters.
208 The misdefined symbols are the arrows
209 and other symbols which are not used for line-drawing.
210 .PP
211 X/Open Curses does not define symbols for thick- or double-lines.
212 SVr4 curses implementations defined their line-drawing symbols in
213 terms of intermediate symbols.
214 This implementation extends those symbols, providing new definitions
215 which are not in the SVr4 implementations.
216 .SH SEE ALSO
217 .PP
218 \fBcurses\fR(3),
219 \fBcurs_addch\fR(3),
220 \fBcurs_attr\fR(3),
221 \fBcurs_clear\fR(3),
222 \fBcurs_outopts\fR(3),
223 \fBcurs_refresh\fR(3),
224 \fBputwc\fR(3)