2012-02-08 18:55:11 -05:00
|
|
|
#include <ncurses.h>
|
|
|
|
#include "windows.h"
|
2012-02-09 19:28:39 -05:00
|
|
|
#include "util.h"
|
2012-02-08 18:55:11 -05:00
|
|
|
|
|
|
|
static WINDOW *inp_bar;
|
|
|
|
|
|
|
|
void create_input_bar(void)
|
|
|
|
{
|
|
|
|
int rows, cols;
|
|
|
|
getmaxyx(stdscr, rows, cols);
|
|
|
|
|
|
|
|
inp_bar = newwin(1, cols, rows-2, 0);
|
|
|
|
wbkgd(inp_bar, COLOR_PAIR(3));
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|
|
|
|
|
|
|
|
void inp_bar_inactive(int win)
|
|
|
|
{
|
|
|
|
mvwaddch(inp_bar, 0, 30 + win, ' ');
|
|
|
|
if (win == 9)
|
|
|
|
mvwaddch(inp_bar, 0, 30 + win + 1, ' ');
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|
|
|
|
|
|
|
|
void inp_bar_active(int win)
|
|
|
|
{
|
|
|
|
mvwprintw(inp_bar, 0, 30 + win, "%d", win+1);
|
|
|
|
touchwin(inp_bar);
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|
|
|
|
|
2012-02-09 20:28:15 -05:00
|
|
|
void inp_bar_get_password(void)
|
|
|
|
{
|
|
|
|
mvwprintw(inp_bar, 0, 1, "Enter password:");
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|
|
|
|
|
2012-02-08 18:55:11 -05:00
|
|
|
void inp_bar_print_message(char *msg)
|
|
|
|
{
|
2012-02-09 19:28:39 -05:00
|
|
|
mvwprintw(inp_bar, 0, 9, msg);
|
2012-02-08 18:55:11 -05:00
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|
|
|
|
|
2012-02-09 19:28:39 -05:00
|
|
|
void inp_bar_update_time(void)
|
|
|
|
{
|
|
|
|
char bar_time[8];
|
|
|
|
char tstmp[80];
|
|
|
|
get_time(tstmp);
|
|
|
|
sprintf(bar_time, "[%s]", tstmp);
|
|
|
|
|
|
|
|
mvwprintw(inp_bar, 0, 1, bar_time);
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
inp_put_back();
|
|
|
|
}
|
2012-02-09 20:28:15 -05:00
|
|
|
|
|
|
|
void inp_bar_clear(void)
|
|
|
|
{
|
|
|
|
wclear(inp_bar);
|
|
|
|
wrefresh(inp_bar);
|
|
|
|
}
|