]> git.sesse.net Git - vlc/blob - modules/gui/qt4/util/input_slider.hpp
Add a preference option to choose your Volume Slider colours.
[vlc] / modules / gui / qt4 / util / input_slider.hpp
1 /*****************************************************************************
2  * input_slider.hpp : A slider that controls an input
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef _INPUTSLIDER_H_
25 #define _INPUTSLIDER_H_
26
27 #include "qt4.hpp"
28
29 #include <QSlider>
30 #include <QMouseEvent>
31
32 class InputSlider : public QSlider
33 {
34     Q_OBJECT
35 public:
36     InputSlider( QWidget *_parent );
37     InputSlider( Qt::Orientation q,QWidget *_parent );
38     virtual ~InputSlider()   {};
39 protected:
40     virtual void mouseMoveEvent(QMouseEvent *event);
41     virtual void mousePressEvent(QMouseEvent* event);
42     virtual void mouseReleaseEvent(QMouseEvent* event);
43 private:
44     bool b_sliding;
45     int inputLength;
46     char psz_length[MSTRTIME_MAX_SIZE];
47 public slots:
48     void setPosition( float, int, int );
49 private slots:
50     void userDrag( int );
51 signals:
52     void sliderDragged( float );
53 };
54
55
56 class QPaintEvent;
57 #include <QAbstractSlider>
58
59 class SoundSlider : public QAbstractSlider
60 {
61     Q_OBJECT
62 public:
63     SoundSlider( QWidget *_parent, int _i_step, bool b_softamp, char * );
64     virtual ~SoundSlider() {};
65 protected:
66     int paddingL;
67     int paddingR;
68     virtual void paintEvent(QPaintEvent *);
69     virtual void wheelEvent( QWheelEvent *event );
70     virtual void mousePressEvent( QMouseEvent * );
71     virtual void mouseMoveEvent( QMouseEvent * );
72     virtual void mouseReleaseEvent( QMouseEvent * );
73 private:
74     bool b_sliding;
75     bool b_outside;
76     int i_oldvalue;
77     float f_step;
78     void changeValue( int x );
79     QPixmap pixGradient;
80     QPixmap pixOutside;
81 };
82
83 #endif