3 * Copyright (c) 2007 Ed Schouten <ed@fxq.nl>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 [CCode (lower_case_cprefix = "", cheader_filename = "curses.h")]
32 public const int COLORS;
33 public const int COLOR_PAIRS;
36 BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
40 ULCORNER, LLCORNER, URCORNER, LRCORNER, LTEE, RTEE,
41 BTEE, TTEE, HLINE, VLINE, PLUS, S1, S9, DIAMOND,
42 CKBOARD, DEGREE, PLMINUS, BULLET, LARROW, RARROW,
43 DARROW, UARROW, BOARD, LANTERN, BLOCK, S3, S7, LEQUAL,
44 GEQUAL, PI, NEQUAL, STERLING, BSSB, SSBB, BBSS, SBBS,
45 SBSS, SSSB, SSBS, BSSS, BSBS, SBSB, SSSS
48 public const Window stdscr;
49 public const Window curscr;
50 public const Window newscr;
52 public const int LINES;
53 public const int COLS;
54 public const int TABSIZE;
56 public const int ESCDELAY;
59 [CCode (copy_function = "dupwin", free_function = "delwin", cname = "WINDOW", cprefix = "")]
61 public int box(ulong verch, ulong horch);
62 public int clearok(bool bf);
63 public int copywin(Window dstwin, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, int overlay);
64 public Window derwin(int nlines, int ncols, int begin_y, int begin_x);
65 [CCode (cname = "dupwin")]
67 public ulong getbkgd();
68 public static Window getwin(FileStream filep);
69 public void idcok(bool bf);
70 public int idlok(bool bf);
71 public void immedok(bool bf);
72 public int intrflush(bool bf);
73 public bool is_linetouched(int line);
74 public bool is_wintouched();
75 public int keypad(bool bf);
76 public int leaveok(bool bf);
77 public int meta(bool bf);
78 public int mvderwin(int par_y, int par_x);
79 [CCode (cname = "mvwaddch")]
80 public int mvaddch(int y, int x, ulong ch);
81 [CCode (cname = "mvwaddchnstr")]
82 public int mvaddchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
83 [CCode (cname = "mvwaddchstr")]
84 public int mvaddchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
85 [CCode (cname = "mvwaddnstr")]
86 public int mvaddnstr(int y, int x, string str, int n);
87 [CCode (cname = "mvwaddstr")]
88 public int mvaddstr(int y, int x, string str);
89 [CCode (cname = "mvwchgat")]
90 public int mvchgat(int y, int x, int n, ulong attr, short color);
91 [CCode (cname = "mvwdelch")]
92 public int mvdelch(int y, int x);
93 [CCode (cname = "mvwgetch")]
94 public int mvgetch(int y, int x);
95 [CCode (cname = "mvwgetnstr")]
96 public int mvgetnstr(int y, int x, string str, int n);
97 [CCode (cname = "mvwgetstr")]
98 public int mvgetstr(int y, int x, string str);
99 [CCode (cname = "mvwhline")]
100 public int mvhline(int y, int x, ulong ch, int n);
101 public int mvwin(int y, int x);
102 [CCode (cname = "mvwinch")]
103 public ulong mvinch(int y, int x);
104 [CCode (cname = "mvwinchnstr")]
105 public int mvinchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
106 [CCode (cname = "mvwinchstr")]
107 public int mvinchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
108 [CCode (cname = "mvwinnstr")]
109 public int mvinnstr(int y, int x, string str, int n);
110 [CCode (cname = "mvwinsch")]
111 public int mvinsch(int y, int x, ulong ch);
112 [CCode (cname = "mvwinsnstr")]
113 public int mvinsnstr(int y, int x, string str, int n);
114 [CCode (cname = "mvwinsstr")]
115 public int mvinsstr(int y, int x, string str);
116 [CCode (cname = "mvwinstr")]
117 public int mvinstr(int y, int x, string str);
118 [CCode (cname = "mvwprintw")]
120 public int mvprintw(int y, int x, string str, ...);
121 [CCode (cname = "mvwscanw")]
123 public int mvscanw(int y, int x, string str, ...);
124 [CCode (cname = "mvwvline")]
125 public int mvvline(int y, int x, ulong ch, int n);
126 [CCode (cname = "newwin")]
127 public Window(int nlines, int ncols, int begin_y, int begin_x);
128 public int nodelay(bool bf);
129 public int notimeout(bool bf);
130 public int overlay(Window win);
131 public int overwrite(Window win);
132 public int putwin(FileStream filep);
133 public int redrawwin();
135 public int scrollok(bool bf);
136 public Window subpad(int nlines, int ncols, int begin_y, int begin_x);
137 public Window subwin(int nlines, int ncols, int begin_y, int begin_x);
138 public int syncok(bool bf);
139 public int touchline(int start, int count);
140 public int touchwin();
141 public int untouchwin();
142 [CCode (cname = "waddch")]
143 public int addch(ulong ch);
144 public int waddchnstr([CCode (array_length = false)] ulong[] chstr, int n);
145 public int waddchstr([CCode (array_length = false)] ulong[] chstr);
146 public int waddnstr(string str, int n);
147 [CCode (cname = "waddstr")]
148 public int addstr(string str);
149 [CCode (cname = "wattron")]
150 public int attron(ulong attrs);
151 [CCode (cname = "wattroff")]
152 public int attroff(ulong attrs);
153 [CCode (cname = "wattrset")]
154 public int attrset(ulong attrs);
155 [CCode (cname = "wattr_get")]
156 public int attr_get(ref ulong attrs, ref ulong pair);
157 [CCode (cname = "wattr_on")]
158 public int attr_on(ulong attrs);
159 [CCode (cname = "wattr_off")]
160 public int attr_off(ulong attrs);
161 [CCode (cname = "wattr_set")]
162 public int attr_set(ulong attrs, short pair);
163 [CCode (cname = "wbkgd")]
164 public int bkgd(ulong ch);
165 [CCode (cname = "wbkgdset")]
166 public void bkgdset(ulong ch);
167 [CCode (cname = "wborder")]
168 public int border(ulong ls, ulong rs, ulong ts, ulong bs, ulong tl, ulong tr, ulong bl, ulong br);
169 [CCode (cname = "wchgat")]
170 public int chgat(int n, ulong attr, short color);
171 [CCode (cname = "wclear")]
173 [CCode (cname = "wclrtobot")]
174 public int clrtobot();
175 [CCode (cname = "wclrtoeol")]
176 public int clrtoeol();
177 [CCode (cname = "wcolor_set")]
178 public int color_set(short color_pair_number);
179 [CCode (cname = "wcursyncup")]
180 public void cursyncup();
181 [CCode (cname = "wdelch")]
183 [CCode (cname = "wdeleteln")]
184 public int deleteln();
185 [CCode (cname = "wechochar")]
186 public int echochar(ulong ch);
187 [CCode (cname = "werase")]
189 [CCode (cname = "wgetch")]
191 [CCode (cname = "wgetnstr")]
192 public int getnstr(string str, int n);
193 [CCode (cname = "wgetstr")]
194 public int getstr(string str);
195 [CCode (cname = "whline")]
196 public int hline(ulong ch, int n);
197 [CCode (cname = "winch")]
199 [CCode (cname = "winchnstr")]
200 public int inchnstr([CCode (array_length = false)] ulong[] chstr, int n);
201 [CCode (cname = "winchstr")]
202 public int inchstr([CCode (array_length = false)] ulong[] chstr);
203 [CCode (cname = "winnstr")]
204 public int innstr(string str, int n);
205 [CCode (cname = "winsch")]
206 public int insch(ulong ch);
207 [CCode (cname = "winsdelln")]
208 public int insdelln(int n);
209 [CCode (cname = "winsertln")]
210 public int insertln();
211 [CCode (cname = "winsnstr")]
212 public int insnstr(string str, int n);
213 [CCode (cname = "winsstr")]
214 public int insstr(string str);
215 [CCode (cname = "winstr")]
216 public int instr(string str);
217 [CCode (cname = "wmove")]
218 public int move(int y, int x);
219 [CCode (cname = "wnoutrefresh")]
220 public int noutrefresh();
221 [CCode (cname = "wprintw")]
223 public int printw(string str, ...);
224 [CCode (cname = "wredrawln")]
225 public int redrawln(int beg_line, int num_lines);
226 [CCode (cname = "wrefresh")]
227 public int refresh();
228 [CCode (cname = "wscanw")]
230 public int scanw(string str, ...);
231 [CCode (cname = "wscrl")]
232 public int scrl(int n);
233 [CCode (cname = "wsetscrreg")]
234 public int setscrreg(int top, int bot);
235 [CCode (cname = "wstandout")]
236 public int standout();
237 [CCode (cname = "wstandend")]
238 public int standend();
239 [CCode (cname = "wsyncdown")]
240 public void syncdown();
241 [CCode (cname = "wsyncup")]
242 public void syncup();
243 [CCode (cname = "wtimeout")]
244 public void timeout(int delay);
245 [CCode (cname = "wtouchln")]
246 public int touchln(int y, int n, int changed);
247 [CCode (cname = "wvline")]
248 public int vline(ulong ch, int n);
252 [CCode (copy_function = "dupwin", free_function = "delwin", cname = "WINDOW", cprefix = "")]
253 public class Pad : Window {
254 [CCode (cname = "newpad")]
255 public Pad(int nlines, int ncols);
256 [CCode (cname = "pechochar")]
257 public int echochar(ulong ch);
258 [CCode (cname = "pnoutrefresh")]
259 public int noutrefresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol);
260 [CCode (cname = "prefresh")]
261 public int refresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol);
265 [CCode (free_function = "delscreen", cname = "SCREEN", cprefix = "")]
266 public class Screen {
267 [CCode (cname = "newterm")]
268 public Screen(string str, FileStream outfd, FileStream infd);
269 public weak Screen set_term();
272 public int addch(ulong ch);
273 public int addchnstr([CCode (array_length = false)] ulong[] chstr, int n);
274 public int addchstr([CCode (array_length = false)] ulong[] chstr);
275 public int addnstr(string str, int n);
276 public int addstr(string str);
277 public int attroff(ulong attr);
278 public int attron(ulong attr);
279 public int attrset(ulong attr);
280 public int attr_get(ref ulong attrs, ref short pair);
281 public int attr_off(ulong attrs);
282 public int attr_on(ulong attrs);
283 public int attr_set(ulong attrs, short pair);
284 public int baudrate();
286 public int bkgd(ulong ch);
287 public void bkgdset(ulong ch);
288 public int border(ulong ls, ulong rs, ulong ts, ulong bs, ulong tl, ulong tr, ulong bl, ulong br);
289 public bool can_change_color();
291 public int chgat(int n, ulong attr, short color);
293 public int clrtobot();
294 public int clrtoeol();
295 public int color_content(short color, ref short r, ref short g, ref short b);
296 public int color_set(short color_pair_number);
297 public int COLOR_PAIR(int n);
298 public int curs_set(int visibility);
299 public int def_prog_mode();
300 public int def_shell_mode();
301 public int delay_output(int ms);
303 public int deleteln();
304 public int doupdate();
306 public int echochar(ulong ch);
309 public char erasechar();
310 public void filter();
312 public int flushinp();
314 public int getnstr(string str, int n);
315 public int getstr(string str);
316 public int halfdelay(int tenths);
317 public bool has_colors();
318 public bool has_ic();
319 public bool has_il();
320 public int hline(ulong ch, int n);
322 public int inchnstr([CCode (array_length = false)] ulong[] chstr, int n);
323 public int inchstr([CCode (array_length = false)] ulong[] chstr);
324 public weak Window initscr();
325 public int init_color(short color, short r, short g, short b);
326 public int init_pair(short pair, Color f, Color b);
327 public int innstr(string str, int n);
328 public int insch(ulong ch);
329 public int insdelln(int n);
330 public int insertln();
331 public int insnstr(string str, int n);
332 public int insstr(string str);
333 public int instr(string str);
334 public bool isendwin();
335 public string keyname(int c);
336 public char killchar();
337 public string ulongname();
338 public int move(int y, int x);
339 public int mvaddch(int y, int x, ulong ch);
340 public int mvaddchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
341 public int mvaddchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
342 public int mvaddnstr(int y, int x, string str, int n);
343 public int mvaddstr(int y, int x, string str);
344 public int mvchgat(int y, int x, int n, ulong attr, short color);
345 public int mvcur(int oldrow, int oldcol, int newrow, int newcol);
346 public int mvdelch(int y, int x);
347 public int mvgetch(int y, int x);
348 public int mvgetnstr(int y, int x, string str, int n);
349 public int mvgetstr(int y, int x, string str);
350 public int mvhline(int y, int x, ulong ch, int n);
351 public ulong mvinch(int y, int x);
352 public int mvinchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
353 public int mvinchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
354 public int mvinnstr(int y, int x, string str, int n);
355 public int mvinsch(int y, int x, ulong ch);
356 public int mvinsnstr(int y, int x, string str, int n);
357 public int mvinsstr(int y, int x, string str);
358 public int mvinstr(int y, int x, string str);
360 public int mvprintw(int y, int x, string str, ...);
362 public int mvscanw(int y, int x, string str, ...);
363 public int mvvline(int y, int x, ulong ch, int n);
364 public int napms(int ms);
366 public int nocbreak();
369 public void noqiflush();
371 public int pair_content(short pair, ref Color f, ref Color b);
372 public int PAIR_NUMBER(int attrs);
374 public int printw(string str, ...);
375 public void qiflush();
377 public int refresh();
378 public int resetty();
379 public int reset_prog_mode();
380 public int reset_shell_mode();
381 public delegate int RipofflineInitFunc(Window win, int n);
382 public int ripoffline(int line, RipofflineInitFunc init);
383 public int savetty();
385 public int scanw(string str, ...);
386 public int scr_dump(string str);
387 public int scr_init(string str);
388 public int scrl(int n);
389 public int scr_restore(string str);
390 public int scr_set(string str);
391 public int setscrreg(int top, int bot);
392 public int slk_attroff(ulong attrs);
393 public int slk_attr_off(ulong attrs);
394 public int slk_attron(ulong attrs);
395 public int slk_attr_on(ulong attrs);
396 public int slk_attrset(ulong attrs);
397 public ulong slk_attr();
398 public int slk_attr_set(ulong attrs, short pair);
399 public int slk_clear();
400 public int slk_color(short color_pair_number);
401 public int slk_init(int fmt);
402 public string slk_label(int labnum);
403 public int slk_noutrefresh();
404 public int slk_refresh();
405 public int slk_restore();
406 public int slk_set(int labnum, string label, int fmt);
407 public int slk_touch();
408 public int standout();
409 public int standend();
410 public int start_color();
411 public ulong termattrs();
412 public string termname();
413 public void timeout(int delay);
414 public int typeahead(int fd);
415 public int ungetch(int ch);
416 public void use_env(bool bf);
417 public int vidattr(ulong attrs);
418 public delegate int VidputsPutcFunc(char ch);
419 public int vidputs(ulong attrs, VidputsPutcFunc putc);
420 public int vline(ulong ch, int n);
421 /* no vwprintw, vw_printw, vwscanw, vw_scanw - va_list */
423 [CCode (cprefix = "A_")]
424 public enum Attribute {
425 NORMAL, ATTRIBUTES, CHARTEXT, COLOR, STANDOUT,
426 UNDERLINE, REVERSE, BLINK, DIM, BOLD, ALTCHARSET, INVIS,
427 PROTECT, HORIZONTAL, LEFT, LOW, RIGHT, TOP, VERTICAL
431 CODE_YES, MIN, BREAK, SRESET, RESET, DOWN, UP, LEFT,
432 RIGHT, HOME, BACKSPACE, F0, /* XXX F(n), */ DL, IL, DC,
433 IC, EIC, CLEAR, EOS, EOL, SF, SR, NPAGE, PPAGE, STAB,
434 CTAB, CATAB, ENTER, PRINT, LL, A1, A3, B2, C1, C3, BTAB,
435 BEG, CANCEL, CLOSE, COMMAND, COPY, CREATE, END, EXIT,
436 FIND, HELP, MARK, MESSAGE, MOVE, NEXT, OPEN, OPTIONS,
437 PREVIOUS, REDO, REFERENCE, REFRESH, REPLACE, RESTART,
438 RESUME, SAVE, SBEG, SCANCEL, SCOMMAND, SCOPY, SCREATE,
439 SDC, SDL, SELECT, SEND, SEOL, SEXIT, SFIND, SHELP,
440 SHOME, SIC, SLEFT, SMESSAGE, SMOVE, SNEXT, SOPTIONS,
441 SPREVIOUS, SPRINT, SREDO, SREPLACE, SRIGHT, SRSUME,
442 SSAVE, SSUSPEND, SUNDO, SUSPEND, UNDO, MOUSE, RESIZE,
446 /* TODO: mouse + wide char support */