xref: /netbsd-src/lib/libcurses/curses_slk.3 (revision 82d56013d7b633d116a93943de88e08335357a7c)
1.\"	$NetBSD: curses_slk.3,v 1.2 2018/09/29 22:04:57 kamil Exp $
2.\"
3.\" Copyright (c) 2017 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Roy Marples.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\"
31.Dd September 29, 2018
32.Dt CURSES_SLK 3
33.Os
34.Sh NAME
35.Nm slk_attroff ,
36.Nm slk_attr_off ,
37.Nm slk_attron ,
38.Nm slk_attr_on ,
39.Nm slk_attrset ,
40.Nm slk_attr_set ,
41.Nm slk_clear ,
42.Nm slk_color ,
43.Nm slk_init ,
44.Nm slk_label ,
45.Nm slk_noutrefresh ,
46.Nm slk_refresh ,
47.Nm slk_restore ,
48.Nm slk_set ,
49.Nm slk_touch ,
50.Nm slk_wset
51.Nd Curses soft label key routines
52.Sh LIBRARY
53.Lb libcurses
54.Sh SYNOPSIS
55.In curses.h
56.Ft int
57.Fn slk_attroff "const chtype attr"
58.Ft int
59.Fn slk_attr_off "const attr_t attr" "void *opt"
60.Ft int
61.Fn slk_attron "const chtype attr"
62.Ft int
63.Fn slk_attr_on "const attr_t attr" "void *opt"
64.Ft int
65.Fn slk_attrset "const chtype attr"
66.Ft int
67.Fn slk_attr_set "const attr_t attr" "short pair" "void *opt"
68.Ft void
69.Fn slk_clear "void"
70.Ft int
71.Fn slk_color "short pair"
72.Ft int
73.Fn slk_init "int fmt"
74.Ft char *
75.Fn slk_label "int labnum"
76.Ft int
77.Fn slk_noutrefresh "void"
78.Ft int
79.Fn slk_refresh "void"
80.Ft int
81.Fn slk_restore "void"
82.Ft int
83.Fn slk_set "int labnum" "const char *label" "int justify"
84.Ft int
85.Fn slk_touch "void"
86.Ft int
87.Fn slk_wset "int labnum" "const wchar_t *label" "int justify"
88.Sh DESCRIPTION
89This Curses interface manipulates the set of soft function-key labels that
90exist on some terminals.
91For those terminals that do not have soft labels, Curses takes over the bottom
92line of
93.Dv stdstr ,
94reducing the size of
95.Dv stdscr
96and the value of the
97.Dv LINES
98external variable.
99There can be up to eight labels of up to eight display columns each.
100.Pp
101To use soft labels,
102.Fn slk_init
103must be called before
104.Xr initscr 3 ,
105.Xr newterm 3 ,
106or
107.Xr ripoffline 3
108is called.
109If
110.Xr newterm 3
111eventually uses a line from
112.Dv stdscr
113to emulate the soft labels, then
114.Fa fmt
115determines how the labels are arranged on the screen from the following list:
116.Bl -tag -width ERR -compact
117.It 0
118indicates a 3-2-3 arrangement.
119.It 1
120indicates a 4-4 arrangement.
121.El
122.Pp
123The
124.Fn slk_set
125and
126.Fn slk_wset
127functions specify the text of soft label number
128.Fa labnum ,
129within the range from 1 to 8 inclusive.
130The
131.Fa label
132argument is the string to be put on the label.
133The
134.Fa justify
135argument can have the following values to indicate how to justify
136.Fa label
137within the space reserved for it:
138.Bl -tag -width ERR -compact
139.It 0
140Left align.
141.It 1
142Center align.
143.It 2
144Right align.
145.El
146.Pp
147The
148.Fn slk_refresh
149and
150.Fn slk_noutrefresh
151functions correspond to the
152.Xr wrefresh 3
153and
154.Xr wnoutrefresh 3
155functions.
156.Pp
157The
158.Fn slk_label
159function returns a pointer to the text displayed in the label.
160.Pp
161The
162.Fn slk_clear
163function immediately clears the soft labels from the screen.
164.Pp
165The
166.Fn slk_restore
167function immediately restores the soft labels to the screen after a call to
168.Fn slk_clear .
169.Pp
170The
171.Fn slk_touch
172function forces all soft labels to be output the next time
173.Fn slk_noutrefresh
174or
175.Fn slk_refresh
176is called.
177.Pp
178The
179.Fn slk_attron ,
180.Fn slk_attrset
181and
182.Fn slk_attroff
183functions correspond to
184.Xr attron 3 ,
185.Xr attrset 3
186and
187.Xr attroff 3 .
188The have an effect only if soft labels are simulated on the bottom line of the
189screen.
190.Pp
191The
192.Fn slk_attr_on ,
193.Fn slk_attr_set ,
194.Fn slk_color
195and
196.Fn slk_attr_off
197functions correspond to
198.Xr attr_on 3 ,
199.Xr attr_set 3 ,
200.Xr color_set 3
201and
202.Xr attr_off 3
203and thus support the attribute constants with the WA_ prefix and color.
204The have an effect only if soft labels are simulated on the bottom line of the
205screen.
206.Pp
207The
208.Fa opt
209argument is reserved for future use.
210Currently the application must provide a NULL pointer as
211.Fa opt .
212.Sh RETURN VALUES
213Functions returning pointers will return
214.Dv NULL
215if an error is detected.
216The functions that return an int will return one of the following
217values:
218.Pp
219.Bl -tag -width ERR -compact
220.It Er OK
221The function completed successfully.
222.It Er ERR
223An error occurred in the function.
224.El
225.Sh SEE ALSO
226.Xr terminfo 5
227.Sh NOTES
228This has not been tested on a terminal with real soft label keys.
229.Dv label_height ,
230.Dv label_width ,
231.Dv label_format
232and
233.Dv lab_f*
234are currently not used.
235.Sh STANDARDS
236The
237.Nx
238Curses library complies with the X/Open Curses specification, part of the
239Single Unix Specification.
240.Sh HISTORY
241The Curses package appeared in
242.Bx 4.0 .
243The soft label key functions were added in
244.Nx 8.0 .
245