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