]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_pad.3x.html
ncurses 6.4 - patch 20230923
[ncurses.git] / doc / html / man / curs_pad.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2022,2023 Thomas E. Dickey                                *
4   * Copyright 1998-2015,2017 Free Software Foundation, Inc.                  *
5   *                                                                          *
6   * Permission is hereby granted, free of charge, to any person obtaining a  *
7   * copy of this software and associated documentation files (the            *
8   * "Software"), to deal in the Software without restriction, including      *
9   * without limitation the rights to use, copy, modify, merge, publish,      *
10   * distribute, distribute with modifications, sublicense, and/or sell       *
11   * copies of the Software, and to permit persons to whom the Software is    *
12   * furnished to do so, subject to the following conditions:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24   *                                                                          *
25   * Except as contained in this notice, the name(s) of the above copyright   *
26   * holders shall not be used in advertising or otherwise to promote the     *
27   * sale, use or other dealings in this Software without prior written       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_pad.3x,v 1.43 2023/09/23 22:49:51 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_pad 3x 2023-09-23 ncurses 6.4 Library calls</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_pad 3x 2023-09-23 ncurses 6.4 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>                     Library calls                    <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <STRONG>newpad</STRONG>, <STRONG>subpad</STRONG>, <STRONG>prefresh</STRONG>, <STRONG>pnoutrefresh</STRONG>, <STRONG>pechochar</STRONG>, <STRONG>pecho_wchar</STRONG> - create
51        and display <EM>curses</EM> pads
52
53
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
56
57        <STRONG>WINDOW</STRONG> <STRONG>*newpad(int</STRONG> <EM>nlines</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>ncols</EM><STRONG>);</STRONG>
58        <STRONG>WINDOW</STRONG> <STRONG>*subpad(WINDOW</STRONG> <STRONG>*</STRONG><EM>orig</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>nlines</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>ncols</EM><STRONG>,</STRONG>
59              <STRONG>int</STRONG> <EM>begin</EM><STRONG>_</STRONG><EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>begin</EM><STRONG>_</STRONG><EM>x</EM><STRONG>);</STRONG>
60        <STRONG>int</STRONG> <STRONG>prefresh(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pmincol</EM><STRONG>,</STRONG>
61              <STRONG>int</STRONG> <EM>sminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smincol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxcol</EM><STRONG>);</STRONG>
62        <STRONG>int</STRONG> <STRONG>pnoutrefresh(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>pmincol</EM><STRONG>,</STRONG>
63              <STRONG>int</STRONG> <EM>sminrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smincol</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxrow</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>smaxcol</EM><STRONG>);</STRONG>
64        <STRONG>int</STRONG> <STRONG>pechochar(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>chtype</STRONG> <EM>ch</EM><STRONG>);</STRONG>
65        <STRONG>int</STRONG> <STRONG>pecho_wchar(WINDOW</STRONG> <STRONG>*</STRONG><EM>pad</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>cchar_t</STRONG> <STRONG>*</STRONG><EM>wch</EM><STRONG>);</STRONG>
66
67
68 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
69
70 </PRE><H3><a name="h3-newpad">newpad</a></H3><PRE>
71        The <STRONG>newpad</STRONG> routine creates and returns a pointer  to  a  new  pad  data
72        structure  with  the given number of lines, <EM>nlines</EM>, and columns, <EM>ncols</EM>.
73        A pad is like a window, except that it is not restricted by the  screen
74        size,  and  is not necessarily associated with a particular part of the
75        screen.  Pads can be used when a large window is  needed,  and  only  a
76        part  of  the  window  will  be  on  the screen at one time.  Automatic
77        refreshes of pads (e.g., from scrolling or echoing  of  input)  do  not
78        occur.
79
80        It  is  not  legal  to  call  <STRONG>wrefresh</STRONG>  with  a <EM>pad</EM> as an argument; the
81        routines <STRONG>prefresh</STRONG> or <STRONG>pnoutrefresh</STRONG> should be called instead.  Note  that
82        these routines require additional parameters to specify the part of the
83        pad to be displayed and the location on the screen to be used  for  the
84        display.
85
86
87 </PRE><H3><a name="h3-subpad">subpad</a></H3><PRE>
88        The  <STRONG>subpad</STRONG> routine creates and returns a pointer to a subwindow within
89        a pad with the given number  of  lines,  <EM>nlines</EM>,  and  columns,  <EM>ncols</EM>.
90        Unlike <STRONG>subwin</STRONG>, which uses screen coordinates, the window is at position
91        (<EM>begin</EM>_<EM>x</EM><STRONG>,</STRONG> <EM>begin</EM>_<EM>y</EM>) on the pad.  The window is made in the middle of the
92        window  <EM>orig</EM>,  so  that changes made to one window affect both windows.
93        During the use of this routine, it will  often  be  necessary  to  call
94        <STRONG>touchwin</STRONG> or <STRONG>touchline</STRONG> on <EM>orig</EM> before calling <STRONG>prefresh</STRONG>.
95
96
97 </PRE><H3><a name="h3-prefresh_-pnoutrefresh">prefresh, pnoutrefresh</a></H3><PRE>
98        The  <STRONG>prefresh</STRONG>  and  <STRONG>pnoutrefresh</STRONG> routines are analogous to <STRONG>wrefresh</STRONG> and
99        <STRONG>wnoutrefresh</STRONG> except that they relate to pads instead of  windows.   The
100        additional  parameters  are needed to indicate what part of the pad and
101        screen are involved.
102
103        <STRONG>o</STRONG>   The <EM>pminrow</EM> and <EM>pmincol</EM>  parameters  specify  the  upper  left-hand
104            corner of the rectangle to be displayed in the pad.
105
106        <STRONG>o</STRONG>   The  <EM>sminrow</EM>,  <EM>smincol</EM>, <EM>smaxrow</EM>, and <EM>smaxcol</EM> parameters specify the
107            edges of the rectangle to be displayed on the screen.
108
109        The lower right-hand corner of the rectangle to be displayed in the pad
110        is calculated from the screen coordinates, since the rectangles must be
111        the same size.  Both rectangles must be entirely contained within their
112        respective  structures.   Negative values of <EM>pminrow</EM>, <EM>pmincol</EM>, <EM>sminrow</EM>,
113        or <EM>smincol</EM> are treated as if they were zero.
114
115
116 </PRE><H3><a name="h3-pechochar">pechochar</a></H3><PRE>
117        The <STRONG>pechochar</STRONG> routine is functionally equivalent to  a  call  to  <STRONG>addch</STRONG>
118        followed  by a call to <STRONG><A HREF="curs_refresh.3x.html">refresh(3x)</A></STRONG>, a call to <STRONG>waddch</STRONG> followed by a call
119        to <STRONG>wrefresh</STRONG>, or a call to <STRONG>waddch</STRONG> followed by a call to  <STRONG>prefresh</STRONG>.   The
120        knowledge  that  only  a single character is being output is taken into
121        consideration  and,  for   non-control   characters,   a   considerable
122        performance gain might be seen by using these routines instead of their
123        equivalents.  In the case of <STRONG>pechochar</STRONG>, the last location of the pad on
124        the screen is reused for the arguments to <STRONG>prefresh</STRONG>.
125
126
127 </PRE><H3><a name="h3-pecho_wchar">pecho_wchar</a></H3><PRE>
128        The  <STRONG>pecho_wchar</STRONG>  function  is  the  analogous  wide-character  form of
129        <STRONG>pechochar</STRONG>.  It outputs one character to a pad and immediately refreshes
130        the  pad.   It  does  this  by a call to <STRONG>wadd_wch</STRONG> followed by a call to
131        <STRONG>prefresh</STRONG>.
132
133
134 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
135        Routines that return an integer return <STRONG>ERR</STRONG> upon failure  and  <STRONG>OK</STRONG>  (SVr4
136        only  specifies  "an  integer  value  other  than <STRONG>ERR</STRONG>") upon successful
137        completion.
138
139        Routines that return pointers return <STRONG>NULL</STRONG> on error, and  set  <STRONG>errno</STRONG>  to
140        <STRONG>ENOMEM</STRONG>.
141
142        X/Open does not define any error conditions.  In this implementation
143
144           <STRONG>prefresh</STRONG> and <STRONG>pnoutrefresh</STRONG>
145                return an error if the window pointer is null, or if the window
146                is not really a pad or if the  area  to  refresh  extends  off-
147                screen  or  if  the  minimum  coordinates  are greater than the
148                maximum.
149
150           <STRONG>pechochar</STRONG>
151                returns an error if the window is not really  a  pad,  and  the
152                associated call to <STRONG>wechochar</STRONG> returns an error.
153
154           <STRONG>pecho_wchar</STRONG>
155                returns  an  error  if  the window is not really a pad, and the
156                associated call to <STRONG>wecho_wchar</STRONG> returns an error.
157
158
159 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
160        Note that <STRONG>pechochar</STRONG> may be a macro.
161
162
163 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
164        BSD <EM>curses</EM> has no <EM>pad</EM> feature.
165
166        SVr2  <EM>curses</EM>  (1986)  provided  the  <STRONG>newpad</STRONG>  and   related   functions,
167        documenting  them  in  a  single  line each.  SVr3 (1987) provided more
168        extensive documentation.
169
170        The documentation does not explain the term <EM>pad</EM>.  However,  the  Apollo
171        <EM>Aegis</EM> workstation operating system supported a graphical <EM>pad</EM> feature:
172
173        <STRONG>o</STRONG>   These  graphical  pads  could  be  much  larger than the computer's
174            display.
175
176        <STRONG>o</STRONG>   The read-only output from a  command  could  be  scrolled  back  to
177            inspect, and select text from the pad.
178
179        The two uses may be related.
180
181        The  XSI  Curses  standard,  Issue 4 describes these functions, without
182        significant change from the SVr3 documentation.  It describes no  error
183        conditions.   The  behavior of <STRONG>subpad</STRONG> if the parent window is not a pad
184        is undocumented, and is not checked by the vendor Unix implementations:
185
186        <STRONG>o</STRONG>   SVr4 <EM>curses</EM> sets a flag in the <STRONG>WINDOW</STRONG>  structure  in  <STRONG>newpad</STRONG>  which
187            tells if the window is a <EM>pad</EM>.
188
189            However,  it  uses this information only in <STRONG>waddch</STRONG> (to decide if it
190            should call <STRONG>wrefresh</STRONG>) and <STRONG>wscrl</STRONG> (to avoid  scrolling  a  pad),  and
191            does  not  check  in  <STRONG>wrefresh</STRONG>  to ensure that the pad is refreshed
192            properly.
193
194        <STRONG>o</STRONG>   Solaris X/Open Curses checks if a window is a pad in  <STRONG>wnoutrefresh</STRONG>,
195            returning <STRONG>ERR</STRONG> in that case.
196
197            However,  it only sets the flag for subwindows if the parent window
198            is a pad.  Its <STRONG>newpad</STRONG>  function  does  not  set  this  information.
199            Consequently, the check will never fail.
200
201            It  makes no comparable check in <STRONG>pnoutrefresh</STRONG>, though interestingly
202            enough, a comment in the source code states  that  the  lack  of  a
203            check was an MKS extension.
204
205        <STRONG>o</STRONG>   NetBSD  7 <EM>curses</EM> sets a flag in the <STRONG>WINDOW</STRONG> structure for <STRONG>newpad</STRONG> and
206            <STRONG>subpad</STRONG>,  using  this  to  help   with   the   distinction   between
207            <STRONG>wnoutrefresh</STRONG> and <STRONG>pnoutrefresh</STRONG>.
208
209            It  does  not  check for the case where a subwindow is created in a
210            pad using <STRONG>subwin</STRONG> or <STRONG>derwin</STRONG>.
211
212            The <STRONG>dupwin</STRONG> function returns a regular  window  when  duplicating  a
213            pad.   Likewise,  <STRONG>getwin</STRONG> always returns a window, even if the saved
214            data was from a pad.
215
216        This implementation
217
218        <STRONG>o</STRONG>   sets a flag in the <STRONG>WINDOW</STRONG> structure for <STRONG>newpad</STRONG> and <STRONG>subpad</STRONG>,
219
220        <STRONG>o</STRONG>   allows a <STRONG>subwin</STRONG> or <STRONG>derwin</STRONG> call to succeed having a  pad  parent  by
221            forcing the subwindow to be a pad,
222
223        <STRONG>o</STRONG>   checks  in  both  <STRONG>wnoutrefresh</STRONG> and <STRONG>pnoutrefresh</STRONG> to ensure that pads
224            and windows are handled distinctly, and
225
226        <STRONG>o</STRONG>   ensures  that  <STRONG>dupwin</STRONG>  and  <STRONG>getwin</STRONG>  treat   pads   versus   windows
227            consistently.
228
229
230 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
231        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_refresh.3x.html">curs_refresh(3x)</A></STRONG>, <STRONG><A HREF="curs_touch.3x.html">curs_touch(3x)</A></STRONG>, <STRONG><A HREF="curs_addch.3x.html">curs_addch(3x)</A></STRONG>
232
233
234
235 ncurses 6.4                       2023-09-23                      <STRONG><A HREF="curs_pad.3x.html">curs_pad(3x)</A></STRONG>
236 </PRE>
237 <div class="nav">
238 <ul>
239 <li><a href="#h2-NAME">NAME</a></li>
240 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
241 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
242 <ul>
243 <li><a href="#h3-newpad">newpad</a></li>
244 <li><a href="#h3-subpad">subpad</a></li>
245 <li><a href="#h3-prefresh_-pnoutrefresh">prefresh, pnoutrefresh</a></li>
246 <li><a href="#h3-pechochar">pechochar</a></li>
247 <li><a href="#h3-pecho_wchar">pecho_wchar</a></li>
248 </ul>
249 </li>
250 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
251 <li><a href="#h2-NOTES">NOTES</a></li>
252 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
253 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
254 </ul>
255 </div>
256 </BODY>
257 </HTML>