KDEUI
kselector.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KSELECTOR_H
00024 #define KSELECTOR_H
00025
00026 #include <kdeui_export.h>
00027
00028 #include <QtGui/QAbstractSlider>
00029 #include <QtGui/QWidget>
00030
00040 class KDEUI_EXPORT KSelector : public QAbstractSlider
00041 {
00042 Q_OBJECT
00043 Q_PROPERTY( int value READ value WRITE setValue )
00044 Q_PROPERTY( int minValue READ minimum WRITE setMinimum )
00045 Q_PROPERTY( int maxValue READ maximum WRITE setMaximum )
00046 public:
00047
00051 explicit KSelector( QWidget *parent=0 );
00056 explicit KSelector( Qt::Orientation o, QWidget *parent = 0 );
00057
00058
00059
00060 ~KSelector();
00061
00065 QRect contentsRect() const;
00066
00071 void setIndent( bool i );
00072
00076 bool indent() const;
00077
00081 void setArrowDirection( Qt::ArrowType direction );
00082
00086 Qt::ArrowType arrowDirection() const;
00087
00088 protected:
00095 virtual void drawContents( QPainter * );
00100 virtual void drawArrow( QPainter *painter, const QPoint &pos );
00101
00102 virtual void paintEvent( QPaintEvent * );
00103 virtual void mousePressEvent( QMouseEvent *e );
00104 virtual void mouseMoveEvent( QMouseEvent *e );
00105 virtual void mouseReleaseEvent( QMouseEvent *e );
00106 virtual void wheelEvent( QWheelEvent * );
00107
00108 private:
00109 QPoint calcArrowPos( int val );
00110 void moveArrow( const QPoint &pos );
00111
00112 private:
00113 class Private;
00114 friend class Private;
00115 Private * const d;
00116
00117 Q_DISABLE_COPY(KSelector)
00118 };
00119
00120
00129 class KDEUI_EXPORT KGradientSelector : public KSelector
00130 {
00131 Q_OBJECT
00132
00133 Q_PROPERTY( QColor firstColor READ firstColor WRITE setFirstColor )
00134 Q_PROPERTY( QColor secondColor READ secondColor WRITE setSecondColor )
00135 Q_PROPERTY( QString firstText READ firstText WRITE setFirstText )
00136 Q_PROPERTY( QString secondText READ secondText WRITE setSecondText )
00137
00138 public:
00143 explicit KGradientSelector( QWidget *parent=0 );
00148 explicit KGradientSelector( Qt::Orientation o, QWidget *parent=0 );
00152 ~KGradientSelector();
00156 void setColors( const QColor &col1, const QColor &col2 );
00157 void setText( const QString &t1, const QString &t2 );
00158
00162 void setFirstColor( const QColor &col );
00163 void setSecondColor( const QColor &col );
00164
00168 void setFirstText( const QString &t );
00169 void setSecondText( const QString &t );
00170
00171 QColor firstColor() const;
00172 QColor secondColor() const;
00173
00174 QString firstText() const;
00175 QString secondText() const;
00176
00177 protected:
00178
00179 virtual void drawContents( QPainter * );
00180 virtual QSize minimumSize() const;
00181
00182 private:
00183 class KGradientSelectorPrivate;
00184 friend class KGradientSelectorPrivate;
00185 KGradientSelectorPrivate * const d;
00186
00187 Q_DISABLE_COPY(KGradientSelector)
00188 };
00189
00190 #endif // KSELECTOR_H