Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_ABSTRACT_SCALE_DRAW_H
00011 #define QWT_ABSTRACT_SCALE_DRAW_H
00012
00013 #include "qwt_global.h"
00014 #include "qwt_scale_div.h"
00015 #include "qwt_text.h"
00016
00017 class QPalette;
00018 class QPainter;
00019 class QFont;
00020 class QwtTransform;
00021 class QwtScaleMap;
00022
00031 class QWT_EXPORT QwtAbstractScaleDraw
00032 {
00033 public:
00034
00039 enum ScaleComponent
00040 {
00042 Backbone = 0x01,
00043
00045 Ticks = 0x02,
00046
00048 Labels = 0x04
00049 };
00050
00052 typedef QFlags<ScaleComponent> ScaleComponents;
00053
00054 QwtAbstractScaleDraw();
00055 virtual ~QwtAbstractScaleDraw();
00056
00057 void setScaleDiv( const QwtScaleDiv &s );
00058 const QwtScaleDiv& scaleDiv() const;
00059
00060 void setTransformation( QwtTransform * );
00061 const QwtScaleMap &scaleMap() const;
00062 QwtScaleMap &scaleMap();
00063
00064 void enableComponent( ScaleComponent, bool enable = true );
00065 bool hasComponent( ScaleComponent ) const;
00066
00067 void setTickLength( QwtScaleDiv::TickType, double length );
00068 double tickLength( QwtScaleDiv::TickType ) const;
00069 double maxTickLength() const;
00070
00071 void setSpacing( double margin );
00072 double spacing() const;
00073
00074 void setPenWidth( int width );
00075 int penWidth() const;
00076
00077 virtual void draw( QPainter *, const QPalette & ) const;
00078
00079 virtual QwtText label( double ) const;
00080
00093 virtual double extent( const QFont &font ) const = 0;
00094
00095 void setMinimumExtent( double );
00096 double minimumExtent() const;
00097
00098 void invalidateCache();
00099
00100 protected:
00110 virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
00111
00118 virtual void drawBackbone( QPainter *painter ) const = 0;
00119
00128 virtual void drawLabel( QPainter *painter, double value ) const = 0;
00129
00130 const QwtText &tickLabel( const QFont &, double value ) const;
00131
00132 private:
00133 Q_DISABLE_COPY(QwtAbstractScaleDraw)
00134
00135 class PrivateData;
00136 PrivateData *d_data;
00137 };
00138
00139 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
00140
00141 #endif