Skip to content
Permalink
c20a9eb6ab
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
27 lines (24 sloc) 638 Bytes
#include "print_menu.h"
#include <ncurses.h>
#include <string>
#define WIDTH 30
#define HEIGHT 10
/////////////////BASED ON CODE FROM: http://www.tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html//////////////
void print_menu(WINDOW *menu_win, int highlight, int n_choices, char **choices)
{
int x, y, i;
x = 0;
y = 2;
box(menu_win, 2, 0);
for(i = 0; i < n_choices; i++)
{ if(highlight == i+1) /* High light the present choice */
{ wattron(menu_win, A_REVERSE);
mvwprintw(menu_win, y, x, choices[i]);
wattroff(menu_win, A_REVERSE);
}
else
mvwprintw(menu_win, y, x, choices[i]);
y++;
}
wrefresh(menu_win);
}