add more test (3)
[cmore.git] / tui.h
CommitLineData
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
22typedef void (*FUNC)(void);
23
24typedef 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
33void clsbody(void);
34int bodylen(void);
35WINDOW *bodywin(void);
36
37void rmerror(void);
38void rmstatus(void);
39
40void titlemsg(char *msg);
41void bodymsg(char *msg);
42void errormsg(char *msg);
43void statusmsg(char *msg);
44
45bool keypressed(void);
46int getkey(void);
47int waitforkey(void);
48
49void DoExit(void);
50void startmenu(menu *mp, char *title, FUNC init);
51void domenu(menu *mp);
52
53void mainmenu(menu *mp);
54void helpmenu(void);
53cd5b25 55void cleanup(void);
ec215ba5
LM
56
57int weditstr(WINDOW *win, char *buf, int field);
58WINDOW *winputbox(WINDOW *win, int nlines, int ncols);
59int 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: */