CanvasPicker.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : CanvasPicker.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Canvas picker
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #include <QObject>
00030 #include <QPoint>
00031 #include <QMouseEvent>
00032 
00033 class Graph;
00034 class ArrowMarker;
00035 
00040 class CanvasPicker: public QObject
00041 {
00042     Q_OBJECT
00043 public:
00044      CanvasPicker(Graph *plot);
00045      virtual bool eventFilter(QObject *, QEvent *);
00046      void selectPoints(int n);
00047      void selectPeak(const QPoint& p);
00048 
00050 
00052     void disableEditing();
00053 
00054 private:
00055     void drawLineMarker(const QPoint&, bool endArrow);
00056 
00058 
00061     bool selectMarker(const QMouseEvent *e);
00062 
00066     Graph *plot(){return (Graph *)parent();};
00067 
00068     QPoint startLinePoint, endLinePoint;
00069 
00070 signals:
00071     void showPlotDialog(int);
00072     void viewLineDialog();
00073     void showMarkerPopupMenu();
00074     void modified();
00075     void selectPlot();
00076 
00077 private:
00078     bool pointSelected;
00085     ArrowMarker *d_editing_marker;
00086 };