Qwt User's Guide 6.0.2

- Main Page
- Related Pages
- Classes

qwt_scale_div.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10 #ifndef QWT_SCALE_DIV_H
11 #define QWT_SCALE_DIV_H
12
13 #include "qwt_global.h"
14 #include "qwt_interval.h"
15 #include <qlist.h>
16
17 class QwtInterval;
18
30 class QWT_EXPORT QwtScaleDiv
31 {
32 public:
34 enum TickType
35 {
37 NoTick = -1,
38
40 MinorTick,
41
43 MediumTick,
44
46 MajorTick,
47
49 NTickTypes
50 };
51
52 explicit QwtScaleDiv();
53 explicit QwtScaleDiv( const QwtInterval &, QList<double>[NTickTypes] );
54 explicit QwtScaleDiv(
55 double lowerBound, double upperBound, QList<double>[NTickTypes] );
56
57 bool operator==( const QwtScaleDiv &s ) const;
58 bool operator!=( const QwtScaleDiv &s ) const;
59
60 void setInterval( double lowerBound, double upperBound );
61 void setInterval( const QwtInterval & );
62 QwtInterval interval() const;
63
64 double lowerBound() const;
65 double upperBound() const;
66 double range() const;
67
68 bool contains( double v ) const;
69
70 void setTicks( int type, const QList<double> & );
71 const QList<double> &ticks( int type ) const;
72
73 void invalidate();
74 bool isValid() const;
75
76 void invert();
77
78 private:
79 double d_lowerBound;
80 double d_upperBound;
81 QList<double> d_ticks[NTickTypes];
82
83 bool d_isValid;
84 };
85
86 Q_DECLARE_TYPEINFO(QwtScaleDiv, Q_MOVABLE_TYPE);
87
93 inline void QwtScaleDiv::setInterval( double lowerBound, double upperBound )
94 {
95 d_lowerBound = lowerBound;
96 d_upperBound = upperBound;
97 }
98
102 inline QwtInterval QwtScaleDiv::interval() const
103 {
104 return QwtInterval( d_lowerBound, d_upperBound );
105 }
106
111 inline double QwtScaleDiv::lowerBound() const
112 {
113 return d_lowerBound;
114 }
115
120 inline double QwtScaleDiv::upperBound() const
121 {
122 return d_upperBound;
123 }
124
128 inline double QwtScaleDiv::range() const
129 {
130 return d_upperBound - d_lowerBound;
131 }
132 #endif