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