]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_slk.3x
ffc6f4e08a2f87144380bfc0e67a2bca3ddbc0af
[ncurses.git] / man / curs_slk.3x
1 .\"***************************************************************************
2 .\" Copyright (c) 1998-2007,2010 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.19 2010/09/11 22:35:11 tom Exp $
30 .TH curs_slk 3X ""
31 .na
32 .hy 0
33 .SH NAME
34 \fBslk_init\fR,
35 \fBslk_set\fR,
36 \fBslk_wset\fR,
37 \fBslk_refresh\fR,
38 \fBslk_noutrefresh\fR,
39 \fBslk_label\fR,
40 \fBslk_clear\fR,
41 \fBslk_restore\fR,
42 \fBslk_touch\fR,
43 \fBslk_attron\fR,
44 \fBslk_attrset\fR,
45 \fBslk_attroff\fR,
46 \fBslk_attr_on\fR,
47 \fBslk_attr_set\fR,
48 \fBslk_attr_off\fR,
49 \fBslk_attr\fR,
50 \fBslk_color\fR \- \fBcurses\fR soft label routines
51 .ad
52 .hy
53 .SH SYNOPSIS
54 \fB#include <curses.h>\fR
55 .sp
56 \fBint slk_init(int fmt);\fR
57 .br
58 \fBint slk_set(int labnum, const char *label, int fmt);\fR
59 .br
60 \fBint slk_refresh(void);\fR
61 .br
62 \fBint slk_noutrefresh(void);\fR
63 .br
64 \fBchar *slk_label(int labnum);\fR
65 .br
66 \fBint slk_clear(void);\fR
67 .br
68 \fBint slk_restore(void);\fR
69 .br
70 \fBint slk_touch(void);\fR
71 .br
72 \fBint slk_attron(const chtype attrs);\fR
73 .br
74 \fBint slk_attroff(const chtype attrs);\fR
75 .br
76 \fBint slk_attrset(const chtype attrs);\fR
77 .br
78 \fBint slk_attr_on(attr_t attrs, void* opts);\fR
79 .br
80 \fBint slk_attr_off(const attr_t attrs, void * opts);\fR
81 .br
82 \fBint slk_attr_set(const attr_t attrs,\fR
83 .br
84         \fBshort color_pair_number, void* opts);\fR
85 .br
86 \fBattr_t slk_attr(void);\fR
87 .br
88 \fBint slk_color(short color_pair_number);\fR
89 .br
90 \fBint slk_wset (int labnum, const wchar_t *label, int fmt);\fR
91 .br
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 today's 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 .PP
109 The \fBslk_init\fR routine must be called before \fBinitscr\fR or \fBnewterm\fR
110 is called.
111 If \fBinitscr\fR eventually uses a line from \fBstdscr\fR to
112 emulate the soft labels,
113 then \fIfmt\fR determines how the labels are arranged on the screen:
114 .RS
115 .TP 3
116 .B 0
117 indicates a 3\-2\-3 arrangement of
118 the labels.
119 .TP 3
120 .B 1
121 indicates a 4\-4 arrangement
122 .TP 3
123 .B 2
124 indicates the PC-like 4\-4\-4 mode.
125 .TP 3
126 .B 3
127 is again the PC-like 4\-4\-4 mode,
128 but in addition an index line is generated, helping the user to
129 identify the key numbers easily.
130 .RE
131 .PP
132 The \fBslk_set\fR routine
133 (and the \fBslk_wset\fR routine for the wide-character library)
134 has three parameters:
135 .RS
136 .TP 5
137 .I labnum
138 is the label number, from \fB1\fR to \fB8\fR
139 (12 for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP);
140 .TP
141 .I label
142 is be the string to put on the label,
143 up to eight
144 (five for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP)
145 characters in length.
146 A null string or a null pointer sets up a blank label.
147 .TP
148 .I fmt
149 is either
150 \fB0\fR, \fB1\fR, or \fB2\fR, indicating whether the label is to be
151 left-justified, centered, or right-justified, respectively, within the
152 label.
153 .RE
154 .PP
155 The \fBslk_refresh\fR and \fBslk_noutrefresh\fR routines correspond to
156 the \fBwrefresh\fR and \fBwnoutrefresh\fR routines.
157 .PP
158 The \fBslk_label\fR routine returns the current label for label number
159 \fIlabnum\fR, with leading and trailing blanks stripped.
160 .PP
161 The \fBslk_clear\fR routine clears the soft labels from the screen.
162 .PP
163 The \fBslk_restore\fR routine restores the soft labels to the screen
164 after a \fBslk_clear\fR has been performed.
165 .PP
166 The \fBslk_touch\fR routine forces all the soft labels to be output
167 the next time a \fBslk_noutrefresh\fR is performed.
168 .PP
169 The \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR and \fBslk_attr\fR
170 routines correspond to \fBattron\fR, \fBattrset\fR, \fBattroff\fR and \fBattr_get\fR.
171 They have an effect only if soft labels are simulated on the bottom line of
172 the screen.
173 The default highlight for soft keys is A_STANDOUT (as in
174 System V curses, which does not document this fact).
175 .PP
176 The \fBslk_color\fR routine corresponds to \fBcolor_set\fR.
177 It has an effect only
178 if soft labels are simulated on the bottom line of the screen.
179 .
180 .SH RETURN VALUE
181 These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an
182 integer value other than \fBERR\fR") upon successful completion.
183 .PP
184 X/Open defines no error conditions.
185 In this implementation
186 .RS
187 .TP 5
188 \fBslk_attr\fR
189 returns the attribute used for the soft keys.
190 .TP 5
191 .na
192 .hy 0
193 \fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP
194 .ad
195 .hy
196 return an error
197 if the terminal or the softkeys were not initialized.
198 .TP 5
199 \fBslk_attrset\fP
200 returns an error
201 if the terminal or the softkeys were not initialized.
202 .TP 5
203 \fBslk_attr_set\fP
204 returns an error
205 if the terminal or the softkeys were not initialized, or
206 the color pair is outside the range 0..COLOR_PAIRS\-1,
207 or opts is not null.
208 .TP 5
209 \fBslk_color\fP
210 returns an error
211 if the terminal or the softkeys were not initialized, or
212 the color pair is outside the range 0..COLOR_PAIRS\-1.
213 .TP 5
214 \fBslk_init\fR
215 returns an error
216 if the format parameter is outside the range 0..3.
217 .TP 5
218 \fBslk_label\fR
219 returns \fBNULL\fR on error.
220 .TP 5
221 \fBslk_set\fP
222 returns an error
223 if the terminal or the softkeys were not initialized, or
224 the \fIlabnum\fP parameter is outside the range of label counts, or
225 if the format parameter is outside the range 0..2, or if
226 memory for the labels cannot be allocated.
227 .RE
228 .SH NOTES
229 Most applications would use \fBslk_noutrefresh\fR because a
230 \fBwrefresh\fR is likely to follow soon.
231 .SH PORTABILITY
232 The XSI Curses standard, Issue 4, describes these functions.
233 It changes the
234 argument type of the attribute-manipulation functions \fBslk_attron\fR,
235 \fBslk_attroff\fR, \fBslk_attrset\fR to be \fBattr_t\fR, and adds \fBconst\fR
236 qualifiers.
237 The format codes \fB2\fR and \fB3\fR for \fBslk_init()\fR and the
238 function \fBslk_attr\fR are specific to ncurses.
239 .SH SEE ALSO
240 \fBcurses\fR(3X), \fBcurs_attr\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_refresh\fR(3X)
241 .\"#
242 .\"# The following sets edit modes for GNU EMACS
243 .\"# Local Variables:
244 .\"# mode:nroff
245 .\"# fill-column:79
246 .\"# End: