aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/libcurses/outopts.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scripts/kconfig/libcurses/outopts.c262
1 files changed, 262 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/outopts.c b/scripts/kconfig/libcurses/outopts.c
new file mode 100644
index 000000000..4c8950959
--- /dev/null
+++ b/scripts/kconfig/libcurses/outopts.c
@@ -0,0 +1,262 @@
1/* PDCurses */
2
3#include "curspriv.h"
4
5/*man-start**************************************************************
6
7outopts
8-------
9
10### Synopsis
11
12 int clearok(WINDOW *win, bool bf);
13 int idlok(WINDOW *win, bool bf);
14 void idcok(WINDOW *win, bool bf);
15 void immedok(WINDOW *win, bool bf);
16 int leaveok(WINDOW *win, bool bf);
17 int setscrreg(int top, int bot);
18 int wsetscrreg(WINDOW *win, int top, int bot);
19 int wgetscrreg(const WINDOW *win, int *top, int *bot);
20 int scrollok(WINDOW *win, bool bf);
21
22 int raw_output(bool bf);
23
24 bool is_cleared(const WINDOW *win);
25 bool is_idlok(const WINDOW *win);
26 bool is_idcok(const WINDOW *win);
27 bool is_immedok(const WINDOW *win);
28 bool is_leaveok(const WINDOW *win);
29 bool is_scrollok(const WINDOW *win);
30
31### Description
32
33 With clearok(), if bf is TRUE, the next call to wrefresh() with this
34 window will clear the screen completely and redraw the entire screen.
35
36 immedok(), called with a second argument of TRUE, causes an automatic
37 wrefresh() every time a change is made to the specified window.
38
39 Normally, the hardware cursor is left at the location of the window
40 being refreshed. leaveok() allows the cursor to be left wherever the
41 update happens to leave it. It's useful for applications where the
42 cursor is not used, since it reduces the need for cursor motions. If
43 possible, the cursor is made invisible when this option is enabled.
44
45 wsetscrreg() sets a scrolling region in a window; "top" and "bot" are
46 the line numbers for the top and bottom margins. If this option and
47 scrollok() are enabled, any attempt to move off the bottom margin
48 will cause all lines in the scrolling region to scroll up one line.
49 setscrreg() is the stdscr version.
50
51 wgetscrreg() gets the top and bottom margins as set in wsetscrreg().
52
53 idlok() and idcok() do nothing in PDCurses, but are provided for
54 compatibility with other curses implementations, likewise is_idlok()
55 and is_idcok().
56
57 raw_output() enables the output of raw characters using the standard
58 *add* and *ins* curses functions (that is, it disables translation of
59 control characters).
60
61 is_cleared() reports whether the specified window causes clear at next
62 refresh.
63
64 is_immedok() reports whether the specified window is in immedok mode.
65
66 is_leaveok() reports whether the specified window is in leaveok mode.
67
68 is_scrollok() reports whether the specified window allows scrolling.
69
70### Return Value
71
72 is_cleared(), is_immedok(), is_leaveok() and is_scrollok() return TRUE
73 or FALSE. is_idlok() and is_idcok() are provided for compatibility with
74 other curses implementations, and always return FALSE. All others
75 return OK on success and ERR on error.
76
77### Portability
78
79 Function | X/Open | ncurses | NetBSD
80 :---------------------|:------:|:-------:|:------:
81 clearok | Y | Y | Y
82 idlok | Y | Y | Y
83 idcok | Y | Y | Y
84 immedok | Y | Y | Y
85 leaveok | Y | Y | Y
86 setscrreg | Y | Y | Y
87 wsetscrreg | Y | Y | Y
88 wgetscrreg | - | Y | -
89 scrollok | Y | Y | Y
90 is_cleared | - | Y | -
91 is_idlok | - | Y | -
92 is_idcok | - | Y | -
93 is_immedok | - | Y | -
94 is_leaveok | - | Y | Y
95 is_scrollok | - | Y | -
96 raw_output | - | - | -
97
98**man-end****************************************************************/
99
100int clearok(WINDOW *win, bool bf)
101{
102 PDC_LOG(("clearok() - called\n"));
103
104 if (!win)
105 return ERR;
106
107 win->_clear = bf;
108
109 return OK;
110}
111
112int idlok(WINDOW *win, bool bf)
113{
114 PDC_LOG(("idlok() - called\n"));
115
116 return OK;
117}
118
119void idcok(WINDOW *win, bool bf)
120{
121 PDC_LOG(("idcok() - called\n"));
122}
123
124void immedok(WINDOW *win, bool bf)
125{
126 PDC_LOG(("immedok() - called\n"));
127
128 if (win)
129 win->_immed = bf;
130}
131
132int leaveok(WINDOW *win, bool bf)
133{
134 PDC_LOG(("leaveok() - called\n"));
135
136 if (!win)
137 return ERR;
138
139 win->_leaveit = bf;
140
141 curs_set(!bf);
142
143 return OK;
144}
145
146int setscrreg(int top, int bottom)
147{
148 PDC_LOG(("setscrreg() - called: top %d bottom %d\n", top, bottom));
149
150 return wsetscrreg(stdscr, top, bottom);
151}
152
153int wsetscrreg(WINDOW *win, int top, int bottom)
154{
155 PDC_LOG(("wsetscrreg() - called: top %d bottom %d\n", top, bottom));
156
157 if (win && 0 <= top && top <= win->_cury &&
158 win->_cury <= bottom && bottom < win->_maxy)
159 {
160 win->_tmarg = top;
161 win->_bmarg = bottom;
162
163 return OK;
164 }
165 else
166 return ERR;
167}
168
169int wgetscrreg(const WINDOW *win, int *top, int *bot)
170{
171 PDC_LOG(("wgetscrreg() - called\n"));
172
173 if (!win || !top || !bot)
174 return ERR;
175
176 *top = win->_tmarg;
177 *bot = win->_bmarg;
178
179 return OK;
180}
181
182int scrollok(WINDOW *win, bool bf)
183{
184 PDC_LOG(("scrollok() - called\n"));
185
186 if (!win)
187 return ERR;
188
189 win->_scroll = bf;
190
191 return OK;
192}
193
194int raw_output(bool bf)
195{
196 PDC_LOG(("raw_output() - called\n"));
197
198 if (!SP)
199 return ERR;
200
201 SP->raw_out = bf;
202
203 return OK;
204}
205
206bool is_cleared(const WINDOW *win)
207{
208 PDC_LOG(("is_cleared() - called\n"));
209
210 if (!win)
211 return FALSE;
212
213 return win->_clear;
214}
215
216bool is_idlok(const WINDOW *win)
217{
218 (void) win;
219
220 PDC_LOG(("is_idlok() - called\n"));
221
222 return FALSE;
223}
224
225bool is_idcok(const WINDOW *win)
226{
227 (void) win;
228
229 PDC_LOG(("is_idcok() - called\n"));
230
231 return FALSE;
232}
233
234bool is_immedok(const WINDOW *win)
235{
236 PDC_LOG(("is_immedok() - called\n"));
237
238 if (!win)
239 return FALSE;
240
241 return win->_immed;
242}
243
244bool is_leaveok(const WINDOW *win)
245{
246 PDC_LOG(("is_leaveok() - called\n"));
247
248 if (!win)
249 return FALSE;
250
251 return win->_leaveit;
252}
253
254bool is_scrollok(const WINDOW *win)
255{
256 PDC_LOG(("is_scrollok() - called\n"));
257
258 if (!win)
259 return FALSE;
260
261 return win->_scroll;
262}