blob: 5b744db1a2898daad3bf8c931fc92daabcbf7c46 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 2001-2012,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_add_wch.3x,v 1.16 2015/07/20 23:44:56 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.TH curs_add_wch 3X ""
Steve Kondikae271bc2015-11-15 02:50:53 +010031.de bP
32.IP \(bu 4
33..
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053034.SH NAME
35\fBadd_wch\fP,
36\fBwadd_wch\fP,
37\fBmvadd_wch\fP,
38\fBmvwadd_wch\fP,
39\fBecho_wchar\fP,
Steve Kondikae271bc2015-11-15 02:50:53 +010040\fBwecho_wchar\fP \- add a complex character and rendition to a \fBcurses\fR window, then advance the cursor
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053041.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
Steve Kondikae271bc2015-11-15 02:50:53 +010058.SS add_wch
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053059.PP
60The
61\fBadd_wch\fP,
62\fBwadd_wch\fP,
63\fBmvadd_wch\fP, and
64\fBmvwadd_wch\fP
65functions put the complex character \fIwch\fP into the given
66window at its current position,
67which is then advanced.
68These functions perform
69wrapping and special-character processing as follows:
Steve Kondikae271bc2015-11-15 02:50:53 +010070.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071If \fIwch\fP refers to a spacing character,
72then any previous character at that location is removed.
73A new character specified by \fIwch\fP is
74placed at that location with rendition specified by \fIwch\fP.
75The cursor then advances to
76the next spacing character on the screen.
Steve Kondikae271bc2015-11-15 02:50:53 +010077.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053078If \fIwch\fP refers to a non-spacing character,
79all previous characters at that location are preserved.
80The non-spacing characters of \fIwch\fP
81are added to the spacing complex character,
82and the rendition specified by \fIwch\fP is ignored.
Steve Kondikae271bc2015-11-15 02:50:53 +010083.bP
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053084If the character part of \fIwch\fP is
85a tab, newline, backspace or other control character,
86the window is updated and the cursor moves as if \fBaddch\fR were called.
Steve Kondikae271bc2015-11-15 02:50:53 +010087.SS echo_wchar
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053088.PP
89The \fBecho_wchar\fP
90function is functionally equivalent to a call to
91\fBadd_wch\fP
92followed by a call to
93\fBrefresh\fP.
94Similarly, the
95\fBwecho_wchar\fP
96is functionally equivalent to a call to
97\fBwadd_wch\fP
98followed by a call to
99\fBwrefresh\fP.
100The knowledge
101that only a single character is being output is taken into consideration and,
102for non-control characters, a considerable performance gain might be seen
103by using the *\fBecho\fP* functions instead of their equivalents.
Steve Kondikae271bc2015-11-15 02:50:53 +0100104.SS Line Graphics
105Like \fBaddch\fP(3X),
106\fBaddch_wch\fP accepts symbols which make it simple to draw lines and other
107frequently used special characters.
108These symbols correspond to the same VT100 line-drawing set as
109\fBaddch\fP(3X).
110.PP
111.TS
112l l l l
113_ _ _ _
114lw(1.5i) lw7 lw7 lw20.
115\fIName\fR \fIUnicode\fP \fIDefault\fR \fIDescription\fR
116WACS_BLOCK 0x25ae # solid square block
117WACS_BOARD 0x2592 # board of squares
118WACS_BTEE 0x2534 + bottom tee
119WACS_BULLET 0x00b7 o bullet
120WACS_CKBOARD 0x2592 : checker board (stipple)
121WACS_DARROW 0x2193 v arrow pointing down
122WACS_DEGREE 0x00b0 ' degree symbol
123WACS_DIAMOND 0x25c6 + diamond
124WACS_GEQUAL 0x2265 > greater-than-or-equal-to
125WACS_HLINE 0x2500 \- horizontal line
126WACS_LANTERN 0x2603 # lantern symbol
127WACS_LARROW 0x2190 < arrow pointing left
128WACS_LEQUAL 0x2264 < less-than-or-equal-to
129WACS_LLCORNER 0x2514 + lower left-hand corner
130WACS_LRCORNER 0x2518 + lower right-hand corner
131WACS_LTEE 0x2524 + left tee
132WACS_NEQUAL 0x2260 ! not-equal
133WACS_PI 0x03c0 * greek pi
134WACS_PLMINUS 0x00b1 # plus/minus
135WACS_PLUS 0x253c + plus
136WACS_RARROW 0x2192 > arrow pointing right
137WACS_RTEE 0x251c + right tee
138WACS_S1 0x23ba \- scan line 1
139WACS_S3 0x23bb \- scan line 3
140WACS_S7 0x23bc \- scan line 7
141WACS_S9 0x23bd \&_ scan line 9
142WACS_STERLING 0x00a3 f pound-sterling symbol
143WACS_TTEE 0x252c + top tee
144WACS_UARROW 0x2191 ^ arrow pointing up
145WACS_ULCORNER 0x250c + upper left-hand corner
146WACS_URCORNER 0x2510 + upper right-hand corner
147WACS_VLINE 0x2502 | vertical line
148.TE
149.PP
150The wide-character configuration of ncurses also defines symbols
151for thick- and double-lines:
152.PP
153.TS
154l l l l
155_ _ _ _
156lw(1.5i) lw7 lw7 lw20.
157\fIName\fR \fIUnicode\fP \fIDefault\fR \fIDescription\fR
158WACS_T_ULCORNER 0x250f + thick upper left corner
159WACS_T_LLCORNER 0x2517 + thick lower left corner
160WACS_T_URCORNER 0x2513 + thick upper right corner
161WACS_T_LRCORNER 0x251b + thick lower right corner
162WACS_T_LTEE 0x252b + thick tee pointing right
163WACS_T_RTEE 0x2523 + thick tee pointing left
164WACS_T_BTEE 0x253b + thick tee pointing up
165WACS_T_TTEE 0x2533 + thick tee pointing down
166WACS_T_HLINE 0x2501 - thick horizontal line
167WACS_T_VLINE 0x2503 | thick vertical line
168WACS_T_PLUS 0x254b + thick large plus or crossover
169WACS_D_ULCORNER 0x2554 + double upper left corner
170WACS_D_LLCORNER 0x255a + double lower left corner
171WACS_D_URCORNER 0x2557 + double upper right corner
172WACS_D_LRCORNER 0x255d + double lower right corner
173WACS_D_RTEE 0x2563 + double tee pointing left
174WACS_D_LTEE 0x2560 + double tee pointing right
175WACS_D_BTEE 0x2569 + double tee pointing up
176WACS_D_TTEE 0x2566 + double tee pointing down
177WACS_D_HLINE 0x2550 - double horizontal line
178WACS_D_VLINE 0x2551 | double vertical line
179WACS_D_PLUS 0x256c + double large plus or crossover
180.TE
181.SH RETURN VALUE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530182.PP
183All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success.
Steve Kondikae271bc2015-11-15 02:50:53 +0100184.PP
185Functions with a "mv" prefix first perform a cursor movement using
186\fBwmove\fP, and return an error if the position is outside the window,
187or if the window pointer is null.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530188.SH NOTES
189.PP
190Note that
191\fBadd_wch\fP,
192\fBmvadd_wch\fP,
193\fBmvwadd_wch\fP, and
194\fBecho_wchar\fP
195may be macros.
196.SH PORTABILITY
197.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100198All of these functions are described in the XSI Curses standard, Issue 4.
199The defaults specified for line-drawing characters apply in the POSIX locale.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530200.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100201X/Open Curses makes it clear that the WACS_ symbols should be defined as
202a pointer to \fBcchar_t\fP data, e.g., in the discussion of \fBborder_set\fR.
203A few implementations are problematic:
204.bP
205NetBSD curses defines the symbols as a \fBwchar_t\fP within a \fBcchar_t\fP.
206.bP
207HPUX curses equates some of the \fIACS_\fP symbols
208to the analogous \fIWACS_\fP symbols as if the \fIACS_\fP symbols were
209wide characters.
210The misdefined symbols are the arrows
211and other symbols which are not used for line-drawing.
212.PP
213X/Open Curses does not define symbols for thick- or double-lines.
214SVr4 curses implementations defined their line-drawing symbols in
215terms of intermediate symbols.
216This implementation extends those symbols, providing new definitions
217which are not in the SVr4 implementations.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530218.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100219.na
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530220.PP
221\fBcurses\fR(3X),
222\fBcurs_addch\fR(3X),
223\fBcurs_attr\fR(3X),
224\fBcurs_clear\fR(3X),
225\fBcurs_outopts\fR(3X),
226\fBcurs_refresh\fR(3X),
227\fBputwc\fR(3)