lib Library API Documentation

koColorSlider.h

00001 /* This file is part of the KDE project 00002 Copyright (c) 1999 Matthias Elter (me@kde.org) 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library 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 GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 Boston, MA 02111-1307, USA. 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
KDE Logo
This file is part of the documentation for lib Library Version 1.3.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 28 04:03:59 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003