1curs_addwch(3CURSES) Curses Library Functions curs_addwch(3CURSES)
2
3
4
6 curs_addwch, addwch, waddwch, mvaddwch, mvwaddwch, echowchar,
7 wechowchar - add a wchar_t character (with attributes) to a curses win‐
8 dow and advance cursor
9
11 cc [flag]... file... -lcurses [library]...
12
13
14 #include<curses.h>
15
16 int addwch(chtype wch);
17
18
19 int waddwch(WINDOW *win, chtype wch);
20
21
22 int mvaddwch(int y, int x, chtype wch);
23
24
25 int mvwaddwch(WINDOW *win, int y, int x, chtype wch);
26
27
28 int echowchar(chtype wch);
29
30
31 int wechowchar(WINDOW *win, chtype wch);
32
33
35 The addwch(),waddwch(),mvaddwch(), and mvwaddwch() routines put the
36 character wch, holding a wchar_t character, into the window at the
37 current cursor position of the window and advance the position of the
38 window cursor. Their function is similar to that of putwchar(3C) in
39 the C multibyte library. At the right margin, an automatic newline is
40 performed. At the bottom of the scrolling region, if scrollok is
41 enabled, the scrolling region is scrolled up one line.
42
43
44 If wch is a tab, newline, or backspace, the cursor is moved appropri‐
45 ately within the window. A newline also does a clrtoeol(3CURSES)
46 before moving. Tabs are considered to be at every eighth column. If
47 wch is another control character, it is drawn in the ^X notation. Call‐
48 ing winwch(3CURSES) after adding a control character does not return
49 the control character, but instead returns the representation of the
50 control character.
51
52
53 Video attributes can be combined with a wchar_t character by OR-ing
54 them into the parameter. This results in these attributes also being
55 set. (The intent here is that text, including attributes, can be copied
56 from one place to another using inwch() and addwch().) See stand‐
57 out(3CURSES), predefined video attribute constants.
58
59
60 The echowchar() and wechowchar() routines are functionally equivalent
61 to a call to addwch() followed by a call to refresh(3CURSES), or a
62 call to waddwch() followed by a call to wrefresh(3CURSES). The knowl‐
63 edge that only a single character is being output is taken into consid‐
64 eration and, for non-control characters, a considerable performance
65 gain might be seen by using these routines instead of their equiva‐
66 lents.
67
68 Line Graphics
69 The following variables may be used to add line drawing characters to
70 the screen with routines of the addwch() family. When variables are
71 defined for the terminal, the A_ALTCHARSET bit is turned on. (See
72 curs_attr(3CURSES)). Otherwise, the default character listed below is
73 stored in the variable. The names chosen are consistent with the VT100
74 nomenclature.
75
76
77
78
79 ┌────────────────────┬────────────────────┬─────────────────────────┐
80 │ Name │ Default │ Glyph Description │
81 ├────────────────────┼────────────────────┼─────────────────────────┤
82 │ACS_ULCORNER │+ │ upper left-hand corner │
83 ├────────────────────┼────────────────────┼─────────────────────────┤
84 │ACS_LLCORNER │+ │ lower left-hand corner │
85 ├────────────────────┼────────────────────┼─────────────────────────┤
86 │ACS_URCORNER │+ │ upper right-hand corner │
87 ├────────────────────┼────────────────────┼─────────────────────────┤
88 │ACS_LRCORNER │+ │ lower right-hand corner │
89 ├────────────────────┼────────────────────┼─────────────────────────┤
90 │ACS_RTEE │+ │ right tee │
91 ├────────────────────┼────────────────────┼─────────────────────────┤
92 │ACS_LTEE │+ │ left tee │
93 ├────────────────────┼────────────────────┼─────────────────────────┤
94 │ACS_BTEE │+ │ bottom tee │
95 ├────────────────────┼────────────────────┼─────────────────────────┤
96 │ACS_TTEE │+ │ top tee │
97 ├────────────────────┼────────────────────┼─────────────────────────┤
98 │ACS_HLINE │- │ horizontal line │
99 ├────────────────────┼────────────────────┼─────────────────────────┤
100 │ACS_VLINE │| │ vertical line │
101 ├────────────────────┼────────────────────┼─────────────────────────┤
102 │ACS_PLUS │+ │ plus │
103 ├────────────────────┼────────────────────┼─────────────────────────┤
104 │ACS_S1 │- │ scan line 1 │
105 ├────────────────────┼────────────────────┼─────────────────────────┤
106 │ACS_S9 │- │ scan line 9 │
107 ├────────────────────┼────────────────────┼─────────────────────────┤
108 │ACS_DIAMOND │+ │ diamond │
109 ├────────────────────┼────────────────────┼─────────────────────────┤
110 │ACS_CKBOARD │: │ checker board (stipple) │
111 ├────────────────────┼────────────────────┼─────────────────────────┤
112 │ACS_DEGREE │' │ degree symbol │
113 ├────────────────────┼────────────────────┼─────────────────────────┤
114 │ACS_PLMINUS │# │ plus/minus │
115 ├────────────────────┼────────────────────┼─────────────────────────┤
116 │ACS_BULLET │o │ bullet │
117 ├────────────────────┼────────────────────┼─────────────────────────┤
118 │ACS_LARROW │< │ arrow pointing left │
119 ├────────────────────┼────────────────────┼─────────────────────────┤
120 │ACS_RARRROW │> │ arrow pointing right │
121 ├────────────────────┼────────────────────┼─────────────────────────┤
122 │ACS_DARROW │v │ arrow pointing down │
123 ├────────────────────┼────────────────────┼─────────────────────────┤
124 │ACS_UARROW │^ │ arrow pointing up │
125 ├────────────────────┼────────────────────┼─────────────────────────┤
126 │ACS_BOARD │# │ board of squares │
127 ├────────────────────┼────────────────────┼─────────────────────────┤
128 │ACS_LANTERN │# │ lantern symbol │
129 ├────────────────────┼────────────────────┼─────────────────────────┤
130 │ACS_BLOCK │# │ solid square block │
131 └────────────────────┴────────────────────┴─────────────────────────┘
132
134 All routines return the integer ERR upon failure and an integer value
135 other than ERR upon successful completion, unless otherwise noted in
136 the preceding routine descriptions.
137
139 See attributes(5) for descriptions of the following attributes:
140
141
142
143
144 ┌─────────────────────────────┬─────────────────────────────┐
145 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
146 ├─────────────────────────────┼─────────────────────────────┤
147 │MT-Level │Unsafe │
148 └─────────────────────────────┴─────────────────────────────┘
149
151 putwchar(3C), clrtoeol(3CURSES), curses(3CURSES), curs_attr(3CURSES),
152 curs_inwch(3CURSES), curs_outopts(3CURSES), refresh(3CURSES), stand‐
153 out(3CURSES), winwch(3CURSES), wrefresh(3CURSES), attributes(5)
154
156 The header file <curses.h> automatically includes the header files
157 <stdio.h>, <unctrl.h> and <widec.h>.
158
159
160 Note that addwch(), mvaddwch(), mvwaddwch(), and echowchar() may be
161 macros.
162
163
164 None of these routines can use the color attribute in chtype.
165
166
167
168SunOS 5.11 31 Dec 1996 curs_addwch(3CURSES)