CURSES_WINDOW(3)

NAME
curses_window, copywin, dupwin, delwin, derwin, mvwin, mvderwin, newwin, overlay, overwrite, subwin, wresize - curses window routines

LIBRARY
libcurses

SYNOPSIS
#include <curses.h>
int
copywin(WINDOW *source, WINDOW *dest, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, int overlay);
WINDOW *
dupwin(WINDOW *win);
WINDOW *
derwin(WINDOW *win, int lines, int cols, int y, int x);
int
delwin(WINDOW *win);
int
mvwin(WINDOW *win, int y, int x);
int
mvderwin(WINDOW *win, int y, int x);
WINDOW *
newwin(int lines, int cols, int begin_y, int begin_x);
WINDOW *
subwin(WINDOW *win, int lines, int cols, int begin_y, int begin_x);
int
overlay(WINDOW *source, WINDOW *dest);
int
overwrite(WINDOW *source, WINDOW *dest);
int
wresize(WINDOW *win, int lines, int cols);

DESCRIPTION
These functions create, modify and delete windows on the current screen.

The contents of a window may be copied to another window by using the copywin() function, a section of the destination window dest bounded by (dminrow, dmincol) and (dmaxrow, dmaxcol) will be overwritten with the contents of the window source starting at the coordinates (sminrow, smincol). If the overlay flag is TRUE then only non-blank characters from source will be copied to dest, if overlay is FALSE then all characters from source will be copied to dest. If the bounding rectangles of either the source or the destination windows lay outside the maximum size of the respective windows then the size of the window copied will be adjusted to be within the bounds of both the source and destination windows.

The dupwin() function creates an exact duplicate of win and returns a pointer to it.

Calling derwin() will create a subwindow of win in the same manner as subwin() excepting that the starting column and row y, x are relative to the parent window origin.

A window may deleted and all resources freed by calling the delwin() function with the pointer to the window to be deleted in win.

A window can be moved to a new position by calling the mvwin() function. The y and x positions are the new origin of the window on the screen. If the new position would cause the any part of the window to lie outside the screen, it is an error and the window is not moved.

A subwindow can be moved relative to the parent window by calling the mvderwin() function, the y and x positions are relative to the origin of the parent window. If the given window in win is not a subwindow then an error will be returned. If the new position would cause the any part of the window to lie outside the parent window, it is an error and the window is not moved.

The newwin() function creates a new window of size lines, cols with an origin at begin_y, begin_x. If lines is less than or equal to zero then the number of rows for the window is set to LINES - begin_x + lines. Similarly if cols is less than or equal to zero then the number of columns for the window is set to COLS - begin_y + cols. If the terminal, or in the case of a subwindow the enclosing window, is resized then the window size will be recalculated so that the window ends the same number of columns from the far edge.

subwin() is similar to newwin() excepting that the size of the subwindow is bounded by the parent window win. The subwindow shares internal data structures with the parent window and will be refreshed when the parent window is refreshed. The subwindow inherits the background character and attributes of the parent window.

The overlay() function copies the contents of the source window source to the destination window dest, only the characters that are not the background character in the source window are copied to the destination. The windows need not be the same size, only the overlapping portion of both windows will be copied. The overwrite() function performs the same functions as overlay() excepting that characters from the source window are copied to the destination without exception.

wresize() resizes the specified window to the new number of lines and columns given, all internal curses structures are resized. The application must redraw the window after it has been resized.

RETURN VALUES
Functions returning pointers will return NULL if an error is detected. The functions that return an int will return one of the following values:

OK  The function completed successfully.
ERR An error occurred in the function.

SEE ALSO
curses_pad(3), curses_screen(3)

STANDARDS
The NetBSD Curses library complies with the X/Open Curses specification, part of the Single Unix Specification.

HISTORY
The Curses package appeared in 4.0BSD.