Diffstat (limited to 'core/settings/citytime/stylusnormalizer.h') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/citytime/stylusnormalizer.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/core/settings/citytime/stylusnormalizer.h b/core/settings/citytime/stylusnormalizer.h new file mode 100644 index 0000000..d5e44a3 --- a/dev/null +++ b/core/settings/citytime/stylusnormalizer.h | |||
@@ -0,0 +1,70 @@ | |||
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 | #ifndef STYLUSNORMALIZER_H | ||
22 | #define STYLUSNORMALIZER_H | ||
23 | |||
24 | #include <qdatetime.h> | ||
25 | #include <qwidget.h> | ||
26 | |||
27 | class QTimer; | ||
28 | |||
29 | class _StylusEvent | ||
30 | { | ||
31 | public: | ||
32 | _StylusEvent( const QPoint &pt = QPoint( 0, 0 ) ); | ||
33 | ~_StylusEvent(); | ||
34 | QPoint point( void ) const { return _pt; }; | ||
35 | QTime time( void ) const { return _t; }; | ||
36 | void setPoint( int x, int y) { _pt.setX( x ); _pt.setY( y ); }; | ||
37 | void setPoint( const QPoint &newPt ) { _pt = newPt; }; | ||
38 | void setTime( QTime newTime ) { _t = newTime; }; | ||
39 | |||
40 | private: | ||
41 | QPoint _pt; | ||
42 | QTime _t; | ||
43 | }; | ||
44 | |||
45 | |||
46 | class StylusNormalizer : public QWidget | ||
47 | { | ||
48 | Q_OBJECT | ||
49 | public: | ||
50 | StylusNormalizer( QWidget *parent = 0, const char* name = 0 ); | ||
51 | ~StylusNormalizer(); | ||
52 | void start(); | ||
53 | void stop(); | ||
54 | void addEvent( const QPoint &pt ); // add a new point in | ||
55 | |||
56 | signals: | ||
57 | void signalNewPoint( const QPoint &p ); | ||
58 | |||
59 | private slots: | ||
60 | void slotAveragePoint( void ); // return an averaged point | ||
61 | |||
62 | private: | ||
63 | static const int SAMPLES = 10; | ||
64 | _StylusEvent _ptList[SAMPLES]; | ||
65 | int _next; | ||
66 | QTimer *_tExpire; | ||
67 | bool bFirst; // the first item added in... | ||
68 | }; | ||
69 | |||
70 | #endif | ||