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