2 ****************************************************************************
3 * Copyright 2018-2020,2021 Thomas E. Dickey *
4 * Copyright 1998-2016,2017 Free Software Foundation, Inc. *
6 * Permission is hereby granted, free of charge, to any person obtaining a *
7 * copy of this software and associated documentation files (the *
8 * "Software"), to deal in the Software without restriction, including *
9 * without limitation the rights to use, copy, modify, merge, publish, *
10 * distribute, distribute with modifications, sublicense, and/or sell *
11 * copies of the Software, and to permit persons to whom the Software is *
12 * furnished to do so, subject to the following conditions: *
14 * The above copyright notice and this permission notice shall be included *
15 * in all copies or substantial portions of the Software. *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
20 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
23 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
25 * Except as contained in this notice, the name(s) of the above copyright *
26 * holders shall not be used in advertising or otherwise to promote the *
27 * sale, use or other dealings in this Software without prior written *
29 ****************************************************************************
30 * @Id: curs_slk.3x,v 1.38 2021/06/17 21:26:02 tom Exp @
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_slk 3X</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
42 <H1 class="no-header">curs_slk 3X</H1>
44 <B><A HREF="curs_slk.3X.html">curs_slk(3X)</A></B> <B><A HREF="curs_slk.3X.html">curs_slk(3X)</A></B>
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50 <B>slk_init</B>, <B>slk_set</B>, <B>slk_wset</B>, <B>slk_refresh</B>, <B>slk_noutrefresh</B>, <B>slk_label</B>,
51 <B>slk_clear</B>, <B>slk_restore</B>, <B>slk_touch</B>, <B>slk_attron</B>, <B>slk_attrset</B>,
52 <B>slk_attroff</B>, <B>slk_attr_on</B>, <B>slk_attr_set</B>, <B>slk_attr_off</B>, <B>slk_attr</B>,
53 <B>slk_color</B>, <B>extended_slk_color</B> - <B>curses</B> soft label routines
56 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
57 <B>#include</B> <B><curses.h></B>
59 <B>int</B> <B>slk_init(int</B> <I>fmt</I><B>);</B>
61 <B>int</B> <B>slk_set(int</B> <I>labnum</I><B>,</B> <B>const</B> <B>char</B> <B>*</B><I>label</I><B>,</B> <B>int</B> <I>fmt</I><B>);</B>
63 <B>int</B> <B>slk_wset(int</B> <I>labnum</I><B>,</B> <B>const</B> <B>wchar_t</B> <B>*</B><I>label</I><B>,</B> <B>int</B> <I>fmt</I><B>);</B>
65 <B>char</B> <B>*slk_label(int</B> <I>labnum</I><B>);</B>
67 <B>int</B> <B>slk_refresh(void);</B>
68 <B>int</B> <B>slk_noutrefresh(void);</B>
69 <B>int</B> <B>slk_clear(void);</B>
70 <B>int</B> <B>slk_restore(void);</B>
71 <B>int</B> <B>slk_touch(void);</B>
73 <B>int</B> <B>slk_attron(const</B> <B>chtype</B> <I>attrs</I><B>);</B>
74 <B>int</B> <B>slk_attroff(const</B> <B>chtype</B> <I>attrs</I><B>);</B>
75 <B>int</B> <B>slk_attrset(const</B> <B>chtype</B> <I>attrs</I><B>);</B>
76 <B>int</B> <B>slk_attr_on(attr_t</B> <I>attrs</I><B>,</B> <B>void*</B> <I>opts</I><B>);</B>
77 <B>int</B> <B>slk_attr_off(const</B> <B>attr_t</B> <I>attrs</I><B>,</B> <B>void</B> <B>*</B> <I>opts</I><B>);</B>
78 <B>int</B> <B>slk_attr_set(const</B> <B>attr_t</B> <I>attrs</I><B>,</B> <B>short</B> <I>pair</I><B>,</B> <B>void*</B> <I>opts</I><B>);</B>
80 <B>attr_t</B> <B>slk_attr(void);</B>
82 <B>int</B> <B>slk_color(short</B> <I>pair</I><B>);</B>
84 <B>int</B> <B>extended_slk_color(int</B> <I>pair</I><B>);</B>
87 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
88 The slk* functions manipulate the set of soft function-key labels that
89 exist on many terminals. For those terminals that do not have soft la-
90 bels, <B>curses</B> takes over the bottom line of <B>stdscr</B>, reducing the size of
91 <B>stdscr</B> and the variable <B>LINES</B>. <B>curses</B> standardizes on eight labels of
92 up to eight characters each. In addition to this, the ncurses imple-
93 mentation supports a mode where it simulates 12 labels of up to five
94 characters each. This is useful for PC-like enduser devices. ncurses
95 simulates this mode by taking over up to two lines at the bottom of the
96 screen; it does not try to use any hardware support for this mode.
99 </PRE><H3><a name="h3-Initialization">Initialization</a></H3><PRE>
100 The <B>slk_init</B> routine must be called before <B>initscr</B> or <B>newterm</B> is
101 called. If <B>initscr</B> eventually uses a line from <B>stdscr</B> to emulate the
102 soft labels, then <I>fmt</I> determines how the labels are arranged on the
105 <B>0</B> indicates a 3-2-3 arrangement of the labels.
107 <B>1</B> indicates a 4-4 arrangement
109 <B>2</B> indicates the PC-like 4-4-4 mode.
111 <B>3</B> is again the PC-like 4-4-4 mode, but in addition an index line is
112 generated, helping the user to identify the key numbers easily.
115 </PRE><H3><a name="h3-Labels">Labels</a></H3><PRE>
116 The <B>slk_set</B> routine (and the <B>slk_wset</B> routine for the wide-character
117 library) has three parameters:
120 is the label number, from <B>1</B> to <B>8</B> (12 for <I>fmt</I> in <B>slk_init</B> is <B>2</B>
124 is be the string to put on the label, up to eight (five for <I>fmt</I>
125 in <B>slk_init</B> is <B>2</B> or <B>3</B>) characters in length. A null string or
126 a null pointer sets up a blank label.
128 <I>fmt</I> is either <B>0</B>, <B>1</B>, or <B>2</B>, indicating whether the label is to be
129 left-justified, centered, or right-justified, respectively,
132 The <B>slk_label</B> routine returns the current label for label number <I>lab-</I>
133 <I>num</I>, with leading and trailing blanks stripped.
136 </PRE><H3><a name="h3-Screen-updates">Screen updates</a></H3><PRE>
137 The <B>slk_refresh</B> and <B>slk_noutrefresh</B> routines correspond to the <B>wrefresh</B>
138 and <B>wnoutrefresh</B> routines.
140 The <B>slk_clear</B> routine clears the soft labels from the screen.
142 The <B>slk_restore</B> routine restores the soft labels to the screen after a
143 <B>slk_clear</B> has been performed.
145 The <B>slk_touch</B> routine forces all the soft labels to be output the next
146 time a <B>slk_noutrefresh</B> is performed.
149 </PRE><H3><a name="h3-Video-attributes">Video attributes</a></H3><PRE>
150 The <B>slk_attron</B>, <B>slk_attrset</B>, <B>slk_attroff</B> and <B>slk_attr</B> routines corre-
151 spond to <B>attron</B>, <B>attrset</B>, <B>attroff</B> and <B>attr_get</B>, respectively. They
152 have an effect only if soft labels are simulated on the bottom line of
153 the screen. The default highlight for soft keys is A_STANDOUT (as in
154 System V curses, which does not document this fact).
157 </PRE><H3><a name="h3-Colors">Colors</a></H3><PRE>
158 The <B>slk_color</B> routine corresponds to <B>color_set</B>. It has an effect only
159 if soft labels are simulated on the bottom line of the screen.
161 Because <B>slk_color</B> accepts only <B>short</B> (signed 16-bit integer) values,
162 this implementation provides <B>extended_slk_color</B> which accepts an inte-
163 ger value, e.g., 32-bits.
166 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
167 These routines return <B>ERR</B> upon failure and <B>OK</B> (SVr4 specifies only "an
168 integer value other than <B>ERR</B>") upon successful completion.
170 X/Open defines no error conditions. In this implementation
173 returns the attribute used for the soft keys.
175 <B>slk_attroff</B>, <B>slk_attron</B>, <B>slk_clear</B>, <B>slk_noutrefresh</B>, <B>slk_refresh</B>,
177 return an error if the terminal or the softkeys were not ini-
181 returns an error if the terminal or the softkeys were not ini-
185 returns an error if the terminal or the softkeys were not ini-
186 tialized, or the color pair is outside the range 0..COL-
190 returns an error if the terminal or the softkeys were not ini-
191 tialized, or the color pair is outside the range 0..COL-
195 returns an error if the format parameter is outside the range
199 returns <B>NULL</B> on error.
202 returns an error if the terminal or the softkeys were not ini-
203 tialized, or the <I>labnum</I> parameter is outside the range of label
204 counts, or if the format parameter is outside the range 0..2,
205 or if memory for the labels cannot be allocated.
208 </PRE><H2><a name="h2-HISTORY">HISTORY</a></H2><PRE>
209 SVr3 introduced these functions:
219 SVr4 added these functions:
225 X/Open Curses added these:
233 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
234 X/Open Curses documents the <I>opts</I> argument as reserved for future use,
235 saying that it must be null. This implementation uses that parameter
236 in ABI 6 for the functions which have a color-pair parameter to support
237 extended color pairs.
239 For functions which modify the color, e.g., <B>slk_attr_set</B>, if <I>opts</I> is
240 set it is treated as a pointer to <B>int</B>, and used to set the color
241 pair instead of the <B>short</B> pair parameter.
244 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
245 Most applications would use <B>slk_noutrefresh</B> because a <B>wrefresh</B> is like-
249 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
250 The XSI Curses standard, Issue 4, described the soft-key functions,
251 with some differences from SVr4 curses:
253 <B>o</B> It added functions like the SVr4 attribute-manipulation functions
254 <B>slk_attron</B>, <B>slk_attroff</B>, <B>slk_attrset</B>, but which use <B>attr_t</B> parame-
255 ters (rather than <B>chtype</B>), along with a reserved <I>opts</I> parameter.
257 Two of these new functions (unlike the SVr4 functions) have no pro-
258 vision for color: <B>slk_attr_on</B> and <B>slk_attr_off</B>.
260 The third function (<B>slk_attr_set</B>) has a color-pair parameter.
262 <B>o</B> It added <B>const</B> qualifiers to parameters (unnecessarily), and
264 <B>o</B> It added <B>slk_color</B>.
266 The format codes <B>2</B> and <B>3</B> for <B>slk_init</B> and the function <B>slk_attr</B> are
269 X/Open Curses does not specify a limit for the number of colors and
270 color pairs which a terminal can support. However, in its use of <B>short</B>
271 for the parameters, it carries over SVr4's implementation detail for
272 the compiled terminfo database, which uses signed 16-bit numbers. This
273 implementation provides extended versions of those functions which use
274 <B>short</B> parameters, allowing applications to use larger color- and pair-
278 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
279 <B><A HREF="curses.3X.html">curses(3X)</A></B>, <B><A HREF="curs_attr.3X.html">curs_attr(3X)</A></B>, <B><A HREF="curs_initscr.3X.html">curs_initscr(3X)</A></B>, <B><A HREF="curs_refresh.3X.html">curs_refresh(3X)</A></B>,
280 <B><A HREF="curs_variables.3X.html">curs_variables(3X)</A></B>.
284 <B><A HREF="curs_slk.3X.html">curs_slk(3X)</A></B>
288 <li><a href="#h2-NAME">NAME</a></li>
289 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
290 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
292 <li><a href="#h3-Initialization">Initialization</a></li>
293 <li><a href="#h3-Labels">Labels</a></li>
294 <li><a href="#h3-Screen-updates">Screen updates</a></li>
295 <li><a href="#h3-Video-attributes">Video attributes</a></li>
296 <li><a href="#h3-Colors">Colors</a></li>
299 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
300 <li><a href="#h2-HISTORY">HISTORY</a></li>
301 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
302 <li><a href="#h2-NOTES">NOTES</a></li>
303 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
304 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>