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