1 #ifndef RTORRENT_DISPLAY_ATTRIBUTES_H 2 #define RTORRENT_DISPLAY_ATTRIBUTES_H 3 4 #include <string> 5 #include <vector> 6 7 #if defined(HAVE_NCURSESW_CURSES_H) 8 #include <ncursesw/curses.h> 9 #elif defined(HAVE_NCURSESW_H) 10 #include <ncursesw.h> 11 #elif defined(HAVE_NCURSES_CURSES_H) 12 #include <ncurses/curses.h> 13 #elif defined(HAVE_NCURSES_H) 14 #include <ncurses.h> 15 #elif defined(HAVE_CURSES_H) 16 #include <curses.h> 17 #else 18 #error "SysV or X/Open-compatible Curses header file required" 19 #endif 20 21 // Let us hail the creators of curses for being idiots. The only 22 // clever move they made was in the naming. 23 #undef timeout 24 #undef move 25 26 namespace display { 27 28 class Attributes { 29 public: 30 static const int a_invalid = ~int(); 31 static const int a_normal = A_NORMAL; 32 static const int a_bold = A_BOLD; 33 static const int a_reverse = A_REVERSE; 34 35 static const int color_invalid = ~int(); 36 static const int color_default = 0; 37 Attributes()38 Attributes() {} Attributes(const char * pos,int attr,int col)39 Attributes(const char* pos, int attr, int col) : 40 m_position(pos), m_attributes(attr), m_colors(col) {} Attributes(const char * pos,const Attributes & old)41 Attributes(const char* pos, const Attributes& old) : 42 m_position(pos), m_attributes(old.m_attributes), m_colors(old.m_colors) {} 43 position()44 const char* position() const { return m_position; } set_position(const char * pos)45 void set_position(const char* pos) { m_position = pos; } 46 attributes()47 int attributes() const { return m_attributes; } set_attributes(int attr)48 void set_attributes(int attr) { m_attributes = attr; } 49 colors()50 int colors() const { return m_colors; } set_colors(int col)51 void set_colors(int col) { m_colors = col; } 52 53 private: 54 const char* m_position; 55 int m_attributes; 56 int m_colors; 57 }; 58 59 } 60 61 #endif 62