Qwt User's Guide 5.2.3

- 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_valuelist.h"
15 #include "qwt_double_interval.h"
16
17 class QwtDoubleInterval;
18
30 class QWT_EXPORT QwtScaleDiv
31 {
32 public:
34 enum TickType
35 {
36 NoTick = -1,
37
38 MinorTick,
39 MediumTick,
40 MajorTick,
41
42 NTickTypes
43 };
44
45 explicit QwtScaleDiv();
46 explicit QwtScaleDiv(const QwtDoubleInterval &,
47 QwtValueList[NTickTypes]);
48 explicit QwtScaleDiv(double lowerBound, double upperBound,
49 QwtValueList[NTickTypes]);
50
51 int operator==(const QwtScaleDiv &s) const;
52 int operator!=(const QwtScaleDiv &s) const;
53
54 void setInterval(double lowerBound, double upperBound);
55 void setInterval(const QwtDoubleInterval &);
56 QwtDoubleInterval interval() const;
57
58 double lowerBound() const;
59 double upperBound() const;
60 double range() const;
61
62 bool contains(double v) const;
63
64 void setTicks(int type, const QwtValueList &);
65 const QwtValueList &ticks(int type) const;
66
67 void invalidate();
68 bool isValid() const;
69
70 void invert();
71
72 private:
73 double d_lowerBound;
74 double d_upperBound;
75 QwtValueList d_ticks[NTickTypes];
76
77 bool d_isValid;
78 };
79
85 inline void QwtScaleDiv::setInterval(double lowerBound, double upperBound)
86 {
87 d_lowerBound = lowerBound;
88 d_upperBound = upperBound;
89 }
90
94 inline QwtDoubleInterval QwtScaleDiv::interval() const
95 {
96 return QwtDoubleInterval(d_lowerBound, d_upperBound);
97 }
98
103 inline double QwtScaleDiv::lowerBound() const
104 {
105 return d_lowerBound;
106 }
107
112 inline double QwtScaleDiv::upperBound() const
113 {
114 return d_upperBound;
115 }
116
120 inline double QwtScaleDiv::range() const
121 {
122 return d_upperBound - d_lowerBound;
123 }
124 #endif