00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #ifndef COMMON_H
00024 #define COMMON_H
00025
00026 #include <qcolor.h>
00027
00028 #ifndef BOOL
00029 typedef bool BOOL;
00030 #endif
00031
00032 #ifndef FALSE
00033 #define FALSE 0
00034 #endif
00035
00036 #ifndef TRUE
00037 #define TRUE 1
00038 #endif
00039
00040 #ifndef UINT8
00041 typedef unsigned char UINT8;
00042 #endif
00043
00044 #ifndef UINT16
00045 typedef unsigned short UINT16;
00046 #endif
00047
00048
00049
00050
00051
00052 #define BASE_COLORS (2+8)
00053 #define INTENSITIES 2
00054 #define TABLE_COLORS (INTENSITIES*BASE_COLORS)
00055
00056 #define DEFAULT_FORE_COLOR 0
00057 #define DEFAULT_BACK_COLOR 1
00058
00059 #define DEFAULT_RENDITION 0
00060 #define RE_BOLD (1 << 0)
00061 #define RE_BLINK (1 << 1)
00062 #define RE_UNDERLINE (1 << 2)
00063 #define RE_REVERSE (1 << 3) // Screen only
00064 #define RE_INTENSIVE (1 << 3) // Widget only
00065
00070 class Character
00071 {
00072 public:
00073 inline Character(UINT16 _c = ' ',
00074 UINT8 _f = DEFAULT_FORE_COLOR,
00075 UINT8 _b = DEFAULT_BACK_COLOR,
00076 UINT8 _r = DEFAULT_RENDITION)
00077 : c(_c), f(_f), b(_b), r(_r) {}
00078 public:
00079 UINT16 c;
00080 UINT8 f;
00081 UINT8 b;
00082 UINT8 r;
00083 public:
00084 friend BOOL operator == (Character a, Character b);
00085 friend BOOL operator != (Character a, Character b);
00086 };
00087
00088 inline BOOL operator == (Character a, Character b)
00089 {
00090 return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r;
00091 }
00092
00093 inline BOOL operator != (Character a, Character b)
00094 {
00095 return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r;
00096 }
00097
00100 struct ColorEntry
00101 {
00102 ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {}
00103 ColorEntry() : transparent(false), bold(false) {}
00104 void operator=(const ColorEntry& rhs) {
00105 color = rhs.color;
00106 transparent = rhs.transparent;
00107 bold = rhs.bold;
00108 }
00109 QColor color;
00110 bool transparent : 1;
00111 bool bold : 1;
00112 };
00113
00114 #endif // COMMON_H