SciDAVis  1.D4
ScalePicker.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ScalePicker.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief, Tilman Benkert
6  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net
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 QwtPlot;
34 class QwtScaleWidget;
35 class Graph;
36 
42 class ScalePicker: public QObject
43 {
44  Q_OBJECT
45 public:
46  ScalePicker(QwtPlot *plot);
47 
49  QRect scaleRect(const QwtScaleWidget *) const;
50 
52  QRect scaleTicksRect(const QwtScaleWidget *scale) const;
53 
55  QRect titleRect(const QwtScaleWidget *scale) const;
56 
61  void refresh();
62 
64  QwtPlot *plot() { return (QwtPlot *)parent(); }
65  Graph *graph() { return (Graph *)(parent()->parent()); }
66 
67  void deselect();
68 
70  void selectTitle(QwtScaleWidget *scale, bool select = true);
71 
73  void selectLabels(QwtScaleWidget *scale, bool select = true);
74 
78  QwtScaleWidget* selectedAxis(){return d_selected_axis;};
80  QwtScaleWidget* currentAxis(){return d_current_axis;};
81 
82 signals:
84  void clicked();
85 
89  void axisRightClicked(int);
93  void axisTitleRightClicked(int);
94 
98  void axisDblClicked(int);
99 
103  void xAxisTitleDblClicked();
107  void yAxisTitleDblClicked();
115  void topAxisTitleDblClicked();
116 
117 private:
118  bool eventFilter(QObject *, QEvent *);
119 
120  void mouseDblClicked(const QwtScaleWidget *, const QPoint &);
121  void mouseClicked(const QwtScaleWidget *scale, const QPoint &pos) ;
122  void mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos);
123 
126  QwtScaleWidget *d_selected_axis, *d_current_axis;
127 };