Commit | Line | Data |
---|---|---|
ec215ba5 LM |
1 | /* |
2 | * 'textual user interface' | |
3 | * | |
4 | * Author : P.J. Kunst <kunst@prl.philips.nl> | |
5 | * Date : 1993-02-25 | |
6 | */ | |
7 | ||
8 | #ifndef _TUI_H_ | |
9 | #define _TUI_H_ | |
10 | ||
11 | #include <curses.h> | |
12 | ||
13 | #ifdef A_COLOR | |
14 | #define A_ATTR (A_ATTRIBUTES ^ A_COLOR) /* A_BLINK, A_REVERSE, A_BOLD */ | |
15 | #else | |
16 | #define A_ATTR (A_ATTRIBUTES) /* standard UNIX attributes */ | |
17 | #endif | |
18 | ||
19 | #define MAXSTRLEN 256 | |
20 | #define KEY_ESC 0x1b /* Escape */ | |
21 | ||
22 | typedef void (*FUNC)(void); | |
23 | ||
24 | typedef struct | |
25 | { | |
26 | char *name; /* item label */ | |
27 | FUNC func; /* (pointer to) function */ | |
28 | char *desc; /* function description */ | |
29 | } menu; | |
30 | ||
31 | /* ANSI C function prototypes: */ | |
32 | ||
33 | void clsbody(void); | |
34 | int bodylen(void); | |
35 | WINDOW *bodywin(void); | |
36 | ||
37 | void rmerror(void); | |
38 | void rmstatus(void); | |
39 | ||
40 | void titlemsg(char *msg); | |
41 | void bodymsg(char *msg); | |
42 | void errormsg(char *msg); | |
43 | void statusmsg(char *msg); | |
44 | ||
45 | bool keypressed(void); | |
46 | int getkey(void); | |
47 | int waitforkey(void); | |
48 | ||
49 | void DoExit(void); | |
50 | void startmenu(menu *mp, char *title, FUNC init); | |
51 | void domenu(menu *mp); | |
52 | ||
53 | void mainmenu(menu *mp); | |
54 | void helpmenu(void); | |
53cd5b25 | 55 | void cleanup(void); |
ec215ba5 LM |
56 | |
57 | int weditstr(WINDOW *win, char *buf, int field); | |
58 | WINDOW *winputbox(WINDOW *win, int nlines, int ncols); | |
59 | int getstrings(char *desc[], char *buf[], int field); | |
60 | ||
61 | #define editstr(s,f) (weditstr(stdscr,s,f)) | |
62 | #define mveditstr(y,x,s,f) (move(y,x)==ERR?ERR:editstr(s,f)) | |
63 | #define mvweditstr(w,y,x,s,f) (wmove(w,y,x)==ERR?ERR:weditstr(w,s,f)) | |
64 | ||
65 | #define inputbox(l,c) (winputbox(stdscr,l,c)) | |
66 | #define mvinputbox(y,x,l,c) (move(y,x)==ERR?w:inputbox(l,c)) | |
67 | #define mvwinputbox(w,y,x,l,c) (wmove(w,y,x)==ERR?w:winputbox(w,l,c)) | |
68 | ||
69 | #endif | |
97efd1ff LM |
70 | |
71 | /* vim: set ts=4 sw=4 et: */ |