Permalink
Cannot retrieve contributors at this time
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?
TxtAdv/print_menu.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
27 lines (24 sloc)
638 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); | |
} |