summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEWidget.h
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.h202
1 files changed, 202 insertions, 0 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.h b/core/apps/embeddedkonsole/TEWidget.h
new file mode 100644
index 0000000..3f9f4ae
--- a/dev/null
+++ b/core/apps/embeddedkonsole/TEWidget.h
@@ -0,0 +1,202 @@
1/* ----------------------------------------------------------------------- */
2/* */
3/* [te_widget.h] Terminal Emulation Widget */
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#ifndef TE_WIDGET_H
20#define TE_WIDGET_H
21
22#include <qwidget.h>
23#include <qlabel.h>
24#include <qtimer.h>
25#include <qcolor.h>
26#include <qkeycode.h>
27#include <qscrollbar.h>
28
29#include <qpopupmenu.h>
30
31#include "TECommon.h"
32
33extern unsigned short vt100_graphics[32];
34
35class TESession;
36
37// class Konsole;
38
39class TEWidget : public QFrame
40// a widget representing attributed text
41{ Q_OBJECT
42
43// friend class Konsole;
44
45public:
46
47 TEWidget(QWidget *parent=0, const char *name=0);
48 virtual ~TEWidget();
49
50public:
51
52 QColor getDefaultBackColor();
53
54 const ColorEntry* getColorTable() const;
55 void setColorTable(const ColorEntry table[]);
56
57 void setScrollbarLocation(int loc);
58 enum { SCRNONE=0, SCRLEFT=1, SCRRIGHT=2 };
59
60 void setScroll(int cursor, int lines);
61 void doScroll(int lines);
62
63 void emitSelection();
64
65public:
66
67 void setImage(const ca* const newimg, int lines, int columns);
68
69 int Lines() { return lines; }
70 int Columns() { return columns; }
71
72 void calcGeometry();
73 void propagateSize();
74 QSize calcSize(int cols, int lins) const;
75
76 QSize sizeHint() const;
77
78public:
79
80 void Bell();
81 void emitText(QString text);
82 void pasteClipboard();
83
84signals:
85
86 void keyPressedSignal(QKeyEvent *e);
87 void mouseSignal(int cb, int cx, int cy);
88 void changedImageSizeSignal(int lines, int columns);
89 void changedHistoryCursor(int value);
90 void configureRequest( TEWidget*, int state, int x, int y );
91
92 void clearSelectionSignal();
93 void beginSelectionSignal( const int x, const int y );
94 void extendSelectionSignal( const int x, const int y );
95 void endSelectionSignal(const BOOL preserve_line_breaks);
96
97
98protected:
99
100 virtual void styleChange( QStyle& );
101
102 bool eventFilter( QObject *, QEvent * );
103
104 void drawAttrStr(QPainter &paint, QRect rect,
105 QString& str, ca attr, BOOL pm, BOOL clear);
106 void paintEvent( QPaintEvent * );
107
108 void resizeEvent(QResizeEvent*);
109
110 void fontChange(const QFont &font);
111 void frameChanged();
112
113 void mouseDoubleClickEvent(QMouseEvent* ev);
114 void mousePressEvent( QMouseEvent* );
115 void mouseReleaseEvent( QMouseEvent* );
116 void mouseMoveEvent( QMouseEvent* );
117
118 void focusInEvent( QFocusEvent * );
119 void focusOutEvent( QFocusEvent * );
120 bool focusNextPrevChild( bool next );
121
122#ifndef QT_NO_DRAGANDDROP
123 // Dnd
124 void dragEnterEvent(QDragEnterEvent* event);
125 void dropEvent(QDropEvent* event);
126#endif
127
128 virtual int charClass(char) const;
129
130 void clearImage();
131
132public:
133 const QPixmap *backgroundPixmap();
134
135 void setSelection(const QString &t);
136
137 virtual void setFont(const QFont &);
138 void setVTFont(const QFont &);
139 QFont getVTFont();
140
141 void setMouseMarks(bool on);
142
143public slots:
144
145 void onClearSelection();
146
147protected slots:
148
149 void scrollChanged(int value);
150 void blinkEvent();
151
152private:
153
154 QChar (*fontMap)(QChar); // possible vt100 font extention
155
156 bool fixed_font; // has fixed pitch
157 int font_h; // height
158 int font_w; // width
159 int font_a; // ascend
160
161 int blX; // actual offset (left)
162 int brX; // actual offset (right)
163 int bY; // actual offset
164
165 int lines;
166 int columns;
167 ca *image; // [lines][columns]
168
169 ColorEntry color_table[TABLE_COLORS];
170
171 BOOL resizing;
172 bool mouse_marks;
173
174 void makeImage();
175
176 QPoint iPntSel; // initial selection point
177 QPoint pntSel; // current selection point
178 int actSel; // selection state
179 BOOL word_selection_mode;
180 BOOL preserve_line_breaks;
181
182 QClipboard* cb;
183 QScrollBar* scrollbar;
184 int scrollLoc;
185
186//#define SCRNONE 0
187//#define SCRLEFT 1
188//#define SCRRIGHT 2
189
190 BOOL blinking; // hide text in paintEvent
191 BOOL hasBlinker; // has characters to blink
192 QTimer* blinkT; // active when hasBlinker
193 QPopupMenu* m_drop;
194 QString dropText;
195 public:
196 // current session in this widget
197 TESession *currentSession;
198private slots:
199 void drop_menu_activated(int item);
200};
201
202#endif // TE_WIDGET_H