mirror of
https://gitlab.com/comunic/comunicterm
synced 2024-11-16 10:31:06 +00:00
47 lines
831 B
C++
47 lines
831 B
C++
#include <ui_utils.h>
|
|
|
|
#include <string>
|
|
|
|
using namespace std;
|
|
|
|
void ui_utils::print_base_screen(WINDOW *w)
|
|
{
|
|
printw("ComunicTerm"); /* Print Hello World */
|
|
|
|
|
|
// Get screen size
|
|
int row, col;
|
|
getmaxyx(w, row, col);
|
|
|
|
const string msg = "Light client";
|
|
mvprintw(0, (col-static_cast<int>(msg.length())), msg.c_str());
|
|
}
|
|
|
|
void ui_utils::alert(WINDOW *win, const string &msg)
|
|
{
|
|
erase();
|
|
print_base_screen(win);
|
|
|
|
int rows, cols;
|
|
getmaxyx(win, rows, cols);
|
|
|
|
int start = (rows/2) - 3;
|
|
|
|
mvwprintw(win, start, (cols-static_cast<int>(msg.length()))/2, msg.c_str());
|
|
|
|
wattron(stdscr, A_REVERSE);
|
|
mvwprintw(win, start+3, (cols-4)/2, " OK ");
|
|
wattroff(stdscr, A_REVERSE);
|
|
|
|
|
|
|
|
curs_set(0);
|
|
refresh();
|
|
|
|
while(getch() != 10);
|
|
|
|
curs_set(1);
|
|
erase();
|
|
refresh();
|
|
}
|