00001 /*************************************************************************** 00002 File : ColorMapEditor.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006 by Ion Vasilief 00006 Email (use @ for *) : ion_vasilief*yahoo.fr 00007 Description : A QwtLinearColorMap Editor Widget 00008 ***************************************************************************/ 00009 00010 /*************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 * This program is distributed in the hope that it will be useful, * 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00020 * GNU General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU General Public License * 00023 * along with this program; if not, write to the Free Software * 00024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00025 * Boston, MA 02110-1301 USA * 00026 * * 00027 ***************************************************************************/ 00028 #ifndef COLORMAPEDITOR_H 00029 #define COLORMAPEDITOR_H 00030 00031 #include <QWidget> 00032 #include <qwt_color_map.h> 00033 00034 class QPushButton; 00035 class QTableWidget; 00036 class QCheckBox; 00037 00038 class ColorMapEditor: public QWidget 00039 { 00040 Q_OBJECT 00041 00042 public: 00043 ColorMapEditor(QWidget* parent=0); 00044 00045 QwtLinearColorMap colorMap(){return color_map;}; 00046 void setColorMap(const QwtLinearColorMap& map); 00047 00048 void setRange(double min, double max); 00049 00050 protected slots: 00051 void updateColorMap(); 00052 void validateLevel(int row, int col); 00053 void enableButtons(int row, int col, int = 0, int = 0); 00054 void showColorDialog(int row, int col); 00055 void insertLevel(); 00056 void deleteLevel(); 00057 void setScaledColors(bool scale = true); 00058 00059 bool eventFilter(QObject *object, QEvent *e); 00060 00061 private: 00062 QTableWidget *table; 00063 QPushButton *insertBtn, *deleteBtn; 00064 QCheckBox *scaleColorsBox; 00065 00067 QwtLinearColorMap color_map; 00068 00070 double min_val, max_val; 00071 }; 00072 00073 #endif