Final polisihing for KDE4:
[kdemultimedia.git] / kmix / ksmallslider.h
blobf905a4c916a398151396acc66cac7055ea7096a3
1 //-*-C++-*-
2 /*
3 * KMix -- KDE's full featured mini mixer
6 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef KSMALLSLIDER_H
24 #define KSMALLSLIDER_H
26 #include <qabstractslider.h>
27 #include <qpixmap.h>
29 class KSmallSlider : public QAbstractSlider
31 Q_OBJECT
33 public:
34 KSmallSlider( int minValue, int maxValue, int pageStep, int value,
35 Qt::Orientation, QWidget *parent, const char *name=0 );
37 QSize sizeHint() const;
38 QSizePolicy sizePolicy() const;
39 QSize minimumSizeHint() const;
41 bool gray() const;
43 public slots:
44 void setGray( bool value );
45 void setColors( QColor high, QColor low, QColor back );
46 void setGrayColors( QColor high, QColor low, QColor back );
48 signals:
49 void valueChanged( int value );
51 protected:
52 void resizeEvent( QResizeEvent * );
53 void paintEvent( QPaintEvent * );
55 void mousePressEvent( QMouseEvent * );
56 void mouseMoveEvent( QMouseEvent * );
57 // void wheelEvent( QWheelEvent * );
59 void valueChange();
61 private:
63 void init();
64 int positionFromValue( int ) const;
65 int valueFromPosition( int ) const;
66 int positionFromValue( int logical_val, int span ) const;
67 int valueFromPosition( int pos, int span ) const;
68 void moveSlider( int );
70 int available() const;
71 int goodPart( const QPoint& ) const;
73 bool grayed;
74 QColor colHigh, colLow, colBack;
75 QColor grayHigh, grayLow, grayBack;
79 #endif