1curs_slk(3X) curs_slk(3X)
2
3
4
6 slk_init, slk_set, slk_refresh, slk_noutrefresh, slk_label, slk_clear,
7 slk_restore, slk_touch, slk_attron, slk_attrset, slk_attroff,
8 slk_attr_on, slk_attr_set, slk_attr_off, slk_attr, slk_color - curses
9 soft label routines
10
12 #include <curses.h>
13
14 int slk_init(int fmt);
15 int slk_set(int labnum, const char *label, int fmt);
16 int slk_refresh(void);
17 int slk_noutrefresh(void);
18 char *slk_label(int labnum);
19 int slk_clear(void);
20 int slk_restore(void);
21 int slk_touch(void);
22 int slk_attron(const chtype attrs);
23 int slk_attroff(const chtype attrs);
24 int slk_attrset(const chtype attrs);
25 int slk_attr_on(attr_t attrs, void* opts);
26 int slk_attr_off(const attr_t attrs, void * opts);
27 int slk_attr_set(const attr_t attrs,
28 short color_pair_number, void* opts);
29 attr_t slk_attr(void);
30 int slk_color(short color_pair_number);
31
33 The slk* functions manipulate the set of soft function-key labels that
34 exist on many terminals. For those terminals that do not have soft la‐
35 bels, curses takes over the bottom line of stdscr, reducing the size of
36 stdscr and the variable LINES. curses standardizes on eight labels of
37 up to eight characters each. In addition to this, the ncurses implemen‐
38 tation supports a mode where it simulates 12 labels of up to five char‐
39 acters each. This is most common for todays PC like enduser devices.
40 Please note that ncurses simulates this mode by taking over up to two
41 lines at the bottom of the screen, it does not try to use any hardware
42 support for this mode.
43
44 The slk_init routine must be called before initscr or newterm is
45 called. If initscr eventually uses a line from stdscr to emulate the
46 soft labels, then fmt determines how the labels are arranged on the
47 screen. Setting fmt to 0 indicates a 3-2-3 arrangement of the labels,
48 1 indicates a 4-4 arrangement and 2 indicates the PC like 4-4-4 mode.
49 If fmt is set to 3, it is again the PC like 4-4-4 mode, but in addition
50 an index line is generated, helping the user to identify the key num‐
51 bers easily.
52
53 The slk_set routine requires labnum to be a label number, from 1 to 8
54 (resp. 12); label must be the string to be put on the label, up to
55 eight (resp. five) characters in length. A null string or a null
56 pointer sets up a blank label. fmt is either 0, 1, or 2, indicating
57 whether the label is to be left-justified, centered, or right-justi‐
58 fied, respectively, within the label.
59
60 The slk_refresh and slk_noutrefresh routines correspond to the wrefresh
61 and wnoutrefresh routines.
62
63 The slk_label routine returns the current label for label number lab‐
64 num, with leading and trailing blanks stripped.
65
66 The slk_clear routine clears the soft labels from the screen.
67
68 The slk_restore routine restores the soft labels to the screen after a
69 slk_clear has been performed.
70
71 The slk_touch routine forces all the soft labels to be output the next
72 time a slk_noutrefresh is performed.
73
74 The slk_attron, slk_attrset, slk_attroff and slk_attr routines corre‐
75 spond to attron, attrset, attroff and attr_get. They have an effect
76 only if soft labels are simulated on the bottom line of the screen.
77 The default highlight for soft keys is A_STANDOUT (as in System V curs‐
78 es, which does not document this fact).
79
80 The slk_color routine corresponds to color_set. It has an effect only
81 if soft labels are simulated on the bottom line of the screen.
82
84 These routines return ERR upon failure and OK (SVr4 specifies only "an
85 integer value other than ERR") upon successful completion.
86
87 X/Open defines no error conditions. In this implementation
88
89 slk_attr
90 returns the attribute used for the soft keys.
91
92 slk_attroff, slk_attron, slk_clear, slk_noutrefresh,
93 slk_refresh, slk_touch
94 return an error if the terminal or the softkeys were not
95 initialized.
96
97 slk_attrset
98 returns an error if the terminal or the softkeys were not
99 initialized.
100
101 slk_attr_set
102 returns an error if the terminal or the softkeys were not
103 initialized, or the color pair is outside the range 0..COL‐
104 OR_PAIRS-1, or opts is not null.
105
106 slk_color
107 returns an error if the terminal or the softkeys were not
108 initialized, or the color pair is outside the range 0..COL‐
109 OR_PAIRS-1.
110
111 slk_init
112 returns an error if the format parameter is outside the
113 range 0..3.
114
115 slk_label
116 returns NULL on error.
117
118 slk_set
119 returns an error if the terminal or the softkeys were not
120 initialized, or the labnum parameter is outside the range
121 of label counts, or if the format parameter is outside the
122 range 0..2, or if memory for the labels cannot be allocat‐
123 ed.
124
126 Most applications would use slk_noutrefresh because a wrefresh is like‐
127 ly to follow soon.
128
130 The XSI Curses standard, Issue 4, describes these functions. It
131 changes the argument type of the attribute-manipulation functions
132 slk_attron, slk_attroff, slk_attrset to be attr_t, and adds const qual‐
133 ifiers. The format codes 2 and 3 for slk_init() and the function
134 slk_attr are specific to ncurses.
135
137 curses(3X), curs_attr(3X), curs_initscr(3X), curs_refresh(3X)
138
139
140
141 curs_slk(3X)