summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TECommon.h
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /core/apps/embeddedkonsole/TECommon.h
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'core/apps/embeddedkonsole/TECommon.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TECommon.h114
1 files changed, 114 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/TECommon.h b/core/apps/embeddedkonsole/TECommon.h
new file mode 100644
index 0000000..261d51b
--- a/dev/null
+++ b/core/apps/embeddedkonsole/TECommon.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
29typedef 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
41typedef unsigned char UINT8;
42#endif
43
44#ifndef UINT16
45typedef 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 ca
67 * \brief a character with rendition attributes.
68*/
69
70class ca
71{
72public:
73 inline ca(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) {}
78public:
79 UINT16 c; // character
80 UINT8 f; // foreground color
81 UINT8 b; // background color
82 UINT8 r; // rendition
83public:
84 friend BOOL operator == (ca a, ca b);
85 friend BOOL operator != (ca a, ca b);
86};
87
88inline BOOL operator == (ca a, ca b)
89{
90 return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r;
91}
92
93inline BOOL operator != (ca a, ca b)
94{
95 return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r;
96}
97
98/*!
99*/
100struct 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