qwt_wheel.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
  2. * Qwt Widget Library
  3. * Copyright (C) 1997 Josef Wilgen
  4. * Copyright (C) 2002 Uwe Rathmann
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the Qwt License, Version 1.0
  8. *****************************************************************************/
  9. #ifndef QWT_WHEEL_H
  10. #define QWT_WHEEL_H
  11. #include "qwt_global.h"
  12. #include "qwt_abstract_slider.h"
  13. /*!
  14. \brief The Wheel Widget
  15. The wheel widget can be used to change values over a very large range
  16. in very small steps. Using the setMass member, it can be configured
  17. as a flywheel.
  18. \sa The radio example.
  19. */
  20. class QWT_EXPORT QwtWheel : public QwtAbstractSlider
  21. {
  22. Q_OBJECT
  23. Q_PROPERTY( double totalAngle READ totalAngle WRITE setTotalAngle )
  24. Q_PROPERTY( double viewAngle READ viewAngle WRITE setViewAngle )
  25. Q_PROPERTY( int tickCnt READ tickCnt WRITE setTickCnt )
  26. Q_PROPERTY( int internalBorder READ internalBorder WRITE setInternalBorder )
  27. Q_PROPERTY( double mass READ mass WRITE setMass )
  28. public:
  29. explicit QwtWheel( QWidget *parent = NULL );
  30. virtual ~QwtWheel();
  31. virtual void setOrientation( Qt::Orientation );
  32. double totalAngle() const;
  33. double viewAngle() const;
  34. int tickCnt() const;
  35. int internalBorder() const;
  36. double mass() const;
  37. void setTotalAngle ( double angle );
  38. void setTickCnt( int cnt );
  39. void setViewAngle( double angle );
  40. void setInternalBorder( int width );
  41. void setMass( double val );
  42. void setWheelWidth( int w );
  43. virtual QSize sizeHint() const;
  44. virtual QSize minimumSizeHint() const;
  45. protected:
  46. virtual void resizeEvent( QResizeEvent *e );
  47. virtual void paintEvent( QPaintEvent *e );
  48. void layoutWheel( bool update = true );
  49. void draw( QPainter *, const QRect & );
  50. void drawWheel( QPainter *, const QRect & );
  51. void drawWheelBackground( QPainter *, const QRect & );
  52. void setColorArray();
  53. virtual void valueChange();
  54. virtual void paletteChange( const QPalette & );
  55. virtual double getValue( const QPoint & );
  56. virtual void getScrollMode( const QPoint &,
  57. int &scrollMode, int &direction );
  58. private:
  59. void initWheel();
  60. class PrivateData;
  61. PrivateData *d_data;
  62. };
  63. #endif