blob: e8f7afbdbfd9e6ea27a1c593acc76652bbb954ea [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002.\" Copyright (c) 1998-2007,2010 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303.\" *
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.\"
Steve Kondikae271bc2015-11-15 02:50:53 +010029.\" $Id: curs_slk.3x,v 1.22 2010/12/04 18:38:55 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053030.TH curs_slk 3X ""
31.na
32.hy 0
33.SH NAME
34\fBslk_init\fR,
35\fBslk_set\fR,
Steve Kondikae271bc2015-11-15 02:50:53 +010036\fBslk_wset\fR,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053037\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,
Steve Kondikae271bc2015-11-15 02:50:53 +010050\fBslk_color\fR \- \fBcurses\fR soft label routines
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053051.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
Steve Kondikae271bc2015-11-15 02:50:53 +010082\fBint slk_attr_set(const attr_t attrs, short color_pair, void* opts);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053083.br
84\fBattr_t slk_attr(void);\fR
85.br
Steve Kondikae271bc2015-11-15 02:50:53 +010086\fBint slk_color(short color_pair);\fR
87.br
88\fBint slk_wset(int labnum, const wchar_t *label, int fmt);\fR
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053089.br
90.SH DESCRIPTION
91The slk* functions manipulate the set of soft function-key labels that exist on
Steve Kondikae271bc2015-11-15 02:50:53 +010092many terminals.
93For those terminals that do not have soft labels,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053094\fBcurses\fR takes over the bottom line of \fBstdscr\fR, reducing the size of
Steve Kondikae271bc2015-11-15 02:50:53 +010095\fBstdscr\fR and the variable \fBLINES\fR.
96\fBcurses\fR standardizes on eight
97labels of up to eight characters each.
98In addition to this, the ncurses
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053099implementation supports a mode where it simulates 12 labels of up to five
Steve Kondikae271bc2015-11-15 02:50:53 +0100100characters each.
101This is useful for today's PC-like enduser devices.
102ncurses simulates this mode by taking over up to two lines at
103the bottom of the screen;
104it does not try to use any hardware support for this
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530105mode.
106.PP
107The \fBslk_init\fR routine must be called before \fBinitscr\fR or \fBnewterm\fR
Steve Kondikae271bc2015-11-15 02:50:53 +0100108is called.
109If \fBinitscr\fR eventually uses a line from \fBstdscr\fR to
110emulate the soft labels,
111then \fIfmt\fR determines how the labels are arranged on the screen:
112.RS
113.TP 3
114.B 0
115indicates a 3\-2\-3 arrangement of
116the labels.
117.TP 3
118.B 1
119indicates a 4\-4 arrangement
120.TP 3
121.B 2
122indicates the PC-like 4\-4\-4 mode.
123.TP 3
124.B 3
125is again the PC-like 4\-4\-4 mode,
126but in addition an index line is generated, helping the user to
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530127identify the key numbers easily.
Steve Kondikae271bc2015-11-15 02:50:53 +0100128.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530129.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100130The \fBslk_set\fR routine
131(and the \fBslk_wset\fR routine for the wide-character library)
132has three parameters:
133.RS
134.TP 5
135.I labnum
136is the label number, from \fB1\fR to \fB8\fR
137(12 for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP);
138.TP
139.I label
140is be the string to put on the label,
141up to eight
142(five for \fIfmt\fP in \fBslk_init\fP is \fB2\fP or \fB3\fP)
143characters in length.
144A null string or a null pointer sets up a blank label.
145.TP
146.I fmt
147is either
148\fB0\fR, \fB1\fR, or \fB2\fR, indicating whether the label is to be
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530149left-justified, centered, or right-justified, respectively, within the
150label.
Steve Kondikae271bc2015-11-15 02:50:53 +0100151.RE
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530152.PP
153The \fBslk_refresh\fR and \fBslk_noutrefresh\fR routines correspond to
154the \fBwrefresh\fR and \fBwnoutrefresh\fR routines.
155.PP
156The \fBslk_label\fR routine returns the current label for label number
157\fIlabnum\fR, with leading and trailing blanks stripped.
158.PP
159The \fBslk_clear\fR routine clears the soft labels from the screen.
160.PP
161The \fBslk_restore\fR routine restores the soft labels to the screen
162after a \fBslk_clear\fR has been performed.
163.PP
164The \fBslk_touch\fR routine forces all the soft labels to be output
165the next time a \fBslk_noutrefresh\fR is performed.
166.PP
167The \fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR and \fBslk_attr\fR
168routines correspond to \fBattron\fR, \fBattrset\fR, \fBattroff\fR and \fBattr_get\fR.
169They have an effect only if soft labels are simulated on the bottom line of
Steve Kondikae271bc2015-11-15 02:50:53 +0100170the screen.
171The default highlight for soft keys is A_STANDOUT (as in
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530172System V curses, which does not document this fact).
173.PP
Steve Kondikae271bc2015-11-15 02:50:53 +0100174The \fBslk_color\fR routine corresponds to \fBcolor_set\fR.
175It has an effect only
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530176if soft labels are simulated on the bottom line of the screen.
177.
178.SH RETURN VALUE
179These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an
180integer value other than \fBERR\fR") upon successful completion.
181.PP
182X/Open defines no error conditions.
183In this implementation
184.RS
185.TP 5
186\fBslk_attr\fR
187returns the attribute used for the soft keys.
188.TP 5
189.na
190.hy 0
191\fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP
192.ad
193.hy
194return an error
195if the terminal or the softkeys were not initialized.
196.TP 5
197\fBslk_attrset\fP
198returns an error
199if the terminal or the softkeys were not initialized.
200.TP 5
201\fBslk_attr_set\fP
202returns an error
203if the terminal or the softkeys were not initialized, or
Steve Kondikae271bc2015-11-15 02:50:53 +0100204the color pair is outside the range 0..COLOR_PAIRS\-1,
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530205or opts is not null.
206.TP 5
207\fBslk_color\fP
208returns an error
209if the terminal or the softkeys were not initialized, or
Steve Kondikae271bc2015-11-15 02:50:53 +0100210the color pair is outside the range 0..COLOR_PAIRS\-1.
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530211.TP 5
212\fBslk_init\fR
213returns an error
214if the format parameter is outside the range 0..3.
215.TP 5
216\fBslk_label\fR
217returns \fBNULL\fR on error.
218.TP 5
219\fBslk_set\fP
220returns an error
221if the terminal or the softkeys were not initialized, or
222the \fIlabnum\fP parameter is outside the range of label counts, or
223if the format parameter is outside the range 0..2, or if
224memory for the labels cannot be allocated.
225.RE
226.SH NOTES
227Most applications would use \fBslk_noutrefresh\fR because a
228\fBwrefresh\fR is likely to follow soon.
229.SH PORTABILITY
Steve Kondikae271bc2015-11-15 02:50:53 +0100230The XSI Curses standard, Issue 4, describes these functions.
231It changes the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530232argument type of the attribute-manipulation functions \fBslk_attron\fR,
233\fBslk_attroff\fR, \fBslk_attrset\fR to be \fBattr_t\fR, and adds \fBconst\fR
Steve Kondikae271bc2015-11-15 02:50:53 +0100234qualifiers.
235The format codes \fB2\fR and \fB3\fR for \fBslk_init()\fR and the
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530236function \fBslk_attr\fR are specific to ncurses.
237.SH SEE ALSO
Steve Kondikae271bc2015-11-15 02:50:53 +0100238\fBcurses\fR(3X),
239\fBcurs_attr\fR(3X),
240\fBcurs_initscr\fR(3X),
241\fBcurs_refresh\fR(3X),
242\fBcurs_variables\fR(3X).