copywin Subroutine

Purpose

Copies a region of a window.

Library

Curses Library (libcurses.a)

Syntax

#include <curses.h>

int copywin(const WINDOW  *scrwin,
WINDOW  *dstwin,
int  sminrow,
int  smincol,
int  dminrow,
int  dmincol,
int  dmaxrow,
int  dmaxcol,
int  overlay);

Description

The copywin subroutine provides a finer granularity of control over the overlay and overwrite subroutines. As in the prefresh subroutine, a rectangle is specified in the destination window, (dimrow, dimincol) and (dmaxrow, dmaxcol), and the upper-left-corner coordinates of the source window, (sminrow, smincol). If the overlay subroutine is TRUE, then copying is non-destructive, as in the overlay subroutine. If the overlay subroutine is FALSE, then copying is destructive, as in the overwrite subroutine.

Parameters

Item Description
*srcwin Points to the source window containing the region to copy.
*dstwin Points to the destination window to copy into.
sminrow Specifies the upper left row coordinate of the source region.
smincol Specifies the upper left column coordinate of the source region.
dminrow Specifies the upper left row coordinate of the destination region.
dmincol Specifies the upper left column coordinate for the destination region.
dmaxrow Specifies the lower right row coordinate for the destination region.
dmaxcol Specifies the lower right column coordinate for the destination region.
overlay Sets the type of copy. If set to TRUE the copy is nondestructive. Otherwise, if set to FALSE, the copy is destructive.

Return Values

Upon successful completion, the copywin subroutine returns OK. Otherwise, it returns ERR.

Examples

To copy to an area in the destination window defined by coordinates (30,40), (30,49), (39,40), and (39,49) beginning with coordinates (0,0) in the source window, enter the following:

WINDOW *srcwin, *dstwin;

copywin(srcwin, dstwin, 
0, 0, 30,40, 39, 49,
 TRUE); 

The example copies ten rows and ten columns from the source window beginning with coordinates (0,0) to the region in the destination window defined by the upper left coordinates (30, 40) and lower right coordinates (39, 49). Because the Overlay parameter is set to TRUE, the copy is nondestructive and blanks from the source window are not copied.