'\"macro stdmacro
.if n .pH g3x.curs_window @(#)curs_window	40.3 of 12/15/89
.\" Copyright 1989 AT&T
.\" ident	"@(#)svid_ti:ti_lib/curs_window	1.2"
.nr X
.if \nX=0 .ds x} curs_window 3X "" "\&"
.if \nX=1 .ds x} curs_window 3X ""
.if \nX=2 .ds x} curs_window 3X "" "\&"
.if \nX=3 .ds x} curs_window "" "" "\&"
.TH \*(x}
.SH NAME
\f4curs_window\f2: \f4 newwin\f1, \f4delwin\f1, \f4mvwin\f1, \f4subwin\f1, \f4derwin\f1, \f4mvderwin\f1, \f4dupwin\f1, \f4wsyncup\f1, \f4syncok\f1, \f4wcursyncup\f1, \f4wsyncdown \f1 \- create \f4curses\fP windows
.SH SYNOPSIS
.nf
.ft 4
#include <curses.h>
.sp
WINDOW *newwin(int nlines, int ncols, int begin_y,
	intbegin_x);
.sp
int delwin(WINDOW *win);
.sp .5
int mvwin(WINDOW *win, int y, int x);
.sp .5
WINDOW *subwin(WINDOW *orig, int nlines, int ncols,
	int begin_y, int begin_x);
.sp .5
WINDOW *derwin(WINDOW *orig, int nlines, int ncols,
	int begin_y, int begin_x);
.sp .5
int mvderwin(WINDOW *win, int par_y, int par_x);
.sp .5
WINDOW *dupwin(WINDOW *win);
.sp 0.5
void wsyncup(WINDOW *win);
.sp 0.5
int syncok(WINDOW *win, bool bf);
.sp 0.5
void wcursyncup(WINDOW *win);
.sp 0.5
void wsyncdown(WINDOW *win);
.ft 1
.fi
.SH DESCRIPTION
The \f4newwin\f1 routine creates and returns a pointer to a new
window with the given number of lines, \f2nlines\f1,
and columns, \f2ncols\f1.
The upper left-hand corner of the window is at line \f2begin_y\f1,
column \f2begin_x\f1.
If either \f2nlines\f1 or \f2ncols\f1 is zero,
they default to \f4LINES \(em \f2begin_y\f1 and \f4COLS \(em \f2begin_x\f1.
A new full-screen window is created by calling \f4newwin(0,0,0,0)\f1.
.P
The \f4delwin\f1 routine
deletes the named window, freeing all memory associated with it.
Subwindows must be deleted before the main window can be deleted.
.P
The \f4mvwin\f1 routine moves the window so that the upper left-hand
corner is at position (\f2x\f1, \f2y\f1).
If the move would cause the window to be off the screen,
it is an error and the window is not moved.
Moving subwindows is allowed, but should be avoided.
.P
The \f4subwin\f1 routine creates and returns a pointer to a
new window with the given number of lines, \f2nlines\f1, and columns,
\f2ncols\f1.
The window is at position (\f2begin_y\f1, \f2begin_x\f1) on the screen.
(This position is relative to the screen,
and not to the window \f2orig\f1.)
The window is made in the middle of the window \f2orig\f1,
so that changes made to one window will affect both windows.
The subwindow shares memory with the window \f2orig\f1.
When using this routine,
it is necessary to call \f4touchwin\f1 or \f4touchline\f1
on \f2orig\f1 before calling \f4wrefresh\f1 on the subwindow.
.P
The \f4derwin\f1 routine is the
same as \f4subwin,\f1 except that \f2begin_y\f1 and \f2begin_x\f1
are relative to the origin of the window \f2orig\f1 rather than the
screen.
There is no difference between the subwindows and the derived
windows.
.P
The \f4mvderwin\f1 routine moves a derived window (or subwindow)
inside its parent window.
The screen-relative parameters of the window are not changed.
This routine is used to display different parts of the parent
window at the same physical position on the screen.
.P
The \f4dupwin\f1 routine creates an exact duplicate of the
window \f2win\f1.
.P
Each \f4curses\fP window maintains two data structures: the
character image structure and the status structure.
The character
image structure is shared among all windows in the window hierarchy
(\f2i.e.\f1, the window with all subwindows).
The status structure, which contains
information about individual line changes in the window, is private
to each window.
The routine
\f4wrefresh\f1 uses the status data structure
when performing screen updating.
Since status structures are not
shared, changes made to one window in the hierarchy may not be
properly reflected on the screen.
.P
The routine
\f4wsyncup\f1 causes the changes in the status structure of a
window to be reflected in the status structures of its ancestors.
If \f4syncok\f1 is called with second argument \f4TRUE\f1
then \f4wsyncup\f1 is called automatically whenever
there is a change in the window.
.P
The routine
\f4wcursyncup\f1 updates the current cursor position of all the
ancestors of the window to reflect the current cursor position of the window.
.P
The routine
\f4wsyncdown\f1 updates the status structure of the window to
reflect the changes in the status structures of its ancestors.
Applications seldom call this routine because it is called
automatically by \f4wrefresh\f1.
.SH RETURN VALUE
Routines that return an integer return the integer \f4ERR\f1 upon
failure and an integer value other than \f4ERR\f1
upon successful completion.
.P
\f4delwin\fP returns the integer \f4ERR\f1 upon
failure and \f4OK\f1 upon successful completion.
.P
Routines that return pointers return \f4NULL\f1 on error.
.SH NOTES
.P
The header file \f4<curses.h>\f1 automatically includes the header files
\f4<stdio.h>\f1 and \f4<unctrl.h>\f1.
.PP
If many small changes are made to the window,
the \f4wsyncup\f1 option could degrade performance.
.PP
Note that \f4syncok\fP may be a macro.
.SH SEE ALSO
.na
\f4curses\fP(3X),
\f4curs_refresh\fP(3X),
\f4curs_touch\fP(3X).
.ad
