qwt_abstract_scale_draw.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  * 
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
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 
00018 #if QT_VERSION < 0x040000
00019 class QColorGroup;
00020 #else
00021 class QPalette;
00022 #endif
00023 class QPainter;
00024 class QFont;
00025 class QwtScaleTransformation;
00026 class QwtScaleMap;
00027 
00037 class QWT_EXPORT QwtAbstractScaleDraw
00038 {
00039 public:
00040 
00052     enum ScaleComponent
00053     { 
00054         Backbone = 1,
00055         Ticks = 2,
00056         Labels = 4
00057     };
00058  
00059     QwtAbstractScaleDraw();
00060     QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
00061     virtual ~QwtAbstractScaleDraw();
00062 
00063     QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &);
00064     
00065     void setScaleDiv(const QwtScaleDiv &s);
00066     const QwtScaleDiv& scaleDiv() const;
00067 
00068     void setTransformation(QwtScaleTransformation *);
00069     const QwtScaleMap &map() const;
00070 
00071     void enableComponent(ScaleComponent, bool enable = true);
00072     bool hasComponent(ScaleComponent) const;
00073 
00074     void setTickLength(QwtScaleDiv::TickType, int length);
00075     int tickLength(QwtScaleDiv::TickType) const;
00076     int majTickLength() const;
00077 
00078     void setSpacing(int margin);
00079     int spacing() const;
00080         
00081 #if QT_VERSION < 0x040000
00082     virtual void draw(QPainter *, const QColorGroup &) const;
00083 #else
00084     virtual void draw(QPainter *, const QPalette &) const;
00085 #endif
00086 
00087     virtual QwtText label(double) const;
00088 
00098     virtual int extent(const QPen &, const QFont &) const = 0;
00099 
00100     void setMinimumExtent(int);
00101     int minimumExtent() const;
00102 
00103     QwtScaleMap &scaleMap();
00104 
00105 protected:
00115     virtual void drawTick(QPainter *painter, double value, int len) const = 0;
00116 
00123     virtual void drawBackbone(QPainter *painter) const = 0;
00124 
00133     virtual void drawLabel(QPainter *painter, double value) const = 0;
00134 
00135     void invalidateCache();
00136     const QwtText &tickLabel(const QFont &, double value) const;
00137 
00138 private:
00139     int operator==(const QwtAbstractScaleDraw &) const;
00140     int operator!=(const QwtAbstractScaleDraw &) const;
00141 
00142     class PrivateData;
00143     PrivateData *d_data;
00144 };
00145 
00146 #endif

Generated on Mon Feb 26 21:22:36 2007 for Qwt User's Guide by  doxygen 1.4.6