00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved. 00004 ** 00005 ** This file is part of the demonstration applications of the Qt Toolkit. 00006 ** 00007 ** This file may be used under the terms of the GNU General Public 00008 ** License version 2.0 as published by the Free Software Foundation 00009 ** and appearing in the file LICENSE.GPL included in the packaging of 00010 ** this file. Please review the following information to ensure GNU 00011 ** General Public Licensing requirements will be met: 00012 ** http://trolltech.com/products/qt/licenses/licensing/opensource/ 00013 ** 00014 ** If you are unsure which license is appropriate for your use, please 00015 ** review the following information: 00016 ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview 00017 ** or contact the sales department at sales@trolltech.com. 00018 ** 00019 ** In addition, as a special exception, Trolltech gives you certain 00020 ** additional rights. These rights are described in the Trolltech GPL 00021 ** Exception version 1.0, which can be found at 00022 ** http://www.trolltech.com/products/qt/gplexception/ and in the file 00023 ** GPL_EXCEPTION.txt in this package. 00024 ** 00025 ** In addition, as a special exception, Trolltech, as the sole copyright 00026 ** holder for Qt Designer, grants users of the Qt/Eclipse Integration 00027 ** plug-in the right for the Qt/Eclipse Integration to link to 00028 ** functionality provided by Qt Designer and its related libraries. 00029 ** 00030 ** Trolltech reserves all rights not expressly granted herein. 00031 ** 00032 ** Trolltech ASA (c) 2007 00033 ** 00034 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00035 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00036 ** 00037 ****************************************************************************/ 00038 00039 #ifndef GRADIENTS_H 00040 #define GRADIENTS_H 00041 00042 #include "common.h" 00043 #include "ShadeWidget.h" 00044 #include "HoverPoints.h" 00045 //#include "Histogram.h" 00046 #include "GradientRenderer.h" 00047 #include <string> 00048 #include <QtGui> 00049 00050 class GradientEditor : public QWidget 00051 { 00052 Q_OBJECT 00053 public: 00054 GradientEditor(QWidget *parent, Qt::WindowFlags flags); 00055 00056 void setGradientStops(const QGradientStops &stops); 00057 00058 //void setHistogram(Histogram* histogram); 00059 //void setRenderer(GradientRenderer* renderer); 00060 00061 public slots: 00062 void pointsUpdated(); 00063 void showTransferFunction() { show(); } 00064 00065 void showHistogram(const int*); 00066 void clearHistogram(); 00067 00068 signals: 00069 void gradientStopsChanged(const QGradientStops &stops); 00070 00071 private: 00072 ShadeWidget *m_red_shade; 00073 ShadeWidget *m_green_shade; 00074 ShadeWidget *m_blue_shade; 00075 ShadeWidget *m_alpha_shade; 00076 00077 QWidget* m_parent; 00078 00079 QVBoxLayout *vbox; 00080 00081 public: 00082 void loadTransferFunction( std::string filename ); 00083 void saveTransferFunction( std::string filename ); 00084 00085 00086 }; 00087 00088 00089 00090 00091 #endif // GRADIENTS_H