]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_pad.3x
52fe51cf35f11ff34be15ea7679880dee0062828
[ncurses.git] / man / curs_pad.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2010,2015 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_pad.3x,v 1.18 2015/07/21 08:58:44 tom Exp $
30 .TH curs_pad 3X ""
31 .na
32 .hy 0
33 .SH NAME
34 \fBnewpad\fR,
35 \fBsubpad\fR,
36 \fBprefresh\fR,
37 \fBpnoutrefresh\fR,
38 \fBpechochar\fR,
39 \fBpecho_wchar\fR \- create and display \fBcurses\fR pads
40 .ad
41 .hy
42 .SH SYNOPSIS
43 \fB#include <curses.h>\fR
44 .sp
45 \fBWINDOW *newpad(int \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB);\fR
46 .br
47 \fBWINDOW *subpad(WINDOW *\fP\fIorig\fP\fB, int \fP\fInlines\fP\fB, int \fP\fIncols\fP\fB,\fR
48       \fBint \fP\fIbegin_y\fP\fB, int \fP\fIbegin_x\fP\fB);\fR
49 .br
50 \fBint prefresh(WINDOW *\fP\fIpad\fP\fB, int \fP\fIpminrow\fP\fB, int \fP\fIpmincol\fP\fB,\fR
51       \fBint \fP\fIsminrow\fP\fB, int \fP\fIsmincol\fP\fB, int \fP\fIsmaxrow\fP\fB, int \fP\fIsmaxcol\fP\fB);\fR
52 .br
53 \fBint pnoutrefresh(WINDOW *\fP\fIpad\fP\fB, int \fP\fIpminrow\fP\fB, int \fP\fIpmincol\fP\fB,\fR
54       \fBint \fP\fIsminrow\fP\fB, int \fP\fIsmincol\fP\fB, int \fP\fIsmaxrow\fP\fB, int \fP\fIsmaxcol\fP\fB);\fR
55 .br
56 \fBint pechochar(WINDOW *\fP\fIpad\fP\fB, chtype \fP\fIch\fP\fB);\fR
57 .br
58 \fBint pecho_wchar(WINDOW *\fP\fIpad\fP\fB, const cchar_t *\fP\fIwch\fP\fB);\fR
59 .SH DESCRIPTION
60 .SS newpad
61 The \fBnewpad\fR routine creates and returns a pointer to a new pad data
62 structure with the given number of lines, \fInlines\fR, and columns,
63 \fIncols\fR.
64 A pad is like a window, except that it is not restricted by the
65 screen size, and is not necessarily associated with a particular part of the
66 screen.
67 Pads can be used when a large window is needed, and only a part of the
68 window will be on the screen at one time.
69 Automatic refreshes of pads
70 (e.g., from scrolling or echoing of input) do not occur.
71 It is not
72 legal to call \fBwrefresh\fR with a \fIpad\fR as an argument; the routines
73 \fBprefresh\fR or \fBpnoutrefresh\fR should be called instead.
74 Note that these
75 routines require additional parameters to specify the part of the pad to be
76 displayed and the location on the screen to be used for the display.
77 .SS subpad
78 .PP
79 The \fBsubpad\fR routine creates and returns a pointer to a subwindow within a
80 pad with the given number of lines, \fInlines\fR, and columns, \fIncols\fR.
81 Unlike \fBsubwin\fR, which uses screen coordinates, the window is at position
82 (\fIbegin\fR_\fIx\fR\fB,\fR \fIbegin\fR_\fIy\fR) on the pad.
83 The window is
84 made in the middle of the window \fIorig\fR, so that changes made to one window
85 affect both windows.
86 During the use of this routine, it will often be
87 necessary to call \fBtouchwin\fR or \fBtouchline\fR on \fIorig\fR before
88 calling \fBprefresh\fR.
89 .SS prefresh, pnoutrefresh
90 .PP
91 The \fBprefresh\fR and \fBpnoutrefresh\fR routines are analogous to
92 \fBwrefresh\fR and \fBwnoutrefresh\fR except that they relate to pads instead
93 of windows.
94 The additional parameters are needed to indicate what part of the
95 pad and screen are involved.
96 The \fIpminrow\fR and \fIpmincol\fR parameters specify the upper
97 left-hand corner of the rectangle to be displayed in the pad.
98 The \fIsminrow\fR,
99 \fIsmincol\fR, \fIsmaxrow\fR, and \fIsmaxcol\fR
100 parameters specify the edges of the
101 rectangle to be displayed on the screen.
102 The lower right-hand corner of the
103 rectangle to be displayed in the pad is calculated from the screen coordinates,
104 since the rectangles must be the same size.
105 Both rectangles must be entirely
106 contained within their respective structures.
107 Negative values of
108 \fIpminrow\fR, \fIpmincol\fR, \fIsminrow\fR, or \fIsmincol\fR are treated as if
109 they were zero.
110 .SS pechochar
111 .PP
112 The \fBpechochar\fR routine is functionally equivalent to a call to \fBaddch\fR
113 followed by a call to \fBrefresh\fR, a call to \fBwaddch\fR followed by a call
114 to \fBwrefresh\fR, or a call to \fBwaddch\fR followed by a call to
115 \fBprefresh\fR.
116 The knowledge that only a single character is being output is
117 taken into consideration and, for non-control characters, a considerable
118 performance gain might be seen by using these routines instead of their
119 equivalents.
120 In the case of \fBpechochar\fR, the last location of the pad on
121 the screen is reused for the arguments to \fBprefresh\fR.
122 .SS pecho_wchar
123 .PP
124 The \fBpecho_wchar\fR function is the analogous wide-character
125 form of \fBpechochar\fR.
126 It outputs one character to a pad and immediately refreshes the pad.
127 It does this by a call to \fBwadd_wch\fR followed by a call to \fBprefresh\fR.
128 .SH RETURN VALUE
129 Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR
130 (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful
131 completion.
132 .PP
133 Routines that return pointers return \fBNULL\fR on error, and set \fBerrno\fR
134 to \fBENOMEM\fR.
135 .PP
136 X/Open does not define any error conditions.
137 In this implementation
138 .RS 3
139 .TP 5
140 \fBprefresh\fP and \fBpnoutrefresh\fP
141 return an error
142 if the window pointer is null, or
143 if the window is not really a pad or
144 if the area to refresh extends off-screen or
145 if the minimum coordinates are greater than the maximum.
146 .TP 5
147 \fBpechochar\fP
148 returns an error
149 if the window is not really a pad, and the associated call
150 to \fBwechochar\fP returns an error.
151 .TP 5
152 \fBpecho_wchar\fP
153 returns an error
154 if the window is not really a pad, and the associated call
155 to \fBwecho_wchar\fP returns an error.
156 .RE
157 .SH NOTES
158 Note that \fBpechochar\fR may be a macro.
159 .SH PORTABILITY
160 The XSI Curses standard, Issue 4 describes these functions.
161 .SH SEE ALSO
162 \fBcurses\fR(3X), \fBcurs_refresh\fR(3X), \fBcurs_touch\fR(3X), \fBcurs_addch\fR(3X).