1curs_pad(3X)                                                      curs_pad(3X)
2
3
4

NAME

6       newpad, subpad, prefresh, pnoutrefresh, pechochar, pecho_wchar - create
7       and display curses pads
8

SYNOPSIS

10       #include <curses.h>
11
12       WINDOW *newpad(int nlines, int ncols);
13       WINDOW *subpad(WINDOW *orig, int nlines, int ncols,
14             int begin_y, int begin_x);
15       int prefresh(WINDOW *pad, int pminrow, int pmincol,
16             int sminrow, int smincol, int smaxrow, int smaxcol);
17       int pnoutrefresh(WINDOW *pad, int pminrow, int pmincol,
18             int sminrow, int smincol, int smaxrow, int smaxcol);
19       int pechochar(WINDOW *pad, chtype ch);
20       int pecho_wchar(WINDOW *pad, const cchar_t *wch);
21

DESCRIPTION

23   newpad
24       The newpad routine creates and returns a pointer  to  a  new  pad  data
25       structure  with  the given number of lines, nlines, and columns, ncols.
26       A pad is like a window, except that it is not restricted by the  screen
27       size,  and  is not necessarily associated with a particular part of the
28       screen.  Pads can be used when a large window is  needed,  and  only  a
29       part  of  the  window will be on the screen at one time.  Automatic re‐
30       freshes of pads (e.g., from scrolling or echoing of input) do  not  oc‐
31       cur.
32
33       It  is  not  legal to call wrefresh with a pad as an argument; the rou‐
34       tines prefresh or pnoutrefresh should be  called  instead.   Note  that
35       these routines require additional parameters to specify the part of the
36       pad to be displayed and the location on the screen to be used  for  the
37       display.
38
39   subpad
40       The  subpad routine creates and returns a pointer to a subwindow within
41       a pad with the given number of lines, nlines, and columns, ncols.   Un‐
42       like  subwin,  which uses screen coordinates, the window is at position
43       (begin_x, begin_y) on the pad.  The window is made in the middle of the
44       window  orig,  so  that changes made to one window affect both windows.
45       During the use of this routine, it will  often  be  necessary  to  call
46       touchwin or touchline on orig before calling prefresh.
47
48   prefresh, pnoutrefresh
49       The  prefresh  and  pnoutrefresh routines are analogous to wrefresh and
50       wnoutrefresh except that they relate to pads instead of  windows.   The
51       additional  parameters  are needed to indicate what part of the pad and
52       screen are involved.
53
54       ·   The pminrow and pmincol parameters specify the upper left-hand cor‐
55           ner of the rectangle to be displayed in the pad.
56
57       ·   The  sminrow,  smincol, smaxrow, and smaxcol parameters specify the
58           edges of the rectangle to be displayed on the screen.
59
60       The lower right-hand corner of the rectangle to be displayed in the pad
61       is calculated from the screen coordinates, since the rectangles must be
62       the same size.  Both rectangles must be entirely contained within their
63       respective  structures.   Negative values of pminrow, pmincol, sminrow,
64       or smincol are treated as if they were zero.
65
66   pechochar
67       The pechochar routine is functionally equivalent to  a  call  to  addch
68       followed  by a call to refresh(3X), a call to waddch followed by a call
69       to wrefresh, or a call to waddch followed by a call to  prefresh.   The
70       knowledge  that  only  a single character is being output is taken into
71       consideration and, for non-control characters, a  considerable  perfor‐
72       mance  gain  might  be  seen  by  using these routines instead of their
73       equivalents.  In the case of pechochar, the last location of the pad on
74       the screen is reused for the arguments to prefresh.
75
76   pecho_wchar
77       The  pecho_wchar  function  is the analogous wide-character form of pe‐
78       chochar.  It outputs one character to a pad and  immediately  refreshes
79       the pad.  It does this by a call to wadd_wch followed by a call to pre‐
80       fresh.
81

RETURN VALUE

83       Routines that return an integer return ERR upon failure  and  OK  (SVr4
84       only  specifies "an integer value other than ERR") upon successful com‐
85       pletion.
86
87       Routines that return pointers return NULL on error, and  set  errno  to
88       ENOMEM.
89
90       X/Open does not define any error conditions.  In this implementation
91
92          prefresh and pnoutrefresh
93               return an error if the window pointer is null, or if the window
94               is not really a pad or if the  area  to  refresh  extends  off-
95               screen or if the minimum coordinates are greater than the maxi‐
96               mum.
97
98          pechochar
99               returns an error if the window is not really a pad, and the as‐
100               sociated call to wechochar returns an error.
101
102          pecho_wchar
103               returns an error if the window is not really a pad, and the as‐
104               sociated call to wecho_wchar returns an error.
105

NOTES

107       Note that pechochar may be a macro.
108

PORTABILITY

110       BSD curses has no pad feature.
111
112       SVr2 curses (1986) provided the newpad and related functions, document‐
113       ing  them  in  a single line each.  SVr3 (1987) provided more extensive
114       documentation.
115
116       The documentation does not explain the term pad.  However,  the  Apollo
117       Aegis workstation operating system supported a graphical pad feature:
118
119       ·   These  graphical pads could be much larger than the computer's dis‐
120           play.
121
122       ·   The read-only output from a command could be scrolled back  to  in‐
123           spect, and select text from the pad.
124
125       The two uses may be related.
126
127       The  XSI  Curses  standard,  Issue 4 describes these functions, without
128       significant change from the SVr3 documentation.  It describes no  error
129       conditions.   The  behavior of subpad if the parent window is not a pad
130       is undocumented, and is not checked by the vendor Unix implementations:
131
132       ·   SVr4 curses sets a flag in the WINDOW  structure  in  newpad  which
133           tells if the window is a pad.
134
135           However,  it  uses this information only in waddch (to decide if it
136           should call wrefresh) and wscrl (to avoid  scrolling  a  pad),  and
137           does  not  check  in  wrefresh  to ensure that the pad is refreshed
138           properly.
139
140       ·   Solaris X/Open Curses checks if a window is a pad in  wnoutrefresh,
141           returning ERR in that case.
142
143           However,  it only sets the flag for subwindows if the parent window
144           is a pad.  Its newpad function does not set this information.  Con‐
145           sequently, the check will never fail.
146
147           It  makes no comparable check in pnoutrefresh, though interestingly
148           enough, a comment in the source code states  that  the  lack  of  a
149           check was an MKS extension.
150
151       ·   NetBSD  7 curses sets a flag in the WINDOW structure for newpad and
152           subpad, using this to help with the  distinction  between  wnoutre‐
153           fresh and pnoutrefresh.
154
155           It  does  not  check for the case where a subwindow is created in a
156           pad using subwin or derwin.
157
158           The dupwin function returns a regular  window  when  duplicating  a
159           pad.   Likewise,  getwin always returns a window, even if the saved
160           data was from a pad.
161
162       This implementation
163
164       ·   sets a flag in the WINDOW structure for newpad and subpad,
165
166       ·   allows a subwin or derwin call to succeed having a  pad  parent  by
167           forcing the subwindow to be a pad,
168
169       ·   checks  in  both  wnoutrefresh and pnoutrefresh to ensure that pads
170           and windows are handled distinctly, and
171
172       ·   ensures that dupwin and getwin treat pads  versus  windows  consis‐
173           tently.
174

SEE ALSO

176       curses(3X), curs_refresh(3X), curs_touch(3X), curs_addch(3X).
177
178
179
180                                                                  curs_pad(3X)
Impressum