Next: , Previous: Terminal Mode Setting, Up: Curses


5.12.3 Window Manipulation

— Function: newwin nlines ncols begy begx

Create and return a new window with the given number of lines (or rows), nlines, and columns, ncols. The upper left corner of the window is at line begy, column begx. If either nlines or ncols is 0, they will be set to the value of LINES-begy and COLS-begx. A new full-screen window is created by calling newwin(0,0,0,0).

— Function: subwin orig nlines ncols begy begx

Create and return a pointer to a new window with the given number of lines (or rows), nlines, and columns, ncols. The window is at position (begy, begx) on the screen. This position is relative to the screen, and not to the window orig. The window is made in the middle of the window orig, so that changes made to one window will affect both windows. When using this routine, often it will be necessary to call touchwin or touchline on orig before calling force-output.

— Function: close-port win

Deletes the window win, freeing up all memory associated with it. In the case of sub-windows, they should be deleted before the main window win.

— Function: refresh
— Function: force-output win

These routines are called to write output to the terminal, as most other routines merely manipulate data structures. force-output copies the window win to the physical terminal screen, taking into account what is already there in order to minimize the amount of information that's sent to the terminal (called optimization). Unless leaveok has been enabled, the physical cursor of the terminal is left at the location of window win's cursor. With refresh, the number of characters output to the terminal is returned.

— Function: mvwin win y x

Move the window win so that the upper left corner will be at position (y, x). If the move would cause the window win to be off the screen, it is an error and the window win is not moved.

— Function: overlay srcwin dstwin
— Function: overwrite srcwin dstwin

These routines overlay srcwin on top of dstwin; that is, all text in srcwin is copied into dstwin. srcwin and dstwin need not be the same size; only text where the two windows overlap is copied. The difference is that overlay is non-destructive (blanks are not copied), while overwrite is destructive.

— Function: touchwin win
— Function: touchline win start count

Throw away all optimization information about which parts of the window win have been touched, by pretending that the entire window win has been drawn on. This is sometimes necessary when using overlapping windows, since a change to one window will affect the other window, but the records of which lines have been changed in the other window will not reflect the change. touchline only pretends that count lines have been changed, beginning with line start.

— Function: wmove win y x

The cursor associated with the window win is moved to line (row) y, column x. This does not move the physical cursor of the terminal until refresh (or force-output) is called. The position specified is relative to the upper left corner of the window win, which is (0, 0).