]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_window.3x
ncurses 6.1 - patch 20200118
[ncurses.git] / man / curs_window.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2015,2016 Free Software Foundation, Inc.              *
3 .\"                                                                          *
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 .\"
29 .\" $Id: curs_window.3x,v 1.20 2016/10/15 17:26:09 tom Exp $
30 .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,
44 \fBwsyncdown\fR \- create \fBcurses\fR windows
45 .ad
46 .hy
47 .SH SYNOPSIS
48 \fB#include <curses.h>\fR
49 .sp
50 \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
53 .br
54 \fBint delwin(WINDOW *\fP\fIwin\fP\fB);\fR
55 .br
56 \fBint mvwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR
57 .br
58 \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
61 .br
62 \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
65 .br
66 \fBint mvderwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIpar_y\fP\fB, int \fP\fIpar_x\fP\fB);\fR
67 .br
68 \fBWINDOW *dupwin(WINDOW *\fP\fIwin\fP\fB);\fR
69 .br
70 \fBvoid wsyncup(WINDOW *\fP\fIwin\fP\fB);\fR
71 .br
72 \fBint syncok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
73 .br
74 \fBvoid wcursyncup(WINDOW *\fP\fIwin\fP\fB);\fR
75 .br
76 \fBvoid wsyncdown(WINDOW *\fP\fIwin\fP\fB);\fR
77 .br
78 .SH DESCRIPTION
79 .SS newwin
80 Calling \fBnewwin\fR creates and returns a pointer to a new window with the
81 given number of lines and columns.
82 The upper left-hand corner of the window is
83 at
84 .RS
85 line \fIbegin\fR_\fIy\fR,
86 .br
87 column \fIbegin\fR_\fIx\fR
88 .RE
89 .PP
90 If 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
98 A new full-screen window is created by calling \fBnewwin(0,0,0,0)\fR.
99 .SS delwin
100 .PP
101 Calling \fBdelwin\fR deletes the named window, freeing all memory
102 associated with it (it does not actually erase the window's screen
103 image).
104 Subwindows must be deleted before the main window can be deleted.
105 .SS mvwin
106 .PP
107 Calling \fBmvwin\fR moves the window so that the upper left-hand
108 corner is at position (\fIx\fR, \fIy\fR).
109 If the move would cause the window to be off the screen,
110 it is an error and the window is not moved.
111 Moving subwindows is allowed, but should be avoided.
112 .SS subwin
113 .PP
114 Calling \fBsubwin\fR creates and returns a pointer to a new window
115 with the given number of lines, \fInlines\fR, and columns, \fIncols\fR.
116 The window is at position (\fIbegin\fR_\fIy\fR,
117 \fIbegin\fR_\fIx\fR) on the screen.
118 The subwindow shares memory with the window \fIorig\fR,
119 so that changes made to one window
120 will affect both windows.
121 When using this routine, it is necessary to call
122 \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling
123 \fBwrefresh\fR on the subwindow.
124 .SS derwin
125 .PP
126 Calling \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
128 of the window \fIorig\fR rather than the screen.
129 There is no difference between the subwindows and the derived windows.
130 .PP
131 Calling \fBmvderwin\fR moves a derived window (or subwindow)
132 inside its parent window.
133 The screen-relative parameters of the window are not changed.
134 This routine is used to display different
135 parts of the parent window at the same physical position on the
136 screen.
137 .SS dupwin
138 .PP
139 Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR.
140 .SS wsyncup
141 .PP
142 Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are
143 changed in \fIwin\fR.
144 If \fBsyncok\fR is called with second argument
145 \fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a
146 change in the window.
147 .SS wsyncdown
148 .PP
149 The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been
150 touched in any of its ancestor windows.
151 This routine is called by
152 \fBwrefresh\fR, so it should almost never be necessary to call it manually.
153 .SS wcursyncup
154 .PP
155 The routine \fBwcursyncup\fR updates the current cursor position of all the
156 ancestors of the window to reflect the current cursor position of the
157 window.
158 .SH RETURN VALUE
159 Routines 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
161 successful completion.
162 .PP
163 Routines that return pointers return \fBNULL\fR on error.
164 .PP
165 X/Open defines no error conditions.
166 In this implementation
167 .TP 5
168 \fBdelwin\fR
169 returns an error if the window pointer is null, or
170 if the window is the parent of another window.
171 .TP 5
172 \fBderwin\fP
173 returns an error if the parent window pointer is null, or
174 if any of its ordinates or dimensions is negative, or
175 if the resulting window does not fit inside the parent window.
176 .TP 5
177 \fBdupwin\fP
178 returns an error if the window pointer is null.
179 .IP
180 This implementation also maintains a list of windows,
181 and checks that the pointer passed to \fBdelwin\fP is one that
182 it created, returning an error if it was not..
183 .TP 5
184 \fBmvderwin\fP
185 returns an error
186 if the window pointer is null, or
187 if some part of the window would be placed off-screen.
188 .TP 5
189 \fBmvwin\fP
190 returns an error
191 if the window pointer is null, or
192 if the window is really a pad, or
193 if some part of the window would be placed off-screen.
194 .TP 5
195 \fBnewwin\fP
196 will fail if either of its beginning ordinates is negative, or
197 if either the number of lines or columns is negative.
198 .TP 5
199 \fBsyncok\fP
200 returns an error
201 if the window pointer is null.
202 .TP 5
203 \fBsubwin\fP
204 returns an error if the parent window pointer is null, or
205 if any of its ordinates or dimensions is negative, or
206 if the resulting window does not fit inside the parent window.
207 .PP
208 The functions which return a window pointer
209 may also fail if there is insufficient memory for its data structures.
210 Any of these functions will fail if the screen has not been initialized,
211 i.e., with \fBinitscr\fP or \fBnewterm\fP.
212 .SH NOTES
213 If many small changes are made to the window, the \fBwsyncup\fR option could
214 degrade performance.
215 .PP
216 Note that \fBsyncok\fR may be a macro.
217 .SH BUGS
218 The subwindow functions (\fBsubwin\fR, \fBderwin\fR, \fBmvderwin\fR,
219 \fBwsyncup\fR, \fBwsyncdown\fR, \fBwcursyncup\fR, \fBsyncok\fR) are flaky,
220 incompletely implemented, and not well tested.
221 .PP
222 The System V curses documentation is very unclear about what \fBwsyncup\fR
223 and \fBwsyncdown\fR actually do.
224 It seems to imply that they are only
225 supposed to touch exactly those lines that are affected by ancestor changes.
226 The language here, and the behavior of the \fBcurses\fR implementation,
227 is patterned on the XPG4 curses standard.
228 The weaker XPG4 spec may result in slower updates.
229 .SH PORTABILITY
230 The XSI Curses standard, Issue 4 describes these functions.
231 .SH SEE ALSO
232 \fBcurses\fR(3X),
233 \fBcurs_refresh\fR(3X),
234 \fBcurs_touch\fR(3X),
235 \fBcurs_variables\fR(3X)