home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boldly Go Collection
/
version40.iso
/
TS
/
17A
/
DRWIN101.ZIP
/
MENUTIL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-13
|
3KB
|
67 lines
#ifndef __MENUTIL_H
#define __MENUTIL_H
#include "wutil.h" /*windowing stuff*/
#define HOTKEY '&'
#define WND_ATTR ATTR(CYAN,BLUE)
#define BRD_ATTR ATTR(WHITE,BLUE)
#define SEL_ATTR ATTR(YELLOW,MAGENTA)
#define HOT_ATTR ATTR(WHITE,BLUE)
typedef enum { /*menu types*/
MEN_VERTICAL=0, /*vertical list of selections*/
MEN_HORIZONTAL, /*horizontal list of selections*/
MEN_LAST
} MENU_TYPE;
enum MENU_RETURNS { /*return codes for menu functions*/
MEN_ERROR=-1, /*some fatal error occurred*/
MEN_ALLOC=-2, /*memory allocation error*/
MEN_ESC=-3, /*ESC was pressed to exit menu*/
MEN_LASTCODE /*dummy placeholder*/
}; /*return codes*/
enum MENU_FLAGS { /*flags for menus...*/
MEN_NONE =0, /*nothing special*/
MEN_CLOSE =0x0001, /*close menu after select*/
MEN_NEXT =0x0002, /*go to next selection after select*/
MEN_SKIP =0x0004 /*skip this selection (not used)*/
}; /*menu flags*/
typedef struct MENU_DESC_s {
struct MENU_LIST_s {
char* str; /*selctor string*/
void (*fun)(struct MENU_DESC_s*); /*function to call upon selection*/
WORD flags; /*auto-close flag*/
char hot; /*hotkey -- set by menu handler*/
} *menu_list;
char *title; /*title of menu*/
WORD border; /*border selection=0,1,2*/
WORD row; /*first row of menu window*/
WORD col; /*first column of menu window*/
WORD wid; /*width of window*/
WORD wnd_attr; /*unselected attribute*/
WORD brd_attr; /*border/title attribute*/
WORD sel_attr; /*selected attribute*/
WORD hot_attr; /*hot-key attribute*/
WORD cur; /*current selection*/
MENU_TYPE typ; /*menu type*/
WORD siz; /*number of selections*/
WIND* w; /*holds window opened by menu func*/
} MENU_DESC; /*menu descriptor*/
typedef struct MENU_LIST_s MENU_LIST; /*typecast for use w/o struct*/
int menshow(MENU_DESC* md); /*re-draw menu*/
int menvert(MENU_DESC* md); /*vertical menu*/
#endif /*if not already #included*/