diff options
author | Harald van Dijk <truedfx@gentoo.org> | 2009-10-26 20:54:50 +0059 |
---|---|---|
committer | Harald van Dijk <truedfx@gentoo.org> | 2009-10-26 20:54:50 +0059 |
commit | 7cbb49f1c318eb4e3dbff1bd8b508b0ef32be2ff (patch) | |
tree | 8e0d79dd608a35d8372dfb2cc209b570cede820f /ufed-curses.h | |
download | ufed-7cbb49f1c318eb4e3dbff1bd8b508b0ef32be2ff.tar.gz ufed-7cbb49f1c318eb4e3dbff1bd8b508b0ef32be2ff.tar.bz2 ufed-7cbb49f1c318eb4e3dbff1bd8b508b0ef32be2ff.zip |
ufed-0.40.tar.bz2
Diffstat (limited to 'ufed-curses.h')
-rw-r--r-- | ufed-curses.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ufed-curses.h b/ufed-curses.h new file mode 100644 index 0000000..0456384 --- /dev/null +++ b/ufed-curses.h @@ -0,0 +1,50 @@ +#define C99 (__STDC_VERSION__ >= 199901L) +#if !C99 +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 95 +#error Either a C99 compiler, or gcc 2.95.* or higher is required. +#endif +#endif + +#include <curses.h> + +#if !C99 +#define inline __inline +#endif + +enum win { Top, Left, List, Input, Scrollbar, Right, Bottom, wCount }; +struct window { + WINDOW *win; + const int top, left, height, width; +}; +struct item { + struct item *prev, *next; + int top, height; +}; +struct key { + char key; + const char *descr; + int length; +}; + +extern struct window window[wCount]; + +extern void initcurses(void); +extern void cursesdone(void); + +extern int maineventloop( + const char *subtitle, + int (*callback)(struct item **currentitem, int key), + void(*drawitem)(struct item *item, bool highlight), + struct item *items, + const struct key *keys); +extern void scrollcurrent(void); +extern bool yesno(const char *); + +static inline WINDOW *win(enum win w) { return window[w].win; } +static inline int wTop (enum win w) { return (window[w].top >= 0 ? 0 : LINES) + window[w].top ; } +static inline int wLeft (enum win w) { return (window[w].left >= 0 ? 0 : COLS ) + window[w].left ; } +static inline int wHeight(enum win w) { return (window[w].height > 0 ? 0 : LINES) + window[w].height; } +static inline int wWidth (enum win w) { return (window[w].width > 0 ? 0 : COLS ) + window[w].width ; } + +extern int minheight, minwidth; +extern int topy; |