# qwt_scale_div.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_SCALE_DIV_H
    00011 #define QWT_SCALE_DIV_H
    00012
    00013 #include "qwt_global.h"
    00014 #include "qwt_valuelist.h"
    00015 #include "qwt_double_interval.h"
    00016
    00017 class QwtDoubleInterval;
    00018
    00030 class QWT_EXPORT QwtScaleDiv
    00031 {
    00032 public:
    00033     enum TickType
    00034     {
    00035         NoTick = -1,
    00036
    00037         MinorTick,
    00038         MediumTick,
    00039         MajorTick,
    00040
    00041         NTickTypes
    00042     };
    00043
    00044     explicit QwtScaleDiv();
    00045     explicit QwtScaleDiv(const QwtDoubleInterval &,
    00046         QwtValueList[NTickTypes]);
    00047     explicit QwtScaleDiv(double lBound, double rBound,
    00048         QwtValueList[NTickTypes]);
    00049
    00050     int operator==(const QwtScaleDiv &s) const;
    00051     int operator!=(const QwtScaleDiv &s) const;
    00052
    00053     void setInterval(double lBound, double rBound);
    00054     void setInterval(const QwtDoubleInterval &);
    00055     QwtDoubleInterval interval() const;
    00056
    00057     inline double lBound() const;
    00058     inline double hBound() const;
    00059     inline double range() const;
    00060
    00061     bool contains(double v) const;
    00062
    00063     void setTicks(int type, const QwtValueList &);
    00064     const QwtValueList &ticks(int type) const;
    00065
    00066     void invalidate();
    00067     bool isValid() const;
    00068
    00069     void invert();
    00070
    00071 private:
    00072     double d_lBound;
    00073     double d_hBound;
    00074     QwtValueList d_ticks[NTickTypes];
    00075
    00076     bool d_isValid;
    00077 };
    00078
    00084 inline void QwtScaleDiv::setInterval(double lBound, double hBound)
    00085 {
    00086     d_lBound = lBound;
    00087     d_hBound = hBound;
    00088 }
    00089
    00093 inline QwtDoubleInterval QwtScaleDiv::interval() const
    00094 {
    00095     return QwtDoubleInterval(d_lBound, d_hBound);
    00096 }
    00097
    00102 inline double QwtScaleDiv::lBound() const
    00103 {
    00104     return d_lBound;
    00105 }
    00106
    00111 inline double QwtScaleDiv::hBound() const
    00112 {
    00113     return d_hBound;
    00114 }
    00115
    00119 inline double QwtScaleDiv::range() const
    00120 {
    00121     return d_hBound - d_lBound;
    00122 }
    00123 #endif