Add dvtm-editor(1) utility to make $EDITOR work as a filter
[dvtm.git] / vt.h
blob0cd9e8a2f0507a4959aa15ed6d8cab9482722a67
1 /*
2 * Copyright © 2004 Bruno T. C. de Oliveira
3 * Copyright © 2006 Pierre Habouzit
4 * Copyright © 2008-2013 Marc André Tanner
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
15 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
16 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #ifndef VT_H
19 #define VT_H
21 #include <curses.h>
22 #include <stdbool.h>
23 #include <sys/types.h>
25 #ifndef NCURSES_MOUSE_VERSION
26 #define mmask_t unsigned long
27 #endif
29 typedef struct Vt Vt;
30 typedef void (*vt_title_handler_t)(Vt*, const char *title);
31 typedef void (*vt_urgent_handler_t)(Vt*);
33 void vt_init(void);
34 void vt_shutdown(void);
36 void vt_keytable_set(char const * const keytable_overlay[], int count);
37 void vt_default_colors_set(Vt*, attr_t attrs, short fg, short bg);
38 void vt_title_handler_set(Vt*, vt_title_handler_t);
39 void vt_urgent_handler_set(Vt*, vt_urgent_handler_t);
40 void vt_data_set(Vt*, void *);
41 void *vt_data_get(Vt*);
43 Vt *vt_create(int rows, int cols, int scroll_buf_sz);
44 void vt_resize(Vt*, int rows, int cols);
45 void vt_destroy(Vt*);
46 pid_t vt_forkpty(Vt*, const char *p, const char *argv[], const char *cwd, const char *env[], int *to, int *from);
47 int vt_pty_get(Vt*);
48 bool vt_cursor_visible(Vt*);
50 int vt_process(Vt *);
51 void vt_keypress(Vt *, int keycode);
52 ssize_t vt_write(Vt*, const char *buf, size_t len);
53 void vt_mouse(Vt*, int x, int y, mmask_t mask);
54 void vt_dirty(Vt*);
55 void vt_draw(Vt*, WINDOW *win, int startrow, int startcol);
56 short vt_color_get(Vt*, short fg, short bg);
57 short vt_color_reserve(short fg, short bg);
59 void vt_scroll(Vt*, int rows);
60 void vt_noscroll(Vt*);
62 pid_t vt_pid_get(Vt*);
63 size_t vt_content_get(Vt*, char **s, bool colored);
64 int vt_content_start(Vt*);
66 #endif /* VT_H */