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