Diffstat (limited to 'inputmethods/handwriting/qimpenwidget.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/handwriting/qimpenwidget.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/inputmethods/handwriting/qimpenwidget.h b/inputmethods/handwriting/qimpenwidget.h new file mode 100644 index 0000000..98d7f5c --- a/dev/null +++ b/inputmethods/handwriting/qimpenwidget.h | |||
@@ -0,0 +1,88 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Qtopia Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | ||
15 | ** | ||
16 | ** Contact info@trolltech.com if any conditions of this licensing are | ||
17 | ** not clear to you. | ||
18 | ** | ||
19 | **********************************************************************/ | ||
20 | |||
21 | #include <qwidget.h> | ||
22 | #include <qlist.h> | ||
23 | #include "qimpenchar.h" | ||
24 | |||
25 | class QIMPenWidget : public QWidget | ||
26 | { | ||
27 | Q_OBJECT | ||
28 | public: | ||
29 | QIMPenWidget( QWidget *parent ); | ||
30 | |||
31 | void clear(); | ||
32 | void greyStroke(); | ||
33 | void setReadOnly( bool r ) { readOnly = r; } | ||
34 | |||
35 | void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 ); | ||
36 | void removeCharSet( int ); | ||
37 | void changeCharSet( QIMPenCharSet *cs, int pos ); | ||
38 | void clearCharSets(); | ||
39 | void showCharacter( QIMPenChar *, int speed = 10 ); | ||
40 | virtual QSize sizeHint(); | ||
41 | |||
42 | public slots: | ||
43 | void removeStroke(); | ||
44 | |||
45 | signals: | ||
46 | void changeCharSet( QIMPenCharSet *cs ); | ||
47 | void changeCharSet( int ); | ||
48 | void beginStroke(); | ||
49 | void stroke( QIMPenStroke *ch ); | ||
50 | |||
51 | protected slots: | ||
52 | void timeout(); | ||
53 | |||
54 | protected: | ||
55 | enum Mode { Waiting, Input, Output }; | ||
56 | bool selectSet( QPoint ); | ||
57 | virtual void mousePressEvent( QMouseEvent *e ); | ||
58 | virtual void mouseReleaseEvent( QMouseEvent *e ); | ||
59 | virtual void mouseMoveEvent( QMouseEvent *e ); | ||
60 | virtual void paintEvent( QPaintEvent *e ); | ||
61 | virtual void resizeEvent( QResizeEvent *e ); | ||
62 | |||
63 | struct CharSetEntry { | ||
64 | QIMPenCharSet *cs; | ||
65 | int stretch; | ||
66 | }; | ||
67 | typedef QList<CharSetEntry> CharSetEntryList; | ||
68 | typedef QListIterator<CharSetEntry> CharSetEntryIterator; | ||
69 | |||
70 | protected: | ||
71 | Mode mode; | ||
72 | bool autoHide; | ||
73 | bool readOnly; | ||
74 | QPoint lastPoint; | ||
75 | unsigned pointIndex; | ||
76 | int strokeIndex; | ||
77 | int currCharSet; | ||
78 | QTimer *timer; | ||
79 | QColor strokeColor; | ||
80 | QRect dirtyRect; | ||
81 | QIMPenChar *outputChar; | ||
82 | QIMPenStroke *outputStroke; | ||
83 | QIMPenStroke *inputStroke; | ||
84 | QIMPenStrokeList strokes; | ||
85 | CharSetEntryList charSets; | ||
86 | int totalStretch; | ||
87 | }; | ||
88 | |||