-
Notifications
You must be signed in to change notification settings - Fork 0
/
userInterface.cpp
37 lines (32 loc) · 977 Bytes
/
userInterface.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "userInterface.hpp"
#include <iostream>
using namespace std;
void FilesyncUI::init() {
// cerr << << " color pairs\n";
initscr(); // initialize ncurses
cbreak(); // disable input buffering
noecho(); // dont echo typed chars
keypad(stdscr, TRUE); // capture special chars
nodelay(stdscr, TRUE);
// curs_set(0); // hide the cursor
if (has_colors()) {
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLACK);
init_pair(2, COLOR_WHITE, COLOR_BLUE);
init_pair(3, COLOR_GREEN, COLOR_BLACK);
init_pair(4, COLOR_YELLOW, COLOR_BLACK);
init_pair(5, COLOR_RED, COLOR_BLACK);
init_pair(6, COLOR_CYAN, COLOR_BLACK);
init_pair(7, COLOR_MAGENTA, COLOR_BLACK);
}
}
void FilesyncUI::end() {
endwin(); // end ncurses
}
void FilesyncUI::boxTitle(WINDOW *win, std::string title) {
box(win, 0, 0);
mvwprintw(win, 0, 1, title.c_str());
}
void FilesyncUI::getScreenSize(int &h, int &w) {
getmaxyx(stdscr, h, w);
}