QtiPlot  0.9.8.2
ScalePicker.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ScalePicker.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : Scale picker
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #include <QObject>
30 
31 class QRect;
32 class QPoint;
33 class QwtScaleWidget;
34 class Graph;
35 
41 class ScalePicker: public QObject
42 {
43  Q_OBJECT
44 public:
46 
48  QRect scaleRect(const QwtScaleWidget *) const;
49 
51  QRect scaleTicksRect(const QwtScaleWidget *scale) const;
52 
54  QRect titleRect(const QwtScaleWidget *scale) const;
55 
60  void refresh();
61 
63  Graph *plot() {return (Graph *)parent();};
64 
65  void deselect();
66 
68  void selectTitle(QwtScaleWidget *scale, bool select = true);
69 
71  void selectLabels(QwtScaleWidget *scale, bool select = true);
72 
76  QwtScaleWidget* selectedAxis(){return d_selected_axis;};
78  QwtScaleWidget* currentAxis(){return d_current_axis;};
79 
80 signals:
82  void clicked();
83 
87  void axisRightClicked(int);
89  void axisTitleRightClicked();
90 
94  void axisDblClicked(int);
95 
99  void axisTicksDblClicked(int);
100 
103  void axisTitleDblClicked();
104 
105 private:
106  bool eventFilter(QObject *, QEvent *);
107  void mouseDblClicked(const QwtScaleWidget *, const QPoint &);
108  void mouseClicked(const QwtScaleWidget *scale, const QPoint &pos) ;
109  void mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos);
110  bool labelClicked(const QwtScaleWidget *scale, const QPoint &pos);
111 
114  QwtScaleWidget *d_selected_axis, *d_current_axis;
115 };