summaryrefslogtreecommitdiffstats
path: root/src/app/slider.h
blob: b389eee2b2dc17b3f77b236f030c0dd483865fda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// (c) 2004 Max Howell (max.howell@methylblue.com)
// See COPYING file for licensing information

#ifndef CODEINESLIDER_H
#define CODEINESLIDER_H

#include <tqslider.h>

namespace Codeine
{
   class Slider : public TQSlider
   {
   TQ_OBJECT

   public:
      static Slider *instance() { return s_instance; }

   public:
      Slider( TQWidget*, 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
      //TQt also emits valueChanged( int )
      void sliderReleased( uint );

   protected:
      virtual void wheelEvent( TQWheelEvent* );
      virtual void mouseMoveEvent( TQMouseEvent* );
      virtual void mouseReleaseEvent( TQMouseEvent* );
      virtual void mousePressEvent( TQMouseEvent* );
      virtual void keyPressEvent( TQKeyEvent *e ) { e->ignore(); } //so that MainWindow gets the keypress

      virtual TQSize sizeHint() const { return TQSlider::sizeHint() + TQSize( 0, 6 ); }
      virtual TQSize 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