summaryrefslogtreecommitdiffhomepage
path: root/contrib/luacurses/src/luacurses.h
blob: 2dc426c93f6ccbaf505ffd29522ecaf5180edb58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

#include <curses.h>

#define MKLUALIB_META_CURSES_SCREEN "SCREEN*"

SCREEN* luacurses_toscreen(lua_State* L, int index);
SCREEN** luacurses_newscreen(lua_State* L);
void luacurses_regscreen(lua_State* L, const char* name, SCREEN* userdata);

#define MKLUALIB_META_CURSES_WINDOW "WINDOW*"

WINDOW* luacurses_towindow(lua_State* L, int index);
WINDOW** luacurses_newwindow(lua_State* L);
void luacurses_regwindow(lua_State* L, const char* name, WINDOW* userdata);

#define MKLUALIB_META_CURSES_FILE "FILE*"

FILE* tofile(lua_State* L, int index);
FILE** newfile(lua_State* L);
void luacurses_regfile(lua_State* L, const char* name, FILE* f);

char* luacurses_wgetnstr(WINDOW* w, int n);
char* luacurses_wgetstr(WINDOW* w);

#define luacurses_mvwgetnstr(w, y, x, n) (wmove(w, y, x) == ERR ? 0 : luacurses_wgetnstr(w, n))
#define luacurses_getnstr(n) luacurses_wgetnstr(stdscr, n)
#define luacurses_mvgetnstr(y, x, n) luacurses_mvwgetnstr(stdscr, y, x, n)

char* luacurses_window_tostring(WINDOW* w);
char* luacurses_screen_tostring(SCREEN* s);

#define luacurses_window_free(w) {delwin(w); w = 0;}
#define luacurses_screen_free(s) {delscreen(s); s = 0;}

bool luacurses_getmouse(short* id, int* x, int* y, int* z, mmask_t* bstate);
bool luacurses_ungetmouse (short id, int x, int y, int z, mmask_t bstate);
mmask_t luacurses_addmousemask(mmask_t m);