]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_slk.3x.html
2a823bdef65bc71e755fad8dae69282c8f4f9de7
[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.31 2017/03/31 11:09:28 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>extended_slk_color</STRONG> -
53        <STRONG>curses</STRONG> soft label 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> <EM>fmt</EM><STRONG>);</STRONG>
60
61        <STRONG>int</STRONG> <STRONG>slk_set(int</STRONG> <EM>labnum</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>char</STRONG> <STRONG>*</STRONG><EM>label</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>fmt</EM><STRONG>);</STRONG>
62        <STRONG>int</STRONG> <STRONG>slk_wset(int</STRONG> <EM>labnum</EM><STRONG>,</STRONG> <STRONG>const</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG><EM>label</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>fmt</EM><STRONG>);</STRONG>
63
64        <STRONG>char</STRONG> <STRONG>*slk_label(int</STRONG> <EM>labnum</EM><STRONG>);</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> <EM>attrs</EM><STRONG>);</STRONG>
73        <STRONG>int</STRONG> <STRONG>slk_attroff(const</STRONG> <STRONG>chtype</STRONG> <EM>attrs</EM><STRONG>);</STRONG>
74        <STRONG>int</STRONG> <STRONG>slk_attrset(const</STRONG> <STRONG>chtype</STRONG> <EM>attrs</EM><STRONG>);</STRONG>
75        <STRONG>int</STRONG> <STRONG>slk_attr_on(attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>void*</STRONG> <EM>opts</EM><STRONG>);</STRONG>
76        <STRONG>int</STRONG> <STRONG>slk_attr_off(const</STRONG> <STRONG>attr_t</STRONG> <EM>attrs</EM><STRONG>,</STRONG> <STRONG>void</STRONG> <STRONG>*</STRONG> <EM>opts</EM><STRONG>);</STRONG>
77        <STRONG>int</STRONG>  <STRONG>slk_attr_set(const</STRONG>  <STRONG>attr_t</STRONG>  <EM>attrs</EM><STRONG>,</STRONG>  <STRONG>short</STRONG> <EM>pair</EM><STRONG>,</STRONG> <STRONG>void*</STRONG>
78        <EM>opts</EM><STRONG>);</STRONG>
79
80        <STRONG>attr_t</STRONG> <STRONG>slk_attr(void);</STRONG>
81
82        <STRONG>int</STRONG> <STRONG>slk_color(short</STRONG> <EM>pair</EM><STRONG>);</STRONG>
83        /* extension */
84        <STRONG>int</STRONG> <STRONG>extended_slk_color(int</STRONG> <EM>pair</EM><STRONG>);</STRONG>
85
86
87 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
88        The slk* functions manipulate the set of soft function-key
89        labels  that exist on many terminals.  For those terminals
90        that do not have soft labels, <STRONG>curses</STRONG> takes over the bottom
91        line  of <STRONG>stdscr</STRONG>, reducing the size of <STRONG>stdscr</STRONG> and the vari-
92        able <STRONG>LINES</STRONG>.  <STRONG>curses</STRONG> standardizes on eight labels of up  to
93        eight  characters  each.  In addition to this, the ncurses
94        implementation supports a mode where it simulates  12  la-
95        bels  of  up  to five characters each.  This is useful for
96        PC-like enduser devices.  ncurses simulates this  mode  by
97        taking  over  up to two lines at the bottom of the screen;
98        it does not try to use any hardware support for this mode.
99
100
101 </PRE><H3><a name="h3-Initialization">Initialization</a></H3><PRE>
102        The <STRONG>slk_init</STRONG> routine must  be  called  before  <STRONG>initscr</STRONG>  or
103        <STRONG>newterm</STRONG> is called.  If <STRONG>initscr</STRONG> eventually uses a line from
104        <STRONG>stdscr</STRONG> to emulate the soft labels, then <EM>fmt</EM> determines how
105        the labels are arranged on the screen:
106
107           <STRONG>0</STRONG>  indicates a 3-2-3 arrangement of the labels.
108
109           <STRONG>1</STRONG>  indicates a 4-4 arrangement
110
111           <STRONG>2</STRONG>  indicates the PC-like 4-4-4 mode.
112
113           <STRONG>3</STRONG>  is  again the PC-like 4-4-4 mode, but in addition an
114              index line is generated, helping the user to identi-
115              fy the key numbers easily.
116
117
118 </PRE><H3><a name="h3-Labels">Labels</a></H3><PRE>
119        The  <STRONG>slk_set</STRONG>  routine  (and  the  <STRONG>slk_wset</STRONG> routine for the
120        wide-character library) has three parameters:
121
122           <EM>labnum</EM>
123                is the label number, from <STRONG>1</STRONG> to <STRONG>8</STRONG> (12  for  <EM>fmt</EM>  in
124                <STRONG>slk_init</STRONG> is <STRONG>2</STRONG> or <STRONG>3</STRONG>);
125
126           <EM>label</EM>
127                is  be the string to put on the label, up to eight
128                (five for <EM>fmt</EM> in <STRONG>slk_init</STRONG> is <STRONG>2</STRONG> or <STRONG>3</STRONG>) characters in
129                length.  A null string or a null pointer sets up a
130                blank label.
131
132           <EM>fmt</EM>  is either <STRONG>0</STRONG>, <STRONG>1</STRONG>, or <STRONG>2</STRONG>, indicating whether the label
133                is to be left-justified, centered, or right-justi-
134                fied, respectively, within the label.
135
136        The <STRONG>slk_label</STRONG> routine returns the current label for  label
137        number <EM>labnum</EM>, with leading and trailing blanks stripped.
138
139
140 </PRE><H3><a name="h3-Screen-updates">Screen updates</a></H3><PRE>
141        The <STRONG>slk_refresh</STRONG> and <STRONG>slk_noutrefresh</STRONG> routines correspond to
142        the <STRONG>wrefresh</STRONG> and <STRONG>wnoutrefresh</STRONG> routines.
143
144        The <STRONG>slk_clear</STRONG> routine clears  the  soft  labels  from  the
145        screen.
146
147        The  <STRONG>slk_restore</STRONG>  routine  restores the soft labels to the
148        screen after a <STRONG>slk_clear</STRONG> has been performed.
149
150        The <STRONG>slk_touch</STRONG> routine forces all the  soft  labels  to  be
151        output the next time a <STRONG>slk_noutrefresh</STRONG> is performed.
152
153
154 </PRE><H3><a name="h3-Video-attributes">Video attributes</a></H3><PRE>
155        The <STRONG>slk_attron</STRONG>, <STRONG>slk_attrset</STRONG>, <STRONG>slk_attroff</STRONG> and <STRONG>slk_attr</STRONG> rou-
156        tines correspond to <STRONG>attron</STRONG>, <STRONG>attrset</STRONG>, <STRONG>attroff</STRONG> and <STRONG>attr_get</STRONG>.
157        They  have  an effect only if soft labels are simulated on
158        the bottom line of the screen.  The default highlight  for
159        soft keys is A_STANDOUT (as in System V curses, which does
160        not document this fact).
161
162
163 </PRE><H3><a name="h3-Colors">Colors</a></H3><PRE>
164        The <STRONG>slk_color</STRONG> routine corresponds to <STRONG>color_set</STRONG>.  It has an
165        effect  only  if  soft  labels are simulated on the bottom
166        line of the screen.
167
168        Because <STRONG>slk_color</STRONG> accepts only <STRONG>short</STRONG> (signed 16-bit  inte-
169        ger)   values,   this   implementation   provides  <STRONG>extend-</STRONG>
170        <STRONG>ed_slk_color</STRONG>  which  accepts  an  integer   value,   e.g.,
171        32-bits.
172
173
174 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
175        These routines return <STRONG>ERR</STRONG> upon failure and OK (SVr4 speci-
176        fies only "an integer value other than <STRONG>ERR</STRONG>") upon success-
177        ful completion.
178
179        X/Open  defines  no error conditions.  In this implementa-
180        tion
181
182           <STRONG>slk_attr</STRONG>
183                returns the attribute used for the soft keys.
184
185           <STRONG>slk_attroff</STRONG>, <STRONG>slk_attron</STRONG>, <STRONG>slk_clear</STRONG>, <STRONG>slk_noutrefresh</STRONG>,
186           <STRONG>slk_refresh</STRONG>, <STRONG>slk_touch</STRONG>
187                return  an  error  if the terminal or the softkeys
188                were not initialized.
189
190           <STRONG>slk_attrset</STRONG>
191                returns an error if the terminal or  the  softkeys
192                were not initialized.
193
194           <STRONG>slk_attr_set</STRONG>
195                returns  an  error if the terminal or the softkeys
196                were not initialized, or the color pair is outside
197                the range 0..COLOR_PAIRS-1.
198
199           <STRONG>slk_color</STRONG>
200                returns  an  error if the terminal or the softkeys
201                were not initialized, or the color pair is outside
202                the range 0..COLOR_PAIRS-1.
203
204           <STRONG>slk_init</STRONG>
205                returns  an  error if the format parameter is out-
206                side the range 0..3.
207
208           <STRONG>slk_label</STRONG>
209                returns <STRONG>NULL</STRONG> on error.
210
211           <STRONG>slk_set</STRONG>
212                returns an error if the terminal or  the  softkeys
213                were  not  initialized, or the <EM>labnum</EM> parameter is
214                outside the range of label counts, or if the  for-
215                mat  parameter  is  outside  the range 0..2, or if
216                memory for the labels cannot be allocated.
217
218
219 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
220        X/Open Curses documents the <EM>opts</EM> argument as reserved  for
221        future use, saying that it must be null.  This implementa-
222        tion uses that parameter in ABI 6 for the functions  which
223        have  a  color-pair  parameter  to  support extended color
224        pairs.
225
226        For  functions  which  modify  the  color,  e.g.,  <STRONG>slk_at-</STRONG>
227        <STRONG>tr_set</STRONG>,  if <EM>opts</EM> is set it is treated as a pointer to <STRONG>int</STRONG>,
228        and used to  set  the  color pair  instead  of  the  <STRONG>short</STRONG>
229        pair parameter.
230
231
232 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
233        Most applications would use <STRONG>slk_noutrefresh</STRONG> because a <STRONG>wre-</STRONG>
234        <STRONG>fresh</STRONG> is likely to follow soon.
235
236
237 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
238        The XSI Curses standard, Issue 4, described  the  soft-key
239        functions, with some differences from SVr4 curses:
240
241        <STRONG>o</STRONG>   It  added  functions like the SVr4 attribute-manipula-
242            tion functions <STRONG>slk_attron</STRONG>,  <STRONG>slk_attroff</STRONG>,  <STRONG>slk_attrset</STRONG>,
243            but  which use <STRONG>attr_t</STRONG> parameters (rather than <STRONG>chtype</STRONG>),
244            along with a reserved <EM>opts</EM> parameter.
245
246            Two of these new functions (unlike the SVr4 functions)
247            have  no  provision for color: <STRONG>slk_attr_on</STRONG> and <STRONG>slk_at-</STRONG>
248            <STRONG>tr_off</STRONG>.
249
250            The third function (<STRONG>slk_attr_set</STRONG>) has a color-pair pa-
251            rameter.
252
253        <STRONG>o</STRONG>   It  added <STRONG>const</STRONG> qualifiers to parameters (unnecessari-
254            ly), and
255
256        <STRONG>o</STRONG>   It added <STRONG>slk_color</STRONG>.
257
258        The format codes <STRONG>2</STRONG> and <STRONG>3</STRONG> for  <STRONG>slk_init</STRONG>  and  the  function
259        <STRONG>slk_attr</STRONG> are specific to ncurses.
260
261        X/Open  Curses  does not specify a limit for the number of
262        colors and color pairs which a terminal can support.  How-
263        ever,  in  its use of <STRONG>short</STRONG> for the parameters, it carries
264        over SVr4's implementation detail for the compiled termin-
265        fo  database,  which uses signed 16-bit numbers.  This im-
266        plementation provides extended versions of those functions
267        which  use  <STRONG>short</STRONG> parameters, allowing applications to use
268        larger color- and pair-numbers.
269
270
271 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
272        <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>
273        <STRONG><A HREF="curs_refresh.3x.html">fresh(3x)</A></STRONG>, <STRONG><A HREF="curs_variables.3x.html">curs_variables(3x)</A></STRONG>.
274
275
276
277                                                            <STRONG><A HREF="curs_slk.3x.html">curs_slk(3x)</A></STRONG>
278 </PRE>
279 <div class="nav">
280 <ul>
281 <li><a href="#h2-NAME">NAME</a></li>
282 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
283 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a>
284 <ul>
285 <li><a href="#h3-Initialization">Initialization</a></li>
286 <li><a href="#h3-Labels">Labels</a></li>
287 <li><a href="#h3-Screen-updates">Screen updates</a></li>
288 <li><a href="#h3-Video-attributes">Video attributes</a></li>
289 <li><a href="#h3-Colors">Colors</a></li>
290 </ul>
291 </li>
292 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
293 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
294 <li><a href="#h2-NOTES">NOTES</a></li>
295 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
296 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
297 </ul>
298 </div>
299 </BODY>
300 </HTML>