Qwt User's Guide 5.2.2

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:
00034     enum TickType
00035     {
00036         NoTick = -1,
00037 
00038         MinorTick,
00039         MediumTick,
00040         MajorTick,
00041 
00042         NTickTypes
00043     };
00044 
00045     explicit QwtScaleDiv();
00046     explicit QwtScaleDiv(const QwtDoubleInterval &,
00047         QwtValueList[NTickTypes]);
00048     explicit QwtScaleDiv(double lowerBound, double upperBound,
00049         QwtValueList[NTickTypes]);
00050 
00051     int operator==(const QwtScaleDiv &s) const;
00052     int operator!=(const QwtScaleDiv &s) const;
00053     
00054     void setInterval(double lowerBound, double upperBound);
00055     void setInterval(const QwtDoubleInterval &);
00056     QwtDoubleInterval interval() const;
00057 
00058     double lowerBound() const;
00059     double upperBound() const;
00060     double range() const;
00061 
00062     bool contains(double v) const;
00063 
00064     void setTicks(int type, const QwtValueList &);
00065     const QwtValueList &ticks(int type) const;
00066 
00067     void invalidate();
00068     bool isValid() const;
00069  
00070     void invert();
00071 
00072 private:
00073     double d_lowerBound;
00074     double d_upperBound;
00075     QwtValueList d_ticks[NTickTypes];
00076 
00077     bool d_isValid;
00078 };
00079 
00085 inline void QwtScaleDiv::setInterval(double lowerBound, double upperBound)
00086 {
00087     d_lowerBound = lowerBound;
00088     d_upperBound = upperBound;
00089 }
00090 
00094 inline QwtDoubleInterval QwtScaleDiv::interval() const
00095 {
00096     return QwtDoubleInterval(d_lowerBound, d_upperBound);
00097 }
00098 
00103 inline double QwtScaleDiv::lowerBound() const 
00104 { 
00105     return d_lowerBound;
00106 }
00107 
00112 inline double QwtScaleDiv::upperBound() const 
00113 { 
00114     return d_upperBound;
00115 }
00116 
00120 inline double QwtScaleDiv::range() const 
00121 { 
00122     return d_upperBound - d_lowerBound;
00123 }
00124 #endif