// Main Function void _main(void) { HANDLE handle = PopupNew ("EXAMPLE", 40); PopupAddText (handle, -1, "Option 1", 1); PopupAddText (handle, -1, "Option 2", 2); PopupAddText (handle, 0, "Submenu 3", 3); PopupAddText (handle, 0, "Submenu 4", 4); PopupAddText (handle, -1, "Option 5", 5); PopupAddText (handle, 3, "Suboption 3.1", 6); PopupAddText (handle, 3, "Suboption 3.2", 7); PopupAddText (handle, 3, "Suboption 3.3", 8); PopupAddText (handle, 4, "Suboption 4.1", 9); HANDLE exec_handle = PopupBegin (handle, 0); MenuCheck (exec_handle, 2, MC_CHECK); MenuCheck (exec_handle, 5, MC_FLIP); short result = PopupBeginDo (exec_handle, CENTER, CENTER, 0); push_longint (result); MenuEnd (exec_handle); }
// Main Function void _main(void) { HANDLE menu_handle = MenuNew (2, 240, 18); MenuAddText (menu_handle, 0, "First", 1, DMF_TOP_SUB); MenuAddText (menu_handle, 1, "Subitem 1.1", 5, DMF_CHILD_SUB); MenuAddText (menu_handle, 5, "Subitem 1.1.1", 8, DMF_CHILD_SUB); MenuAddText (menu_handle, 5, "Subitem 1.1.2", 9, DMF_CHILD); MenuAddText (menu_handle, 8, "Subitem 1.1.1.1", 10, DMF_CHILD); MenuAddText (menu_handle, 1, "Subitem 1.2", 6, DMF_CHILD); MenuAddText (menu_handle, 0, "Second", 2, DMF_TOP_SUB); MenuAddText (menu_handle, 2, "Subitem 2.1", 7, DMF_CHILD); MenuAddText (menu_handle, -1, "Third", 3, DMF_TOP); MenuAddText (menu_handle, -1, "Fourth", 4, DMF_TOP); HANDLE exec_handle = MenuBegin (NULL, 0, 0, MBF_HMENU, menu_handle); short result; do { result = MenuKey (exec_handle, ngetchx ()); } while (result == M_NOTMENUKEY); MenuEnd (exec_handle); MenuUpdate (); push_shortint (result); }
/****************************************************************** * Function: TopMenu * * Purpose: Generates the top level menu. * ******************************************************************/ static int TopMenu( void ) { char ch; /* Print the top-level menu to stdout */ while (1) { MenuBegin(" Memory Test Main Menu"); MenuItem( 'a', "Test RAM" ); MenuItem( 'b', "Test Flash"); ch = MenuEnd( 'a', 'b' ); switch(ch) { MenuCase('a',TestRam()); MenuCase('b',TestFlash(TEST)); MenuCase('e',FlashErase()); /* hidden option */ MenuCase('m',TestFlash(SHOWMAP)); /* hidden option */ } if (ch == 'q') break; } return (ch); }
/* menu start menu [up|down|right|left] menu enter menu exit */ void MonitorMenu(void) { // int x, y; if (!stricmp(argv[1], "?")) { Puts("\n === Help for MENU command ==="); Puts("\nmenu start ;start main menu"); Puts("\nmenu [up|down|right|left] ;menu arrow key"); Puts("\nmenu enter ;enter key"); Puts("\nmenu exit ;exit key"); return; } if (argc != 3) { //Puts("\nmenu x y"); if (TaskGetGrid()) { if (!stricmp(argv[1], "up")) { TaskSetGridCmd(NAVI_KEY_UP); } else if (!stricmp(argv[1], "down")) { TaskSetGridCmd(NAVI_KEY_DOWN); } else if (!stricmp(argv[1], "left")) { TaskSetGridCmd(NAVI_KEY_LEFT); } else if (!stricmp(argv[1], "right")) { TaskSetGridCmd(NAVI_KEY_RIGHT); } else if (!stricmp(argv[1], "enter")) { TaskSetGridCmd(NAVI_KEY_ENTER); } return; } if (MenuGetLevel()) { if (!stricmp(argv[1], "up")) { MenuKeyInput(NAVI_KEY_UP); } else if (!stricmp(argv[1], "down")) { MenuKeyInput(NAVI_KEY_DOWN); } else if (!stricmp(argv[1], "left")) { MenuKeyInput(NAVI_KEY_LEFT); } else if (!stricmp(argv[1], "right")) { MenuKeyInput(NAVI_KEY_RIGHT); } else if (!stricmp(argv[1], "enter")) { MenuKeyInput(NAVI_KEY_ENTER); } } if (!stricmp(argv[1], "start")) { Printf("\ncall MenuStart"); //proc_home_menu_start(); MenuStart(); } else if (!stricmp(argv[1], "exit")) { Printf("\ncall MenuEnd"); MenuEnd(); } else if (!stricmp(argv[1], "test1")) { //draw 1bpp FOSD Palette //environmemt // w ff 3 // b 8a 0c 66 40 // fosd dnfont 0 // DumpFontOsdPalette(); } else if (!stricmp(argv[1], "test2")) { //FOSD FIFO test. Test16x32FontSet(); } else if (!stricmp(argv[1], "test3")) { TestUpper256Char(); } else if (!stricmp(argv[1], "test4")) { TestMultiBPP4(); } else if (!stricmp(argv[1], "test5")) { TestNum1BPP3BPP(); } else if (!stricmp(argv[1], "main1")) { TestMainMenuImage(1); } else if (!stricmp(argv[1], "main2")) { TestMainMenuImage(2); } else if (!stricmp(argv[1], "main3")) { TestMainMenuImage(3); } return; } // x=a2h(argv[1]); // y=a2h(argv[2]); // Printf("\n ECHO: menu x:%d y:%d", x,y); // MenuCheckTouchInput(x,y); }