author | ibotty <ibotty> | 2002-10-05 21:26:01 (UTC) |
---|---|---|
committer | ibotty <ibotty> | 2002-10-05 21:26:01 (UTC) |
commit | 89ed5b2847092523db36737704487776c001dc41 (patch) (unidiff) | |
tree | 62958a185f636df00b86b600005259d39e3b1e30 /noncore/apps/opie-console/common.h | |
parent | d0c61661d694574dfaf18162e015c493cd1d571c (diff) | |
download | opie-89ed5b2847092523db36737704487776c001dc41.zip opie-89ed5b2847092523db36737704487776c001dc41.tar.gz opie-89ed5b2847092523db36737704487776c001dc41.tar.bz2 |
initial commit
Diffstat (limited to 'noncore/apps/opie-console/common.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/common.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/common.h b/noncore/apps/opie-console/common.h new file mode 100644 index 0000000..ac0e2cf --- a/dev/null +++ b/noncore/apps/opie-console/common.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* -------------------------------------------------------------------------- */ | ||
2 | /* */ | ||
3 | /* [TECommon.h] Common Definitions */ | ||
4 | /* */ | ||
5 | /* -------------------------------------------------------------------------- */ | ||
6 | /* */ | ||
7 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | ||
8 | /* */ | ||
9 | /* This file is part of Konsole - an X terminal for KDE */ | ||
10 | /* */ | ||
11 | /* -------------------------------------------------------------------------- */ | ||
12 | /* */ | ||
13 | /* Ported Konsole to Qt/Embedded */ | ||
14 | /* */ | ||
15 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | ||
16 | /* */ | ||
17 | /* -------------------------------------------------------------------------- */ | ||
18 | |||
19 | /*! \file TECommon.h | ||
20 | \brief Definitions shared between TEScreen and TEWidget. | ||
21 | */ | ||
22 | |||
23 | #ifndef TECOMMON_H | ||
24 | #define TECOMMON_H | ||
25 | |||
26 | #include <qcolor.h> | ||
27 | |||
28 | #ifndef BOOL | ||
29 | typedef int BOOL; | ||
30 | #endif | ||
31 | |||
32 | #ifndef FALSE | ||
33 | #define FALSE 0 | ||
34 | #endif | ||
35 | |||
36 | #ifndef TRUE | ||
37 | #define TRUE 1 | ||
38 | #endif | ||
39 | |||
40 | #ifndef UINT8 | ||
41 | typedef unsigned char UINT8; | ||
42 | #endif | ||
43 | |||
44 | #ifndef UINT16 | ||
45 | typedef unsigned short UINT16; | ||
46 | #endif | ||
47 | |||
48 | // Attributed Character Representations /////////////////////////////// | ||
49 | |||
50 | // Colors | ||
51 | |||
52 | #define BASE_COLORS (2+8) | ||
53 | #define INTENSITIES 2 | ||
54 | #define TABLE_COLORS (INTENSITIES*BASE_COLORS) | ||
55 | |||
56 | #define DEFAULT_FORE_COLOR 0 | ||
57 | #define DEFAULT_BACK_COLOR 1 | ||
58 | |||
59 | #define DEFAULT_RENDITION 0 | ||
60 | #define RE_BOLD (1 << 0) | ||
61 | #define RE_BLINK (1 << 1) | ||
62 | #define RE_UNDERLINE (1 << 2) | ||
63 | #define RE_REVERSE (1 << 3) // Screen only | ||
64 | #define RE_INTENSIVE (1 << 3) // Widget only | ||
65 | |||
66 | /*! \class Character | ||
67 | * \brief a character with rendition attributes. | ||
68 | */ | ||
69 | |||
70 | class Character | ||
71 | { | ||
72 | public: | ||
73 | inline Character(UINT16 _c = ' ', | ||
74 | UINT8 _f = DEFAULT_FORE_COLOR, | ||
75 | UINT8 _b = DEFAULT_BACK_COLOR, | ||
76 | UINT8 _r = DEFAULT_RENDITION) | ||
77 | : c(_c), f(_f), b(_b), r(_r) {} | ||
78 | public: | ||
79 | UINT16 c; // character | ||
80 | UINT8 f; // foreground color | ||
81 | UINT8 b; // background color | ||
82 | UINT8 r; // rendition | ||
83 | public: | ||
84 | friend BOOL operator == (Character a, Character b); | ||
85 | friend BOOL operator != (Character a, Character b); | ||
86 | }; | ||
87 | |||
88 | inline BOOL operator == (Character a, Character b) | ||
89 | { | ||
90 | return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r; | ||
91 | } | ||
92 | |||
93 | inline BOOL operator != (Character a, Character b) | ||
94 | { | ||
95 | return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r; | ||
96 | } | ||
97 | |||
98 | /*! | ||
99 | */ | ||
100 | struct ColorEntry | ||
101 | { | ||
102 | ColorEntry(QColor c, bool tr, bool b) : color(c), transparent(tr), bold(b) {} | ||
103 | ColorEntry() : transparent(false), bold(false) {} // default constructors | ||
104 | void operator=(const ColorEntry& rhs) { | ||
105 | color = rhs.color; | ||
106 | transparent = rhs.transparent; | ||
107 | bold = rhs.bold; | ||
108 | } | ||
109 | QColor color; | ||
110 | bool transparent; // if used on bg | ||
111 | bool bold; // if used on fg | ||
112 | }; | ||
113 | |||
114 | #endif // TECOMMON_H | ||