// Source: menus.h // Author: Michele Estebon // Date: 12/3/96/96 // For: CS1704: Introduction to Data Structures and Software Design // Last revision: 12/3/96 /************************************************************************ Menuing functions and declarations using curses windows functions Provides functions to create and manipulate menus. *************************************************************************/ #ifndef MENUS_H #define MENUS_H #include "curses.h" #include "globals.h" #include "bool.h" /*-- TYPE DEFINITIONS --------------------------------------------------*/ typedef int itemkey; typedef struct item *items; typedef struct item{ string name; int pos; itemkey key; items up; items down; } ; typedef struct mainitem *menus; typedef struct mainitem { menus rt; menus lt; item sub; int itemcnt; winptr window; } ; /*-- CONSTANTS ---------------------------------------------------------*/ /*-- KEYS -----------------*/ #define KEYRETURN 0x0D // ENTER key const int KEYUP = 75; // up arrow const int KEYDN = 77; // down arrow const int KEYLT = 80; // left arrow const int KEYRT = 72; // right arrow const int BKSP = 8; // fix this! /*-- MENU ITEMS -----------*/ const char FORCEQUIT = 'x'; const char menufile[] = "menu.ini"; const int MAXCHAR = 13; // max length of menu item string const int FIRSTyPOS = 1; ; const char TERM = '.'; const char DIVIDER = '-'; const int MWIDTH = MAXCHAR+2; #define NO_OPTIONS "No options are available." const int SEEPOS = 61; /*-- KEY OPTION VALUES ----*/ const char PROGCH = 'P'; const char LPROGCH = 'p'; const int PROG = 1; const int ABOUT = 2; const int HELP = 3; const char FILECH = 'F'; const char LFILECH = 'f'; const int FILE = 4; const int NEW = 5; const int OPEN = 6; const int SAVE = 7; const int SAVEAS = 8; const int CLOSE = 9; const int QUIT = 10; const char EDITCH = 'E'; const char LEDITCH = 'e'; const int EDIT = 11; const int UNDO = 12; const int REDO = 13; const int ADD = 14; const int DELETE = 15; const int MNAME = 16; const int MLABEL = 17; const int MTYPE = 18; const char VIEWCH = 'V'; const char LVIEWCH = 'v'; const int VIEW = 19; const int DESCR = 20; const int CODEINFO = 21; const int BACK = 22; const int ROOT = 23; const int INDEX = 24; const char SEECH = 'S'; const char LSEECH = 's'; const int SEE = 25; const int NOCOM = 99; const int NO_OPT = 99; /*-- FUNCTION PROTOTYPES --------------------------------------------------*/ int menumode( menus menulist, int key, winptr &mainwin, winptr &IOwin ); Boolean InitMenus( winptr &mainwin, menus &menulist, winptr &menubar ); void Resetmwin( menus &currmenu ); void ActivateMenu( winptr &menuwin ); void DestroyMenus( menus &menulist ); void CustomMenu( winptr &newmenu, int length); /*-------------------------------------------------------------------------*/ #endif