dtor first
[personal-kdebase.git] / workspace / ksysguard / gui / SensorDisplayLib / BarGraph.h
blob1b843dda16f660e3164b3579eace7ce9580d1294
1 /*
2 KSysGuard, the KDE System Guard
4 Copyright (c) 1999 - 2001 Chris Schlaeger <cs@kde.org>
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public
8 License version 2 or at your option version 3 as published by
9 the Free Software Foundation.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #ifndef KSG_BARGRAPH_H
23 #define KSG_BARGRAPH_H
25 #include <QWidget>
26 #include <QPaintEvent>
28 class BarGraph : public QWidget
30 Q_OBJECT
32 friend class DancingBars;
34 public:
35 explicit BarGraph( QWidget *parent );
36 ~BarGraph();
38 bool addBar( const QString &footer );
39 bool removeBar( uint idx );
41 void updateSamples( const QVector<double> &newSamples );
43 double getMin() const
45 return minValue;
48 double getMax() const
50 return maxValue;
53 void getLimits( double &l, bool &la, double &u, bool &ua ) const
55 l = lowerLimit;
56 la = lowerLimitActive;
57 u = upperLimit;
58 ua = upperLimitActive;
61 void setLimits( double l, bool la, double u, bool ua )
63 lowerLimit = l;
64 lowerLimitActive = la;
65 upperLimit = u;
66 upperLimitActive = ua;
69 void changeRange( double min, double max );
71 protected:
72 virtual void paintEvent( QPaintEvent* );
74 private:
75 double minValue;
76 double maxValue;
77 double lowerLimit;
78 double lowerLimitActive;
79 double upperLimit;
80 bool upperLimitActive;
81 bool autoRange;
82 QVector<double> samples;
83 QStringList footers;
84 uint bars;
85 QColor normalColor;
86 QColor alarmColor;
87 QColor mBackgroundColor;
88 int fontSize;
91 #endif