]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_slk.3x
ncurses 6.0 - patch 20170325
[ncurses.git] / man / curs_slk.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
3 .\"                                                                          *
4 .\" Permission is hereby granted, free of charge, to any person obtaining a  *
5 .\" copy of this software and associated documentation files (the            *
6 .\" "Software"), to deal in the Software without restriction, including      *
7 .\" without limitation the rights to use, copy, modify, merge, publish,      *
8 .\" distribute, distribute with modifications, sublicense, and/or sell       *
9 .\" copies of the Software, and to permit persons to whom the Software is    *
10 .\" furnished to do so, subject to the following conditions:                 *
11 .\"                                                                          *
12 .\" The above copyright notice and this permission notice shall be included  *
13 .\" in all copies or substantial portions of the Software.                   *
14 .\"                                                                          *
15 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16 .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18 .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19 .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20 .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21 .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22 .\"                                                                          *
23 .\" Except as contained in this notice, the name(s) of the above copyright   *
24 .\" holders shall not be used in advertising or otherwise to promote the     *
25 .\" sale, use or other dealings in this Software without prior written       *
26 .\" authorization.                                                           *
27 .\"***************************************************************************
28 .\"
29 .\" $Id: curs_slk.3x,v 1.29 2017/03/18 01:00:30 tom Exp $
30 .TH curs_slk 3X ""
31 .de bP
32 .IP \(bu 4
33 ..
34 .na
35 .hy 0
36 .SH NAME
37 \fBslk_init\fR,
38 \fBslk_set\fR,
39 \fBslk_wset\fR,
40 \fBslk_refresh\fR,
41 \fBslk_noutrefresh\fR,
42 \fBslk_label\fR,
43 \fBslk_clear\fR,
44 \fBslk_restore\fR,
45 \fBslk_touch\fR,
46 \fBslk_attron\fR,
47 \fBslk_attrset\fR,
48 \fBslk_attroff\fR,
49 \fBslk_attr_on\fR,
50 \fBslk_attr_set\fR,
51 \fBslk_attr_off\fR,
52 \fBslk_attr\fR,
53 \fBslk_color\fR \- \fBcurses\fR soft label routines
54 .ad
55 .hy
56 .SH SYNOPSIS
57 \fB#include <curses.h>\fR
58 .sp
59 \fBint slk_init(int fmt);\fR
60 .sp
61 \fBint slk_set(int labnum, const char *label, int fmt);\fR
62 .br
63 \fBint slk_wset(int labnum, const wchar_t *label, int fmt);\fR
64 .sp
65 \fBchar *slk_label(int labnum);\fR
66 .sp
67 \fBint slk_refresh(void);\fR
68 .br
69 \fBint slk_noutrefresh(void);\fR
70 .br
71 \fBint slk_clear(void);\fR
72 .br
73 \fBint slk_restore(void);\fR
74 .br
75 \fBint slk_touch(void);\fR
76 .sp
77 \fBint slk_attron(const chtype attrs);\fR
78 .br
79 \fBint slk_attroff(const chtype attrs);\fR
80 .br
81 \fBint slk_attrset(const chtype attrs);\fR
82 .br
83 \fBint slk_attr_on(attr_t attrs, void* opts);\fR
84 .br
85 \fBint slk_attr_off(const attr_t attrs, void * opts);\fR
86 .br
87 \fBint slk_attr_set(const attr_t attrs, short pair, void* opts);\fR
88 .sp
89 \fBattr_t slk_attr(void);\fR
90 .sp
91 \fBint slk_color(short pair);\fR
92 .SH DESCRIPTION
93 The slk* functions manipulate the set of soft function-key labels that exist on
94 many terminals.
95 For those terminals that do not have soft labels,
96 \fBcurses\fR takes over the bottom line of \fBstdscr\fR, reducing the size of
97 \fBstdscr\fR and the variable \fBLINES\fR.
98 \fBcurses\fR standardizes on eight
99 labels of up to eight characters each.
100 In addition to this, the ncurses
101 implementation supports a mode where it simulates 12 labels of up to five
102 characters each.
103 This is useful for PC-like enduser devices.
104 ncurses simulates this mode by taking over up to two lines at
105 the bottom of the screen;
106 it does not try to use any hardware support for this
107 mode.
108 .SS Initialization
109 .PP
110 The \fBslk_init\fR routine must be called before \fBinitscr\fR or \fBnewterm\fR
111 is called.
112 If \fBinitscr\fR eventually uses a line from \fBstdscr\fR to
113 emulate the soft labels,
114 then \fIfmt\fR determines how the labels are arranged on the screen:
115 .RS 3
116 .TP 3
117 .B 0
118 indicates a 3\-2\-3 arrangement of
119 the labels.
120 .TP 3
121 .B 1
122 indicates a 4\-4 arrangement
123 .TP 3
124 .B 2
125 indicates the PC-like 4\-4\-4 mode.
126 .TP 3
127 .B 3
128 is again the PC-like 4\-4\-4 mode,
129 but in addition an index line is generated, helping the user to
130 identify the key numbers easily.
131 .RE
132 .SS Labels
133 .PP
134 The \fBslk_set\fR routine
135 (and the \fBslk_wset\fR routine for the wide-character library)
136 has three parameters:
137 .RS 3
138 .TP 5
139 .I labnum
140 is the label number, from \fB1\fR to \fB8\fR
141 (12 for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP);
142 .TP
143 .I label
144 is be the string to put on the label,
145 up to eight
146 (five for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP)
147 characters in length.
148 A null string or a null pointer sets up a blank label.
149 .TP
150 .I fmt
151 is either
152 \fB0\fR, \fB1\fR, or \fB2\fR, indicating whether the label is to be
153 left-justified, centered, or right-justified, respectively, within the
154 label.
155 .RE
156 .PP
157 The \fBslk_label\fR routine returns the current label for label number
158 \fIlabnum\fR, with leading and trailing blanks stripped.
159 .SS Screen updates
160 .PP
161 The \fBslk_refresh\fR and \fBslk_noutrefresh\fR routines correspond to
162 the \fBwrefresh\fR and \fBwnoutrefresh\fR routines.
163 .PP
164 The \fBslk_clear\fR routine clears the soft labels from the screen.
165 .PP
166 The \fBslk_restore\fR routine restores the soft labels to the screen
167 after a \fBslk_clear\fR has been performed.
168 .PP
169 The \fBslk_touch\fR routine forces all the soft labels to be output
170 the next time a \fBslk_noutrefresh\fR is performed.
171 .SS Video attributes
172 .PP
173 The \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR and \fBslk_attr\fR
174 routines correspond to \fBattron\fR, \fBattrset\fR, \fBattroff\fR and \fBattr_get\fR.
175 They have an effect only if soft labels are simulated on the bottom line of
176 the screen.
177 The default highlight for soft keys is A_STANDOUT (as in
178 System V curses, which does not document this fact).
179 .SS Colors
180 .PP
181 The \fBslk_color\fR routine corresponds to \fBcolor_set\fR.
182 It has an effect only
183 if soft labels are simulated on the bottom line of the screen.
184 .
185 .SH RETURN VALUE
186 These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an
187 integer value other than \fBERR\fR") upon successful completion.
188 .PP
189 X/Open defines no error conditions.
190 In this implementation
191 .RS 3
192 .TP 5
193 \fBslk_attr\fR
194 returns the attribute used for the soft keys.
195 .TP 5
196 .na
197 .hy 0
198 \fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP
199 .ad
200 .hy
201 return an error
202 if the terminal or the softkeys were not initialized.
203 .TP 5
204 \fBslk_attrset\fP
205 returns an error
206 if the terminal or the softkeys were not initialized.
207 .TP 5
208 \fBslk_attr_set\fP
209 returns an error
210 if the terminal or the softkeys were not initialized, or
211 the color pair is outside the range 0..COLOR_PAIRS\-1,
212 or opts is not null.
213 .TP 5
214 \fBslk_color\fP
215 returns an error
216 if the terminal or the softkeys were not initialized, or
217 the color pair is outside the range 0..COLOR_PAIRS\-1.
218 .TP 5
219 \fBslk_init\fR
220 returns an error
221 if the format parameter is outside the range 0..3.
222 .TP 5
223 \fBslk_label\fR
224 returns \fBNULL\fR on error.
225 .TP 5
226 \fBslk_set\fP
227 returns an error
228 if the terminal or the softkeys were not initialized, or
229 the \fIlabnum\fP parameter is outside the range of label counts, or
230 if the format parameter is outside the range 0..2, or if
231 memory for the labels cannot be allocated.
232 .RE
233 .SH NOTES
234 Most applications would use \fBslk_noutrefresh\fR because a
235 \fBwrefresh\fR is likely to follow soon.
236 .SH PORTABILITY
237 The XSI Curses standard, Issue 4, described the soft-key functions,
238 with some differences from SVr4 curses:
239 .bP
240 It
241 added functions like the SVr4
242 the attribute-manipulation functions \fBslk_attron\fR,
243 \fBslk_attroff\fR, \fBslk_attrset\fR
244 which use \fBattr_t\fR parameters,
245 along with a reserved \fIopts\fP parameter.
246 .IP
247 One of these new functions (\fBslk_attr_set\fP) also has a color-pair parameter.
248 .bP
249 It added \fBconst\fR qualifiers to parameters (unnecessarily), and
250 .bP
251 It added \fBslk_color\fP.
252 .PP
253 The format codes \fB2\fR and \fB3\fR for \fBslk_init\fR and the
254 function \fBslk_attr\fR are specific to ncurses.
255 .SH SEE ALSO
256 \fBcurses\fR(3X),
257 \fBcurs_attr\fR(3X),
258 \fBcurs_initscr\fR(3X),
259 \fBcurs_refresh\fR(3X),
260 \fBcurs_variables\fR(3X).