krita

kis_histogram_view.h

00001 /*
00002  *  Copyright (c) 2005 Bart Coppens <kde@bartcoppens.be>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #ifndef _KIS_HISTOGRAM_VIEW_
00020 #define _KIS_HISTOGRAM_VIEW_
00021 
00022 #include <qlabel.h>
00023 #include <qpixmap.h>
00024 #include <qvaluevector.h>
00025 #include <qstringlist.h>
00026 
00027 #include "kis_types.h"
00028 #include "kis_histogram_producer.h"
00029 #include "kis_histogram.h"
00030 
00031 class KisChannelInfo;
00032 
00048 class KisHistogramView : public QLabel {
00049     Q_OBJECT
00050 public:
00051     KisHistogramView(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
00052     virtual ~KisHistogramView();
00053 
00054     void setPaintDevice(KisPaintDeviceSP dev);
00055     void setHistogram(KisHistogramSP histogram);
00056     void setView(double from, double size);
00057     KisHistogramProducerSP currentProducer();
00058     QStringList channelStrings();
00060     KisIDList listProducers();
00062     void setCurrentChannels(const KisID& producerID, QValueVector<KisChannelInfo *> channels);
00064     void setCurrentChannels(KisHistogramProducerSP producer, QValueVector<KisChannelInfo *> channels);
00065     bool hasColor();
00066     void setColor(bool set);
00067 
00068 public slots:
00069     void setActiveChannel(int channel);
00070     void setHistogramType(enumHistogramType type);
00071     void updateHistogram();
00072 
00073 signals:
00074     void rightClicked(const QPoint& pos);
00075 
00076 protected:
00077     virtual void mousePressEvent(QMouseEvent * e);
00078 
00079 private:
00080     void setChannels();
00081     void addProducerChannels(KisHistogramProducerSP producer);
00082 
00083     typedef struct {
00084         bool isProducer;
00085         KisHistogramProducerSP producer;
00086         KisChannelInfo * channel;
00087     } ComboboxInfo;
00088 
00089     QValueVector<ComboboxInfo> m_comboInfo;
00090     QPixmap m_pix;
00091     KisHistogramSP m_histogram;
00092     KisColorSpace* m_cs;
00093     KisHistogramProducerSP m_currentProducer;
00094     QValueVector<KisChannelInfo *> m_channels;
00095     // Maps the channels in m_channels to a real channel offset in the producer->channels()
00096     QValueVector<Q_INT32> m_channelToOffset;
00097     QStringList m_channelStrings;
00098     bool m_color;
00099     double m_from;
00100     double m_width;
00101 };
00102 
00103 #endif // _KIS_HISTOGRAM_VIEW_
KDE Home | KDE Accessibility Home | Description of Access Keys