Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 2 | .\" Copyright (c) 1998-2014,2015 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 | .\" |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 29 | .\" $Id: curs_window.3x,v 1.19 2015/07/21 08:25:23 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 44 | \fBwsyncdown\fR \- create \fBcurses\fR windows |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 45 | .ad |
| 46 | .hy |
| 47 | .SH SYNOPSIS |
| 48 | \fB#include <curses.h>\fR |
| 49 | .sp |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 53 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 54 | \fBint delwin(WINDOW *\fP\fIwin\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 55 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 56 | \fBint mvwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIy\fP\fB, int \fP\fIx\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 57 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 61 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 65 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 66 | \fBint mvderwin(WINDOW *\fP\fIwin\fP\fB, int \fP\fIpar_y\fP\fB, int \fP\fIpar_x\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 67 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 68 | \fBWINDOW *dupwin(WINDOW *\fP\fIwin\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 69 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 70 | \fBvoid wsyncup(WINDOW *\fP\fIwin\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 71 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 72 | \fBint syncok(WINDOW *\fP\fIwin\fP\fB, bool \fP\fIbf\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 74 | \fBvoid wcursyncup(WINDOW *\fP\fIwin\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 75 | .br |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 76 | \fBvoid wsyncdown(WINDOW *\fP\fIwin\fP\fB);\fR |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 77 | .br |
| 78 | .SH DESCRIPTION |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 79 | .SS newwin |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 80 | Calling \fBnewwin\fR creates and returns a pointer to a new window with the |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 103 | image). |
| 104 | Subwindows must be deleted before the main window can be deleted. |
| 105 | .SS mvwin |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 106 | .PP |
| 107 | Calling \fBmvwin\fR moves the window so that the upper left-hand |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 113 | .PP |
| 114 | Calling \fBsubwin\fR creates and returns a pointer to a new window |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 122 | \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before calling |
| 123 | \fBwrefresh\fR on the subwindow. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 124 | .SS derwin |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 128 | of the window \fIorig\fR rather than the screen. |
| 129 | There is no difference between the subwindows and the derived windows. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 130 | .PP |
| 131 | Calling \fBmvderwin\fR moves a derived window (or subwindow) |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 132 | inside its parent window. |
| 133 | The screen-relative parameters of the window are not changed. |
| 134 | This routine is used to display different |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 135 | parts of the parent window at the same physical position on the |
| 136 | screen. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 137 | .SS dupwin |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 138 | .PP |
| 139 | Calling \fBdupwin\fR creates an exact duplicate of the window \fIwin\fR. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 140 | .SS wsyncup |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 141 | .PP |
| 142 | Calling \fBwsyncup\fR touches all locations in ancestors of \fIwin\fR that are |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 143 | changed in \fIwin\fR. |
| 144 | If \fBsyncok\fR is called with second argument |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 145 | \fBTRUE\fR then \fBwsyncup\fR is called automatically whenever there is a |
| 146 | change in the window. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 147 | .SS wsyncdown |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 148 | .PP |
| 149 | The \fBwsyncdown\fR routine touches each location in \fIwin\fR that has been |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 150 | touched in any of its ancestor windows. |
| 151 | This routine is called by |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 152 | \fBwrefresh\fR, so it should almost never be necessary to call it manually. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 153 | .SS wcursyncup |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 199 | \fBsyncok\fP |
| 200 | returns an error |
| 201 | if the window pointer is null. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 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. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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 (\fIsubwin\fR, \fIderwin\fR, \fImvderwin\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 |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 223 | and \fBwsyncdown\fR actually do. |
| 224 | It seems to imply that they are only |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 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, |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 227 | is patterned on the XPG4 curses standard. |
| 228 | The weaker XPG4 spec may result in slower updates. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 229 | .SH PORTABILITY |
| 230 | The XSI Curses standard, Issue 4 describes these functions. |
| 231 | .SH SEE ALSO |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 232 | \fBcurses\fR(3X), |
| 233 | \fBcurs_refresh\fR(3X), |
| 234 | \fBcurs_touch\fR(3X), |
| 235 | \fBcurs_variables\fR(3X) |