Content-type: text/html
curs_add_wch, add_wch, wadd_wch, mvadd_wch, mvwadd_wch, echo_wchar, wecho_wchar - Add a complex character and rendition to a Curses window and advance the cursor
#include <curses.h>
int add_wch(
const cchar_t *wch
);
int wadd_wch(
WINDOW *win,
const cchar_t *wch
);
int mvadd_wch(
int y,
int x,
const cchar_t *wch
);
int mvwadd_wch(
WINDOW *win,
int y,
int x,
const cchar_t *wch
);
int echo_wchar(
const cchar_t *wch
);
int wecho_wchar(
WINDOW *win,
const cchar_t *wch
);
Interfaces documented on this reference page conform to industry standards as follows:
add_wch, wadd_wch, mvadd_wch, mvwadd_wch, echo_wchar, wecho_wchar: XPG4-UNIX
Refer to the
standards(5)
reference page for more information
about industry standards and associated tags.
The add_wch, wadd_wch, mvadd_wch, and mvwadd_wch functions put the complex character wch into the window at the current or specified cursor position, of the current or specified window, and advance the position of the window cursor. These functions perform wrapping and special-character processing as follows: If wch refers to a spacing character, then any previous character at that location is removed; a new character specified by wch is added at that location with rendition specified by wch; then the cursor is advanced to the next spacing character on the screen. If wch refers to a non-spacing character, all previous characters at that location are preserved; the non-spacing characters of wch are added to the spacing complex character, and the rendition specified by wch is ignored. If the character part of wch is a tab, newline, or backspace, the cursor is moved appropriately within the window. A newline also does a clrtoeol before moving. Tabs are considered to be at every eighth column. If the character part of wch is another control character, it is drawn in the ^X notation. Calling win_wch after adding a control character does not return the control character, but instead returns the representation of the control character.
The
echo_wchar
function is functionally equivalent to a call to
add_wch
followed by a call to
refresh. Similarly, the
wecho_wchar
is functionally equivalent to a call to
wadd_wch
followed by a call to
wrefresh. The knowledge
that only a single character is being output is taken into consideration and,
for non-control characters, a considerable performance gain might be seen
by using the *echo* functions instead of their equivalents.
The following variables may be used to add line-drawing characters to the screen with functions of the add_wch family. When variables are defined for the terminal, the WA_ALTCHARSET bit is turned on [see curs_attr_get(3)]. Otherwise, the default character listed below is stored in the variable. The names chosen are consistent with the VT100 nomenclature.
Name | Default | Glyph Description |
WACS_ULCORNER | + | upper left-hand corner |
WACS_LLCORNER | + | lower left-hand corner |
WACS_URCORNER | + | upper right-hand corner |
WACS_LRCORNER | + | lower right-hand corner |
WACS_RTEE | + | right tee |
WACS_LTEE | + | left tee |
WACS_BTEE | + | bottom tee |
WACS_TTEE | + | top tee |
WACS_HLINE | - | horizontal line |
WACS_VLINE | | | vertical line |
WACS_PLUS | + | plus |
WACS_S1 | - | scan line 1 |
WACS_S9 | _ | scan line 9 |
WACS_DIAMOND | + | diamond |
WACS_CKBOARD | : | checker board (stipple) |
WACS_DEGREE | ' | degree symbol |
WACS_PLMINUS | # | plus/minus |
WACS_BULLET | o | bullet |
WACS_LARROW | < | arrow pointing left |
WACS_RARROW | > | arrow pointing right |
WACS_DARROW | v | arrow pointing down |
WACS_UARROW | ^ | arrow pointing up |
WACS_BOARD | # | board of squares |
WACS_LANTERN | # | lantern symbol |
WACS_BLOCK | # | solid square block |
The header file <curses.h> automatically includes the header file <stdio.h>.
The
add_wch,
mvadd_wch,
mvwadd_wch, and
echo_wchar
may be macros.
All functions return
OK
upon successful completion.
Otherwise, they return
ERR.
Functions: curses(3), curs_attr_get(3), curs_clear(3), curs_outopts(3), curs_refresh(3), putwc(3)
Others: standards(5)