/////// File: CalcWindow.C /////// #include #include "CalcWindow.h" CalcWindow::CalcWindow(int d, CursesWindow* parent) : CursesWindow(parent, 5, d+14, 5, 16, 'r') { int width = d+4; x0 = 5; x1 = x0+width-1; // begin and end of LCD Box('#','#'); init(); } CalcWindow::~CalcWindow() { clean_up(); } void CalcWindow::clear_lcd() { Standout(); for (int i=x0; i <= x1; i++) Mvaddch(2, i, ' '); Standend(); } void CalcWindow::lcd(int x, char* str) { Standout(); Mvaddstr(2, x, str); Standend(); Refresh(); } void CalcWindow::show_str(char* b) { lcd(x1-strlen(b)+1, b); } void CalcWindow::show_op(char op) { Mvaddch(3, x1 + 2, op); Refresh(); } void CalcWindow::init() { fflush(stdin); fflush(stdout); noecho(); // do not echo input characters crmode(); // set to cbreak mode } void CalcWindow::clean_up() { Clear(); Refresh(); fflush(stdin); fflush(stdout); }