SciDAVis  1.D4
ColorMapEditor.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ColorMapEditor.h
3  Project : SciDAVis
4 --------------------------------------------------------------------
5  Copyright : (C) 2006 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : A QwtLinearColorMap Editor Widget
8  ***************************************************************************/
9 
10 /***************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  * This program is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20  * GNU General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public License *
23  * along with this program; if not, write to the Free Software *
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
25  * Boston, MA 02110-1301 USA *
26  * *
27  ***************************************************************************/
28 #ifndef COLORMAPEDITOR_H
29 #define COLORMAPEDITOR_H
30 
31 #include <QWidget>
32 #include <qwt_color_map.h>
33 
34 class QPushButton;
35 class QTableWidget;
36 class QCheckBox;
37 
38 class ColorMapEditor: public QWidget
39 {
40  Q_OBJECT
41 
42 public:
43  ColorMapEditor(QWidget* parent=0);
44 
45  QwtLinearColorMap colorMap(){return color_map;};
46  void setColorMap(const QwtLinearColorMap& map);
47 
48  void setRange(double min, double max);
49 
50 protected slots:
51  void updateColorMap();
52  void validateLevel(int row, int col);
53  void enableButtons(int row, int col, int = 0, int = 0);
54  void showColorDialog(int row, int col);
55  void insertLevel();
56  void deleteLevel();
57  void setScaledColors(bool scale = true);
58 
59  bool eventFilter(QObject *object, QEvent *e);
60 
61 private:
62  QTableWidget *table;
63  QPushButton *insertBtn, *deleteBtn;
64  QCheckBox *scaleColorsBox;
65 
67  QwtLinearColorMap color_map;
68 
70  double min_val, max_val;
71 };
72 
73 #endif