2013-10-16 02:15:17 +04:00
|
|
|
.\" $NetBSD: curses_window.3,v 1.16 2013/10/15 22:15:17 roy Exp $
|
2002-10-21 17:55:12 +04:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 2002
|
2003-02-14 19:29:11 +03:00
|
|
|
.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au)
|
2002-10-21 17:55:12 +04:00
|
|
|
.\"
|
|
|
|
.\" This code is donated to the NetBSD Foundation by the Author.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. The name of the Author may not be used to endorse or promote
|
|
|
|
.\" products derived from this software without specific prior written
|
|
|
|
.\" permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\"
|
2013-10-16 02:15:17 +04:00
|
|
|
.Dd October 15, 2013
|
2002-10-21 17:55:12 +04:00
|
|
|
.Dt CURSES_WINDOW 3
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm curses_window ,
|
|
|
|
.Nm copywin ,
|
|
|
|
.Nm dupwin ,
|
|
|
|
.Nm delwin ,
|
|
|
|
.Nm derwin ,
|
2003-04-08 09:53:49 +04:00
|
|
|
.Nm mvwin ,
|
2002-10-21 17:55:12 +04:00
|
|
|
.Nm mvderwin ,
|
|
|
|
.Nm newwin ,
|
|
|
|
.Nm overlay ,
|
|
|
|
.Nm overwrite ,
|
|
|
|
.Nm subwin ,
|
|
|
|
.Nm wresize
|
|
|
|
.Nd curses window routines
|
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libcurses
|
|
|
|
.Sh SYNOPSIS
|
2003-04-16 17:34:34 +04:00
|
|
|
.In curses.h
|
2002-10-21 17:55:12 +04:00
|
|
|
.Ft int
|
|
|
|
.Fo copywin
|
|
|
|
.Fa "WINDOW *source"
|
|
|
|
.Fa "WINDOW *dest"
|
|
|
|
.Fa "int sminrow"
|
|
|
|
.Fa "int smincol"
|
|
|
|
.Fa "int dminrow"
|
|
|
|
.Fa "int dmincol"
|
|
|
|
.Fa "int dmaxrow"
|
|
|
|
.Fa "int dmaxcol"
|
|
|
|
.Fa "int overlay"
|
|
|
|
.Fc
|
|
|
|
.Ft WINDOW *
|
|
|
|
.Fn dupwin "WINDOW *win"
|
|
|
|
.Ft WINDOW *
|
|
|
|
.Fn derwin "WINDOW *win" "int lines" "int cols" "int y" "int x"
|
|
|
|
.Ft int
|
|
|
|
.Fn delwin "WINDOW *win"
|
|
|
|
.Ft int
|
2003-04-08 09:53:49 +04:00
|
|
|
.Fn mvwin "WINDOW *win" "int y" "int x"
|
|
|
|
.Ft int
|
2002-10-21 17:55:12 +04:00
|
|
|
.Fn mvderwin "WINDOW *win" "int y" "int x"
|
|
|
|
.Ft WINDOW *
|
|
|
|
.Fn newwin "int lines" "int cols" "int begin_y" "int begin_x"
|
|
|
|
.Ft WINDOW *
|
|
|
|
.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x"
|
|
|
|
.Ft int
|
|
|
|
.Fn overlay "WINDOW *source" "WINDOW *dest"
|
|
|
|
.Ft int
|
|
|
|
.Fn overwrite "WINDOW *source" "WINDOW *dest"
|
|
|
|
.Ft int
|
|
|
|
.Fn wresize "WINDOW *win" "int lines" "int cols"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
These functions create, modify and delete windows on the current screen.
|
|
|
|
.Pp
|
|
|
|
The contents of a window may be copied to another window by using the
|
|
|
|
.Fn copywin
|
|
|
|
function, a section of the destination window
|
|
|
|
.Fa dest
|
|
|
|
bounded by
|
|
|
|
.Fa (dminrow ,
|
|
|
|
.Fa dmincol )
|
|
|
|
and
|
|
|
|
.Fa (dmaxrow ,
|
|
|
|
.Fa dmaxcol )
|
|
|
|
will be overwritten with the contents of the window
|
|
|
|
.Fa source
|
|
|
|
starting at the coordinates
|
|
|
|
.Fa (sminrow ,
|
2002-10-21 18:17:54 +04:00
|
|
|
.Fa smincol ) .
|
2002-10-21 17:55:12 +04:00
|
|
|
If the
|
|
|
|
.Fa overlay
|
|
|
|
flag is
|
|
|
|
.Dv TRUE
|
|
|
|
then only non-blank characters from
|
|
|
|
.Fa source
|
|
|
|
will be copied to
|
|
|
|
.Fa dest ,
|
|
|
|
if
|
|
|
|
.Fa overlay
|
|
|
|
is
|
|
|
|
.Dv FALSE
|
|
|
|
then all characters from
|
|
|
|
.Fa source
|
|
|
|
will be copied to
|
|
|
|
.Fa 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.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn dupwin
|
|
|
|
function creates an exact duplicate of
|
|
|
|
.Fa win
|
|
|
|
and returns a pointer to it.
|
|
|
|
.Pp
|
|
|
|
Calling
|
|
|
|
.Fn derwin
|
|
|
|
will create a subwindow of
|
|
|
|
.Fa win
|
|
|
|
in the same manner as
|
|
|
|
.Fn subwin
|
|
|
|
excepting that the starting column and row
|
|
|
|
.Fa y ,
|
|
|
|
.Fa x
|
|
|
|
are relative to the parent window origin.
|
|
|
|
.Pp
|
|
|
|
A window may deleted and all resources freed by calling the
|
|
|
|
.Fn delwin
|
|
|
|
function with the pointer to the window to be deleted in
|
|
|
|
.Fa win .
|
2013-10-16 02:15:17 +04:00
|
|
|
If
|
|
|
|
.Fa win
|
|
|
|
is
|
|
|
|
.Dv NULL ,
|
|
|
|
then no action occurs.
|
2002-10-21 17:55:12 +04:00
|
|
|
.Pp
|
2003-04-08 09:53:49 +04:00
|
|
|
A window can be moved to a new position by calling the
|
|
|
|
.Fn mvwin
|
2004-03-22 22:11:28 +03:00
|
|
|
function.
|
|
|
|
The
|
2003-04-08 09:53:49 +04:00
|
|
|
.Fa y
|
|
|
|
and
|
|
|
|
.Fa 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.
|
|
|
|
.Pp
|
2011-09-15 15:58:05 +04:00
|
|
|
A mapping of a region relative to the parent window may be created by
|
|
|
|
calling the
|
2002-10-21 17:55:12 +04:00
|
|
|
.Fn mvderwin
|
|
|
|
function, the
|
|
|
|
.Fa y
|
|
|
|
and
|
|
|
|
.Fa x
|
|
|
|
positions are relative to the origin of the parent window.
|
2011-09-15 15:58:05 +04:00
|
|
|
The screen offset of
|
|
|
|
.Fa win
|
2011-09-15 16:01:18 +04:00
|
|
|
is not updated, the characters beginning at
|
2011-09-15 15:58:05 +04:00
|
|
|
.Fa y ,
|
|
|
|
.Fa x
|
|
|
|
for the area the size of
|
|
|
|
.Fa win
|
2011-09-15 16:01:18 +04:00
|
|
|
will be displayed at the screen offset of
|
2011-09-15 15:58:05 +04:00
|
|
|
.Fa win .
|
2002-10-21 17:55:12 +04:00
|
|
|
If the given window in
|
|
|
|
.Fa win
|
|
|
|
is not a subwindow then an error will be returned.
|
2003-04-08 09:53:49 +04:00
|
|
|
If the new position would cause the any part of the window to lie outside
|
2011-09-15 15:58:05 +04:00
|
|
|
the parent window, it is an error and the mapping is not updated.
|
2002-10-21 17:55:12 +04:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn newwin
|
|
|
|
function creates a new window of size
|
|
|
|
.Fa lines ,
|
|
|
|
.Fa cols
|
|
|
|
with an origin at
|
|
|
|
.Fa begin_y ,
|
|
|
|
.Fa begin_x .
|
|
|
|
If
|
|
|
|
.Fa lines
|
2003-03-03 17:21:12 +03:00
|
|
|
is less than or equal to zero then the number of rows
|
|
|
|
for the window is set to
|
2002-10-21 17:55:12 +04:00
|
|
|
.Dv LINES -
|
2003-03-03 17:21:12 +03:00
|
|
|
.Fa begin_x
|
|
|
|
+
|
|
|
|
.Fa lines .
|
|
|
|
Similarly if
|
2002-10-21 17:55:12 +04:00
|
|
|
.Fa cols
|
2003-03-03 17:21:12 +03:00
|
|
|
is less than or equal to zero then the number of columns
|
|
|
|
for the window is set to
|
|
|
|
.Dv COLS -
|
|
|
|
.Fa begin_y
|
|
|
|
+
|
|
|
|
.Fa cols .
|
2002-10-21 17:55:12 +04:00
|
|
|
.Pp
|
|
|
|
.Fn subwin
|
|
|
|
is similar to
|
|
|
|
.Fn newwin
|
|
|
|
excepting that the size of the subwindow is bounded by the parent
|
|
|
|
window
|
|
|
|
.Fa win .
|
|
|
|
The subwindow shares internal data structures with the parent window
|
|
|
|
and will be refreshed when the parent window is refreshed.
|
2006-01-15 19:57:45 +03:00
|
|
|
The subwindow inherits the background character and attributes of the
|
|
|
|
parent window.
|
2002-10-21 17:55:12 +04:00
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Fn overlay
|
|
|
|
function copies the contents of the source window
|
|
|
|
.Fa source
|
|
|
|
to the destination window
|
|
|
|
.Fa 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
|
|
|
|
.Fn overwrite
|
|
|
|
function performs the same functions as
|
|
|
|
.Fn overlay
|
|
|
|
excepting that characters from the source window are copied to the
|
|
|
|
destination without exception.
|
|
|
|
.Pp
|
|
|
|
.Fn wresize
|
|
|
|
resizes the specified window to the new number of lines and columns
|
|
|
|
given, all internal curses structures are resized.
|
2007-10-26 00:42:07 +04:00
|
|
|
Any subwindows of the specified window will also be resized if any part
|
|
|
|
of them falls outside the new parent window size.
|
2009-05-18 13:30:31 +04:00
|
|
|
The application must redraw the window after it has been resized.
|
|
|
|
Note that
|
2007-10-26 00:42:07 +04:00
|
|
|
.Dv curscr
|
|
|
|
and
|
|
|
|
.Dv stdscr
|
|
|
|
can not be resized to be larger than the size of the screen.
|
2002-10-21 17:55:12 +04:00
|
|
|
.Sh RETURN VALUES
|
|
|
|
Functions returning pointers will return
|
|
|
|
.Dv NULL
|
|
|
|
if an error is detected.
|
|
|
|
The functions that return an int will return one of the following
|
|
|
|
values:
|
|
|
|
.Pp
|
|
|
|
.Bl -tag -width ERR -compact
|
|
|
|
.It Er OK
|
|
|
|
The function completed successfully.
|
|
|
|
.It Er ERR
|
|
|
|
An error occurred in the function.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
2008-04-15 01:26:16 +04:00
|
|
|
.Xr curses_fileio 3 ,
|
2009-05-18 13:30:31 +04:00
|
|
|
.Xr curses_pad 3 ,
|
2002-10-21 17:55:12 +04:00
|
|
|
.Xr curses_screen 3
|
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nx
|
|
|
|
Curses library complies with the X/Open Curses specification, part of the
|
|
|
|
Single Unix Specification.
|
|
|
|
.Sh HISTORY
|
|
|
|
The Curses package appeared in
|
|
|
|
.Bx 4.0 .
|