Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

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 
00015 class QwtDoubleInterval;
00016 
00017 #if QT_VERSION < 0x040000
00018 
00019 #include <qvaluelist.h>
00020 
00021 #if defined(QWT_TEMPLATEDLL)
00022 // MOC_SKIP_BEGIN
00023 template class QWT_EXPORT QValueList<double>;
00024 // MOC_SKIP_END
00025 #endif
00026 
00027 typedef QValueList<double> QwtTickList;
00028 
00029 #else
00030 
00031 #include <qlist.h>
00032 
00033 #if defined(QWT_TEMPLATEDLL)
00034 
00035 #if defined Q_CC_MSVC  // Q_CC_MSVC_NET
00036 // Some definitions, needed to avoid a MSVC crash
00037 #include <qset.h>
00038 #include <qvector.h>
00039 inline uint qHash(double key) { return uint(key); }
00040 #endif
00041 
00042 // MOC_SKIP_BEGIN
00043 template class QWT_EXPORT QList<double>;
00044 // MOC_SKIP_END
00045 #endif
00046 
00047 typedef QList<double> QwtTickList;
00048 
00049 #endif
00050 
00051 
00063 class QWT_EXPORT QwtScaleDiv
00064 {
00065 public:
00066     enum TickType
00067     {
00068         NoTick = -1,
00069 
00070         MinorTick,
00071         MediumTick,
00072         MajorTick,
00073 
00074         NTickTypes
00075     };
00076 
00077     explicit QwtScaleDiv();
00078     explicit QwtScaleDiv(const QwtDoubleInterval &,
00079         QwtTickList[NTickTypes]);
00080     explicit QwtScaleDiv(double lBound, double rBound,
00081         QwtTickList[NTickTypes]);
00082 
00083     int operator==(const QwtScaleDiv &s) const;
00084     int operator!=(const QwtScaleDiv &s) const;
00085     
00086     inline double lBound() const;
00087     inline double hBound() const;
00088     inline double range() const;
00089 
00090     bool contains(double v) const;
00091 
00092     const QwtTickList &ticks(int type) const;
00093 
00094     void invalidate();
00095     bool isValid() const;
00096  
00097     void invert();
00098 
00099 private:
00100     double d_lBound;
00101     double d_hBound;
00102     QwtTickList d_ticks[NTickTypes];
00103 
00104     bool d_isValid;
00105 };
00106 
00111 inline double QwtScaleDiv::lBound() const 
00112 { 
00113     return d_lBound;
00114 }
00115 
00120 inline double QwtScaleDiv::hBound() const 
00121 { 
00122     return d_hBound;
00123 }
00124 
00128 inline double QwtScaleDiv::range() const 
00129 { 
00130     return d_hBound - d_lBound;
00131 }
00132 #endif

Generated on Mon Jan 30 22:16:26 2006 for Qwt User's Guide by  doxygen 1.4.4