MENUPAN* menuvisual_create(void) { MENU *menu; MENUPAN *menupan; const char *choices[] = { "Visualizza tabella", NULL, NULL, }; const char *desc[] = { "M-t", NULL, NULL, }; menu=menu_create(choices, desc, 0); menupan=menu_pan_create(menu, 1, 2*ISIZE+1, 2); post_menu(menu); return menupan; }
MENUPAN* menulpr_create(void) { MENU *menu; MENUPAN *menupan; const char *choices[] = { "Cambia path db", SEP, "Esci", }; const char *desc[] = { "M-p", DSEP, "M-x", }; menu=menu_create(choices, desc, A_SIZE(choices)); menupan=menu_pan_create(menu, 1, 1, 0); post_menu(menu); return menupan; }
/* display current menu */ void display_menu() { int rows, cols, begin_y, begin_x; /* setup menu options */ menu_opts_off(menu_ptr, O_ROWMAJOR); set_menu_fore(menu_ptr, COLOR_PAIR(MENU_PAIR) | A_STANDOUT); set_menu_back(menu_ptr, COLOR_PAIR(MENU_PAIR) | A_DIM | A_NORMAL); /* setup appropriate windows */ set_menu_win(menu_ptr, stdscr); scale_menu(menu_ptr, &rows, &cols); /* locate menu in the center */ getmaxyx(stdscr,LINES,COLS); begin_y = (LINES-rows) / 2; begin_x = (COLS-cols) / 2; /* create main menu window */ sub_window = subwin(stdscr, rows, cols, begin_y, begin_x); set_menu_sub(menu_ptr, sub_window); /* display the menu */ post_menu(menu_ptr); refresh(); }
MENUPAN* menucerca_create(void) { MENU *menu; MENUPAN *menupan; const char *choices[] = { "Cerca per Orario", "Cerca per Docente", "Cerca per Aula", "Cerca per Materia" }; const char *desc[] = { "M-o ", "M-d ", "M-a ", NULL }; menu=menu_create(choices, desc, A_SIZE(choices)); menupan=menu_pan_create(menu, 1, 3*ISIZE+1, 3); post_menu(menu); return menupan; }
int main() { initscr(); start_color(); ITEM *menuitems[6]; MENU *menubar; WINDOW *win,*sub_win; int i,rows,cols; //initcolor(); menuitems[0]=new_item("File",""); menuitems[1]=new_item("Edit",""); menuitems[2]=new_item("Options",""); menuitems[3]=new_item("Window",""); menuitems[4]=new_item("Help",""); menuitems[5]=NULL; //menu_opts_off(menubar,O_ROWMAJOR); menubar=new_menu(menuitems); scale_menu(menubar,&rows,&cols); win=newwin(rows+2,cols+2,2,5); box(win,179,196); sub_win=derwin(win,rows,cols,1,1); set_menu_win(menubar,win); set_menu_sub(menubar,sub_win); post_menu(menubar); wrefresh(win); wgetch(sub_win); unpost_menu(menubar); free_menu(menubar); for(i=0;i<6;i++) free_item(menuitems[i]); endwin(); }
MENUPAN* menuhelp_create(void) { MENU *menu; MENUPAN *menupan; const char *choices[] = { "Help", SEP, "About", NULL, }; const char *desc[] = { "M-h", DSEP, NULL, }; menu=menu_create(choices, desc, A_SIZE(choices)); menupan=menu_pan_create(menu, 1, 4*ISIZE+1, 4); post_menu(menu); return menupan; }
MENU* workspace_create(void) { MENU *menu; const char *choices[] = { "Lpr ", "Edita ", "Visualizza ", "Cerca ", "Help " , }; const char *desc[] = { NULL, NULL, NULL, NULL, NULL, }; menu=menu_create(choices, desc, A_SIZE(choices)); set_menu_format(menu, 1, A_SIZE(choices)); set_menu_fore(menu, COLOR_PAIR(1) | A_REVERSE); set_menu_back(menu, COLOR_PAIR(1)); post_menu(menu); return menu; }
MENUPAN* menuedita_create(void) { MENU *menu; MENUPAN *menupan; const char *choices[] = { "Inserisci Record", "Edita Record", "Elimina Record", }; const char *desc[] = { "M-i", "M-e", "M-c ", }; menu=menu_create(choices, desc, A_SIZE(choices)); menupan=menu_pan_create(menu, 1, ISIZE+1, 1); post_menu(menu); return menupan; }
void printMenus() { int i; MENU *fileMenu, *dirMenu; // Create items fileItems = malloc(numFiles * sizeof(ITEM *)); for (i = 0; i < numFiles; i++) { fileItems[i] = new_item(fileEntries[i]->d_name, NULL); if (fileItems[i] == NULL) break; } fileItems[numFiles] = NULL; dirItems = malloc(numDirs * sizeof(ITEM *)); for (i = 0; i < numDirs; i++) { dirItems[i] = new_item(dirEntries[i]->d_name, NULL); if (dirItems[i] == NULL) break; } dirItems[numDirs] = NULL; // Create menus fileMenu = new_menu(fileItems); dirMenu = new_menu(dirItems); menus = malloc(2 * sizeof(MENU *)); menus[0] = fileMenu; menus[1] = dirMenu; if (fileMenu == NULL || dirMenu == NULL) { fprintf(stderr, "Error creating menus\n"); } // Associate windows and menus set_menu_win(fileMenu, cursesWins[0]); set_menu_sub(fileMenu, derwin(cursesWins[0], LINES / 2, (COLS / 2) - 6, 3, 1)); set_menu_format(fileMenu, (LINES / 2), 1); set_menu_win(dirMenu, cursesWins[1]); set_menu_sub(dirMenu, derwin(cursesWins[1], LINES / 2, (COLS / 2) - 6, 3, 1)); set_menu_format(dirMenu, (LINES / 2), 1); post_menu(fileMenu); wrefresh(cursesWins[0]); post_menu(dirMenu); wrefresh(cursesWins[1]); }
void show_chooser_win(MENU *dirmenu, size_t items, char *buf) { int c = 0; size_t buflen, offset = 0; char *tmp; buflen = strlen(buf) - 1; set_menu_fore(dirmenu, A_REVERSE); returnval = set_menu_format(dirmenu, LINES, 1); post_menu(dirmenu); refresh(); while ((c = getch()) != 'q') { switch(c) { case 'j': case KEY_DOWN: menu_driver(dirmenu, REQ_DOWN_ITEM); break; case 'k': case KEY_UP: menu_driver(dirmenu, REQ_UP_ITEM); break; case KEY_NPAGE: menu_driver(dirmenu, REQ_SCR_DPAGE); break; case KEY_PPAGE: menu_driver(dirmenu, REQ_SCR_UPAGE); break; case KEY_END: menu_driver(dirmenu, REQ_LAST_ITEM); break; case KEY_HOME: menu_driver(dirmenu, REQ_FIRST_ITEM); break; case 10: /* Enter */ move(20, 0); clrtoeol(); tmp = (char *)item_name(current_item(dirmenu)); offset = strlcpy(buf, tmp, MAX_CHOICESIZE); if (offset >= MAX_CHOICESIZE) goto toolong; if (strlcpy(buf + offset, item_description(current_item(dirmenu)), MAX_CHOICESIZE - offset)) goto toolong; pos_menu_cursor(dirmenu); break; } } toolong: unpost_menu(dirmenu); fprintf(stdout, "shit happens\n"); fprintf(stdout, "VALUE WAS: %d\n", returnval); }
int mainmenu(int height, int width) { int ret; ITEM **menu_items; MENU *main_menu; int n_choices, i; clean_main_menu(); build_main_menu(instance_path); n_choices = menu_size; menu_items = (ITEM **) calloc(n_choices + 1, sizeof (ITEM *)); for (i = 0; i < n_choices; ++i) { menu_items[i] = new_item(menu_values[i], menu_values[i]); set_item_userptr(menu_items[i], (void *) menu_selected); } menu_items[n_choices] = (ITEM *) NULL; main_menu = new_menu((ITEM **) menu_items); menu_opts_off(main_menu, O_SHOWDESC); set_menu_sub(main_menu, derwin(stdscr, 10, 50, 6, 10)); post_menu(main_menu); attron(A_BOLD); mvprintw(0, 0, name); mvprintw(0, width - strlen(vers), vers); attroff(A_BOLD); refresh(); pos_menu_cursor(main_menu); while ((i = getch()) != KEY_F(4)) { switch (i) { case KEY_DOWN: menu_driver(main_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(main_menu, REQ_UP_ITEM); break; case 10: { ITEM *cur; int (*p)(char *); cur = current_item(main_menu); p = (int (*)(char *))item_userptr(cur); ret = p((char *) item_name(cur)); pos_menu_cursor(main_menu); goto menu_sel; } } } if (i == KEY_F(4)) { ret = menu_size - 1; } menu_sel: unpost_menu(main_menu); free_menu(main_menu); for (i = 0; i < n_choices; ++i) free_item(menu_items[i]); return ret; }
int main(int argc, char const *argv[]) { ITEM **my_items; int c; MENU *my_menu; WINDOW *my_menu_win; int n_choices, i; initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); init_pair(1, COLOR_RED, COLOR_BLACK); n_choices = ARRAY_SIZE(choices); my_items = (ITEM **) calloc(n_choices, sizeof(ITEM *)); for (i = 0; i < n_choices; ++i) my_items[i] = new_item(choices[i], choices[i]); my_menu = new_menu((ITEM **) my_items); my_menu_win = newwin(10, 40, 4, 4); keypad(my_menu_win, TRUE); set_menu_win(my_menu, my_menu_win); set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1)); set_menu_mark(my_menu, " * "); box(my_menu_win, 0, 0); print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1)); mvwaddch(my_menu_win, 2, 0, ACS_LTEE); mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38); mvwaddch(my_menu_win, 2, 39, ACS_RTEE); mvprintw(LINES - 2, 0, "F1 to exit"); refresh(); post_menu(my_menu); wrefresh(my_menu_win); while ((c = wgetch(my_menu_win)) != KEY_F(1)) { switch (c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; } wrefresh(my_menu_win); } unpost_menu(my_menu); free_menu(my_menu); for (i = 0; i < n_choices; ++i) free_item(my_items[i]); endwin(); return 0; }
int generic_menu::get_choice() { if (choices.size() == return_values.size()) { //create the menu and the item pointer vector MENU* my_menu; std::vector<ITEM*> my_items; WINDOW* menu_win = derwin(screen, choices.size(), 30, ypos, xpos); ITEM* cur = NULL; for (int x = 0; x < choices.size(); x++) { //populate the items vector with the string data in choices //c_str because ncurses is very old my_items.push_back(new_item(choices.at(x).c_str(), NULL)); } //pushback a null item for safety my_items.push_back((ITEM*)NULL); //create the menu and attach the items my_menu = new_menu((ITEM**)my_items.data()); //print the desc and post the menu mvwprintw(screen, LINES - 3, 0, "%s\n", desc.c_str()); //set_current_item(my_menu, lastItem); set_menu_win(my_menu, menu_win); keypad(menu_win, TRUE); post_menu(my_menu); touchwin(screen); wrefresh(menu_win); std::vector<int>::iterator return_iter = return_values.begin(); int c = 0; while((c = wgetch(menu_win)) != '\n') { touchwin(screen); wrefresh(menu_win); switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); if (return_iter != return_values.end()) { return_iter++; } break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); if (return_iter != return_values.begin()) { return_iter--; } break; } } unpost_menu(my_menu); for (int x = 0; x < my_items.size(); x++) { free_item(my_items[x]); } free_menu(my_menu); return *return_iter; } }
void displayMenu(int y, int x, char title[],int numOfOpt, char *options[], void (*p[])(void)){ int i,c; WINDOW *menuWindow; MENU *myMenu; ITEM **myOptions; ITEM *currentOption; initscr(); noecho(); cbreak(); keypad(stdscr,TRUE); init_pair(1,COLOR_CYAN,COLOR_BLACK); myOptions=(ITEM **)calloc(numOfOpt+1,sizeof(ITEM *)); for(i=0;i<numOfOpt;i++){ myOptions[i]=new_item(options[i]," "); set_item_userptr(myOptions[i],p[i]); } myOptions[numOfOpt]=(ITEM *)NULL; myMenu=new_menu(myOptions); menuWindow = newwin(8,20,(LINES-y)/2,(COLS-x)/2); keypad(menuWindow,TRUE); set_menu_win(myMenu,menuWindow); set_menu_sub(myMenu, derwin(menuWindow,y-4,x-2,3,1)); set_menu_format(myMenu,numOfOpt,1); menu_opts_off(myMenu, O_SHOWDESC); set_menu_mark(myMenu," * "); post_menu(myMenu); wrefresh(menuWindow); while((c=wgetch(menuWindow))!=KEY_F(2)){ switch(c){ case KEY_UP: menu_driver(myMenu,REQ_UP_ITEM); break; case KEY_DOWN: menu_driver(myMenu,REQ_DOWN_ITEM); break; case 10:{ ITEM *temp; temp=current_item(myMenu); void(*pointer)(void); pointer=item_userptr(temp); pointer(); pos_menu_cursor(myMenu); menu_driver(myMenu,REQ_DOWN_ITEM); break; } wrefresh(menuWindow); } } /*unpost_menu(myMenu);*/ /*for(i=0;i<numOfOpt;++i){*/ /*free_item(myOptions[i]);*/ /*}*/ /*free_menu(myMenu);*/ /*free(optionsNumbers);*/ }
int main() { ITEM **my_items; int c; MENU *my_menu; int n_choices, i; ITEM *cur_item; initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); n_choices = ARRAY_SIZE(choices); my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); for(i = 0; i < n_choices; ++i) my_items[i] = new_item(choices[i], choices[i]); my_items[n_choices] = (ITEM *)NULL; my_menu = new_menu((ITEM **)my_items); post_menu(my_menu); refresh(); while((c = getch()) != KEY_F(1)) { switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; case 10: /* Enter */ cur_item = current_item(my_menu); move(LINES - 2, 0); clrtoeol(); mvprintw(LINES - 2, 0, "You have chosen %d item with name %s and description %s", item_index(cur_item) + 1, item_name(cur_item), item_description(cur_item)); refresh(); pos_menu_cursor(my_menu); break; } } free_item(my_items[0]); free_item(my_items[1]); free_menu(my_menu); endwin(); }
/* void updateBuddyList(){ int i; for(i = 1; i <= buddy_count; i++){ char *s = (char *)malloc(100*sizeof(char)); memset(s, '\0', 100); s = strncpy(s, buddies[i].nick, strlen(buddies[i].nick)); strcat(s, "@"); strcat(s, buddies[i].ip); items[i] = new_item(s, ""); } unpost_menu(buddy_menu); post_menu(buddy_menu); //s = strdup(buddies[i].nick); //set_menu_items(buddy_menu, items); wrefresh(buddy_win); char c; while((c = wgetch(buddy_win)) != KEY_F(1)) { switch(c) { case KEY_DOWN: menu_driver(buddy_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(buddy_menu, REQ_UP_ITEM); break; } } } */ void initBuddyList(){ //build list displayName int i; items = (ITEM **)calloc(252, sizeof(ITEM *)); items[0] = new_item("Group",""); for(i = 1; i <= buddy_count; i++){ char *s = (char *)malloc(100*sizeof(char)); memset(s, '\0', 100); s = strncpy(s, buddies[i].nick, strlen(buddies[i].nick)); strcat(s, "@"); strcat(s, buddies[i].ip); //s = strdup(buddies[i].nick); items[i] = new_item(s, ""); } for(i = 0; i < buddy_count; i++){ //printf(displayNames[i]); // items[i] = new_item(displayNames[i], displayNames[i]); // char *name = (char *)malloc(strlen(displayNames[i]) + 1); // name = strncpy(name, displayNames[i], strlen(displayNames[i])); // char *xxx = "Bonsoir"; // name[strlen(displayNames[i])] = '\0'; //name = strncpy(name, displayNames[i], strlen(displayNames[i])); // char *yyy = (char *)malloc(strlen(xxx) + 1); // yyy = strdup(xxx); // items[i] = new_item(yyy, ""); } // keypad(buddy_win, TRUE); buddy_menu = new_menu((ITEM **)items); set_menu_win(buddy_menu, buddy_win); set_menu_sub(buddy_menu, derwin(buddy_win, 0, 0, 0, 0)); //set_menu_sub(buddy_menu, buddy_win); post_menu(buddy_menu); wrefresh(buddy_win); refresh(); /* char c; while((c = wgetch(buddy_win)) != KEY_F(1)) { switch(c) { case KEY_DOWN: menu_driver(buddy_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(buddy_menu, REQ_UP_ITEM); break; } wrefresh(buddy_win); }*/ }
void NCRowMenu::setup() { wbkgd(getWindow(),COLOR_PAIR(2)); ITEM **my_items; MENU *my_menu; WINDOW *my_menu_win; int i; my_items = (ITEM **) calloc(choices.size()+2, sizeof(ITEM *)); for(i = 0; i < choices.size(); ++i) my_items[i] = new_item(choices[i].c_str(), "NULL"); my_menu = new_menu((ITEM **) my_items); set_menu_grey(my_menu, COLOR_PAIR(2)); set_menu_fore(my_menu, COLOR_PAIR(2)); set_menu_back(my_menu, COLOR_PAIR(2)); menu_opts_off(my_menu, O_SHOWDESC); my_menu_win = getWindow(); keypad(my_menu_win, FALSE); /* Set main window and sub window */ set_menu_win(my_menu, my_menu_win); //set_menu_sub(my_menu, derwin(my_menu_win, 10, 150, 3, 1)); set_menu_format(my_menu, 1, 10); set_menu_mark(my_menu, " "); //box(my_menu_win, 0, 0); //wbkgdset(getWindow(), COLOR_PAIR(2)); //wrefresh(getWindow()); wrefresh(stdscr); refresh(); /* Post the menu */ post_menu(my_menu); wrefresh(my_menu_win); //setBorder(0, 0); }
void column_select_update_menu(ui_t *ui) { // Get panel information column_select_info_t *info = column_select_info(ui); ITEM *current = current_item(info->menu); int top_idx = top_row(info->menu); // Remove the menu from the subwindow unpost_menu(info->menu); // Set menu items set_menu_items(info->menu, info->items); // Put the menu agin into its subwindow post_menu(info->menu); // Move until the current position is set set_top_row(info->menu, top_idx); set_current_item(info->menu, current); }
int main(int argc, char *argv[]) { int ch; initscr(); atexit(quit); clear(); noecho(); curs_set(0); nl(); keypad(stdscr, TRUE); it = (ITEM **)calloc(5, sizeof(ITEM *)); it[0] = new_item("M1", ""); it[1] = new_item("M2", ""); it[2] = new_item("M3", ""); it[3] = new_item("Ende", ""); it[4] = 0; me = new_menu(it); post_menu(me); mvaddstr(7, 3, "Programm mittels Menü oder F2-Funktionstaste beenden"); refresh(); while ((ch = getch()) != KEY_F(2)) { switch (ch) { case KEY_DOWN: menu_driver(me, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(me, REQ_UP_ITEM); break; case 0xA: if (item_index(current_item(me)) == 3) { exit(0); } break; } } return 0; }
/* glue items to menu and post menu */ static void display_menu(smsgloader *_this) { int rows,cols; VERBOSE_DEBUGPR("displaying scom menu requested\n"); if(_this->loadmenu) { DEBUGPR("Error!!!!! loadmenu already dsiplayed??\n"); return; } _this->loadmenu=new_menu(_this->loaditems); scale_menu(_this->loadmenu,&rows,&cols); wresize(_this->msgloaderwin,rows+5,cols+5); box(_this->msgloaderwin,0,0); wprintw(_this->msgloaderwin,"(%s)",SCOMMENU_TOGGLE_STR); set_menu_win(_this->loadmenu,_this->msgloaderwin); _this->derwin=derwin(_this->msgloaderwin,rows,cols,2,2); set_menu_sub(_this->loadmenu,_this->derwin); set_menu_mark(_this->loadmenu," * "); post_menu(_this->loadmenu); }
int main() { ITEM **my_items; int c; MENU *my_menu; int n_choices, i; ITEM *cur_item; initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); n_choices = ARRAY_SIZE(choices); my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *)); for(i = 0; i < n_choices; ++i) my_items[i] = new_item(choices[i], choices[i]); my_items[n_choices] = (ITEM *)NULL; my_menu = new_menu((ITEM **)my_items); mvprintw(LINES - 2, 0, "F1 to Exit"); post_menu(my_menu); refresh(); while((c = getch()) != KEY_F(1)) { switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; } } free_item(my_items[0]); free_item(my_items[1]); free_menu(my_menu); endwin(); }
int main() { initscr(); nonl(); raw(); noecho(); wclear(stdscr); MENU *menu; ITEM** i = item; menu = new_menu(); post_menu(menu); sleep(5); unpost_menu(menu); refresh(); free_menu(); while() free_item(); endwin(); exit(0); }
WINDOW *Napravi_menu(int *n_choices, ITEM **items, MENU *menu) { int i, height, width; WINDOW *menu_window; *n_choices = ARRAY_SIZE(choices); items = (ITEM **) calloc(*n_choices, sizeof(ITEM *)); for(i = 0; i < *n_choices; ++i) items[i] = new_item(choices[i], ""); menu = new_menu((ITEM **) items); height = 3; width = 9+7+6; menu_window = newwin(height, width, 16, COLS/2-width/2); //Validiraj_ncurses(keypad(menu_window, TRUE)); set_menu_win(menu, menu_window); set_menu_sub(menu, derwin(menu_window, height-1, width-1, 1, 1)); set_menu_mark(menu, ">"); set_menu_format(menu, 1, 7); menu_opts_off(menu, O_SHOWDESC); box(menu_window, 0, 0); post_menu(menu); Wrefresh(menu_window); return menu_window; }
/* * Create and initialize a new popup. popup_btn_action *must* be filled before * this call. * @param rows The number of rows for win_body * @param cols The number of lines for win_body * @param posy Position of the top left corner on the y axis * @param posx Position of the top left corner on the x axis * @param requests An array of strings to put in the form. This can be null: * only the title and the buttons will be present. * @param title A string to print in the popup. */ void popup_new(int rows, int cols, int posy, int posx, char **requests, char *title) { int i, cury = 0, curx = 1, tmp, nb_buttons, nb_fields; WINDOW *inner; win_body = newwin(rows, cols, posy, posx); assert(win_body != NULL && popup_btn_action != NULL); box(win_body, 0, 0); for (nb_buttons = 0; popup_btn_action[nb_buttons]; nb_buttons++); popup_items = malloc(sizeof(ITEM *) * (nb_buttons+1)); assert(popup_items != NULL); assert(popup_btn_action != NULL); for (i = 0; popup_btn_action[i]; i++) { popup_items[i] = new_item(popup_btn_action[i]->key, ""); assert(popup_items[i] != NULL); } popup_items[i] = NULL; popup_menu = new_menu(popup_items); win_menu = derwin(win_body, 3, cols-2, rows-4, 1); assert(popup_menu != NULL && win_menu != NULL); box(win_menu, 0, 0); set_menu_win(popup_menu, win_menu); set_menu_format(popup_menu, 1, nb_buttons); tmp = popup_menu->fcols * (popup_menu->namelen + popup_menu->spc_rows); tmp--; inner = derwin(win_menu, 1, tmp, 1, (cols-3-tmp)/2); assert(inner != NULL); set_menu_sub(popup_menu, inner); set_menu_mark(popup_menu, ""); assert(post_menu(popup_menu) == E_OK); mvwprintw(win_body, 1, 2, "%s", title); for (nb_fields = 0; requests && requests[nb_fields]; nb_fields++); if (nb_fields == 0) { popup_fields = NULL; popup_form = NULL; is_on_button = true; return; } popup_fields = malloc(sizeof(FIELD *) * (nb_fields+1)); assert(popup_fields != NULL); for (i = 0; i < nb_fields && requests[i]; i++) { if (i % 2 == 1) { popup_fields[i] = new_field(1, 41, cury, curx, 0, 0); assert(popup_fields[i] != NULL); set_field_buffer(popup_fields[i], 0, strdup(requests[i])); cury = cury+1; curx = 1; field_opts_on(popup_fields[i], O_ACTIVE); field_opts_on(popup_fields[i], O_EDIT); field_opts_off(popup_fields[i], O_STATIC); set_field_back(popup_fields[i], A_UNDERLINE); } else { popup_fields[i] = new_field(1, 45, cury, curx, 0, 0); assert(popup_fields[i] != NULL); set_field_buffer(popup_fields[i], 0, strdup(requests[i])); curx = strlen(requests[i]) + 2; field_opts_off(popup_fields[i], O_ACTIVE); field_opts_off(popup_fields[i], O_EDIT); } } popup_fields[i] = NULL; popup_form = new_form(popup_fields); assert(popup_form != NULL); win_form = derwin(win_body, rows-6, cols-2, 1, 1); assert(popup_form != NULL && win_form != NULL); assert(set_form_win(popup_form, win_form) == E_OK); int diff_rows = popup_form->cols - win_form->_maxx-2; /* * There isn't enough rows for the form so we resize win_body and * win_form to fit the form. * This resize isn't needed for the lines (as there is always fery few * of them). */ if (diff_rows > 0) { wresize(win_body, win_body->_maxy, win_body->_maxx + diff_rows); wresize(win_form, win_form->_maxy, win_form->_maxx - 2 + diff_rows); } inner = derwin(win_form, win_form->_maxy-2, win_form->_maxx, 2, 0); assert(inner != NULL); set_form_sub(popup_form, inner); assert(post_form(popup_form) == E_OK); is_on_button = false; set_menu_fore(popup_menu, A_NORMAL); // "hide" the button pos_form_cursor(popup_form); }
int main_menu(void) { MENU *my_menu = NULL; ITEM **my_items = NULL; struct tool_instance *list = NULL; const char *ret_msg = NULL; // Init at refresh for first loop. int c = 'R'; do { switch (c) { // Navigate in the menu case KEY_DOWN: case KEY_RIGHT: menu_driver(my_menu, REQ_DOWN_ITEM); break ; case KEY_UP: case KEY_LEFT: menu_driver(my_menu, REQ_UP_ITEM); break ; // Select a migration to monitor case ' ': case 13: // Enter key { if (item_count(my_menu) > 0) { ITEM *curitem = current_item(my_menu); if (view_instance(item_description(curitem)) != EXIT_SUCCESS) { ret_msg = "An error occured while trying to display the tool's data."; } } } // No break here to allow refreshing the list // when coming out of the instance display. // Refresh the list. case 'r': case 'R': if (list) clear_instance_list(list); list = get_instance_list(); if (list == NULL) mvprintw(0, 0, "cloudmig-view: No cloudmig tool is running at the moment.\n"); if (my_menu) clear_menu(my_menu, my_items); my_items = NULL; my_menu = NULL; if (fill_menu(list, &my_items, &my_menu)) return EXIT_FAILURE; post_menu(my_menu); break; // Leave the monitor case 'q': case 'Q': break ; // Ignore the others default: break ; } mvprintw(LINES - 4, 0, "Use <SPACE> or <ENTER> to select the process to monitor."); mvprintw(LINES - 3, 0, " <q> or <Q> to quit this program."); mvprintw(LINES - 2, 0, " <r> or <R> to see refresh the list manually."); if (ret_msg) { mvprintw(LINES -6, 0, "%.*s", COLS, ret_msg); ret_msg = NULL; } refresh(); } while ((c = getch()) != 'q'); return EXIT_FAILURE; }
int main() { ITEM **my_items; int c; MENU *my_menu; WINDOW *my_menu_win; int n_choices, i; /* Initialize curses */ initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); init_pair(1, COLOR_RED, COLOR_BLACK); init_pair(2, COLOR_CYAN, COLOR_BLACK); /* Create items */ n_choices = ARRAY_SIZE(choices); my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *)); for(i = 0; i < n_choices; ++i) my_items[i] = new_item(choices[i], choices[i]); /* Crate menu */ my_menu = new_menu((ITEM **)my_items); /* Set menu option not to show the description */ menu_opts_off(my_menu, O_SHOWDESC); /* Create the window to be associated with the menu */ my_menu_win = newwin(10, 40, 4, 4); keypad(my_menu_win, TRUE); /* Set main window and sub window */ set_menu_win(my_menu, my_menu_win); set_menu_sub(my_menu, derwin(my_menu_win, 6, 30, 3, 1)); set_menu_format(my_menu, 5, 3); set_menu_mark(my_menu, " * "); /* Print a border around the main window and print a title */ box(my_menu_win, 0, 0); attron(COLOR_PAIR(2)); mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll"); mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)"); attroff(COLOR_PAIR(2)); refresh(); /* Post the menu */ post_menu(my_menu); wrefresh(my_menu_win); while((c = wgetch(my_menu_win)) != KEY_F(1)) { switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; case KEY_LEFT: menu_driver(my_menu, REQ_LEFT_ITEM); break; case KEY_RIGHT: menu_driver(my_menu, REQ_RIGHT_ITEM); break; case KEY_NPAGE: menu_driver(my_menu, REQ_SCR_DPAGE); break; case KEY_PPAGE: menu_driver(my_menu, REQ_SCR_UPAGE); break; } wrefresh(my_menu_win); } /* Unpost and free all the memory taken up */ unpost_menu(my_menu); free_menu(my_menu); for(i = 0; i < n_choices; ++i) free_item(my_items[i]); endwin(); }
void display_execution(int num_instruction, mot * tab_mot_instruction, int nb_instruction, int* registres,int nb_reg, int PC, int SP, int SR){ ITEM *item_en_cour = NULL; char ** tab_instruction; // for instructions ITEM **instructions_items; int c; WINDOW *instructions_win; MENU *instruction_menu; int i; instructions_items = (ITEM **)calloc(nb_instruction + 1, sizeof(ITEM *)); int menu_instruction_alrdy_dlt = 0; //pour ne pas supprimer le menu 2 fois --> évite les erreur de segmentation lorsqu'on quitte char ** files; //in case of F2 // for register char ** tab_register; ITEM **register_items; WINDOW *register_win; MENU *register_menu; register_items = (ITEM **)calloc(nb_reg + 1 +3, sizeof(ITEM *)); //+3 pour PC SP et SR int menu_register_alrdy_dlt = 0; //pour ne pas supprimer le menu 2 fois --> évite les erreur de segmentation lorsqu'on quitte char dest_string[5]; char source_string[5]; char brut_string[10]; char pc_string[6], sp_string[6], sr_string[6]; int is_brut = 0; //si le mot précedent contient un mode direct, alors le mot suivant est un brut //si DIRIMM les 2 suivant sont des brut //allocation de mémoire pour les insctruction sous forme de chaine tab_instruction = (char**) malloc (nb_instruction* sizeof(char*)); //allocation de mémoire pour le tabeau de registre sous forme de string tab_register = (char**) malloc (nb_reg* sizeof(char *)); int num_choix; char * choix = NULL; for(i = 0; i < nb_instruction; ++i){ tab_instruction[i] = malloc(50 * sizeof(char)); //plus simple pour le moment, une instruction ne peut dépasser 50caractères ... a améliorer si assez de temps if(is_brut == 0){ sprintf(dest_string, "%d", tab_mot_instruction[i].codage.dest); sprintf(source_string, "%d", tab_mot_instruction[i].codage.source); //si l'instruction contient une source ou destination en mode immediat ou direct, la prochaine instruction sera un brut if(is_brut==2 || tab_mot_instruction[i].codage.mode == REGIMM || tab_mot_instruction[i].codage.mode == INDIMM || tab_mot_instruction[i].codage.mode == REGDIR || tab_mot_instruction[i].codage.mode == DIRREG){ is_brut = 1; } if(tab_mot_instruction[i].codage.mode == DIRIMM){ is_brut = 2; } strcpy(tab_instruction[i], codeop_tostring(tab_mot_instruction[i].codage.codeop) ); //on met tout les élément sous forme de string concaténé et espacé strcat(tab_instruction[i], " "); strcat(tab_instruction[i], mode_tostring(tab_mot_instruction[i].codage.mode)); strcat(tab_instruction[i], " "); strcat(tab_instruction[i], dest_string); strcat(tab_instruction[i], " "); strcat(tab_instruction[i], source_string); } else{ sprintf(brut_string, "%d", tab_mot_instruction[i].brut); strcpy(tab_instruction[i], brut_string ); if(is_brut == 2){ is_brut = 1; // cas du DIRIMM } else{ is_brut = 0; } } //mvprintw(i+2, 0, "%s", tab_instruction[i]); instructions_items[i] = new_item(tab_instruction[i], ""); //ajoute les éléments dans mon tableau d'item if(i == num_instruction){ //on sauvegarde l'adresse de l'item que l'on est entrain de traiter (celui donner par num_instruction) item_en_cour = instructions_items[i]; //n le desactive, cela permet de lui doonner une autre apparence pur le repérer item_opts_off(instructions_items[i], O_SELECTABLE); } } for(i = 0; i < nb_reg; ++i){ //contient le registre sous forme de string par exemple R1 ou PC tab_register[i] = malloc(3 * sizeof(char)); sprintf(tab_register[i], "R%i: %d",i, registres[i]); //mvprintw(i+2, 0, "%s", tab_instruction[i]); register_items[i] = new_item(tab_register[i], ""); //ajoute les éléments dans mon tableau d'item } sprintf(pc_string, "%d", PC); sprintf(sp_string, "%d", SP); sprintf(sr_string, "%d", SR); register_items[nb_reg] = new_item("PC:", pc_string); //register_items[8] register_items[nb_reg+1] = new_item("SP:", sp_string); //register_items[9] register_items[nb_reg+2] = new_item("SR:", sr_string); //register_items[10] //pour cacher la selection du premier registre item_opts_off(register_items[0], O_SELECTABLE); instruction_menu = new_menu((ITEM **)instructions_items); //creer un menu contenant les instructions register_menu = new_menu((ITEM **)register_items); //creer un menu contenant les registres mvprintw(LINES - 2, 0, "F9 to close the menu"); instructions_win = newwin((LINES-4)/2, 40 , 3, (COLS/2)- (COLS-4)/4); //créer une nouvelle fenetre pour les instructions register_win = newwin(16, 20 , 3, (COLS/2) + 10); //créer une nouvelle fenetre pour les registres keypad(instructions_win, TRUE); //active le clavier sur les instructions /* Set main window and sub window */ set_menu_win(instruction_menu, instructions_win); //set main menu set_menu_sub(instruction_menu, derwin(instructions_win, ((LINES-4)/2)-4, 38, 3, 1)); // set sub window set_menu_format(instruction_menu, ((LINES-4)/2)-4, 1); set_menu_win(register_menu, register_win); //set main menu set_menu_sub(register_menu, derwin(register_win, 13, 18, 3, 1)); // set sub window set_menu_format(register_menu, 13, 1); /* Set menu mark to the string " * " */ set_menu_mark(instruction_menu, " * "); set_menu_mark(register_menu, ""); /* Print a border around the main window and print a title */ box(instructions_win, 0, 0); print_in_middle(instructions_win, 1, 0, 40, "liste des instructions", COLOR_PAIR(1)); mvwaddch(instructions_win, 2, 0, ACS_LTEE); mvwhline(instructions_win, 2, 1, ACS_HLINE, 43); mvwaddch(instructions_win, 2, 39, ACS_RTEE); box(register_win, 0, 0); print_in_middle(register_win, 1, 0, 20, "Registres", COLOR_PAIR(1)); mvwaddch(register_win, 2, 0, ACS_LTEE); mvwhline(register_win, 2, 1, ACS_HLINE, 22); mvwaddch(register_win, 2, 19, ACS_RTEE); refresh(); post_menu(instruction_menu); post_menu(register_menu); //on se place sur l'instruction en cour set_current_item (instruction_menu, item_en_cour); wrefresh(instructions_win); wrefresh(register_win); while((c = getch()) != KEY_F(9) && c != 32) { switch(c) { case KEY_F(5): mvprintw(LINES-2, 0, "Exiting..."); endwin(); /* End curses mode */ exit(0); case KEY_F(2): files = list_file("", &i); draw_menu(files, execute_file_menu, "", i); case KEY_DOWN: menu_driver(instruction_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(instruction_menu, REQ_UP_ITEM); break; //case KEY_NPAGE: // menu_driver(my_menu, REQ_SCR_DPAGE); // break; //case KEY_PPAGE: // menu_driver(my_menu, REQ_SCR_UPAGE); // break; case 10: move(20, 0); clrtoeol(); break; } wrefresh(instructions_win); } if(menu_instruction_alrdy_dlt == 0){ clean_menu(instruction_menu); clean_window(instructions_win); } if(menu_register_alrdy_dlt == 0){ clean_menu(register_menu); clean_window(register_win); } }
void draw_menu(char ** menu_liste, void (*ptrfonction)(int,const char *, char *), char * folder, int taille_menu){ ITEM **my_items; int c; WINDOW *my_menu_win; MENU *my_menu; int i; ITEM *cur_item; my_items = (ITEM **)calloc(taille_menu + 1, sizeof(ITEM *)); int menu_alrdy_dlt = 0; //pour ne pas supprimer le menu 2 fois --> évite les erreur de segmentation lorsqu'on quitte char ** files; //pour le cas ou on utilise F2 (ouvrir un fichier) int num_choix; char choix[FILE_MAX]; for(i = 0; i < taille_menu; ++i){ my_items[i] = new_item(menu_liste[i], ""); //ajoute les éléments dans mon tableau d'item } //my_items[taille_menu+1] = (ITEM *)NULL; //ajoute un item vide à la fin du tableau my_menu = new_menu((ITEM **)my_items); //creer un menu contenan les items mvprintw(LINES - 2, 0, "F9 to close the menu"); //affiche un pied de page pour fermer le menu my_menu_win = newwin(10, 45, (LINES-10)/2, (COLS-45)/2); //créer une nouvelle fenetre keypad(my_menu_win, TRUE); //active le clavier pour le menu /* Set main window and sub window */ set_menu_win(my_menu, my_menu_win); //set main menu set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1)); // set sub window set_menu_format(my_menu, 5, 1); /* Set menu mark to the string " * " */ set_menu_mark(my_menu, " * "); /* Print a border around the main window and print a title */ box(my_menu_win, 0, 0); print_in_middle(my_menu_win, 1, 0, 45, "Menu Principal", COLOR_PAIR(1)); mvwaddch(my_menu_win, 2, 0, ACS_LTEE); mvwhline(my_menu_win, 2, 1, ACS_HLINE, 43); mvwaddch(my_menu_win, 2, 44, ACS_RTEE); refresh(); post_menu(my_menu); wrefresh(my_menu_win); while((c = getch()) != KEY_F(9) && c != 27) { switch(c) { case KEY_F(5): mvprintw(LINES-2, 0, "Exiting..."); endwin(); /* End curses mode */ exit(0); case KEY_F(2): files = list_file("", &i); clean_menu(my_menu); clean_window(my_menu_win); draw_menu(files, execute_file_menu, "", i); return; case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; case KEY_NPAGE: menu_driver(my_menu, REQ_SCR_DPAGE); break; case KEY_PPAGE: menu_driver(my_menu, REQ_SCR_UPAGE); break; case 10: move(20, 0); clrtoeol(); num_choix = item_index(current_item(my_menu)); strcpy(choix, item_name(current_item(my_menu))); //mvprintw(5, 0, "Item selected is : %s", item_name(current_item(my_menu))); clean_menu(my_menu); menu_alrdy_dlt = 1; clean_window(my_menu_win); (*ptrfonction)(num_choix, choix, folder); pos_menu_cursor(my_menu); break; } wrefresh(my_menu_win); } if(menu_alrdy_dlt == 0) clean_menu(my_menu); clean_window(my_menu_win); }
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) { va_list ap; char *btn; int btns_width = 0; int msg_lines = 0; int msg_width = 0; int total_width; int win_rows = 0; WINDOW *win; WINDOW *msg_win; WINDOW *menu_win; MENU *menu; ITEM *btns[btn_num+1]; int i, x, y; int res = -1; va_start(ap, btn_num); for (i = 0; i < btn_num; i++) { btn = va_arg(ap, char *); btns[i] = new_item(btn, ""); btns_width += strlen(btn)+1; } va_end(ap); btns[btn_num] = NULL; /* find the widest line of msg: */ msg_lines = get_line_no(msg); for (i = 0; i < msg_lines; i++) { const char *line = get_line(msg, i); int len = get_line_length(line); if (msg_width < len) msg_width = len; } total_width = max(msg_width, btns_width); /* place dialog in middle of screen */ y = (LINES-(msg_lines+4))/2; x = (COLS-(total_width+4))/2; /* create the windows */ if (btn_num > 0) win_rows = msg_lines+4; else win_rows = msg_lines+2; win = newwin(win_rows, total_width+4, y, x); keypad(win, TRUE); menu_win = derwin(win, 1, btns_width, win_rows-2, 1+(total_width+2-btns_width)/2); menu = new_menu(btns); msg_win = derwin(win, win_rows-2, msg_width, 1, 1+(total_width+2-msg_width)/2); set_menu_fore(menu, attributes[DIALOG_MENU_FORE]); set_menu_back(menu, attributes[DIALOG_MENU_BACK]); wattrset(win, attributes[DIALOG_BOX]); box(win, 0, 0); /* print message */ wattrset(msg_win, attributes[DIALOG_TEXT]); fill_window(msg_win, msg); set_menu_win(menu, win); set_menu_sub(menu, menu_win); set_menu_format(menu, 1, btn_num); menu_opts_off(menu, O_SHOWDESC); menu_opts_off(menu, O_SHOWMATCH); menu_opts_on(menu, O_ONEVALUE); menu_opts_on(menu, O_NONCYCLIC); set_menu_mark(menu, ""); post_menu(menu); touchwin(win); refresh_all_windows(main_window); while ((res = wgetch(win))) { switch (res) { case KEY_LEFT: menu_driver(menu, REQ_LEFT_ITEM); break; case KEY_RIGHT: menu_driver(menu, REQ_RIGHT_ITEM); break; case 10: /* ENTER */ case 27: /* ESCAPE */ case ' ': case KEY_F(F_BACK): case KEY_F(F_EXIT): break; } touchwin(win); refresh_all_windows(main_window); if (res == 10 || res == ' ') { res = item_index(current_item(menu)); break; } else if (res == 27 || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) { res = KEY_EXIT; break; } } unpost_menu(menu); free_menu(menu); for (i = 0; i < btn_num; i++) free_item(btns[i]); delwin(win); return res; }
int main_giris() { ITEM **my_items; int c; MENU *my_menu; int n_choices, i; ITEM *cur_item; WINDOW *my_menu_win; char *anamenu[] = { _("Market ") , _("Current Module"), _("Cheque Module"), _("Stock Module"), _("Reports"), _("Configuration"), _("Help"), _("About"), _("Exit"), (char *)NULL, }; (int) signal (SIGINT, sonlandir); (int) signal (SIGILL, sonlandir); (int) signal (SIGTERM, sonlandir); //backup control yedek_kontrol_et(); initscr(); start_color(); cbreak(); noecho(); keypad(stdscr, TRUE); //sql configuration ayar_dosyasi_oku (); ana_win = newwin(LINES, 80, 0, 0); temizle_win=newwin(LINES, 80, 0, 0); init_pair(1, COLOR_WHITE, COLOR_RED); init_pair(2, COLOR_WHITE, COLOR_BLUE); terminal_kontrol_et(); if (irsaliye_gun_kontrol()) mesaj( _("Some bills not prepared. Don't forget.!") ); kullanici_onayla(); init_pair(1, COLOR_WHITE, COLOR_RED); init_pair(2, COLOR_WHITE, COLOR_BLUE); baslik_goruntule(); n_choices = ARRAY_SIZE(anamenu); my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *)); for(i = 0; i < n_choices; ++i) my_items[i] = new_item(anamenu[i], " "); my_menu = new_menu((ITEM **)my_items); my_menu_win = newwin(15, 50, 5, 10); keypad(my_menu_win, TRUE); set_menu_win(my_menu, my_menu_win); set_menu_sub(my_menu, derwin(my_menu_win, 10, 40, 4, 2)); set_menu_mark(my_menu, mark); box(my_menu_win, 0, 0); print_in_middle(my_menu_win, 1, 0, 45, "Options", COLOR_PAIR(1)); mvwaddch(my_menu_win, 2, 0, ACS_LTEE); mvwhline(my_menu_win, 2, 1, ACS_HLINE, 48); mvwaddch(my_menu_win, 2, 49, ACS_RTEE); post_menu(my_menu); wrefresh(my_menu_win); while((c = wgetch(my_menu_win)) ) { switch(c) { case KEY_DOWN: menu_driver(my_menu, REQ_DOWN_ITEM); break; case KEY_UP: menu_driver(my_menu, REQ_UP_ITEM); break; case 10: cur_item = current_item(my_menu); switch(item_index(cur_item) + 1) { case 1: /* Kasa satis */ //satis if ( haklari_kontrol_et(0)==1 ) market_ana_ekran(); else {mesaj(_("Access denied.!!!"));} baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 2: /*cari*/ //stok giris kontrolu if ( haklari_kontrol_et(0)==1 ) cari(); else {mesaj(_("Access denied.!!!"));} baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 3: /*ceksenet*/ //cari giris kontrolu if ( haklari_kontrol_et(1)==1 ) ceksenet(); else {mesaj(_("Access denied.!!!"));} baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 4: /*stok*/ //cari giris kontrolu if ( haklari_kontrol_et(1)==1 ) stok(); else {mesaj(_("Access denied.!!!"));} baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 5: /*raporlar*/ //rapor giris kontrolu if ( haklari_kontrol_et(2)==1 ) raporlar(); else {mesaj(_("Access denied.!!!"));} baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 6: /*ayarlar*/ ayarlar(); baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 7:/*yardým*/ yardim(); baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 8:/*hakkýnda*/ hakkinda(); baslik_goruntule(); touchwin(my_menu_win); wrefresh(my_menu_win); baslik_yaz(); refresh(); break; case 9:/*Kapat*/ donen_deger=onayla(cikis_onay); if (donen_deger==1) { // donen deger evet ise kapat beep(); touchwin(ana_win); wrefresh(ana_win); unpost_menu(my_menu); free_menu(my_menu); for(i = 0; i < n_choices; ++i) free_item(my_items[i]); endwin(); return; } touchwin(ana_win); wrefresh(ana_win); touchwin(my_menu_win); wrefresh(my_menu_win); break; } wrefresh(my_menu_win); pos_menu_cursor(my_menu); } wrefresh(my_menu_win); } }