7 The X/Open Curses Interface Definition describes a set of C-Language
8 functions that provide screen-handling and updating, which are
9 collectively known as the curses library.
11 The curses library permits manipulation of data structures called
12 windows which may be thought of as two-dimensional arrays of
13 characters representing all or part of a terminal's screen. The
14 windows are manipulated using a procedural interface described
15 elsewhere. The curses package maintains a record of what characters
16 are on the screen. At the most basic level, manipulation is done with
17 the routines move() and addch() which are used to "move" the curses
18 around and add characters to the default window, stdscr, which
19 represents the whole screen.
21 An application may use these routines to add data to the window in any
22 convenient order. Once all data have been added, the routine
23 refresh() is called. The package then determines what changes have
24 been made which affect the screen. The screen contents are then
25 changed to reflect those characters now in the window, using a
26 sequence of operations optimized for the type of terminal in use.
28 At a higher level routines combining the actions of move() and addch()
29 are defined, as are routines to add whole strings and to perform
30 format conversions in the manner of printf().
32 Interfaces are also defined to erase the entire window and to specify
33 the attributes of individual characters in the window. Attributes
34 such as inverse video, underline and blink can be used on a
37 New windows can be created by allowing the application to build
38 several images of the screen and display the appropriate one very
39 quickly. New windows are created using the routine newwin(). For
40 each routine that manipulates the default window, stdscr, there is a
41 corresponding routine prefixed with w to manipulate the contents of a
42 specified window; for example, move() and wmove(). In fact, move(...)
43 is functionally equivalent to wmove( stdscr, ...). This is similar to
44 the interface offered by printf(...) and fprintf(stdout, ...).
46 Windows do not have to correspond to the entire screen. It is
47 possible to create smaller windows, and also to indicate that the
48 window is only partially visible on the screen. Furthermore, large
49 windows or pads, which are bigger than the actual screen size, may be
52 Interfaces are also defined to allow input character manipulation and
53 to disable and enable many input attributes: character echo, single
54 character input with or without signal processing (cbreak or raw
55 modes), carriage returns mapping to newlines, screen scrolling, etc.
58 Data Types and the <curses.h> Header
59 ------------------------------------
61 The data types supported by curses are described in this section.
63 As the library supports a procedural interface to the data types, actual
64 structure contents are not described. All curses data are manipulated
65 using the routines provided.
70 The <curses.h> header defines various constants and declares the data
71 types that are available to the application.
76 The following data types are declared:
78 WINDOW * pointer to screen representation
79 SCREEN * pointer to terminal descriptor
80 bool boolean data type
81 chtype representation of a character in a window
82 cchar_t the wide-character equivalent of chtype
83 attr_t for WA_-style attributes
85 The actual WINDOW and SCREEN objects used to store information are
86 created by the corresponding routines and a pointer to them is provided.
87 All manipulation is through that pointer.
92 The following variables are defined:
94 LINES number of lines on terminal screen
95 COLS number of columns on terminal screen
96 stdscr pointer to the default screen window
97 curscr pointer to the current screen image
98 SP pointer to the current SCREEN struct
99 Mouse_status status of the mouse
100 COLORS number of colors available
101 COLOR_PAIRS number of color pairs available
102 TABSIZE size of one TAB block
103 acs_map[] alternate character set map
104 ttytype[] terminal name/description
109 The following constants are defined:
113 FALSE boolean false value
114 TRUE boolean true value
115 NULL zero pointer value
116 ERR value returned on error condition
117 OK value returned on successful completion
121 Normally, attributes are a property of the character.
125 A_ALTCHARSET use the alternate character set
126 A_BLINK bright background or blinking
127 A_BOLD bright foreground or bold
128 A_DIM half bright -- no effect in PDCurses
131 A_LEFTLINE line along the left edge
132 A_PROTECT protected (?) -- PDCurses renders this as a
133 combination of the *LINE attributes
134 A_REVERSE reverse video
135 A_RIGHTLINE line along the right edge
136 A_STANDOUT terminal's best highlighting mode
137 A_UNDERLINE underline
139 A_ATTRIBUTES bit-mask to extract attributes
140 A_CHARTEXT bit-mask to extract a character
141 A_COLOR bit-mask to extract a color-pair
143 Not all attributes will work on all terminals. A_RIGHTLINE, A_LEFTLINE
144 and A_ITALIC are specific to PDCurses. A_INVIS and A_ITALIC are given
145 the same value in PDCurses.
149 WA_ALTCHARSET same as A_ALTCHARSET
150 WA_BLINK same as A_BLINK
151 WA_BOLD same as A_BOLD
153 WA_INVIS same as A_INVIS
154 WA_LEFT same as A_LEFTLINE
155 WA_PROTECT same as A_PROTECT
156 WA_REVERSE same as A_REVERSE
157 WA_RIGHT same as A_RIGHTLINE
158 WA_STANDOUT same as A_STANDOUT
159 WA_UNDERLINE same as A_UNDERLINE
161 Note that while A_LEFTLINE and A_RIGHTLINE are PDCurses-specific,
162 WA_LEFT and WA_RIGHT are standard. The following are also defined, for
163 compatibility, but currently have no effect in PDCurses: WA_HORIZONTAL,
164 WA_LOW, WA_TOP, WA_VERTICAL.
166 THE ALTERNATE CHARACTER SET
168 For use in chtypes and with related functions. These are a portable way
169 to represent graphics characters on different terminals.
171 VT100-compatible symbols -- box characters:
173 ACS_ULCORNER upper left box corner
174 ACS_LLCORNER lower left box corner
175 ACS_URCORNER upper right box corner
176 ACS_LRCORNER lower right box corner
181 ACS_HLINE horizontal line
182 ACS_VLINE vertical line
183 ACS_PLUS plus sign, cross, or four-corner piece
185 VT100-compatible symbols -- other:
190 ACS_CKBOARD checkerboard -- 50% grey
191 ACS_DEGREE degree symbol
192 ACS_PLMINUS plus/minus sign
195 Teletype 5410v1 symbols -- these are defined in SysV curses, but
196 are not well-supported by most terminals. Stick to VT100 characters
197 for optimum portability:
199 ACS_LARROW left arrow
200 ACS_RARROW right arrow
201 ACS_DARROW down arrow
203 ACS_BOARD checkerboard -- lighter (less dense) than
205 ACS_LANTERN lantern symbol
206 ACS_BLOCK solid block
208 That goes double for these -- undocumented SysV symbols. Don't use
213 ACS_LEQUAL less than or equal
214 ACS_GEQUAL greater than or equal
217 ACS_STERLING pounds sterling symbol
219 Box character aliases:
221 ACS_BSSB same as ACS_ULCORNER
222 ACS_SSBB same as ACS_LLCORNER
223 ACS_BBSS same as ACS_URCORNER
224 ACS_SBBS same as ACS_LRCORNER
225 ACS_SBSS same as ACS_RTEE
226 ACS_SSSB same as ACS_LTEE
227 ACS_SSBS same as ACS_BTEE
228 ACS_BSSS same as ACS_TTEE
229 ACS_BSBS same as ACS_HLINE
230 ACS_SBSB same as ACS_VLINE
231 ACS_SSSS same as ACS_PLUS
233 For cchar_t and wide-character functions, WACS_ equivalents are also
238 For use with init_pair(), color_set(), etc.:
249 Use these instead of numeric values. The definition of the colors
250 depends on the implementation of curses.
255 The following constants might be returned by getch() if keypad() has
256 been enabled. Note that not all of these may be supported on a
260 KEY_DOWN the four arrow keys
264 KEY_HOME home key (upward+left arrow)
265 KEY_BACKSPACE backspace
266 KEY_F0 function keys; space for 64 keys is reserved
267 KEY_F(n) (KEY_F0+(n))
270 KEY_DC delete character
271 KEY_IC insert character
272 KEY_EIC exit insert character mode
273 KEY_CLEAR clear screen
274 KEY_EOS clear to end of screen
275 KEY_EOL clear to end of line
276 KEY_SF scroll 1 line forwards
277 KEY_SR scroll 1 line backwards (reverse)
279 KEY_PPAGE previous page
282 KEY_CATAB clear all tabs
283 KEY_ENTER enter or send
284 KEY_SRESET soft (partial) reset
285 KEY_RESET reset or hard reset
286 KEY_PRINT print or copy
287 KEY_LL home down or bottom (lower left)
288 KEY_A1 upper left of virtual keypad
289 KEY_A3 upper right of virtual keypad
290 KEY_B2 center of virtual keypad
291 KEY_C1 lower left of virtual keypad
292 KEY_C3 lower right of virtual keypad
294 KEY_BTAB Back tab key
295 KEY_BEG Beginning key
296 KEY_CANCEL Cancel key
298 KEY_COMMAND Cmd (command) key
300 KEY_CREATE Create key
306 KEY_MESSAGE Message key
308 KEY_NEXT Next object key
310 KEY_OPTIONS Options key
311 KEY_PREVIOUS Previous object key
313 KEY_REFERENCE Reference key
314 KEY_REFRESH Refresh key
315 KEY_REPLACE Replace key
316 KEY_RESTART Restart key
317 KEY_RESUME Resume key
319 KEY_SBEG Shifted beginning key
320 KEY_SCANCEL Shifted cancel key
321 KEY_SCOMMAND Shifted command key
322 KEY_SCOPY Shifted copy key
323 KEY_SCREATE Shifted create key
324 KEY_SDC Shifted delete char key
325 KEY_SDL Shifted delete line key
326 KEY_SELECT Select key
327 KEY_SEND Shifted end key
328 KEY_SEOL Shifted clear line key
329 KEY_SEXIT Shifted exit key
330 KEY_SFIND Shifted find key
331 KEY_SHELP Shifted help key
332 KEY_SHOME Shifted home key
333 KEY_SIC Shifted input key
334 KEY_SLEFT Shifted left arrow key
335 KEY_SMESSAGE Shifted message key
336 KEY_SMOVE Shifted move key
337 KEY_SNEXT Shifted next key
338 KEY_SOPTIONS Shifted options key
339 KEY_SPREVIOUS Shifted prev key
340 KEY_SPRINT Shifted print key
341 KEY_SREDO Shifted redo key
342 KEY_SREPLACE Shifted replace key
343 KEY_SRIGHT Shifted right arrow
344 KEY_SRSUME Shifted resume key
345 KEY_SSAVE Shifted save key
346 KEY_SSUSPEND Shifted suspend key
347 KEY_SUNDO Shifted undo key
348 KEY_SUSPEND Suspend key
351 The virtual keypad is arranged like this:
357 This list is incomplete -- see curses.h for the full list, and use the
358 testcurs demo to see what values are actually returned. The above are
359 just the keys required by X/Open. In particular, PDCurses defines many
360 CTL_ and ALT_ combinations; these are not portable.
365 The following table lists each curses routine and the name of the manual
366 page on which it is described.
368 Functions from the X/Open curses standard -- complete, except for
369 getch() and ungetch(), which are implemented as macros for DOS
372 Curses Function Manual Page Name
392 can_change_color color
404 def_shell_mode kernel
482 mvwaddchnstr addchstr
530 reset_prog_mode kernel
531 reset_shell_mode kernel
652 Wide-character functions from the X/Open standard -- these are only
653 available when PDCurses is built with PDC_WIDE defined, and the
654 prototypes are only available from curses.h when PDC_WIDE is defined
655 before its inclusion in your app:
685 mvadd_wchnstr addchstr
686 mvadd_wchstr addchstr
699 mvwadd_wchnstr addchstr
700 mvwadd_wchstr addchstr
710 mvwin_wchnstr inchstr
722 wadd_wchnstr addchstr
744 Quasi-standard functions, from Sys V or BSD curses:
757 Classic PDCurses mouse functions, based on Sys V:
762 request_mouse_pos mouse
764 wmouse_position mouse
768 Functions from ncurses:
770 assume_default_colors color
771 curses_version initscr
773 use_default_colors color
784 PDCurses-specific functions -- avoid these in code that's intended to be
789 is_termresized initscr
808 PDC_set_blink pdcsetsc
809 PDC_set_line_color color
810 PDC_set_title pdcsetsc
812 PDC_clearclipboard pdcclip
813 PDC_freeclipboard pdcclip
814 PDC_getclipboard pdcclip
815 PDC_setclipboard pdcclip
817 PDC_get_input_fd pdckbd
818 PDC_get_key_modifiers getch
819 PDC_return_key_modifiers getch
820 PDC_save_key_modifiers getch
822 Functions specific to the X11 port of PDCurses:
833 --------------------------------------------------------------------------