HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)

c
curses_intro(3X) curses_intro(3X)
(X/Open CURSES)
WINDOW An opaque window representation.
Interface Overview
Components
A Curses initialisation function, usually
initscr(), determines the terminal model in use, by reference
to either an argument or an environment variable. If that model is defined in terminfo, then the same
terminfo entry tells Curses exactly how to operate the terminal.
In this case, a comprehensive API lets the application perform terminal operations. The Curses run-time
system receives each terminal request and sends appropriate commands to the terminal to achieve the
desired effect.
Relationship to the X/Open System Interface Definitions, Issue 4, Version 2 specification
Applications using Curses should not also control the terminal using capabilities of the general terminal
interface defined in the X/Open System Interface Definitions, Issue 4, Version 2 specification, Chapter 9,
General Terminal Interface .
There is no requirement that the paradigms that exist while in Curses mode be carried over outside the
Curses environment (see the
def_prog_mode()
page).
Relationship to Signals
Curses implementations may provide for special handling of the SIGINT, SIGQUIT and SIGTSTP signals
if their disposition is SIGDFL at the time
initscr() is called (see the initscr() page).
Any special handling for these signals may remain in effect for the life of the process or until the process
changes the disposition of the signal.
None of the Curses functions are required to be safe with respect to signals (see
sigaction()
in the
X/Open System Interfaces and Headers, Issue 4, Version 2 specification).
The behaviour of Curses with respect to signals not defined by the X/Open System Interfaces and
Headers, Issue 4, Version 2 specification is unspecified.
Screens, Windows and Terminals
Screen
A screen is the physical output device of the terminal. In Curses, a SCREEN data type is an opaque
data type associated with a terminal. Each window (see below) is associated with a SCREEN.
Windows
The Curses functions permit manipulation of window objects, which can be thought of as two-dimensional
arrays of characters and their renditions. A default window called stdscr , which is the size of the termi-
nal screen, is supplied. Others may be created with
newwin().
Variables declared as WINDOW * refer to windows (and to subwindows, derived windows, and pads, as
described below). These data structures are manipulated with functions described on the reference
manual pages in terminfo(4). Among the most basic functions are
move() and addch(). More general
versions of these functions are included that allow a process to specify a window.
After using functions to manipulate a window,
refresh() is called, telling Curses to make the CRT
screen look like stdscr .
Line drawing characters may be specified to be output. On input, Curses is also able to translate arrow
and function keys that transmit escape sequences into single values. The line drawing characters and
input values use names defined in
<curses.h>.
Each window has a flag that indicates that the information in the window could differ from the informa-
tion displayed on the terminal device. Making any change to the contents of the window, moving or modi-
fying the window, or setting the window’s cursor position, sets this flag (touches the window).
Subwindows
A subwindow is a window, created within another window (called the parent window ), and positioned
relative to the parent window. A subwindow can be created by calling derwin(), newpad() or
subwin(). Changes made to a subwindow do not affect its parent window.
Subwindows can be created from a parent window by calling
subwin(). The position and size of
subwindows on the screen must be identical to or totally within the parent window. Changes to either the
parent window or the subwindow affect both. Window clipping is not a property of subwindows.
Section 3156 Hewlett-Packard Company 4 HP-UX 11i Version 2: August 2003