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
28 [CCode (lower_case_cprefix = "", cheader_filename = "curses.h")]
30 public const int COLORS;
31 public const int COLOR_PAIRS;
34 BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE
38 ULCORNER, LLCORNER, URCORNER, LRCORNER, LTEE, RTEE,
39 BTEE, TTEE, HLINE, VLINE, PLUS, S1, S9, DIAMOND,
40 CKBOARD, DEGREE, PLMINUS, BULLET, LARROW, RARROW,
41 DARROW, UARROW, BOARD, LANTERN, BLOCK, S3, S7, LEQUAL,
42 GEQUAL, PI, NEQUAL, STERLING, BSSB, SSBB, BBSS, SBBS,
43 SBSS, SSSB, SSBS, BSSS, BSBS, SBSB, SSSS
50 public const int LINES;
51 public const int COLS;
52 public const int TABSIZE;
54 public const int ESCDELAY;
57 [CCode (copy_function = "dupwin", free_function = "delwin", cname = "WINDOW", cprefix = "")]
59 public int box(ulong verch, ulong horch);
60 public int clearok(bool bf);
61 public int copywin(Window dstwin, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, int overlay);
62 public Window derwin(int nlines, int ncols, int begin_y, int begin_x);
63 [CCode (cname = "dupwin")]
65 public ulong getbkgd();
66 public static Window getwin(GLib.FileStream filep);
67 public void idcok(bool bf);
68 public int idlok(bool bf);
69 public void immedok(bool bf);
70 public int intrflush(bool bf);
71 public bool is_linetouched(int line);
72 public bool is_wintouched();
73 public int keypad(bool bf);
74 public int leaveok(bool bf);
75 public int meta(bool bf);
76 public int mvderwin(int par_y, int par_x);
77 [CCode (cname = "mvwaddch")]
78 public int mvaddch(int y, int x, ulong ch);
79 [CCode (cname = "mvwaddchnstr")]
80 public int mvaddchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
81 [CCode (cname = "mvwaddchstr")]
82 public int mvaddchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
83 [CCode (cname = "mvwaddnstr")]
84 public int mvaddnstr(int y, int x, string str, int n);
85 [CCode (cname = "mvwaddstr")]
86 public int mvaddstr(int y, int x, string str);
87 [CCode (cname = "mvwchgat")]
88 public int mvchgat(int y, int x, int n, ulong attr, short color);
89 [CCode (cname = "mvwdelch")]
90 public int mvdelch(int y, int x);
91 [CCode (cname = "mvwgetch")]
92 public int mvgetch(int y, int x);
93 [CCode (cname = "mvwgetnstr")]
94 public int mvgetnstr(int y, int x, string str, int n);
95 [CCode (cname = "mvwgetstr")]
96 public int mvgetstr(int y, int x, string str);
97 [CCode (cname = "mvwhline")]
98 public int mvhline(int y, int x, ulong ch, int n);
99 public int mvwin(int y, int x);
100 [CCode (cname = "mvwinch")]
101 public ulong mvinch(int y, int x);
102 [CCode (cname = "mvwinchnstr")]
103 public int mvinchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
104 [CCode (cname = "mvwinchstr")]
105 public int mvinchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
106 [CCode (cname = "mvwinnstr")]
107 public int mvinnstr(int y, int x, string str, int n);
108 [CCode (cname = "mvwinsch")]
109 public int mvinsch(int y, int x, ulong ch);
110 [CCode (cname = "mvwinsnstr")]
111 public int mvinsnstr(int y, int x, string str, int n);
112 [CCode (cname = "mvwinsstr")]
113 public int mvinsstr(int y, int x, string str);
114 [CCode (cname = "mvwinstr")]
115 public int mvinstr(int y, int x, string str);
116 [CCode (cname = "mvwprintw")]
118 public int mvprintw(int y, int x, string str, ...);
119 [CCode (cname = "mvwscanw")]
121 public int mvscanw(int y, int x, string str, ...);
122 [CCode (cname = "mvwvline")]
123 public int mvvline(int y, int x, ulong ch, int n);
124 [CCode (cname = "newwin")]
125 public Window(int nlines, int ncols, int begin_y, int begin_x);
126 public int nodelay(bool bf);
127 public int notimeout(bool bf);
128 public int overlay(Window win);
129 public int overwrite(Window win);
130 public int putwin(GLib.FileStream filep);
131 public int redrawwin();
133 public int scrollok(bool bf);
134 public Window subpad(int nlines, int ncols, int begin_y, int begin_x);
135 public Window subwin(int nlines, int ncols, int begin_y, int begin_x);
136 public int syncok(bool bf);
137 public int touchline(int start, int count);
138 public int touchwin();
139 public int untouchwin();
140 [CCode (cname = "waddch")]
141 public int addch(ulong ch);
142 public int waddchnstr([CCode (array_length = false)] ulong[] chstr, int n);
143 public int waddchstr([CCode (array_length = false)] ulong[] chstr);
144 public int waddnstr(string str, int n);
145 [CCode (cname = "waddstr")]
146 public int addstr(string str);
147 [CCode (cname = "wattron")]
148 public int attron(ulong attrs);
149 [CCode (cname = "wattroff")]
150 public int attroff(ulong attrs);
151 [CCode (cname = "wattrset")]
152 public int attrset(ulong attrs);
153 [CCode (cname = "wattr_get")]
154 public int attr_get(ref ulong attrs, ref ulong pair);
155 [CCode (cname = "wattr_on")]
156 public int attr_on(ulong attrs);
157 [CCode (cname = "wattr_off")]
158 public int attr_off(ulong attrs);
159 [CCode (cname = "wattr_set")]
160 public int attr_set(ulong attrs, short pair);
161 [CCode (cname = "wbkgd")]
162 public int bkgd(ulong ch);
163 [CCode (cname = "wbkgdset")]
164 public void bkgdset(ulong ch);
165 [CCode (cname = "wborder")]
166 public int border(ulong ls, ulong rs, ulong ts, ulong bs, ulong tl, ulong tr, ulong bl, ulong br);
167 [CCode (cname = "wchgat")]
168 public int chgat(int n, ulong attr, short color);
169 [CCode (cname = "wclear")]
171 [CCode (cname = "wclrtobot")]
172 public int clrtobot();
173 [CCode (cname = "wclrtoeol")]
174 public int clrtoeol();
175 [CCode (cname = "wcolor_set")]
176 public int color_set(short color_pair_number);
177 [CCode (cname = "wcursyncup")]
178 public void cursyncup();
179 [CCode (cname = "wdelch")]
181 [CCode (cname = "wdeleteln")]
182 public int deleteln();
183 [CCode (cname = "wechochar")]
184 public int echochar(ulong ch);
185 [CCode (cname = "werase")]
187 [CCode (cname = "wgetch")]
189 [CCode (cname = "wgetnstr")]
190 public int getnstr(string str, int n);
191 [CCode (cname = "wgetstr")]
192 public int getstr(string str);
193 [CCode (cname = "whline")]
194 public int hline(ulong ch, int n);
195 [CCode (cname = "winch")]
197 [CCode (cname = "winchnstr")]
198 public int inchnstr([CCode (array_length = false)] ulong[] chstr, int n);
199 [CCode (cname = "winchstr")]
200 public int inchstr([CCode (array_length = false)] ulong[] chstr);
201 [CCode (cname = "winnstr")]
202 public int innstr(string str, int n);
203 [CCode (cname = "winsch")]
204 public int insch(ulong ch);
205 [CCode (cname = "winsdelln")]
206 public int insdelln(int n);
207 [CCode (cname = "winsertln")]
208 public int insertln();
209 [CCode (cname = "winsnstr")]
210 public int insnstr(string str, int n);
211 [CCode (cname = "winsstr")]
212 public int insstr(string str);
213 [CCode (cname = "winstr")]
214 public int instr(string str);
215 [CCode (cname = "wmove")]
216 public int move(int y, int x);
217 [CCode (cname = "wresize")]
218 public int resize(int h, int w);
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, GLib.FileStream outfd, GLib.FileStream infd);
269 public unowned 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 unowned 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 */
447 [CCode (cname="MEVENT")]
448 public struct MouseEvent {
457 public enum MouseMask {
459 REPORT_MOUSE_POSITION
468 public enum Button1 {
476 public enum Button2 {
484 public enum Button3 {
492 public enum Button4 {
500 public enum Button5 {
508 public bool getmouse(out MouseEvent me);
509 public int mouseinterval(int erval);
510 public int mousemask(MouseMask @new, out MouseMask old);