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 };
QwtScaleWidget * selectedAxis()
Definition: ScalePicker.h:76
void mouseDblClicked(const QwtScaleWidget *, const QPoint &)
Definition: ScalePicker.cpp:125
A 2D-plotting widget.
Definition: Graph.h:123
ScalePicker(Graph *plot)
Definition: ScalePicker.cpp:40
bool d_labels_selected
Definition: ScalePicker.h:113
void selectLabels(QwtScaleWidget *scale, bool select=true)
Definition: ScalePicker.cpp:269
QRect scaleTicksRect(const QwtScaleWidget *scale) const
Returns the bounding rectangle of a scale excluding the title and the tick labels.
Definition: ScalePicker.cpp:189
void axisDblClicked(int)
void deselect()
Definition: ScalePicker.cpp:292
void mouseClicked(const QwtScaleWidget *scale, const QPoint &pos)
bool titleSelected()
Definition: ScalePicker.h:67
void axisTitleDblClicked()
void axisTicksDblClicked(int)
QwtScaleWidget * d_current_axis
Definition: ScalePicker.h:114
void axisRightClicked(int)
void selectTitle(QwtScaleWidget *scale, bool select=true)
Definition: ScalePicker.cpp:243
QwtScaleWidget * currentAxis()
Returns a pointer to the active axis in the plot layer.
Definition: ScalePicker.h:78
void clicked()
Emitted when the user clicks on one of the monitored axes.
bool eventFilter(QObject *, QEvent *)
Definition: ScalePicker.cpp:50
QwtScaleWidget * d_selected_axis
Definition: ScalePicker.h:114
bool d_title_selected
Definition: ScalePicker.h:112
QRect titleRect(const QwtScaleWidget *scale) const
Returns the bounding rectangle of a scale&#39;s title.
Definition: ScalePicker.cpp:210
Handles user interaction with a QwtScaleWidget.
Definition: ScalePicker.h:41
bool labelsSelected()
Definition: ScalePicker.h:70
void refresh()
Definition: ScalePicker.cpp:180
bool labelClicked(const QwtScaleWidget *scale, const QPoint &pos)
Definition: ScalePicker.cpp:87
QRect scaleRect(const QwtScaleWidget *) const
Returns the bounding rectangle of a scale without the title.
Definition: ScalePicker.cpp:148
void axisTitleRightClicked()
Emitted when the user right-clicks on the title of an axis.
void mouseRightClicked(const QwtScaleWidget *scale, const QPoint &pos)
Definition: ScalePicker.cpp:137
Graph * plot()
Return my parent casted to Graph.
Definition: ScalePicker.h:63