author | zecke <zecke> | 2002-10-14 17:46:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-14 17:46:45 (UTC) |
commit | 2c5e8939ba073a42c032f5a9660ed0dd4580bf88 (patch) (unidiff) | |
tree | 163d660eb057ba0f78c119465d85413d3524ed1b /noncore/apps/opie-console/TEWidget.h | |
parent | 51e18b363eb37621479a059af58da3040db1be7e (diff) | |
download | opie-2c5e8939ba073a42c032f5a9660ed0dd4580bf88.zip opie-2c5e8939ba073a42c032f5a9660ed0dd4580bf88.tar.gz opie-2c5e8939ba073a42c032f5a9660ed0dd4580bf88.tar.bz2 |
The new old TerminalWidget I'm anything but happy about it
Diffstat (limited to 'noncore/apps/opie-console/TEWidget.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/TEWidget.h | 202 |
1 files changed, 202 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h new file mode 100644 index 0000000..40e1aea --- a/dev/null +++ b/noncore/apps/opie-console/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 | #ifndef TE_WIDGET_H | ||
19 | #define TE_WIDGET_H | ||
20 | |||
21 | #include <qwidget.h> | ||
22 | #include <qlabel.h> | ||
23 | #include <qtimer.h> | ||
24 | #include <qcolor.h> | ||
25 | #include <qkeycode.h> | ||
26 | #include <qscrollbar.h> | ||
27 | |||
28 | #include <qpopupmenu.h> | ||
29 | |||
30 | #include "TECommon.h" | ||
31 | |||
32 | extern unsigned short vt100_graphics[32]; | ||
33 | |||
34 | class TESession; | ||
35 | |||
36 | // class Konsole; | ||
37 | |||
38 | class TEWidget : public QFrame | ||
39 | // a widget representing attributed text | ||
40 | { Q_OBJECT | ||
41 | |||
42 | // friend class Konsole; | ||
43 | |||
44 | public: | ||
45 | |||
46 | TEWidget(QWidget *parent=0, const char *name=0); | ||
47 | virtual ~TEWidget(); | ||
48 | |||
49 | public: | ||
50 | |||
51 | QColor getDefaultBackColor(); | ||
52 | |||
53 | const ColorEntry* getColorTable() const; | ||
54 | const ColorEntry* getdefaultColorTable() 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 | |||
65 | public: | ||
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 | |||
78 | public: | ||
79 | |||
80 | void Bell(); | ||
81 | void emitText(QString text); | ||
82 | void pasteClipboard(); | ||
83 | |||
84 | signals: | ||
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 | |||
98 | protected: | ||
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 | |||
132 | public: | ||
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 | |||
143 | public slots: | ||
144 | |||
145 | void onClearSelection(); | ||
146 | |||
147 | protected slots: | ||
148 | |||
149 | void scrollChanged(int value); | ||
150 | void blinkEvent(); | ||
151 | |||
152 | private: | ||
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; | ||
198 | private slots: | ||
199 | void drop_menu_activated(int item); | ||
200 | }; | ||
201 | |||
202 | #endif // TE_WIDGET_H | ||