table of contents
window(3NCURSES) | window(3NCURSES) |
NAME¶
newwin, delwin, mvwin, subwin, derwin, mvderwin, dupwin, wsyncup, syncok, wcursyncup, wsyncdown - create curses windowsSYNOPSIS¶
#include <curses.h> WINDOW *newwin(int nlines, int ncols,
int begin_y, int begin_x);
int nlines, int ncols,
int begin_y, int begin_x);
int nlines, int ncols,
int begin_y, int begin_x);
DESCRIPTION¶
Calling newwin creates and returns a pointer to a new window with the given number of lines and columns. The upper left-hand corner of the window is atline begin_y,
column begin_x
If either nlines or ncols is zero, they default to
LINES - begin_y and
COLS - begin_x.
A new full-screen window is created by calling newwin(0,0,0,0).
Calling delwin deletes the named window, freeing all memory associated
with it (it does not actually erase the window's screen image). Subwindows
must be deleted before the main window can be deleted.
Calling mvwin moves the window so that the upper left-hand corner is at
position ( x, y). 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.
Calling subwin creates and returns a pointer to a new window with the
given number of lines, nlines, and columns, ncols. The window is
at position ( begin_y, begin_x) on the screen. The
subwindow shares memory with the window orig, so that changes made to
one window will affect both windows. When using this routine, it is necessary
to call touchwin or touchline on orig before calling
wrefresh on the subwindow.
Calling derwin is the same as calling subwin, except that
begin_ y and begin_x are relative to the origin of
the window orig rather than the screen. There is no difference between
the subwindows and the derived windows.
Calling mvderwin 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.
Calling dupwin creates an exact duplicate of the window win.
Calling wsyncup touches all locations in ancestors of win that are
changed in win. If syncok is called with second argument
TRUE then wsyncup is called automatically whenever there is a
change in the window.
The wsyncdown routine touches each location in win that has been
touched in any of its ancestor windows. This routine is called by
wrefresh, so it should almost never be necessary to call it manually.
The routine wcursyncup updates the current cursor position of all the
ancestors of the window to reflect the current cursor position of the window.
RETURN VALUE¶
Routines that return an integer return the integer ERR upon failure and OK (SVr4 only specifies "an integer value other than ERR") upon successful completion. Routines that return pointers return NULL on error. X/Open defines no error conditions. In this implementation- delwin
- returns an error if the window pointer is null, or if the window is the parent of another window.
- derwin
- returns an error if the parent window pointer is null, or if any of its ordinates or dimensions is negative, or if the resulting window does not fit inside the parent window.
- dupwin
- returns an error if the window pointer is null.
- This implementation also maintains a list of windows, and checks that the pointer passed to delwin is one that it created, returning an error if it was not..
- mvderwin
- returns an error if the window pointer is null, or if some part of the window would be placed off-screen.
- mvwin
- returns an error if the window pointer is null, or if the window is really a pad, or if some part of the window would be placed off-screen.
- newwin
- will fail if either of its beginning ordinates is negative, or if either the number of lines or columns is negative.
- syncok
- returns an error if the window pointer is null.
- subwin
- returns an error if the parent window pointer is null, or if any of its ordinates or dimensions is negative, or if the resulting window does not fit inside the parent window.