home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************/
- /* File Id. Ldemo.C */
- /* Author. Stan Milam. */
- /* Date Written 05/30/89. */
- /* */
- /* Comments: This is really a hack! I took the test code */
- /* changed it around a little and integrated into a larger*/
- /* program. Does not check for errors so beware! */
- /**********************************************************/
-
- #include <stdio.h>
- #include <pcwproto.h>
- #include <menu.h>
-
- /* First set up arrays of type LMNUFLDS */
-
- static LMNUFLDS menu1[] = {
- { 'A', 2, "Add", "Add An Entry"},
- { 'H', 15, "C(h)ange", "Change An Entry"},
- { 'D', 30, "Delete", "Delete An Entry"},
- { NULL, NULL, NULL, NULL}
- };
-
- static LMNUFLDS menu2[] = {
- { 'S', 2, "Search", "Search For An Entry"},
- { 'F', 16, "First", "First Entry In Index"},
- { 'L', 33, "Last", "Last Entry In Index"},
- { NULL, NULL, NULL, NULL}
- };
-
- static LMNUFLDS menu3[] = {
- { 'M', 2, "Methodology", "Multicam & Excelerator"},
- { 'P', 15, "Pascal", "Pascal Programming Environment"},
- { 'C', 23, "C Language", "C Programming Environment"},
- { 'I', 35, "ITI", "ITI Mainframe Commnuications"},
- { NULL, NULL, NULL, NULL}
- };
-
- static LMNUFLDS exit_menu[] = {
- { 'E', 2, "Exit", "Esc or Right Mouse Key - Exit"},
- { NULL, NULL, NULL, NULL}
- };
-
- /* Now create an array of pointers back to our menus */
-
- static LMNUFLDS *menus[] = {menu1, menu2, menu3, exit_menu, NULL};
-
- /**********************************************************/
- /* LMNUTYPE is a structure that contains information for */
- /* makelmenu() & lmenuinput(). It contains a pointer to a*/
- /* window, window parameters, titles....and finally a */
- /* pointer to an array of pointers of LMNUFLDS. */
- /**********************************************************/
-
- static LMNUTYPE l_menu = {
- NULL, /* For Window Pointer */
- 15,20,18,60, BLUE,LIGHTGRAY, /* Window parms */
- DOUBLEALL, RED,LIGHTGRAY, /* Border Parms */
- " A Sorta Lotus Menu ", /* The window title */
- TOP, LEFT, BLACK,LIGHTGRAY, /* Where title & color */
- WHITE,BLUE, /* Selection bar color */
- 0,0, /* Which menu & item */
- menus /* Point back to menus */
- };
-
- static char *choices[] = {
- "Add", "Change", "Delete", /* A table of messages */
- "Search", "First", "Last",
- "Methodology", "Pascal",
- "C Langauge", "ITI"
- };
-
- static char *instructions[] = { /* Some instructions */
- "To use this menu you may use the arrow keys, PgUp, PgDn,",
- "Home and the End keys. More than one menu may be stacked",
- "into one window, therefore, you may page through them.",
- "Arrow to your selection and press enter, or use the hot",
- "character (usually the first character of the selection)",
- "or use the Mouse. You may use the Mouse to page through",
- "the menus by clicking on the arrows at either side of",
- "the menu. Play with it .... it will suprise you! ",
- NULL
- };
-
- int lmenu_demo(void) {
-
- char select = 0;
- int index, mxr, mxc;
- WNDPTR *menuwnd, *savewnd, *iwnd;
-
- chk_video_state(&mxr, &mxc);
- savewnd = wpush(1,1,mxr,mxc); /* Save entire screen */
- bordercolor(BLUE, LIGHTGRAY);
- titlecolor(RED,LIGHTGRAY);
- iwnd = wexplode(2,10,13,70,BLACK,LIGHTGRAY);
- wtitle(iwnd,TOP,RITE," Lmenu Instructions ");
- w_block_write(iwnd, 2, CENTER, instructions);
- qputs(20, 30, WHITE, RED,"Your Choice: "); /* Message line */
- menuwnd = makelmenu(&l_menu); /* Draw the menu */
- while (select != 27 && select != 'E') {
- select = lmenuinput(&l_menu); /* Get return val from menu */
- switch(select) { /* Make a decision */
- case 'A' : index = 0; break; /* About our index to */
- case 'H' : index = 1; break; /* Message table */
- case 'D' : index = 2; break;
- case 'S' : index = 3; break;
- case 'F' : index = 4; break;
- case 'L' : index = 5; break;
- case 'M' : index = 6; break;
- case 'P' : index = 7; break;
- case 'C' : index = 8; break;
- case 'I' : index = 9; break;
- default : continue;
- }
- qhchar(20,43,LIGHTGRAY,BLUE,176,37); /* Clear prev message */
- qputs(20,43,BLUE,LIGHTGRAY,choices[index]); /* Write new one */
- }
-
- if (mpresent) { /* If rat home */
- hide_mouse(); /* Hide it */
- }
- iwnd = wpop(iwnd); /* Remove instructions */
- menuwnd = wpop(menuwnd);
- savewnd = wpop(savewnd); /* Remove trash */
- return(0);
- }
-