koColorSlider.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __ko_ColorSlider_h__
00021 #define __ko_ColorSlider_h__
00022
00023 #include <qframe.h>
00024 #include <qpoint.h>
00025 #include <qimage.h>
00026 #include <qwidget.h>
00027 #include <kpixmap.h>
00028
00029 class SliderWidget;
00030
00031 class KoColorFrame : public QFrame
00032 {
00033 Q_OBJECT
00034 public:
00035 KoColorFrame(QWidget *parent = 0L);
00036
00037 const QColor colorAt(const QPoint &p);
00038
00039 protected:
00040 void drawContents(QPainter *p);
00041 void mousePressEvent(QMouseEvent *e);
00042 void mouseMoveEvent(QMouseEvent *e);
00043 void mouseReleaseEvent(QMouseEvent *e);
00044
00045 public slots:
00046 void slotSetColor1(const QColor &c);
00047 void slotSetColor2(const QColor &c);
00048
00049 signals:
00050 void clicked(const QPoint &p);
00051 void colorSelected(const QColor &c);
00052
00053 protected:
00054 QColor mC1;
00055 QColor mC2;
00056 KPixmap mPixmap;
00057 QImage mImage;
00058 bool mColorChanged;
00059 bool mPixChanged;
00060 bool mDragging;
00061 };
00062
00063 class KoSliderWidget : public QWidget
00064 {
00065 Q_OBJECT
00066 public:
00067 KoSliderWidget(QWidget *parent = 0L);
00068
00069 protected:
00070 void mousePressEvent(QMouseEvent *e);
00071 void mouseReleaseEvent(QMouseEvent *e);
00072 void mouseMoveEvent(QMouseEvent *e);
00073 void paintEvent(QPaintEvent *);
00074
00075 signals:
00076 void positionChanged(int);
00077
00078 protected:
00079 bool mDragging;
00080 QPoint mPos;
00081 };
00082
00083 class KoColorSlider : public QWidget
00084 {
00085 Q_OBJECT
00086 public:
00087 KoColorSlider(QWidget *parent = 0L);
00088 virtual ~KoColorSlider();
00089
00090 int minValue();
00091 int maxValue();
00092
00093 protected:
00094 void resizeEvent(QResizeEvent *);
00095 void mousePressEvent(QMouseEvent *);
00096
00097 public slots:
00098 void slotSetColor1(const QColor &c);
00099 void slotSetColor2(const QColor &c);
00100
00101 void slotSetValue(int value);
00102 void slotSetRange(int min, int max);
00103
00104 protected slots:
00105 void slotSliderMoved(int x);
00106 void slotFrameClicked(const QPoint &p);
00107
00108 signals:
00109 void colorSelected(const QColor &c);
00110 void valueChanged(int value);
00111
00112 protected:
00113 KoSliderWidget *mSlider;
00114 KoColorFrame *mColorFrame;
00115 int mMin, mMax;
00116 int mValue;
00117 };
00118
00119 #endif
This file is part of the documentation for lib Library Version 1.3.5.