summaryrefslogtreecommitdiffstats
path: root/src/app/slider.h
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2020-06-13 22:45:28 +0900
committerMichele Calgaro <[email protected]>2020-06-13 22:45:28 +0900
commit5f44f7b187093ef290315b7f8766b540a31de35f (patch)
tree27ffb7b218199ca04f240c390c52426c65f45dce /src/app/slider.h
downloadcodeine-5f44f7b187093ef290315b7f8766b540a31de35f.tar.gz
codeine-5f44f7b187093ef290315b7f8766b540a31de35f.zip
Initial code import from debian snapshot
https://snapshot.debian.org/package/codeine/1.0.1-3.dfsg-3.1/ Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/app/slider.h')
-rw-r--r--src/app/slider.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/app/slider.h b/src/app/slider.h
new file mode 100644
index 0000000..7e06b6b
--- /dev/null
+++ b/src/app/slider.h
@@ -0,0 +1,52 @@
+// (c) 2004 Max Howell ([email protected])
+// See COPYING file for licensing information
+
+#ifndef CODEINESLIDER_H
+#define CODEINESLIDER_H
+
+#include <qslider.h>
+
+namespace Codeine
+{
+ class Slider : public QSlider
+ {
+ Q_OBJECT
+
+ public:
+ static Slider *instance() { return s_instance; }
+
+ public:
+ Slider( QWidget*, uint max = 0 );
+
+ virtual void setValue( int );
+
+ signals:
+ //we emit this when the user has specifically changed the slider
+ //so connect to it if valueChanged() is too generic
+ //Qt also emits valueChanged( int )
+ void sliderReleased( uint );
+
+ protected:
+ virtual void wheelEvent( QWheelEvent* );
+ virtual void mouseMoveEvent( QMouseEvent* );
+ virtual void mouseReleaseEvent( QMouseEvent* );
+ virtual void mousePressEvent( QMouseEvent* );
+ virtual void keyPressEvent( QKeyEvent *e ) { e->ignore(); } //so that MainWindow gets the keypress
+
+ virtual QSize sizeHint() const { return QSlider::sizeHint() + QSize( 0, 6 ); }
+ virtual QSize minimumSizeHint() const { return sizeHint(); }
+
+ bool m_sliding;
+
+ private:
+ static Slider *s_instance;
+
+ bool m_outside;
+ int m_prevValue;
+
+ Slider( const Slider& ); //undefined
+ Slider &operator=( const Slider& ); //undefined
+ };
+}
+
+#endif