DLS  1.6
ValueScale.h
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009 - 2017 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the DLS widget library.
6  *
7  * The DLS widget library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The DLS widget library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the DLS widget library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef DLS_VALUESCALE_H
24 #define DLS_VALUESCALE_H
25 
26 #include <QRect>
27 #include "export.h"
28 
29 namespace DLS {
30 
31 /****************************************************************************/
32 
35 class DLSWIDGETS_PUBLIC ValueScale
36 {
37  public:
38  ValueScale(QWidget *);
39 
40  double getMin() const { return min; };
41  void setMin(double);
42  double getMax() const { return max; };
43  void setMax(double);
44  int getHeight() const { return height; };
45  void setHeight(int);
46 
47  void update();
48 
49  double getRange() const { return max - min; }
50  int getWidth() const { return width; }
51 
52  void draw(QPainter &, const QRect &, int) const;
53 
54  private:
55  const QWidget * const parent;
56  double min;
57  double max;
58  int height;
60  int width;
61  double majorStep;
62  unsigned int minorDiv;
63  int decade;
65  ValueScale();
66  QString formatValue(double) const;
67 };
68 
69 /****************************************************************************/
70 
71 } // namespace Pd
72 
73 #endif
Definition: Graph.h:56
Vertical value scale.
Definition: ValueScale.h:35