summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/graphwindow.h
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/graphwindow.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/graphwindow.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/graphwindow.h b/noncore/net/wellenreiter/gui/graphwindow.h
new file mode 100644
index 0000000..4050065
--- a/dev/null
+++ b/noncore/net/wellenreiter/gui/graphwindow.h
@@ -0,0 +1,118 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14**********************************************************************/
15
16#ifndef GRAPHWINDOW_H
17#define GRAPHWINDOW_H
18
19#include <qwidget.h>
20#include <qvbox.h>
21
22class MFrequencySpectrum : public QWidget
23{
24 public:
25 MFrequencySpectrum( int channels, QWidget* parent = 0, const char* name = "MFrequencySpectrum", WFlags f = 0 );
26 int value( int channel ) const { return _values[channel]; };
27 void setValue( int channel, int value )
28 {
29 if ( value > _values[channel] )
30 {
31 _values[channel] = value;
32 _dirty[channel] = true;
33 }
34 };
35 void decrease( int channel, int amount )
36 {
37 if ( _values[channel] >= amount )
38 {
39 _values[channel] -= amount;
40 _dirty[channel] = true;
41 }
42 };
43
44 protected:
45 virtual void paintEvent( QPaintEvent* );
46
47 void drawLine( QPainter* p, int x, int y, int width, const QColor& c );
48 void MFrequencySpectrum::drawBar( QPainter* p, int x, int y, int width, int height, int maxheight );
49
50 private:
51 int _channels;
52 int* _values;
53 bool* _dirty;
54};
55
56
57class Legende : public QFrame
58{
59 public:
60 Legende( int channels, QWidget* parent = 0, const char* name = "Legende", WFlags f = 0 );
61
62 protected:
63 virtual void drawContents( QPainter* );
64
65 private:
66 int _channels;
67};
68
69
70class MGraphWindow : public QVBox
71{
72 Q_OBJECT
73
74 public:
75 MGraphWindow( QWidget* parent = 0, const char* name = "MGraphWindow", WFlags f = 0 );
76 void traffic( int channel, int signal );
77
78 protected:
79 virtual void timerEvent( QTimerEvent* e );
80
81 protected slots:
82 virtual void testGraph();
83
84 protected:
85 MFrequencySpectrum* spectrum;
86 Legende* legende;
87
88};
89
90/* XPM */
91static char * background[] = {
92"16 16 6 1",
93 " c None",
94 ".c #52676E",
95 "+c #3F545B",
96 "@c #394E56",
97 "#c #2F454C",
98 "$c #364B52",
99".+++++++++++++++",
100"@###############",
101"+$$$$$$$$$$$$$$$",
102"@###############",
103"+$$$$$$$$$$$$$$$",
104"@###############",
105"+$$$$$$$$$$$$$$$",
106"@###############",
107"+$$$$$$$$$$$$$$$",
108"@###############",
109"+$$$$$$$$$$$$$$$",
110"@###############",
111"+$$$$$$$$$$$$$$$",
112"@###############",
113"+$$$$$$$$$$$$$$$",
114"@###############"};
115
116
117#endif
118