00001
00002
00003
00004
00005 #ifndef COLORDLG_H
00006 #define COLORDLG_H
00007
00008 #include <qdialog.h>
00009 #include "rcolor.h"
00010
00011 class QVBoxLayout;
00012 class QHBoxLayout;
00013 class QGridLayout;
00014 class QSpinBox;
00015 class QLabel;
00016 class QLineEdit;
00017 class QPushButton;
00018 class QToolButton;
00019
00020 class ColorCircle;
00021 class Slider;
00022 class Sample;
00023 class HistoryFrame;
00024
00025 class ColorDlg : public QDialog
00026 {
00027 Q_OBJECT
00028
00029 rColor curColor;
00030 ColorCircle* colci;
00031 QHBoxLayout* upperLayout;
00032 QVBoxLayout* colorsLayout, *ColorDlgLayout;
00033 QGridLayout* SliderLayout, *sampleLayout, *lowerLayout;
00034 bool useSpinBoxes;
00035 bool grabbing;
00036
00037 Slider* hueSlider, *satSlider, *valSlider;
00038 Slider* redSlider, *greenSlider, *blueSlider;
00039 QSpinBox* hueSpinBox, *satSpinBox, *valSpinBox;
00040 QSpinBox* redSpinBox, *greenSpinBox, *blueSpinBox;
00041 QLabel* hueLabel, *satLabel, *valLabel;
00042 QLabel* redLabel, *greenLabel, *blueLabel;
00043 QLabel* alphaLabel, *htmlLabel;
00044 QLabel* newLabel, *oldLabel;
00045 QSpinBox* alphaSpinBox;
00046 Slider* alphaSlider;
00047 QLineEdit* htmlText;
00048 Sample* newSample, *oldSample;
00049 HistoryFrame** history;
00050 int historyFrames;
00051 int nextFrame;
00052 QPushButton* acceptButton, *rejectButton;
00053 QToolButton* addHistory, *pickColor;
00054
00055 QColor retQCol;
00056 rColor retRCol;
00057 public:
00058 ColorDlg( QWidget* parent = 0, const char* name = 0,
00059 bool modal = false, WFlags f = 0 );
00061 void setColor( const rColor& c ) { colorChanged( c ); }
00062 void setColor( const QColor& );
00063 const rColor& getRColor() { return curColor; }
00064 const QColor& getQColor();
00065 void setHistory( int, const rColor& );
00066 const rColor& getHistory( int );
00067
00068 public slots:
00069 void colorChanged( const rColor& );
00070 void rgbChanged( int );
00071 void hsvChanged( int );
00072 void alphaChanged( int );
00073 void grabPixel();
00074 void addCustomColor() { toHistory( curColor ); }
00075 void toHistory( const rColor& );
00076 void deleteHistory( HistoryFrame* );
00077 void htmlChanged();
00078
00079 protected:
00080 void mouseReleaseEvent( QMouseEvent* );
00081 };
00082
00083 #endif // COLORDLG_H