summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/widget_layer.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/widget_layer.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/widget_layer.h265
1 files changed, 0 insertions, 265 deletions
diff --git a/noncore/apps/opie-console/widget_layer.h b/noncore/apps/opie-console/widget_layer.h
deleted file mode 100644
index 6812711..0000000
--- a/noncore/apps/opie-console/widget_layer.h
+++ b/dev/null
@@ -1,265 +0,0 @@
1/* -------------------------------------------------------------------------- */
2/* */
3/* [widget_layer.h] Widget Layer */
4/* */
5/* -------------------------------------------------------------------------- */
6
7// proposal of a widget Layer in opie-console
8//
9// fellow devels:
10// just mail me (ibotty@web.de), what you additionally need from the main widget
11// (or say in chat)
12
13#ifndef WIDGET_LAYER_H
14#define WIDGET_LAYER_H
15
16// qt includes
17#include <qapplication.h>
18#include <qframe.h>
19#include <qarray.h>
20#include <qtimer.h>
21#include <qkeycode.h>
22#include <qclipboard.h>
23
24
25// opie-console includes
26#include "session.h"
27#include "common.h"
28#include "profile.h"
29
30
31/*
32 * given a pseudo location ( column, line ),
33 * returns the actual index, in the QArray<Character>
34 */
35#define loc(X,Y) ((Y)*m_columns+(X))
36
37
38
39extern unsigned short vt100_graphics[32];
40
41class WidgetLayer : public QFrame
42{ Q_OBJECT
43
44public:
45
46 /**
47 * constructor
48 * @param const Profile &config, the configuration for this widget
49 * @param QWidget *parent, the parent widget
50 * @param const char *name, the name of the widget, defaults to ""
51 */
52 WidgetLayer( const Profile& config, QWidget *parent=0, const char *name=0 );
53
54 /**
55 * destructor
56 */
57 virtual ~WidgetLayer();
58
59public:
60 /**
61 * sets the image
62 * @param QArray<Character> const newimg, the new image
63 * @param int lines, lines count of newimg
64 * @param int columns, columns count of newimg
65 */
66 virtual void setImage( QArray<Character> const newimg, int lines, int colums ) = 0;
67
68 /**
69 * annoy the user
70 */
71 void bell();
72
73 /**
74 * @return int m_lines, the lines count
75 */
76 int lines(){ return m_lines; }
77
78 /**
79 * @return int m_columns, the columns count
80 */
81 int columns(){ return m_columns; }
82
83 /**
84 * insert current selection (currently this is only the clipboard)
85 */
86 void insertSelection();
87
88 /**
89 * insert text
90 * @param QString text, the text to be inserted
91 */
92 void insertText( QString text );
93
94 /**
95 * set selection (clipboard) to text
96 * @param const QString &text, the text to be selected
97 */
98 void setSelection( const QString &text );
99
100 /**
101 * paste content of clipboard
102 */
103 void pasteClipboard();
104
105
106 /**
107 * reload configuration
108 * @param const Profile& config, the config to be used (may be the same as in constructor)
109 */
110 virtual void reloadConfig( const Profile& config ) = 0;
111
112
113 /**
114 * sets the scrollbar (if implemented by successor of this class)
115 */
116 virtual void setScroll( int cursor, int slines ) = 0;
117
118 /**
119 * scrolls (if implemented, by successor of this class)
120 * @param int value, how much the widget should scroll up (positive value) or down (negative value)
121 */
122 virtual void scroll( int value ) = 0;
123
124
125 virtual bool eventFilter( QObject *obj, QEvent *event );
126
127
128 QSize sizeHint();
129
130 virtual QSize calcSize( int cols, int lins ) const = 0;
131signals:
132
133 /**
134 * key was pressed
135 */
136 void keyPressed( QKeyEvent *e );
137
138 /**
139 * whenever Mouse selects something
140 * @param int button, the button that us pressed :
141 * 0left Button
142 * 3Button released
143 * @param int x, x position
144 * @param int y, y position
145 *
146 * // numbering due to layout in old TEWidget
147 */
148 void mousePressed( int button, int x, int y );
149
150 /**
151 * size of image changed
152 * @param int lines, line count of new size
153 * @param int columns, column count of new size
154 */
155 void imageSizeChanged( int lines, int columns );
156
157 /**
158 * cursor in history changed
159 * @param int value, value of history cursor
160 */
161 void historyCursorChanged( int value );
162
163 /**
164 * selection should be cleared
165 */
166 void selectionCleared();
167
168 /**
169 * selection begin
170 * @param const int x, x position
171 * @param const int y, y position
172 */
173 void selectionBegin( const int x, const int y );
174
175 /**
176 * selection extended
177 * (from begin (s.a.) to x, y)
178 * @param const int x, x position
179 * @param const int y, y position
180 */
181 void selectionExtended( const int x, const int y );
182
183 /**
184 * selection end
185 * @param const bool lineBreakPreserve, preserve line breaks in selection
186 */
187 void selectionEnd( const bool lineBreakPreserve );
188
189
190
191// protected methods
192protected:
193
194 // image operations
195
196 /**
197 * changes image, to suit new size
198 * TODO: find meaningful name!
199 */
200 void propagateSize();
201
202 /**
203 *determines count of lines and columns
204 */
205 virtual void calcGeometry() = 0;
206
207 /**
208 * makes an empty image
209 */
210 void makeImage();
211
212 /**
213 * clears the image
214 */
215 void clearImage();
216
217protected slots:
218
219 /**
220 * clear selection
221 */
222 void onClearSelection();
223
224
225// protected vars
226protected:
227
228 /**
229 * current Session
230 */
231 Session *m_session;
232
233 /**
234 * current character image
235 *
236 * a Character at loc( column, line )
237 * has the actual index:
238 * ix = line * m_columns + column;
239 *
240 * use loc( x, y ) macro to access.
241 */
242 QArray<Character> m_image;
243
244 /**
245 * lines count
246 */
247 int m_lines;
248
249 /**
250 * columns count
251 */
252 int m_columns;
253
254 /**
255 * clipboard
256 */
257 QClipboard* m_clipboard;
258
259 /**
260 * whether widget is resizing
261 */
262 bool m_resizing;
263};
264
265#endif // WIDGET_LAYER_H