40efdb9fb814092cd798dcf54d2c2d4e9496e217
[ncurses.git] / doc / html / man / curs_slk.3x.html
1 <!-- 
2   ****************************************************************************
3   * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
4   *                                                                          *
5   * Permission is hereby granted, free of charge, to any person obtaining a  *
6   * copy of this software and associated documentation files (the            *
7   * "Software"), to deal in the Software without restriction, including      *
8   * without limitation the rights to use, copy, modify, merge, publish,      *
9   * distribute, distribute with modifications, sublicense, and/or sell       *
10   * copies of the Software, and to permit persons to whom the Software is    *
11   * furnished to do so, subject to the following conditions:                 *
12   *                                                                          *
13   * The above copyright notice and this permission notice shall be included  *
14   * in all copies or substantial portions of the Software.                   *
15   *                                                                          *
16   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23   *                                                                          *
24   * Except as contained in this notice, the name(s) of the above copyright   *
25   * holders shall not be used in advertising or otherwise to promote the     *
26   * sale, use or other dealings in this Software without prior written       *
27   * authorization.                                                           *
28   ****************************************************************************
29   * @Id: curs_slk.3x,v 1.29 2017/03/18 01:00:30 tom Exp @
30 -->
31 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
32 <HTML>
33 <HEAD>
34 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
35 <meta name="generator" content="Manpage converted by man2html - see http://invisible-island.net/scripts/readme.html#others_scripts">
36 <TITLE>curs_slk 3x</TITLE>
37 <link rev=made href="mailto:bug-ncurses@gnu.org">
38 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
39 </HEAD>
40 <BODY>
41 <H1 class="no-header">curs_slk 3x</H1>
42 <PRE>
43 <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>                                               <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>
44
45
46
47
48 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
49        <STRONG>slk_init</STRONG>, <STRONG>slk_set</STRONG>, <STRONG>slk_wset</STRONG>, <STRONG>slk_refresh</STRONG>, <STRONG>slk_noutrefresh</STRONG>,
50        <STRONG>slk_label</STRONG>, <STRONG>slk_clear</STRONG>, <STRONG>slk_restore</STRONG>, <STRONG>slk_touch</STRONG>, <STRONG>slk_attron</STRONG>,
51        <STRONG>slk_attrset</STRONG>, <STRONG>slk_attroff</STRONG>, <STRONG>slk_attr_on</STRONG>, <STRONG>slk_attr_set</STRONG>,
52        <STRONG>slk_attr_off</STRONG>, <STRONG>slk_attr</STRONG>, <STRONG>slk_color</STRONG> - <STRONG>curses</STRONG> soft label
53        routines
54
55
56 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
57        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
58
59        <STRONG>int</STRONG> <STRONG>slk_init(int</STRONG> <STRONG>fmt);</STRONG>
60
61        <STRONG>int</STRONG> <STRONG>slk_set(int</STRONG> <STRONG>labnum,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*label,</STRONG> <STRONG>int</STRONG> <STRONG>fmt);</STRONG>
62        <STRONG>int</STRONG> <STRONG>slk_wset(int</STRONG> <STRONG>labnum,</STRONG> <STRONG>const</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*label,</STRONG> <STRONG>int</STRONG> <STRONG>fmt);</STRONG>
63
64        <STRONG>char</STRONG> <STRONG>*slk_label(int</STRONG> <STRONG>labnum);</STRONG>
65
66        <STRONG>int</STRONG> <STRONG>slk_refresh(void);</STRONG>
67        <STRONG>int</STRONG> <STRONG>slk_noutrefresh(void);</STRONG>
68        <STRONG>int</STRONG> <STRONG>slk_clear(void);</STRONG>
69        <STRONG>int</STRONG> <STRONG>slk_restore(void);</STRONG>
70        <STRONG>int</STRONG> <STRONG>slk_touch(void);</STRONG>
71
72        <STRONG>int</STRONG> <STRONG>slk_attron(const</STRONG> <STRONG>chtype</STRONG> <STRONG>attrs);</STRONG>
73        <STRONG>int</STRONG> <STRONG>slk_attroff(const</STRONG> <STRONG>chtype</STRONG> <STRONG>attrs);</STRONG>
74        <STRONG>int</STRONG> <STRONG>slk_attrset(const</STRONG> <STRONG>chtype</STRONG> <STRONG>attrs);</STRONG>
75        <STRONG>int</STRONG> <STRONG>slk_attr_on(attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void*</STRONG> <STRONG>opts);</STRONG>
76        <STRONG>int</STRONG> <STRONG>slk_attr_off(const</STRONG> <STRONG>attr_t</STRONG> <STRONG>attrs,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG> <STRONG>opts);</STRONG>
77        <STRONG>int</STRONG>  <STRONG>slk_attr_set(const</STRONG>  <STRONG>attr_t</STRONG>  <STRONG>attrs,</STRONG>  <STRONG>short</STRONG> <STRONG>pair,</STRONG> <STRONG>void*</STRONG>
78        <STRONG>opts);</STRONG>
79
80        <STRONG>attr_t</STRONG> <STRONG>slk_attr(void);</STRONG>
81
82        <STRONG>int</STRONG> <STRONG>slk_color(short</STRONG> <STRONG>pair);</STRONG>
83
84
85 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
86        The slk* functions manipulate the set of soft function-key
87        labels  that exist on many terminals.  For those terminals
88        that do not have soft labels, <STRONG>curses</STRONG> takes over the bottom
89        line  of <STRONG>stdscr</STRONG>, reducing the size of <STRONG>stdscr</STRONG> and the vari-
90        able <STRONG>LINES</STRONG>.  <STRONG>curses</STRONG> standardizes on eight labels of up  to
91        eight  characters  each.  In addition to this, the ncurses
92        implementation supports a mode where it simulates  12  la-
93        bels  of  up  to five characters each.  This is useful for
94        PC-like enduser devices.  ncurses simulates this  mode  by
95        taking  over  up to two lines at the bottom of the screen;
96        it does not try to use any hardware support for this mode.
97
98
99 </PRE><H3><a name="h3-Initialization">Initialization</a></H3><PRE>
100        The <STRONG>slk_init</STRONG> routine must  be  called  before  <STRONG>initscr</STRONG>  or
101        <STRONG>newterm</STRONG> is called.  If <STRONG>initscr</STRONG> eventually uses a line from
102        <STRONG>stdscr</STRONG> to emulate the soft labels, then <EM>fmt</EM> determines how
103        the labels are arranged on the screen:
104
105           <STRONG>0</STRONG>  indicates a 3-2-3 arrangement of the labels.
106
107           <STRONG>1</STRONG>  indicates a 4-4 arrangement
108
109           <STRONG>2</STRONG>  indicates the PC-like 4-4-4 mode.
110
111           <STRONG>3</STRONG>  is  again the PC-like 4-4-4 mode, but in addition an
112              index line is generated, helping the user to identi-
113              fy the key numbers easily.
114
115
116 </PRE><H3><a name="h3-Labels">Labels</a></H3><PRE>
117        The  <STRONG>slk_set</STRONG>  routine  (and  the  <STRONG>slk_wset</STRONG> routine for the
118        wide-character library) has three parameters:
119
120           <EM>labnum</EM>
121                is the label number, from <STRONG>1</STRONG> to <STRONG>8</STRONG> (12  for  <EM>fmt</EM>  in
122                <STRONG>slk_init</STRONG> is <STRONG>2</STRONG> or <STRONG>3</STRONG>);
123
124           <EM>label</EM>
125                is  be the string to put on the label, up to eight
126                (five for <EM>fmt</EM> in <STRONG>slk_init</STRONG> is <STRONG>2</STRONG> or <STRONG>3</STRONG>) characters in
127                length.  A null string or a null pointer sets up a
128                blank label.
129
130           <EM>fmt</EM>  is either <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG>, indicating whether the label
131                is to be left-justified, centered, or right-justi-
132                fied, respectively, within the label.
133
134        The <STRONG>slk_label</STRONG> routine returns the current label for  label
135        number <EM>labnum</EM>, with leading and trailing blanks stripped.
136
137
138 </PRE><H3><a name="h3-Screen-updates">Screen updates</a></H3><PRE>
139        The <STRONG>slk_refresh</STRONG> and <STRONG>slk_noutrefresh</STRONG> routines correspond to
140        the <STRONG>wrefresh</STRONG> and <STRONG>wnoutrefresh</STRONG> routines.
141
142        The <STRONG>slk_clear</STRONG> routine clears  the  soft  labels  from  the
143        screen.
144
145        The  <STRONG>slk_restore</STRONG>  routine  restores the soft labels to the
146        screen after a <STRONG>slk_clear</STRONG> has been performed.
147
148        The <STRONG>slk_touch</STRONG> routine forces all the  soft  labels  to  be
149        output the next time a <STRONG>slk_noutrefresh</STRONG> is performed.
150
151
152 </PRE><H3><a name="h3-Video-attributes">Video attributes</a></H3><PRE>
153        The <STRONG>slk_attron</STRONG>, <STRONG>slk_attrset</STRONG>, <STRONG>slk_attroff</STRONG> and <STRONG>slk_attr</STRONG> rou-
154        tines correspond to <STRONG>attron</STRONG>, <STRONG>attrset</STRONG>, <STRONG>attroff</STRONG> and <STRONG>attr_get</STRONG>.
155        They  have  an effect only if soft labels are simulated on
156        the bottom line of the screen.  The default highlight  for
157        soft keys is A_STANDOUT (as in System V curses, which does
158        not document this fact).
159
160
161 </PRE><H3><a name="h3-Colors">Colors</a></H3><PRE>
162        The <STRONG>slk_color</STRONG> routine corresponds to <STRONG>color_set</STRONG>.  It has an
163        effect  only  if  soft  labels are simulated on the bottom
164        line of the screen.
165
166
167 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
168        These routines return <STRONG>ERR</STRONG> upon failure and OK (SVr4 speci-
169        fies only "an integer value other than <STRONG>ERR</STRONG>") upon success-
170        ful completion.
171
172        X/Open defines no error conditions.  In  this  implementa-
173        tion
174
175           <STRONG>slk_attr</STRONG>
176                returns the attribute used for the soft keys.
177
178           <STRONG>slk_attroff</STRONG>, <STRONG>slk_attron</STRONG>, <STRONG>slk_clear</STRONG>, <STRONG>slk_noutrefresh</STRONG>,
179           <STRONG>slk_refresh</STRONG>, <STRONG>slk_touch</STRONG>
180                return an error if the terminal  or  the  softkeys
181                were not initialized.
182
183           <STRONG>slk_attrset</STRONG>
184                returns  an  error if the terminal or the softkeys
185                were not initialized.
186
187           <STRONG>slk_attr_set</STRONG>
188                returns an error if the terminal or  the  softkeys
189                were not initialized, or the color pair is outside
190                the range 0..COLOR_PAIRS-1, or opts is not null.
191
192           <STRONG>slk_color</STRONG>
193                returns an error if the terminal or  the  softkeys
194                were not initialized, or the color pair is outside
195                the range 0..COLOR_PAIRS-1.
196
197           <STRONG>slk_init</STRONG>
198                returns an error if the format parameter  is  out-
199                side the range 0..3.
200
201           <STRONG>slk_label</STRONG>
202                returns <STRONG>NULL</STRONG> on error.
203
204           <STRONG>slk_set</STRONG>
205                returns  an  error if the terminal or the softkeys
206                were not initialized, or the <EM>labnum</EM>  parameter  is
207                outside  the range of label counts, or if the for-
208                mat parameter is outside the  range  0..2,  or  if
209                memory for the labels cannot be allocated.
210
211
212 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
213        Most applications would use <STRONG>slk_noutrefresh</STRONG> because a <STRONG>wre-</STRONG>
214        <STRONG>fresh</STRONG> is likely to follow soon.
215
216
217 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
218        The XSI Curses standard, Issue 4, described  the  soft-key
219        functions, with some differences from SVr4 curses:
220
221        <STRONG>o</STRONG>   It added functions like the SVr4 the attribute-manipu-
222            lation functions <STRONG>slk_attron</STRONG>, <STRONG>slk_attroff</STRONG>,  <STRONG>slk_attrset</STRONG>
223            which  use  <STRONG>attr_t</STRONG>  parameters,  along with a reserved
224            <EM>opts</EM> parameter.
225
226            One of these new functions (<STRONG>slk_attr_set</STRONG>) also  has  a
227            color-pair parameter.
228
229        <STRONG>o</STRONG>   It  added <STRONG>const</STRONG> qualifiers to parameters (unnecessari-
230            ly), and
231
232        <STRONG>o</STRONG>   It added <STRONG>slk_color</STRONG>.
233
234        The format codes <STRONG>2</STRONG> and <STRONG>3</STRONG> for  <STRONG>slk_init</STRONG>  and  the  function
235        <STRONG>slk_attr</STRONG> are specific to ncurses.
236
237
238 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
239        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>,   <STRONG><A HREF="curs_attr.3x.html">curs_attr(3x)</A></STRONG>,   <STRONG><A HREF="curs_initscr.3x.html">curs_initscr(3x)</A></STRONG>,  <STRONG>curs_re-</STRONG>
240        <STRONG><A HREF="curs_refresh.3x.html">fresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>.
241
242
243
244                                                            <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>
245 </PRE>
246 <div class="nav">
247 <ul>
248 <li><a href="#h2-NAME">NAME</a></li>
249 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
250 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
251 <ul>
252 <li><a href="#h3-Initialization">Initialization</a></li>
253 <li><a href="#h3-Labels">Labels</a></li>
254 <li><a href="#h3-Screen-updates">Screen updates</a></li>
255 <li><a href="#h3-Video-attributes">Video attributes</a></li>
256 <li><a href="#h3-Colors">Colors</a></li>
257 </ul>
258 </li>
259 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
260 <li><a href="#h2-NOTES">NOTES</a></li>
261 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
262 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
263 </ul>
264 </div>
265 </BODY>
266 </HTML>