xref: /netbsd-src/lib/libcurses/curses_pad.3 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: curses_pad.3,v 1.6 2017/01/05 23:15:43 roy Exp $
2.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to The NetBSD Foundation
6.\" by Julian Coleman.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26.\" POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd January 5, 2016
29.Dt CURSES_PAD 3
30.Os
31.Sh NAME
32.Nm curses_pad ,
33.Nm newpad ,
34.Nm subpad ,
35.Nm prefresh ,
36.Nm pnoutrefresh
37.Nd curses pad routines
38.Sh LIBRARY
39.Lb libcurses
40.Sh SYNOPSIS
41.In curses.h
42.Ft WINDOW *
43.Fn newpad "int lines" "int cols"
44.Ft WINDOW *
45.Fn subpad "WINDOW *pad" "int lines" "int cols" "int begin_y" "int begin_x"
46.Ft int
47.Fn prefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x"
48.Ft int
49.Fn pnoutrefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x"
50.Ft bool
51.Fn is_pad "const WINDOW *pad"
52.Sh DESCRIPTION
53These functions create and display pads on the current screen.
54.Pp
55The
56.Fn newpad
57function creates a new pad of size
58.Fa lines ,
59.Fa cols .
60.Pp
61.Fn subpad
62is similar to
63.Fn newpad
64excepting that the size of the subpad is bounded by the parent
65pad
66.Fa pad .
67The subpad shares internal data structures with the parent pad
68and will be refreshed when the parent pad is refreshed.
69The starting column and row
70.Fa begin_y ,
71.Fa begin_x
72are relative to the parent pad origin.
73.Pp
74The
75.Fn pnoutrefresh
76function performs the internal processing required by curses to determine
77what changes need to be made to synchronise the internal screen buffer
78and the terminal but does not modify the terminal display.
79A rectangular area of the pad starting at column and row
80.Fa pbeg_y ,
81.Fa pbeg_x
82is copied to the corresponding rectangular area of the screen buffer starting
83at column and row
84.Fa sbeg_y ,
85.Fa sbeg_x
86and extending to
87.Fa smax_y ,
88.Fa smax_x .
89.Pp
90The
91.Fn prefresh
92function causes curses to propagate changes made to the pad specified by
93.Fa pad
94to the terminal display.
95A rectangular area of the pad starting at column and row
96.Fa pbeg_y ,
97.Fa pbeg_x
98is copied to the corresponding rectangular area of the terminal starting
99at column and row
100.Fa sbeg_y ,
101.Fa sbeg_x
102and extending to
103.Fa smax_y ,
104.Fa smax_x .
105.Pp
106The
107.Fn pnoutrefresh
108and
109.Fn doupdate
110functions can be used together to speed up terminal redraws by
111deferring the actual terminal updates until after a batch of updates
112to multiple pads has been done.
113.Pp
114The
115.Fn is_pad
116function returns true if the given window was created by
117.Fn newpad ,
118otherwise false.
119.Sh RETURN VALUES
120Functions returning pointers will return
121.Dv NULL
122if an error is detected.
123The functions that return an int will return one of the following
124values:
125.Pp
126.Bl -tag -width ERR -compact
127.It Er OK
128The function completed successfully.
129.It Er ERR
130An error occurred in the function.
131.El
132.Sh SEE ALSO
133.Xr curses_refresh 3 ,
134.Xr curses_window 3
135.Sh NOTES
136The
137.Fn subpad
138function is similar to the
139.Xr derwin 3
140function, and not the
141.Xr subwin 3
142function.
143.Sh STANDARDS
144The
145.Nx
146Curses library complies with the X/Open Curses specification, part of the
147Single Unix Specification.
148.Sh HISTORY
149The Curses package appeared in
150.Bx 4.0 .
151The
152.Fn is_pad
153function is a
154.Em ncurses
155extension to the Curses library and was added in
156.Nx 8.0 .
157