ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/dclient/include/ndk/terminal.hh
Revision: 1.1
Committed: Sun Oct 24 20:31:44 2010 UTC (13 years, 8 months ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Log Message:
use EV and plain sockets instead of asio

File Contents

# Content
1 /* terminal.hh
2 * This file is part of ncursesxx library
3 * Copyright (c) 2003,2004 by Stanislav Ievlev
4 *
5 * This file is covered by the GNU Library General Public License,
6 * which should be included with libncursesxx as the file COPYING.
7 */
8 #ifndef NCURSESXX_TERMINAL_HH__
9 #define NCURSESXX_TERMINAL_HH__
10
11 #include <curses.h>
12 #include <term.h>
13
14 #include <ext/stdio_filebuf.h>
15
16 namespace ndk
17 {
18 typedef short color_t;
19 using ::attr_t;
20
21 /**
22 * ncurses terminal object.
23 */
24 struct terminal
25 {
26 typedef __gnu_cxx::stdio_filebuf<char> buffer_type;
27
28 // init terminal, open descriptor pointing to file descriptor
29 explicit terminal (buffer_type &buf, const char *termname = 0);
30 ~terminal ();
31
32 // send control sequences to terminal to set foreground color and attributes
33 void set_attr (attr_t mode = A_NORMAL); // set terminal attributes
34 void set_fg_color (color_t color = COLOR_WHITE); // set foreground color
35 void set_fg (color_t color, attr_t mode = A_NORMAL); // set foreground color and attributes
36
37 color_t color () const; // return current terminal color
38 attr_t attr () const; // return current terminal attributes
39
40 int colors_num () const; // return number of possible colors
41
42 void reset_colors (); // reset all colors and color pairs
43
44 private:
45 buffer_type &buf_; // pointer to output buffer
46 TERMINAL *term_; // ncurses terminal object
47 attr_t attr_; // current terminal attributes
48 int colors_num_; // maximum number of the colors
49 color_t color_; // current terminal color
50 };
51 }
52
53 #endif