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