home *** CD-ROM | disk | FTP | other *** search
- #include "menu.h"
- int menu_func();
-
- POPUP_MENU_ENTRY menu_items[] = {
- " Load F3", /* entry name */
- 1, /* row number */
- 'L', /* hotkey */
- F3, /* secondary hotkey */
- menu_func, /* function to call
- if chosen */
-
- /* now do rest of the popup entries */
- " Pick Alt-F3",2, 'P',ALTF3,menu_func,
- " New" ,3, 'N',0,menu_func,
- " Save F2",4, 'S',F2,menu_func,
- " Write to ",5, 'W',0,menu_func,
- " Directory ",6, 'D',0,menu_func,
- " Change Dir" ,7, 'C',0,menu_func,
- " OS shell" ,8, 'O',0,menu_func,
- " Quit Alt-X" ,9,'Q',ALTX,menu_func,
-
- /* Terminate with a CWL_NULL and 0 */
-
- CWL_NULL,0};
- unsigned int menu_colors[5];
- POPUP_MENU_PTR p;
-
- main()
- {
- WindowInitializeSystem();
- WindowSaveInitial(0); /* Remember to save the initial screen */
- /* define colors */
- menu_colors[ENTRYCOLOR] = CREATE_VIDEO_ATTRIBUTE(white,black);
- menu_colors[BORDERCOLOR] = CREATE_VIDEO_ATTRIBUTE(white,black);
- menu_colors[HOTKEYCOLOR] = CREATE_VIDEO_ATTRIBUTE(white,blue);
- menu_colors[HIGHLIGHTCOLOR] = CREATE_VIDEO_ATTRIBUTE(cyan,black);
- menu_colors[UNAVAILCOLOR] = CREATE_VIDEO_ATTRIBUTE(white,black);
-
- /* create a POPUP_MENU_PTR */
- p = PopupCreateMenu(menu_items,menu_colors, 1,1,6,WNULLFN,VWNULLFN);
- PopupSetOptions(p,POPUPSTATIC,1);
- PopupSelectMenu(p, /* POPUP_MENU_PTR */
- 1, /* rank of popup window */
- 1 /* menu entry to start on */
- );
- }
-
-
- int menu_func(POPUP_MENU_PTR p, int which)
- {
- WPOINTER w;
- w = WindowInitialize(BORDER,15,15,40,4,CREATE_VIDEO_ATTRIBUTE(black,white),
- CREATE_VIDEO_ATTRIBUTE(black,white), SINGLEBOX);
- WindowOpen(w);
- WindowClear(w);
- WindowPrintf(w,"You have selected %s",menu_items[which-1].entry_name);
- WindowWriteCenterString(w,"Press a key to continue",3);
- WindowDisplay(w,1,NOEFFECT);
- GET_KEY();
- WindowFree(w,NOEFFECT);
- if (which == 9)
- return POPUP_EXIT;
- else
- return POPUP_CONTINUE;
- }
-