From b891420946d5269cc326d67555c6aab3db41a01a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 21 Nov 2010 17:01:59 +0000 Subject: added yhttpd and ycurses trunk versions --- ycurses/src/curses/curses.cpp | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 ycurses/src/curses/curses.cpp (limited to 'ycurses/src/curses/curses.cpp') diff --git a/ycurses/src/curses/curses.cpp b/ycurses/src/curses/curses.cpp new file mode 100644 index 0000000..3605e59 --- /dev/null +++ b/ycurses/src/curses/curses.cpp @@ -0,0 +1,86 @@ +#ifndef CURSES_CPP +#define CURSES_CPP + +#include "curses.h" + +int curses::i_self_counter = 0; + +curses::curses() +{ + if ( ++i_self_counter == 1 ) + { + initscr(); + raw(); + keypad(stdscr, TRUE); + noecho(); + } +} + +curses::~curses() +{ + if ( --i_self_counter == 0 ) + { +/* + Factory::destroyAll(); + Factory::destroyAll(); + Factory::destroyAll(); + Factory::destroyAll(); + Factory::destroyAll(); + */ + clear(); + endwin(); + } +} + +void +curses::finish() +{ +} + +int +curses::get_char() +{ + return getch(); +} + +string +curses::get_string() +{ + char c[1024]; + getstr(c); + return string(c); +} + +void +curses::pause() +{ + getch(); +} + +void +curses::disable() +{ + refresh(); + def_prog_mode(); + endwin(); +} + +void +curses::enable() +{ + reset_prog_mode(); + refresh(); +} + +void +curses::clear() +{ + coordinate coord(LINES, COLS); + for ( int i = 0; i < coord.y; ++i ) + for ( int j = 0; j < coord.x; ++j ) + mvaddch(i, j, ' '); + + refresh(); +} + +#endif -- cgit v1.2.3