lib Library API Documentation

koColorChooser.h

00001 /* This file is part of the KDE project
00002   Copyright (c) 1999 Matthias Elter (me@kde.org)
00003   Copyright (c) 2001-2002 Igor Jansen (rm@kde.org)
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019 */
00020 
00021 #ifndef __ko_ColorChooser_h__
00022 #define __ko_ColorChooser_h__
00023 
00024 #include <qwidget.h>
00025 #include "koColor.h"
00026 
00027 class KoFrameButton;
00028 class QGridLayout;
00029 class QTabWidget;
00030 class RGBWidget;
00031 class HSVWidget;
00032 class CMYKWidget;
00033 class LABWidget;
00034 class GreyWidget;
00035 class KoColor;
00036 class KoColorSlider;
00037 class QLabel;
00038 class QSpinBox;
00039 class KHSSelector;
00040 class KColorPatch;
00041 class ColorWidget;
00042 
00043 class KoColorChooser : public QWidget
00044 {
00045   Q_OBJECT
00046 public:
00047   KoColorChooser(QWidget *parent = 0L, const char *name = 0L);
00048 
00049   const KoColor &color() const {return mColor; }
00050 
00051 public slots:
00052   void slotChangeColor(const KoColor &c);
00053   void slotChangeColor(const QColor &c);
00054 
00055 signals:
00056   void colorChanged(const KoColor &c);
00057 
00058 protected slots:
00059   void slotChangeXY(int h, int s);
00060 
00061 private slots:
00062   void childColorChanged(const KoColor& c);
00063   void slotCurrentChanged(QWidget *current);
00064 
00065 private:
00066   ColorWidget *m_current;
00067   KoColor           mColor;
00068   QTabWidget *m_tab;
00069   QGridLayout      *mGrid;
00070   KoFrameButton    *btnRGB;
00071   KoFrameButton    *btnHSV;
00072   KoFrameButton    *btnCMYK;
00073   KoFrameButton    *btnLAB;
00074   KoFrameButton    *btnGrey;
00075   RGBWidget        *mRGBWidget;
00076   HSVWidget        *mHSVWidget;
00077   QWidget       *mCMYKWidget;
00078   LABWidget        *mLABWidget;
00079   GreyWidget       *mGreyWidget;
00080   KHSSelector      *mColorSelector;
00081 };
00082 
00083 class ColorWidget : public QWidget {
00084     Q_OBJECT
00085 
00086 public:
00087     ColorWidget(QWidget *parent = 0);
00088     virtual ~ColorWidget();
00089 
00090 public slots:
00091     virtual void slotChangeColor(const KoColor& c);
00092     virtual void slotChangeColor(const QColor& c);
00093     virtual void slotRefreshColor() = 0;
00094 
00095 protected:
00096     KoColor mColor;
00097 };
00098 
00099 class RGBWidget : public ColorWidget
00100 {
00101   Q_OBJECT
00102 public:
00103   RGBWidget(QWidget *parent = 0L);
00104   virtual ~RGBWidget() {}
00105 
00106 public slots:
00107   virtual void slotRefreshColor();
00108 
00109 protected slots:
00110   void slotRSliderChanged(int r);
00111   void slotGSliderChanged(int g);
00112   void slotBSliderChanged(int b);
00113 
00114   void slotRInChanged(int r);
00115   void slotGInChanged(int g);
00116   void slotBInChanged(int b);
00117 
00118   void slotPatchChanged(const QColor& clr);
00119 
00120 signals:
00121   void colorChanged(const KoColor &c);
00122 
00123 private:
00124   KoColorSlider *mRSlider;
00125   KoColorSlider *mGSlider;
00126   KoColorSlider *mBSlider;
00127   QLabel *mRLabel;
00128   QLabel *mGLabel;
00129   QLabel *mBLabel;
00130   QSpinBox *mRIn;
00131   QSpinBox *mGIn;
00132   QSpinBox *mBIn;
00133   KColorPatch *mColorPatch;
00134 };
00135 
00136 class HSVWidget : public ColorWidget
00137 {
00138   Q_OBJECT
00139 public:
00140   HSVWidget(QWidget *parent = 0L);
00141   virtual ~HSVWidget() {}
00142 
00143 public slots:
00144   virtual void slotRefreshColor();
00145 
00146 protected slots:
00147   void slotHSliderChanged(int h);
00148   void slotSSliderChanged(int s);
00149   void slotVSliderChanged(int v);
00150 
00151   void slotHInChanged(int h);
00152   void slotSInChanged(int s);
00153   void slotVInChanged(int v);
00154 
00155   void slotPatchChanged(const QColor& clr);
00156 
00157 signals:
00158   void colorChanged(const KoColor &c);
00159 
00160 private:
00161   KoColorSlider    *mHSlider;
00162   KoColorSlider    *mSSlider;
00163   KoColorSlider    *mVSlider;
00164   QLabel           *mHLabel;
00165   QLabel           *mSLabel;
00166   QLabel           *mVLabel;
00167   QSpinBox         *mHIn;
00168   QSpinBox         *mSIn;
00169   QSpinBox         *mVIn;
00170   KColorPatch *mColorPatch;
00171 };
00172 
00173 class GreyWidget : public ColorWidget
00174 {
00175   Q_OBJECT
00176 public:
00177   GreyWidget(QWidget *parent = 0L);
00178   virtual ~GreyWidget() {}
00179 
00180 public slots:
00181   virtual void slotRefreshColor();
00182 
00183 protected slots:
00184   void slotVSliderChanged(int v);
00185   void slotVInChanged(int v);
00186   void slotPatchChanged(const QColor& clr);
00187 
00188 signals:
00189   void colorChanged(const KoColor &c);
00190 
00191 protected:
00192   KoColorSlider *mVSlider;
00193   QLabel      *mVLabel;
00194   QSpinBox    *mVIn;
00195   KColorPatch *mColorPatch;
00196 };
00197 
00198 class LABWidget : public ColorWidget
00199 {
00200   Q_OBJECT
00201 public:
00202   LABWidget(QWidget *parent = 0L);
00203   virtual ~LABWidget() {}
00204 
00205 public slots:
00206   virtual void slotRefreshColor();
00207 
00208 protected slots:
00209   void slotLSliderChanged(int l);
00210   void slotASliderChanged(int a);
00211   void slotBSliderChanged(int b);
00212 
00213   void slotLInChanged(int l);
00214   void slotAInChanged(int a);
00215   void slotBInChanged(int b);
00216 
00217   void slotPatchChanged(const QColor& clr);
00218 
00219 signals:
00220   void colorChanged(const KoColor &c);
00221 
00222 private:
00223   KoColorSlider *mLSlider;
00224   KoColorSlider *mASlider;
00225   KoColorSlider *mBSlider;
00226   QLabel *mLLabel;
00227   QLabel *mALabel;
00228   QLabel *mBLabel;
00229   QSpinBox *mLIn;
00230   QSpinBox *mAIn;
00231   QSpinBox *mBIn;
00232   KColorPatch *mColorPatch;
00233 };
00234 
00235 #endif
00236 
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Mar 20 14:25:24 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003