Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qimpenwidget.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #include <qwidget.h>
00022 #include <qlist.h>
00023 #include "qimpenchar.h"
00024 
00025 class QIMPenWidget : public QWidget
00026 {
00027     Q_OBJECT
00028 public:
00029     QIMPenWidget( QWidget *parent );
00030 
00031     void clear();
00032     void greyStroke();
00033     void setReadOnly( bool r ) { readOnly = r; }
00034 
00035     void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 );
00036     void removeCharSet( int );
00037     void changeCharSet( QIMPenCharSet *cs, int pos );
00038     void clearCharSets();
00039     void showCharacter( QIMPenChar *, int speed = 10 );
00040     virtual QSize sizeHint();
00041 
00042 public slots:
00043     void removeStroke();
00044 
00045 signals:
00046     void changeCharSet( QIMPenCharSet *cs );
00047     void changeCharSet( int );
00048     void beginStroke();
00049     void stroke( QIMPenStroke *ch );
00050 
00051 protected slots:
00052     void timeout();
00053 
00054 protected:
00055     enum Mode { Waiting, Input, Output };
00056     bool selectSet( QPoint );
00057     virtual void mousePressEvent( QMouseEvent *e );
00058     virtual void mouseReleaseEvent( QMouseEvent *e );
00059     virtual void mouseMoveEvent( QMouseEvent *e );
00060     virtual void paintEvent( QPaintEvent *e );
00061     virtual void resizeEvent( QResizeEvent *e );
00062 
00063     struct CharSetEntry {
00064         QIMPenCharSet *cs;
00065         int stretch;
00066     };
00067     typedef QList<CharSetEntry> CharSetEntryList;
00068     typedef QListIterator<CharSetEntry> CharSetEntryIterator;
00069 
00070 protected:
00071     Mode mode;
00072     bool autoHide;
00073     bool readOnly;
00074     QPoint lastPoint;
00075     unsigned pointIndex;
00076     int strokeIndex;
00077     int currCharSet;
00078     QTimer *timer;
00079     QColor strokeColor;
00080     QRect dirtyRect;
00081     QIMPenChar *outputChar;
00082     QIMPenStroke *outputStroke;
00083     QIMPenStroke *inputStroke;
00084     QIMPenStrokeList strokes;
00085     CharSetEntryList charSets;
00086     int totalStretch;
00087 };
00088 

Generated on Sat Nov 5 16:16:02 2005 for OPIE by  doxygen 1.4.2