qwt_abstract_scale.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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_ABSTRACT_SCALE_H
  10. #define QWT_ABSTRACT_SCALE_H
  11. #include "qwt_global.h"
  12. #include <qwidget.h>
  13. class QwtScaleEngine;
  14. class QwtAbstractScaleDraw;
  15. class QwtScaleDiv;
  16. class QwtScaleMap;
  17. class QwtInterval;
  18. /*!
  19. \brief An abstract base class for widgets having a scale
  20. The scale of an QwtAbstractScale is determined by a QwtScaleDiv
  21. definition, that contains the boundaries and the ticks of the scale.
  22. The scale is painted using a QwtScaleDraw object.
  23. The scale division might be assigned explicitly - but usually
  24. it is calculated from the boundaries using a QwtScaleEngine.
  25. The scale engine also decides the type of transformation of the scale
  26. ( linear, logarithmic ... ).
  27. */
  28. class QWT_EXPORT QwtAbstractScale: public QWidget
  29. {
  30. Q_OBJECT
  31. Q_PROPERTY( double lowerBound READ lowerBound WRITE setLowerBound )
  32. Q_PROPERTY( double upperBound READ upperBound WRITE setUpperBound )
  33. Q_PROPERTY( int scaleMaxMajor READ scaleMaxMajor WRITE setScaleMaxMajor )
  34. Q_PROPERTY( int scaleMaxMinor READ scaleMaxMinor WRITE setScaleMaxMinor )
  35. Q_PROPERTY( double scaleStepSize READ scaleStepSize WRITE setScaleStepSize )
  36. public:
  37. QwtAbstractScale( QWidget *parent = NULL );
  38. virtual ~QwtAbstractScale();
  39. void setScale( double lowerBound, double upperBound );
  40. void setScale( const QwtInterval & );
  41. void setScale( const QwtScaleDiv & );
  42. const QwtScaleDiv& scaleDiv() const;
  43. void setLowerBound( double value );
  44. double lowerBound() const;
  45. void setUpperBound( double value );
  46. double upperBound() const;
  47. void setScaleStepSize( double stepSize );
  48. double scaleStepSize() const;
  49. void setScaleMaxMajor( int ticks );
  50. int scaleMaxMinor() const;
  51. void setScaleMaxMinor( int ticks );
  52. int scaleMaxMajor() const;
  53. void setScaleEngine( QwtScaleEngine * );
  54. const QwtScaleEngine *scaleEngine() const;
  55. QwtScaleEngine *scaleEngine();
  56. int transform( double ) const;
  57. double invTransform( int ) const;
  58. bool isInverted() const;
  59. double minimum() const;
  60. double maximum() const;
  61. const QwtScaleMap &scaleMap() const;
  62. protected:
  63. void rescale( double lowerBound,
  64. double upperBound, double stepSize );
  65. void setAbstractScaleDraw( QwtAbstractScaleDraw * );
  66. const QwtAbstractScaleDraw *abstractScaleDraw() const;
  67. QwtAbstractScaleDraw *abstractScaleDraw();
  68. virtual void scaleChange();
  69. private:
  70. void updateScaleDraw();
  71. class PrivateData;
  72. PrivateData *d_data;
  73. };
  74. #endif