summaryrefslogtreecommitdiff
path: root/noncore/games/qasteroids/ledmeter.h
Unidiff
Diffstat (limited to 'noncore/games/qasteroids/ledmeter.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/qasteroids/ledmeter.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/noncore/games/qasteroids/ledmeter.h b/noncore/games/qasteroids/ledmeter.h
new file mode 100644
index 0000000..b2f06c1
--- a/dev/null
+++ b/noncore/games/qasteroids/ledmeter.h
@@ -0,0 +1,72 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia 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** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************//*
20 * KAsteroids - Copyright (c) Martin R. Jones 1997
21 *
22 * Part of the KDE project
23 */
24
25#ifndef __LEDMETER_H__
26#define __LEDMETER_H__
27
28#include <qframe.h>
29#include <qlist.h>
30
31#define QPtrList QList
32
33class KALedMeter : public QFrame
34{
35 Q_OBJECT
36public:
37 KALedMeter( QWidget *parent );
38
39 int range() const { return mRange; }
40 void setRange( int r );
41
42 int count() const { return mCount; }
43 void setCount( int c );
44
45 int value () const { return mValue; }
46
47 void addColorRange( int pc, const QColor &c );
48
49public slots:
50 void setValue( int v );
51
52protected:
53 virtual void resizeEvent( QResizeEvent * );
54 virtual void drawContents( QPainter * );
55 void calcColorRanges();
56
57protected:
58 struct ColorRange
59 {
60 int mPc;
61 int mValue;
62 QColor mColor;
63 };
64
65 int mRange;
66 int mCount;
67 int mCurrentCount;
68 int mValue;
69 QPtrList<ColorRange> mCRanges;
70};
71
72#endif