blob: ba9d293e711589f85e3ff9289b15b3258efacead [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
4.\" Permission is hereby granted, free of charge, to any person obtaining a *
5.\" copy of this software and associated documentation files (the *
6.\" "Software"), to deal in the Software without restriction, including *
7.\" without limitation the rights to use, copy, modify, merge, publish, *
8.\" distribute, distribute with modifications, sublicense, and/or sell *
9.\" copies of the Software, and to permit persons to whom the Software is *
10.\" furnished to do so, subject to the following conditions: *
11.\" *
12.\" The above copyright notice and this permission notice shall be included *
13.\" in all copies or substantial portions of the Software. *
14.\" *
15.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22.\" *
23.\" Except as contained in this notice, the name(s) of the above copyright *
24.\" holders shall not be used in advertising or otherwise to promote the *
25.\" sale, use or other dealings in this Software without prior written *
26.\" authorization. *
27.\"***************************************************************************
28.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_window.3x,v 1.19 2015/07/21 08:25:23 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.TH curs_window 3X ""
31.na
32.hy 0
33.SH NAME
34\fBnewwin\fR,
35\fBdelwin\fR,
36\fBmvwin\fR,
37\fBsubwin\fR,
38\fBderwin\fR,
39\fBmvderwin\fR,
40\fBdupwin\fR,
41\fBwsyncup\fR,
42\fBsyncok\fR,
43\fBwcursyncup\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +010044\fBwsyncdown\fR \- create \fBcurses\fR windows
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053045.ad
46.hy
47.SH SYNOPSIS
48\fB#include <curses.h>\fR
49.sp
Steve Kondikae271bc2015-11-15 02:50:53 +010050\fBWINDOW *newwin(\fR
51 \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
52 \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053053.br
Steve Kondikae271bc2015-11-15 02:50:53 +010054\fBint delwin(WINDOW *\fP\fIwin\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053055.br
Steve Kondikae271bc2015-11-15 02:50:53 +010056\fBint mvwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053057.br
Steve Kondikae271bc2015-11-15 02:50:53 +010058\fBWINDOW *subwin(WINDOW *\fP\fIorig\fP\fB,\fR
59 \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
60 \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053061.br
Steve Kondikae271bc2015-11-15 02:50:53 +010062\fBWINDOW *derwin(WINDOW *\fP\fIorig\fP\fB,\fR
63 \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
64 \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053065.br
Steve Kondikae271bc2015-11-15 02:50:53 +010066\fBint mvderwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIpar_y\fP\fB, int \fP\fIpar_x\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053067.br
Steve Kondikae271bc2015-11-15 02:50:53 +010068\fBWINDOW *dupwin(WINDOW *\fP\fIwin\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053069.br
Steve Kondikae271bc2015-11-15 02:50:53 +010070\fBvoid wsyncup(WINDOW *\fP\fIwin\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053071.br
Steve Kondikae271bc2015-11-15 02:50:53 +010072\fBint syncok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053073.br
Steve Kondikae271bc2015-11-15 02:50:53 +010074\fBvoid wcursyncup(WINDOW *\fP\fIwin\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053075.br
Steve Kondikae271bc2015-11-15 02:50:53 +010076\fBvoid wsyncdown(WINDOW *\fP\fIwin\fP\fB);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053077.br
78.SH DESCRIPTION
Steve Kondikae271bc2015-11-15 02:50:53 +010079.SS newwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053080Calling \fBnewwin\fR creates and returns a pointer to a new window with the
Steve Kondikae271bc2015-11-15 02:50:53 +010081given number of lines and columns.
82The upper left-hand corner of the window is
83at
84.RS
85line \fIbegin\fR_\fIy\fR,
86.br
87column \fIbegin\fR_\fIx\fR
88.RE
89.PP
90If either
91\fInlines\fR or \fIncols\fR is zero, they default to
92.RS
93\fBLINES \-\fR \fIbegin\fR_\fIy\fR and
94.br
95\fBCOLS \-\fR \fIbegin\fR_\fIx\fR.
96.RE
97.PP
98A new full-screen window is created by calling \fBnewwin(0,0,0,0)\fR.
99.SS delwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530100.PP
101Calling \fBdelwin\fR deletes the named window, freeing all memory
102associated with it (it does not actually erase the window's screen
Steve Kondikae271bc2015-11-15 02:50:53 +0100103image).
104Subwindows must be deleted before the main window can be deleted.
105.SS mvwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530106.PP
107Calling \fBmvwin\fR moves the window so that the upper left-hand
Steve Kondikae271bc2015-11-15 02:50:53 +0100108corner is at position (\fIx\fR, \fIy\fR).
109If the move would cause the window to be off the screen,
110it is an error and the window is not moved.
111Moving subwindows is allowed, but should be avoided.
112.SS subwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530113.PP
114Calling \fBsubwin\fR creates and returns a pointer to a new window
Steve Kondikae271bc2015-11-15 02:50:53 +0100115with the given number of lines, \fInlines\fR, and columns, \fIncols\fR.
116The window is at position (\fIbegin\fR_\fIy\fR,
117\fIbegin\fR_\fIx\fR) on the screen.
118The subwindow shares memory with the window \fIorig\fR,
119so that changes made to one window
120will affect both windows.
121When using this routine, it is necessary to call
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530122\fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling
123\fBwrefresh\fR on the subwindow.
Steve Kondikae271bc2015-11-15 02:50:53 +0100124.SS derwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530125.PP
126Calling \fBderwin\fR is the same as calling \fBsubwin,\fR except that
127\fIbegin\fR_\fIy\fR and \fIbegin\fR_\fIx\fR are relative to the origin
Steve Kondikae271bc2015-11-15 02:50:53 +0100128of the window \fIorig\fR rather than the screen.
129There is no difference between the subwindows and the derived windows.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530130.PP
131Calling \fBmvderwin\fR moves a derived window (or subwindow)
Steve Kondikae271bc2015-11-15 02:50:53 +0100132inside its parent window.
133The screen-relative parameters of the window are not changed.
134This routine is used to display different
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530135parts of the parent window at the same physical position on the
136screen.
Steve Kondikae271bc2015-11-15 02:50:53 +0100137.SS dupwin
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530138.PP
139Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR.
Steve Kondikae271bc2015-11-15 02:50:53 +0100140.SS wsyncup
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530141.PP
142Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are
Steve Kondikae271bc2015-11-15 02:50:53 +0100143changed in \fIwin\fR.
144If \fBsyncok\fR is called with second argument
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530145\fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a
146change in the window.
Steve Kondikae271bc2015-11-15 02:50:53 +0100147.SS wsyncdown
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530148.PP
149The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been
Steve Kondikae271bc2015-11-15 02:50:53 +0100150touched in any of its ancestor windows.
151This routine is called by
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530152\fBwrefresh\fR, so it should almost never be necessary to call it manually.
Steve Kondikae271bc2015-11-15 02:50:53 +0100153.SS wcursyncup
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530154.PP
155The routine \fBwcursyncup\fR updates the current cursor position of all the
156ancestors of the window to reflect the current cursor position of the
157window.
158.SH RETURN VALUE
159Routines that return an integer return the integer \fBERR\fR upon failure and
160\fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon
161successful completion.
162.PP
163Routines that return pointers return \fBNULL\fR on error.
164.PP
165X/Open defines no error conditions.
166In this implementation
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530167.TP 5
168\fBdelwin\fR
169returns an error if the window pointer is null, or
170if the window is the parent of another window.
Steve Kondikae271bc2015-11-15 02:50:53 +0100171.TP 5
172\fBderwin\fP
173returns an error if the parent window pointer is null, or
174if any of its ordinates or dimensions is negative, or
175if the resulting window does not fit inside the parent window.
176.TP 5
177\fBdupwin\fP
178returns an error if the window pointer is null.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530179.IP
180This implementation also maintains a list of windows,
181and checks that the pointer passed to \fBdelwin\fP is one that
182it created, returning an error if it was not..
183.TP 5
184\fBmvderwin\fP
185returns an error
186if the window pointer is null, or
187if some part of the window would be placed off-screen.
188.TP 5
189\fBmvwin\fP
190returns an error
191if the window pointer is null, or
192if the window is really a pad, or
193if some part of the window would be placed off-screen.
194.TP 5
Steve Kondikae271bc2015-11-15 02:50:53 +0100195\fBnewwin\fP
196will fail if either of its beginning ordinates is negative, or
197if either the number of lines or columns is negative.
198.TP 5
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530199\fBsyncok\fP
200returns an error
201if the window pointer is null.
Steve Kondikae271bc2015-11-15 02:50:53 +0100202.TP 5
203\fBsubwin\fP
204returns an error if the parent window pointer is null, or
205if any of its ordinates or dimensions is negative, or
206if the resulting window does not fit inside the parent window.
207.PP
208The functions which return a window pointer
209may also fail if there is insufficient memory for its data structures.
210Any of these functions will fail if the screen has not been initialized,
211i.e., with \fBinitscr\fP or \fBnewterm\fP.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530212.SH NOTES
213If many small changes are made to the window, the \fBwsyncup\fR option could
214degrade performance.
215.PP
216Note that \fBsyncok\fR may be a macro.
217.SH BUGS
218The subwindow functions (\fIsubwin\fR, \fIderwin\fR, \fImvderwin\fR,
219\fBwsyncup\fR, \fBwsyncdown\fR, \fBwcursyncup\fR, \fBsyncok\fR) are flaky,
220incompletely implemented, and not well tested.
221.PP
222The System V curses documentation is very unclear about what \fBwsyncup\fR
Steve Kondikae271bc2015-11-15 02:50:53 +0100223and \fBwsyncdown\fR actually do.
224It seems to imply that they are only
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530225supposed to touch exactly those lines that are affected by ancestor changes.
226The language here, and the behavior of the \fBcurses\fR implementation,
Steve Kondikae271bc2015-11-15 02:50:53 +0100227is patterned on the XPG4 curses standard.
228The weaker XPG4 spec may result in slower updates.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530229.SH PORTABILITY
230The XSI Curses standard, Issue 4 describes these functions.
231.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100232\fBcurses\fR(3X),
233\fBcurs_refresh\fR(3X),
234\fBcurs_touch\fR(3X),
235\fBcurs_variables\fR(3X)