]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_window.3x
ncurses 6.3 - patch 20211030
[ncurses.git] / man / curs_window.3x
1 .\"***************************************************************************
2 .\" Copyright 2020,2021 Thomas E. Dickey                                     *
3 .\" Copyright 1998-2015,2016 Free Software Foundation, Inc.                  *
4 .\"                                                                          *
5 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
6 .\" copy of this software and associated documentation files (the            *
7 .\" "Software"), to deal in the Software without restriction, including      *
8 .\" without limitation the rights to use, copy, modify, merge, publish,      *
9 .\" distribute, distribute with modifications, sublicense, and/or sell       *
10 .\" copies of the Software, and to permit persons to whom the Software is    *
11 .\" furnished to do so, subject to the following conditions:                 *
12 .\"                                                                          *
13 .\" The above copyright notice and this permission notice shall be included  *
14 .\" in all copies or substantial portions of the Software.                   *
15 .\"                                                                          *
16 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23 .\"                                                                          *
24 .\" Except as contained in this notice, the name(s) of the above copyright   *
25 .\" holders shall not be used in advertising or otherwise to promote the     *
26 .\" sale, use or other dealings in this Software without prior written       *
27 .\" authorization.                                                           *
28 .\"***************************************************************************
29 .\"
30 .\" $Id: curs_window.3x,v 1.23 2021/06/17 21:11:08 tom Exp $
31 .TH curs_window 3X ""
32 .de bP
33 .ie n  .IP \(bu 4
34 .el    .IP \(bu 2
35 ..
36 .na
37 .hy 0
38 .SH NAME
39 \fBnewwin\fR,
40 \fBdelwin\fR,
41 \fBmvwin\fR,
42 \fBsubwin\fR,
43 \fBderwin\fR,
44 \fBmvderwin\fR,
45 \fBdupwin\fR,
46 \fBwsyncup\fR,
47 \fBsyncok\fR,
48 \fBwcursyncup\fR,
49 \fBwsyncdown\fR \- create \fBcurses\fR windows
50 .ad
51 .hy
52 .SH SYNOPSIS
53 \fB#include <curses.h>\fR
54 .sp
55 \fBWINDOW *newwin(\fR
56       \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
57       \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
58 .br
59 \fBint delwin(WINDOW *\fP\fIwin\fP\fB);\fR
60 .br
61 \fBint mvwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR
62 .br
63 \fBWINDOW *subwin(WINDOW *\fP\fIorig\fP\fB,\fR
64       \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
65       \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
66 .br
67 \fBWINDOW *derwin(WINDOW *\fP\fIorig\fP\fB,\fR
68       \fBint \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
69       \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
70 .br
71 \fBint mvderwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIpar_y\fP\fB, int \fP\fIpar_x\fP\fB);\fR
72 .br
73 \fBWINDOW *dupwin(WINDOW *\fP\fIwin\fP\fB);\fR
74 .br
75 \fBvoid wsyncup(WINDOW *\fP\fIwin\fP\fB);\fR
76 .br
77 \fBint syncok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR
78 .br
79 \fBvoid wcursyncup(WINDOW *\fP\fIwin\fP\fB);\fR
80 .br
81 \fBvoid wsyncdown(WINDOW *\fP\fIwin\fP\fB);\fR
82 .br
83 .SH DESCRIPTION
84 .SS newwin
85 Calling \fBnewwin\fR creates and returns a pointer to a new window with the
86 given number of lines and columns.
87 The upper left-hand corner of the window is
88 at
89 .RS
90 line \fIbegin\fR_\fIy\fR,
91 .br
92 column \fIbegin\fR_\fIx\fR
93 .RE
94 .PP
95 If either
96 \fInlines\fR or \fIncols\fR is zero, they default to
97 .RS
98 \fBLINES \-\fR \fIbegin\fR_\fIy\fR and
99 .br
100 \fBCOLS \-\fR \fIbegin\fR_\fIx\fR.
101 .RE
102 .PP
103 A new full-screen window is created by calling \fBnewwin(0,0,0,0)\fR.
104 .PP
105 Regardless of the function used for creating a new window
106 (e.g., \fBnewwin\fP, \fBsubwin\fP, \fBderwin\fP, \fBnewpad\fP),
107 rather than a duplicate (with \fBdupwin\fP),
108 all of the window modes are initialized to the default values.
109 These functions set window modes after a window is created:
110 .RS
111 .na
112 .PP
113 idcok,
114 idlok,
115 immedok,
116 keypad,
117 leaveok,
118 nodelay,
119 scrollok,
120 setscrreg,
121 syncok,
122 wbkgdset,
123 wbkgrndset, and
124 wtimeout
125 .RE
126 .ad
127 .SS delwin
128 .PP
129 Calling \fBdelwin\fR deletes the named window, freeing all memory
130 associated with it (it does not actually erase the window's screen
131 image).
132 Subwindows must be deleted before the main window can be deleted.
133 .SS mvwin
134 .PP
135 Calling \fBmvwin\fR moves the window so that the upper left-hand
136 corner is at position (\fIx\fR, \fIy\fR).
137 If the move would cause the window to be off the screen,
138 it is an error and the window is not moved.
139 Moving subwindows is allowed, but should be avoided.
140 .SS subwin
141 .PP
142 Calling \fBsubwin\fR creates and returns a pointer to a new window
143 with the given number of lines, \fInlines\fR, and columns, \fIncols\fR.
144 The window is at position (\fIbegin\fR_\fIy\fR,
145 \fIbegin\fR_\fIx\fR) on the screen.
146 The subwindow shares memory with the window \fIorig\fR,
147 so that changes made to one window
148 will affect both windows.
149 When using this routine, it is necessary to call
150 \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling
151 \fBwrefresh\fR on the subwindow.
152 .SS derwin
153 .PP
154 Calling \fBderwin\fR is the same as calling \fBsubwin,\fR except that
155 \fIbegin\fR_\fIy\fR and \fIbegin\fR_\fIx\fR are relative to the origin
156 of the window \fIorig\fR rather than the screen.
157 There is no difference between the subwindows and the derived windows.
158 .PP
159 Calling \fBmvderwin\fR moves a derived window (or subwindow)
160 inside its parent window.
161 The screen-relative parameters of the window are not changed.
162 This routine is used to display different
163 parts of the parent window at the same physical position on the
164 screen.
165 .SS dupwin
166 .PP
167 Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR.
168 .SS wsyncup
169 .PP
170 Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are
171 changed in \fIwin\fR.
172 If \fBsyncok\fR is called with second argument
173 \fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a
174 change in the window.
175 .SS wsyncdown
176 .PP
177 The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been
178 touched in any of its ancestor windows.
179 This routine is called by
180 \fBwrefresh\fR, so it should almost never be necessary to call it manually.
181 .SS wcursyncup
182 .PP
183 The routine \fBwcursyncup\fR updates the current cursor position of all the
184 ancestors of the window to reflect the current cursor position of the
185 window.
186 .SH RETURN VALUE
187 Routines that return an integer return the integer \fBERR\fR upon failure and
188 \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon
189 successful completion.
190 .PP
191 Routines that return pointers return \fBNULL\fR on error.
192 .PP
193 X/Open defines no error conditions.
194 In this implementation
195 .TP 5
196 \fBdelwin\fR
197 returns an error if the window pointer is null, or
198 if the window is the parent of another window.
199 .TP 5
200 \fBderwin\fP
201 returns an error if the parent window pointer is null, or
202 if any of its ordinates or dimensions is negative, or
203 if the resulting window does not fit inside the parent window.
204 .TP 5
205 \fBdupwin\fP
206 returns an error if the window pointer is null.
207 .IP
208 This implementation also maintains a list of windows,
209 and checks that the pointer passed to \fBdelwin\fP is one that
210 it created, returning an error if it was not..
211 .TP 5
212 \fBmvderwin\fP
213 returns an error
214 if the window pointer is null, or
215 if some part of the window would be placed off-screen.
216 .TP 5
217 \fBmvwin\fP
218 returns an error
219 if the window pointer is null, or
220 if the window is really a pad, or
221 if some part of the window would be placed off-screen.
222 .TP 5
223 \fBnewwin\fP
224 will fail if either of its beginning ordinates is negative, or
225 if either the number of lines or columns is negative.
226 .TP 5
227 \fBsyncok\fP
228 returns an error
229 if the window pointer is null.
230 .TP 5
231 \fBsubwin\fP
232 returns an error if the parent window pointer is null, or
233 if any of its ordinates or dimensions is negative, or
234 if the resulting window does not fit inside the parent window.
235 .PP
236 The functions which return a window pointer
237 may also fail if there is insufficient memory for its data structures.
238 Any of these functions will fail if the screen has not been initialized,
239 i.e., with \fBinitscr\fP or \fBnewterm\fP.
240 .SH NOTES
241 If many small changes are made to the window, the \fBwsyncup\fR option could
242 degrade performance.
243 .PP
244 Note that \fBsyncok\fR may be a macro.
245 .SH BUGS
246 The subwindow functions (\fBsubwin\fR, \fBderwin\fR, \fBmvderwin\fR,
247 \fBwsyncup\fR, \fBwsyncdown\fR, \fBwcursyncup\fR, \fBsyncok\fR) are flaky,
248 incompletely implemented, and not well tested.
249 .PP
250 The System V curses documentation is very unclear about what \fBwsyncup\fR
251 and \fBwsyncdown\fR actually do.
252 It seems to imply that they are only
253 supposed to touch exactly those lines that are affected by ancestor changes.
254 The language here, and the behavior of the \fBcurses\fR implementation,
255 is patterned on the XPG4 curses standard.
256 The weaker XPG4 spec may result in slower updates.
257 .SH PORTABILITY
258 The XSI Curses standard, Issue 4 describes these functions.
259 .SH SEE ALSO
260 \fBcurses\fR(3X),
261 \fBcurs_refresh\fR(3X),
262 \fBcurs_touch\fR(3X),
263 \fBcurs_variables\fR(3X)