xref: /netbsd/lib/libcurses/curses_scroll.3 (revision 23b2be97)
1.\"	$NetBSD: curses_scroll.3,v 1.1 2002/10/21 13:55:20 blymn Exp $
2.\"
3.\" Copyright (c) 2002
4.\"	Brett Lymn (blymn@netbsd.org, brett_lymn@yahoo.com.au)
5.\"
6.\" This code is donated to the NetBSD Foundation by the Author.
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.\" 3. The name of the Author may not be used to endorse or promote
17.\"    products derived from this software without specific prior written
18.\"    permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"
33.Dd August 12, 2002
34.Dt CURSES_SCROLL 3
35.Os
36.Sh NAME
37.Nm curses_scroll ,
38.Nm scrl ,
39.Nm wscrl
40.Nm scroll ,
41.Nm scrollok ,
42.Nm setscrreg ,
43.Nm wsetscrreg
44.Nd curses window scrolling routines
45.Sh LIBRARY
46.Lb libcurses
47.Sh SYNOPSIS
48.Fd #include \*[Lt]curses.h\*[Gt]
49.Ft int
50.Fn scrl "int n"
51.Ft int
52.Fn wscrl "WINDOW *win" "int n"
53.Ft int
54.Fn scroll "WINDOW *win"
55.Ft int
56.Fn scrollok "WINDOW *win" "boolf flag"
57.Ft int
58.Fn setscrreg "int top" "int bottom"
59.Ft int
60.Fn wsetscrreg "WINDOW *win" "int top" "int bottom"
61.Sh DESCRIPTION
62These functions scroll areas on
63.Dv stdscr
64or on the specified window.
65.Pp
66The
67.Fn scrl
68function scrolls
69.Dv stdscr
70by
71.Fa n
72lines.
73If
74.Fa n
75is positive then then
76.Dv stdscr
77is scrolled up.
78.Fa n
79lines are lost from the top of
80.Dv stdscr
81and
82.Fa n
83blank lines are inserted at the bottom.
84If
85.Fa n
86is negative then
87.Dv stdscr
88is scrolled down.
89.Fa n
90blank lines are inserted at the top of
91.Dv stdscr
92and
93.Fa n
94lines are lost from the bottom.
95.Pp
96The
97.Fn wscrl
98function is the same as the
99.Fn scrl
100function, excepting that it scrolls the window specified by
101.Fa win .
102.Pp
103The
104.Fn scroll
105function scrolls the window
106.Fa win
107up by one line.
108.Pp
109The scrolling behaviour of a window can be controlled by using the
110.Fn scrollok
111function.
112If the
113.Fa flag
114argument is
115.Dv TRUE
116then a line wrap at the bottom of the window will cause the window to
117be scrolled up one line, if
118.Fa flag
119is
120.Dv FALSE
121then lines that would force a scroll will be truncated.
122.Pp
123The
124.Fn setscrreg
125function sets up a software scrolling region on
126.Dv stdscr
127which will define a region of the screen that will be scrolled.
128The scrolling of this region is also controlled by the
129.Fn scrollok
130function.
131.Pp
132The
133.Fn wsetscrreg
134function does the same as the
135.Fn setscrreg
136function, except that the scrolling region is set on the window specified by
137.Fa win .
138.Pp
139If a scrolling region has been set with the
140.Fn setscrreg
141or
142.Fn wsetscrreg
143functions and the current cursor position is inside the scrolling region,
144then only the area inside the scrolling region is scrolled.
145.Sh RETURN VALUES
146Functions returning pointers will return
147.Dv NULL
148if an error is detected.
149The functions that return an int will return one of the following
150values:
151.Pp
152.Bl -tag -width ERR -compact
153.It Er OK
154The function completed successfully.
155.It Er ERR
156An error occurred in the function.
157.El
158.Sh SEE ALSO
159.Xr curses_deleteln 3 ,
160.Xr curses_insdelln 3 ,
161.Xr curses_insertln 3
162.Sh STANDARDS
163The
164.Nx
165Curses library complies with the X/Open Curses specification, part of the
166Single Unix Specification.
167.Sh HISTORY
168The Curses package appeared in
169.Bx 4.0 .
170