00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_SCALE_DIV_H
00011 #define QWT_SCALE_DIV_H
00012
00013 #include "qwt_global.h"
00014
00015 class QwtDoubleInterval;
00016
00017 #if QT_VERSION < 0x040000
00018 #include <qvaluelist.h>
00019
00020 #if defined(QWT_TEMPLATEDLL)
00021
00022 template class QWT_EXPORT QValueList<double>;
00023
00024 #endif
00025 typedef QValueList<double> QwtTickList;
00026 #else
00027 #include <qlist.h>
00028 #if defined(QWT_TEMPLATEDLL)
00029
00030 template class QWT_EXPORT QList<double>;
00031
00032 #endif
00033 typedef QList<double> QwtTickList;
00034 #endif
00035
00036
00048 class QWT_EXPORT QwtScaleDiv
00049 {
00050 public:
00051 enum TickType
00052 {
00053 NoTick = -1,
00054
00055 MinorTick,
00056 MediumTick,
00057 MajorTick,
00058
00059 NTickTypes
00060 };
00061
00062 explicit QwtScaleDiv();
00063 explicit QwtScaleDiv(const QwtDoubleInterval &,
00064 QwtTickList[NTickTypes]);
00065 explicit QwtScaleDiv(double lBound, double rBound,
00066 QwtTickList[NTickTypes]);
00067
00068 int operator==(const QwtScaleDiv &s) const;
00069 int operator!=(const QwtScaleDiv &s) const;
00070
00071 inline double lBound() const;
00072 inline double hBound() const;
00073 inline double range() const;
00074
00075 bool contains(double v) const;
00076
00077 const QwtTickList &ticks(int type) const;
00078
00079 void invalidate();
00080 bool isValid() const;
00081
00082 void invert();
00083
00084 private:
00085 double d_lBound;
00086 double d_hBound;
00087 QwtTickList d_ticks[NTickTypes];
00088
00089 bool d_isValid;
00090 };
00091
00096 inline double QwtScaleDiv::lBound() const
00097 {
00098 return d_lBound;
00099 }
00100
00105 inline double QwtScaleDiv::hBound() const
00106 {
00107 return d_hBound;
00108 }
00109
00113 inline double QwtScaleDiv::range() const
00114 {
00115 return d_hBound - d_lBound;
00116 }
00117 #endif