DigestGuiCore/strokesviewer.h

Go to the documentation of this file.
00001 /*  -*- c++ -*-  (for Emacs)
00002  *
00003  *  strokesviewer.h
00004  *  Digest
00005  * 
00006  *  Created by Aidan Lane on Mon Jun 27 2005.
00007  *  Copyright (c) 2005-2006 Optimisation and Constraint Solving Group,
00008  *  Monash University. All rights reserved.
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00023  */
00024 
00025 #ifndef STROKESVIEWER_H
00026 #define STROKESVIEWER_H
00027 
00028 
00029 #include <QWidget>
00030 
00031 #include <QBrush>
00032 #include <QPainterPath>
00033 #include <QPen>
00034 #include <QTime>
00035 
00036 #include "Gesture/strokelist.h"
00037 #include "DigestGuiCore/strokespainterpath.h"
00038 
00039 
00040 class StrokesViewer : public QWidget {
00041 
00042   Q_OBJECT
00043 
00044 public:
00045   StrokesViewer( QWidget* parent = 0 );
00046   StrokesViewer( const StrokeList& strokes, QWidget* parent = 0 );
00047   virtual ~StrokesViewer() {}
00048 
00049   const StrokeList& strokes() const { return m_strokes; }
00050   virtual void setStrokes( const StrokeList& strokes, bool updateWidget = true );
00051 
00052   const QPen& pen() const { return m_pen; }
00053   virtual void setPen( const QPen& pen, bool updateWidget = true );
00054 
00055   const QBrush& backgroundBrush() const { return m_backgroundBrush; }
00056   virtual void setBackgroundBrush( const QBrush& brush, bool updateWidget = true );
00057 
00058   const QPen& gridPen() const { return m_gridPen; }
00059   virtual void setGridPen( const QPen& pen, bool updateWidget= true );
00060 
00061   bool isAnimating() const { return animTimerId; } // !=0 == in animation
00062 
00063 
00064 signals:
00065   void animationStarted();
00066   void animationStopped();
00067 
00068 
00069 public slots:
00070   virtual void animate();
00071   virtual void stopAnimation();
00072 
00073 
00074 protected:
00075   StrokeList& strokesRef() { return m_strokes; }
00076   StrokesPainterPath& pathRef() { return m_path; }
00077 
00078   virtual void paintEvent( QPaintEvent* event );
00079   virtual void timerEvent( QTimerEvent* event );
00080 
00081 
00082 private:
00083   void init();
00084 
00085   StrokeList          m_strokes;
00086   StrokesPainterPath  m_path;
00087 
00088   QPen         m_pen;
00089   QBrush       m_backgroundBrush;
00090   QPen         m_gridPen;
00091 
00092   int          animTimerId;
00093   int          animStrokeIndex;
00094   int          animStrokePointIndex;
00095   QTime        animStrokeTime;
00096   StrokePoint  animQueuedPoint;
00097   bool         animQueuedPointWaiting;
00098 };
00099 
00100 
00101 #endif  // ! STROKESVIEWER_H

Generated on Mon Jul 30 09:46:50 2007 for Digest by  doxygen 1.5.2