Release 0.40.3
[vala-gnome.git] / vapi / curses.vapi
blob6dcc78e4339dc60ea6e2cd502c4d7527fd823618
1 /* curses.vala
2  *
3  * Copyright (c) 2007 Ed Schouten <ed@fxq.nl>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
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.
14  *
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
25  * SUCH DAMAGE.
26  */
28 [CCode (lower_case_cprefix = "", cheader_filename = "curses.h")]
29 namespace Curses {
30         public const int COLORS;
31         public const int COLOR_PAIRS;
33         [SimpleType]
34         [CCode (cname = "short", has_type_id = false, default_value = "0")]
35         [IntegerType (rank = 4, min = -32768, max = 32767)]
36         public struct Color : short {
37                 public const Curses.Color BLACK;
38                 public const Curses.Color RED;
39                 public const Curses.Color GREEN;
40                 public const Curses.Color YELLOW;
41                 public const Curses.Color BLUE;
42                 public const Curses.Color MAGENTA;
43                 public const Curses.Color CYAN;
44                 public const Curses.Color WHITE;
45         }
47         [CCode (has_type_id = false)]
48         public enum Acs {
49                 ULCORNER, LLCORNER, URCORNER, LRCORNER, LTEE, RTEE,
50                 BTEE, TTEE, HLINE, VLINE, PLUS, S1, S9, DIAMOND,
51                 CKBOARD, DEGREE, PLMINUS, BULLET, LARROW, RARROW,
52                 DARROW, UARROW, BOARD, LANTERN, BLOCK, S3, S7, LEQUAL,
53                 GEQUAL, PI, NEQUAL, STERLING, BSSB, SSBB, BBSS, SBBS,
54                 SBSS, SSSB, SSBS, BSSS, BSBS, SBSB, SSSS
55         }
57         public Window stdscr;
58         public Window curscr;
59         public Window newscr;
61         public const int LINES;
62         public const int COLS;
63         public const int TABSIZE;
65         public const int ESCDELAY;
67         [Compact]
68         [CCode (copy_function = "dupwin", free_function = "delwin", cname = "WINDOW", cprefix = "")]
69         public class Window {
70                 public int box(ulong verch, ulong horch);
71                 public int clearok(bool bf);
72                 public int copywin(Window dstwin, int sminrow, int smincol, int dminrow, int dmincol, int dmaxrow, int dmaxcol, int overlay);
73                 public Window derwin(int nlines, int ncols, int begin_y, int begin_x);
74                 [CCode (cname = "dupwin")]
75                 public Window copy();
76                 public ulong getbkgd();
77                 public static Window getwin(GLib.FileStream filep);
78                 public void idcok(bool bf);
79                 public int idlok(bool bf);
80                 public void immedok(bool bf);
81                 public int intrflush(bool bf);
82                 public bool is_linetouched(int line);
83                 public bool is_wintouched();
84                 public int keypad(bool bf);
85                 public int leaveok(bool bf);
86                 public int meta(bool bf);
87                 public int mvderwin(int par_y, int par_x);
88                 [CCode (cname = "mvwaddch")]
89                 public int mvaddch(int y, int x, ulong ch);
90                 [CCode (cname = "mvwaddchnstr")]
91                 public int mvaddchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
92                 [CCode (cname = "mvwaddchstr")]
93                 public int mvaddchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
94                 [CCode (cname = "mvwaddnstr")]
95                 public int mvaddnstr(int y, int x, string str, int n);
96                 [CCode (cname = "mvwaddstr")]
97                 public int mvaddstr(int y, int x, string str);
98                 [CCode (cname = "mvwchgat")]
99                 public int mvchgat(int y, int x, int n, ulong attr, short color);
100                 [CCode (cname = "mvwdelch")]
101                 public int mvdelch(int y, int x);
102                 [CCode (cname = "mvwgetch")]
103                 public int mvgetch(int y, int x);
104                 [CCode (cname = "mvwgetnstr")]
105                 public int mvgetnstr(int y, int x, string str, int n);
106                 [CCode (cname = "mvwgetstr")]
107                 public int mvgetstr(int y, int x, string str);
108                 [CCode (cname = "mvwhline")]
109                 public int mvhline(int y, int x, ulong ch, int n);
110                 public int mvwin(int y, int x);
111                 [CCode (cname = "mvwinch")]
112                 public ulong mvinch(int y, int x);
113                 [CCode (cname = "mvwinchnstr")]
114                 public int mvinchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
115                 [CCode (cname = "mvwinchstr")]
116                 public int mvinchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
117                 [CCode (cname = "mvwinnstr")]
118                 public int mvinnstr(int y, int x, string str, int n);
119                 [CCode (cname = "mvwinsch")]
120                 public int mvinsch(int y, int x, ulong ch);
121                 [CCode (cname = "mvwinsnstr")]
122                 public int mvinsnstr(int y, int x, string str, int n);
123                 [CCode (cname = "mvwinsstr")]
124                 public int mvinsstr(int y, int x, string str);
125                 [CCode (cname = "mvwinstr")]
126                 public int mvinstr(int y, int x, string str);
127                 [CCode (cname = "mvwprintw")]
128                 [PrintfLike]
129                 public int mvprintw(int y, int x, string str, ...);
130                 [CCode (cname = "mvwscanw")]
131                 [PrintfLike]
132                 public int mvscanw(int y, int x, string str, ...);
133                 [CCode (cname = "mvwvline")]
134                 public int mvvline(int y, int x, ulong ch, int n);
135                 [CCode (cname = "newwin")]
136                 public Window(int nlines, int ncols, int begin_y, int begin_x);
137                 public int nodelay(bool bf);
138                 public int notimeout(bool bf);
139                 public int overlay(Window win);
140                 public int overwrite(Window win);
141                 public int putwin(GLib.FileStream filep);
142                 public int redrawwin();
143                 public int scroll();
144                 public int scrollok(bool bf);
145                 public Window subpad(int nlines, int ncols, int begin_y, int begin_x);
146                 public Window subwin(int nlines, int ncols, int begin_y, int begin_x);
147                 public int syncok(bool bf);
148                 public int touchline(int start, int count);
149                 public int touchwin();
150                 public int untouchwin();
151                 [CCode (cname = "waddch")]
152                 public int addch(ulong ch);
153                 public int waddchnstr([CCode (array_length = false)] ulong[] chstr, int n);
154                 public int waddchstr([CCode (array_length = false)] ulong[] chstr);
155                 public int waddnstr(string str, int n);
156                 [CCode (cname = "waddstr")]
157                 public int addstr(string str);
158                 [CCode (cname = "wattron")]
159                 public int attron(ulong attrs);
160                 [CCode (cname = "wattroff")]
161                 public int attroff(ulong attrs);
162                 [CCode (cname = "wattrset")]
163                 public int attrset(ulong attrs);
164                 [CCode (cname = "wattr_get")]
165                 public int attr_get(ref ulong attrs, ref ulong pair);
166                 [CCode (cname = "wattr_on")]
167                 public int attr_on(ulong attrs);
168                 [CCode (cname = "wattr_off")]
169                 public int attr_off(ulong attrs);
170                 [CCode (cname = "wattr_set")]
171                 public int attr_set(ulong attrs, short pair);
172                 [CCode (cname = "wbkgd")]
173                 public int bkgd(ulong ch);
174                 [CCode (cname = "wbkgdset")]
175                 public void bkgdset(ulong ch);
176                 [CCode (cname = "wborder")]
177                 public int border(ulong ls, ulong rs, ulong ts, ulong bs, ulong tl, ulong tr, ulong bl, ulong br);
178                 [CCode (cname = "wchgat")]
179                 public int chgat(int n, ulong attr, short color);
180                 [CCode (cname = "wclear")]
181                 public int clear();
182                 [CCode (cname = "wclrtobot")]
183                 public int clrtobot();
184                 [CCode (cname = "wclrtoeol")]
185                 public int clrtoeol();
186                 [CCode (cname = "wcolor_set")]
187                 public int color_set(short color_pair_number);
188                 [CCode (cname = "wcursyncup")]
189                 public void cursyncup();
190                 [CCode (cname = "wdelch")]
191                 public int delch();
192                 [CCode (cname = "wdeleteln")]
193                 public int deleteln();
194                 [CCode (cname = "wechochar")]
195                 public int echochar(ulong ch);
196                 [CCode (cname = "werase")]
197                 public int erase();
198                 [CCode (cname = "wgetch")]
199                 public int getch();
200                 [CCode (cname = "wgetnstr")]
201                 public int getnstr(string str, int n);
202                 [CCode (cname = "wgetstr")]
203                 public int getstr(string str);
204                 [CCode (cname = "whline")]
205                 public int hline(ulong ch, int n);
206                 [CCode (cname = "winch")]
207                 public ulong inch();
208                 [CCode (cname = "winchnstr")]
209                 public int inchnstr([CCode (array_length = false)] ulong[] chstr, int n);
210                 [CCode (cname = "winchstr")]
211                 public int inchstr([CCode (array_length = false)] ulong[] chstr);
212                 [CCode (cname = "winnstr")]
213                 public int innstr(string str, int n);
214                 [CCode (cname = "winsch")]
215                 public int insch(ulong ch);
216                 [CCode (cname = "winsdelln")]
217                 public int insdelln(int n);
218                 [CCode (cname = "winsertln")]
219                 public int insertln();
220                 [CCode (cname = "winsnstr")]
221                 public int insnstr(string str, int n);
222                 [CCode (cname = "winsstr")]
223                 public int insstr(string str);
224                 [CCode (cname = "winstr")]
225                 public int instr(string str);
226                 [CCode (cname = "wmove")]
227                 public int move(int y, int x);
228                 [CCode (cname = "wresize")]
229                 public int resize(int h, int w);
230                 [CCode (cname = "wnoutrefresh")]
231                 public int noutrefresh();
232                 [CCode (cname = "wprintw")]
233                 [PrintfLike]
234                 public int printw(string str, ...);
235                 [CCode (cname = "vw_printw")]
236                 public int vprintw(string str, va_list args);
237                 [CCode (cname = "wredrawln")]
238                 public int redrawln(int beg_line, int num_lines);
239                 [CCode (cname = "wrefresh")]
240                 public int refresh();
241                 [CCode (cname = "wscanw")]
242                 [PrintfLike]
243                 public int scanw(string str, ...);
244                 [CCode (cname = "vw_scanw")]
245                 public int vscanw(string str, va_list args);
246                 [CCode (cname = "wscrl")]
247                 public int scrl(int n);
248                 [CCode (cname = "wsetscrreg")]
249                 public int setscrreg(int top, int bot);
250                 [CCode (cname = "wstandout")]
251                 public int standout();
252                 [CCode (cname = "wstandend")]
253                 public int standend();
254                 [CCode (cname = "wsyncdown")]
255                 public void syncdown();
256                 [CCode (cname = "wsyncup")]
257                 public void syncup();
258                 [CCode (cname = "wtimeout")]
259                 public void timeout(int delay);
260                 [CCode (cname = "wtouchln")]
261                 public int touchln(int y, int n, int changed);
262                 [CCode (cname = "wvline")]
263                 public int vline(ulong ch, int n);
264         }
266         [Compact]
267         [CCode (copy_function = "dupwin", free_function = "delwin", cname = "WINDOW", cprefix = "")]
268         public class Pad : Window {
269                 [CCode (cname = "newpad")]
270                 public Pad(int nlines, int ncols);
271                 [CCode (cname = "pechochar")]
272                 public int echochar(ulong ch);
273                 [CCode (cname = "pnoutrefresh")]
274                 public int noutrefresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol);
275                 [CCode (cname = "prefresh")]
276                 public int refresh(int pminrow, int pmincol, int sminrow, int smincol, int smaxrow, int smaxcol);
277         }
279         [Compact]
280         [CCode (free_function = "delscreen", cname = "SCREEN", cprefix = "")]
281         public class Screen {
282                 [CCode (cname = "newterm")]
283                 public Screen(string str, GLib.FileStream outfd, GLib.FileStream infd);
284                 public unowned Screen set_term();
285         }
287         public int addch(ulong ch);
288         public int addchnstr([CCode (array_length = false)] ulong[] chstr, int n);
289         public int addchstr([CCode (array_length = false)] ulong[] chstr);
290         public int addnstr(string str, int n);
291         public int addstr(string str);
292         public int attroff(ulong attr);
293         public int attron(ulong attr);
294         public int attrset(ulong attr);
295         public int attr_get(ref ulong attrs, ref short pair);
296         public int attr_off(ulong attrs);
297         public int attr_on(ulong attrs);
298         public int attr_set(ulong attrs, short pair);
299         public int baudrate();
300         public int beep();
301         public int bkgd(ulong ch);
302         public void bkgdset(ulong ch);
303         public int border(ulong ls, ulong rs, ulong ts, ulong bs, ulong tl, ulong tr, ulong bl, ulong br);
304         public bool can_change_color();
305         public int cbreak();
306         public int chgat(int n, ulong attr, short color);
307         public int clear();
308         public int clrtobot();
309         public int clrtoeol();
310         public int color_content(short color, ref short r, ref short g, ref short b);
311         public int color_set(short color_pair_number);
312         public int COLOR_PAIR(int n);
313         public int curs_set(int visibility);
314         public int def_prog_mode();
315         public int def_shell_mode();
316         public int delay_output(int ms);
317         public int delch();
318         public int deleteln();
319         public int doupdate();
320         public int echo();
321         public int echochar(ulong ch);
322         public int erase();
323         public int endwin();
324         public char erasechar();
325         public void filter();
326         public int flash();
327         public int flushinp();
328         public int getch();
329         public int getnstr(string str, int n);
330         public int getstr(string str);
331         public int halfdelay(int tenths);
332         public bool has_colors();
333         public bool has_ic();
334         public bool has_il();
335         public int hline(ulong ch, int n);
336         public ulong inch();
337         public int inchnstr([CCode (array_length = false)] ulong[] chstr, int n);
338         public int inchstr([CCode (array_length = false)] ulong[] chstr);
339         public unowned Window initscr();
340         public int init_color(short color, short r, short g, short b);
341         public int init_pair(short pair, Color f, Color b);
342         public int innstr(string str, int n);
343         public int insch(ulong ch);
344         public int insdelln(int n);
345         public int insertln();
346         public int insnstr(string str, int n);
347         public int insstr(string str);
348         public int instr(string str);
349         public bool isendwin();
350         public string keyname(int c);
351         public char killchar();
352         public string ulongname();
353         public int move(int y, int x);
354         public int mvaddch(int y, int x, ulong ch);
355         public int mvaddchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
356         public int mvaddchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
357         public int mvaddnstr(int y, int x, string str, int n);
358         public int mvaddstr(int y, int x, string str);
359         public int mvchgat(int y, int x, int n, ulong attr, short color);
360         public int mvcur(int oldrow, int oldcol, int newrow, int newcol);
361         public int mvdelch(int y, int x);
362         public int mvgetch(int y, int x);
363         public int mvgetnstr(int y, int x, string str, int n);
364         public int mvgetstr(int y, int x, string str);
365         public int mvhline(int y, int x, ulong ch, int n);
366         public ulong mvinch(int y, int x);
367         public int mvinchnstr(int y, int x, [CCode (array_length = false)] ulong[] chstr, int n);
368         public int mvinchstr(int y, int x, [CCode (array_length = false)] ulong[] chstr);
369         public int mvinnstr(int y, int x, string str, int n);
370         public int mvinsch(int y, int x, ulong ch);
371         public int mvinsnstr(int y, int x, string str, int n);
372         public int mvinsstr(int y, int x, string str);
373         public int mvinstr(int y, int x, string str);
374         [PrintfLike]
375         public int mvprintw(int y, int x, string str, ...);
376         [PrintfLike]
377         public int mvscanw(int y, int x, string str, ...);
378         public int mvvline(int y, int x, ulong ch, int n);
379         public int napms(int ms);
380         public int nl();
381         public int nocbreak();
382         public int noecho();
383         public int nonl();
384         public void noqiflush();
385         public int noraw();
386         public int pair_content(short pair, ref Color f, ref Color b);
387         public int PAIR_NUMBER(int attrs);
388         [PrintfLike]
389         public int printw(string str, ...);
390         public void qiflush();
391         public int raw();
392         public int refresh();
393         public int resetty();
394         public int reset_prog_mode();
395         public int reset_shell_mode();
396         public delegate int RipofflineInitFunc(Window win, int n);
397         public int ripoffline(int line, RipofflineInitFunc init);
398         public int savetty();
399         [PrintfLike]
400         public int scanw(string str, ...);
401         public int scr_dump(string str);
402         public int scr_init(string str);
403         public int scrl(int n);
404         public int scr_restore(string str);
405         public int scr_set(string str);
406         public int setscrreg(int top, int bot);
407         public int slk_attroff(ulong attrs);
408         public int slk_attr_off(ulong attrs);
409         public int slk_attron(ulong attrs);
410         public int slk_attr_on(ulong attrs);
411         public int slk_attrset(ulong attrs);
412         public ulong slk_attr();
413         public int slk_attr_set(ulong attrs, short pair);
414         public int slk_clear();
415         public int slk_color(short color_pair_number);
416         public int slk_init(int fmt);
417         public string slk_label(int labnum);
418         public int slk_noutrefresh();
419         public int slk_refresh();
420         public int slk_restore();
421         public int slk_set(int labnum, string label, int fmt);
422         public int slk_touch();
423         public int standout();
424         public int standend();
425         public int start_color();
426         public ulong termattrs();
427         public string termname();
428         public void timeout(int delay);
429         public int typeahead(int fd);
430         public int ungetch(int ch);
431         public void use_env(bool bf);
432         public int vidattr(ulong attrs);
433         public delegate int VidputsPutcFunc(char ch);
434         public int vidputs(ulong attrs, VidputsPutcFunc putc);
435         public int vline(ulong ch, int n);
437         [CCode (cprefix = "A_", has_type_id = false)]
438         public enum Attribute {
439                 NORMAL, ATTRIBUTES, CHARTEXT, COLOR, STANDOUT,
440                 UNDERLINE, REVERSE, BLINK, DIM, BOLD, ALTCHARSET, INVIS,
441                 PROTECT, HORIZONTAL, LEFT, LOW, RIGHT, TOP, VERTICAL
442         }
444         [CCode (has_type_id = false)]
445         public enum Key {
446                 CODE_YES, MIN, BREAK, SRESET, RESET, DOWN, UP, LEFT,
447                 RIGHT, HOME, BACKSPACE, F0, /* XXX F(n), */ DL, IL, DC,
448                 IC, EIC, CLEAR, EOS, EOL, SF, SR, NPAGE, PPAGE, STAB,
449                 CTAB, CATAB, ENTER, PRINT, LL, A1, A3, B2, C1, C3, BTAB,
450                 BEG, CANCEL, CLOSE, COMMAND, COPY, CREATE, END, EXIT,
451                 FIND, HELP, MARK, MESSAGE, MOVE, NEXT, OPEN, OPTIONS,
452                 PREVIOUS, REDO, REFERENCE, REFRESH, REPLACE, RESTART,
453                 RESUME, SAVE, SBEG, SCANCEL, SCOMMAND, SCOPY, SCREATE,
454                 SDC, SDL, SELECT, SEND, SEOL, SEXIT, SFIND, SHELP,
455                 SHOME, SIC, SLEFT, SMESSAGE, SMOVE, SNEXT, SOPTIONS,
456                 SPREVIOUS, SPRINT, SREDO, SREPLACE, SRIGHT, SRSUME,
457                 SSAVE, SSUSPEND, SUNDO, SUSPEND, UNDO, MOUSE, RESIZE,
458                 EVENT, MAX
459         }
461         /* TODO: mouse + wide char support */
462         [CCode (cname="MEVENT", has_type_id = false)]
463         public struct MouseEvent {
464                 short id;
465                 int x;
466                 int y;
467                 int z;
468                 long bstate;
469         }
471         [CCode (cprefix="", has_type_id = false)]
472         public enum MouseMask {
473                 ALL_MOUSE_EVENTS,
474                 REPORT_MOUSE_POSITION
475         }
477         [CCode (has_type_id = false)]
478         public enum Button {
479                 SHIFT,
480                 CTRL,
481                 ALT,
482         }
484         [CCode (has_type_id = false)]
485         public enum Button1 {
486                 PRESSED,
487                 RELEASED,
488                 CLICKED,
489                 DOUBLE_CLICKED,
490                 TRIPLE_CLICKED
491         }
493         [CCode (has_type_id = false)]
494         public enum Button2 {
495                 PRESSED,
496                 RELEASED,
497                 CLICKED,
498                 DOUBLE_CLICKED,
499                 TRIPLE_CLICKED
500         }
502         [CCode (has_type_id = false)]
503         public enum Button3 {
504                 PRESSED,
505                 RELEASED,
506                 CLICKED,
507                 DOUBLE_CLICKED,
508                 TRIPLE_CLICKED
509         }
511         [CCode (has_type_id = false)]
512         public enum Button4 {
513                 PRESSED,
514                 RELEASED,
515                 CLICKED,
516                 DOUBLE_CLICKED,
517                 TRIPLE_CLICKED
518         }
520         [CCode (has_type_id = false)]
521         public enum Button5 {
522                 PRESSED,
523                 RELEASED,
524                 CLICKED,
525                 DOUBLE_CLICKED,
526                 TRIPLE_CLICKED
527         }
529         public bool getmouse(out MouseEvent me);
530         public int mouseinterval(int erval);
531         public int mousemask(MouseMask @new, out MouseMask old);