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 imple‐
38 mentation supports a mode where it simulates 12 labels of up to five
39 characters each. This is useful for today's PC-like enduser devices.
40 ncurses simulates this mode by taking over up to two lines at the bot‐
41 tom of the screen; it does not try to use any hardware support for this
42 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:
48
49 0 indicates a 3-2-3 arrangement of the labels.
50
51 1 indicates a 4-4 arrangement
52
53 2 indicates the PC-like 4-4-4 mode.
54
55 3 is again the PC-like 4-4-4 mode, but in addition an index
56 line is generated, helping the user to identify the key num‐
57 bers easily.
58
59 The slk_set routine has three parameters:
60
61 labnum
62 is the label number, from 1 to 8 (12 for fmt in slk_init is
63 2 or 3);
64
65 label
66 is be the string to put on the label, up to eight (five for
67 fmt in slk_init is 2 or 3) characters in length. A null
68 string or a null pointer sets up a blank label.
69
70 fmt is either 0, 1, or 2, indicating whether the label is to be
71 left-justified, centered, or right-justified, respectively,
72 within the label.
73
74 The slk_refresh and slk_noutrefresh routines correspond to the wrefresh
75 and wnoutrefresh routines.
76
77 The slk_label routine returns the current label for label number lab‐
78 num, with leading and trailing blanks stripped.
79
80 The slk_clear routine clears the soft labels from the screen.
81
82 The slk_restore routine restores the soft labels to the screen after a
83 slk_clear has been performed.
84
85 The slk_touch routine forces all the soft labels to be output the next
86 time a slk_noutrefresh is performed.
87
88 The slk_attron, slk_attrset, slk_attroff and slk_attr routines corre‐
89 spond to attron, attrset, attroff and attr_get. They have an effect
90 only if soft labels are simulated on the bottom line of the screen.
91 The default highlight for soft keys is A_STANDOUT (as in System V curs‐
92 es, which does not document this fact).
93
94 The slk_color routine corresponds to color_set. It has an effect only
95 if soft labels are simulated on the bottom line of the screen.
96
98 These routines return ERR upon failure and OK (SVr4 specifies only "an
99 integer value other than ERR") upon successful completion.
100
101 X/Open defines no error conditions. In this implementation
102
103 slk_attr
104 returns the attribute used for the soft keys.
105
106 slk_attroff, slk_attron, slk_clear, slk_noutrefresh,
107 slk_refresh, slk_touch
108 return an error if the terminal or the softkeys were not
109 initialized.
110
111 slk_attrset
112 returns an error if the terminal or the softkeys were not
113 initialized.
114
115 slk_attr_set
116 returns an error if the terminal or the softkeys were not
117 initialized, or the color pair is outside the range 0..COL‐
118 OR_PAIRS-1, or opts is not null.
119
120 slk_color
121 returns an error if the terminal or the softkeys were not
122 initialized, or the color pair is outside the range 0..COL‐
123 OR_PAIRS-1.
124
125 slk_init
126 returns an error if the format parameter is outside the
127 range 0..3.
128
129 slk_label
130 returns NULL on error.
131
132 slk_set
133 returns an error if the terminal or the softkeys were not
134 initialized, or the labnum parameter is outside the range
135 of label counts, or if the format parameter is outside the
136 range 0..2, or if memory for the labels cannot be allocat‐
137 ed.
138
140 Most applications would use slk_noutrefresh because a wrefresh is like‐
141 ly to follow soon.
142
144 The XSI Curses standard, Issue 4, describes these functions. It
145 changes the argument type of the attribute-manipulation functions
146 slk_attron, slk_attroff, slk_attrset to be attr_t, and adds const qual‐
147 ifiers. The format codes 2 and 3 for slk_init() and the function
148 slk_attr are specific to ncurses.
149
151 curses(3X), curs_attr(3X), curs_initscr(3X), curs_refresh(3X)
152
153
154
155 curs_slk(3X)