Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ledmeter.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************//*
00020  * KAsteroids - Copyright (c) Martin R. Jones 1997
00021  *
00022  * Part of the KDE project
00023  */
00024 
00025 #ifndef __LEDMETER_H__
00026 #define __LEDMETER_H__
00027 
00028 #include <qframe.h>
00029 #include <qlist.h>
00030 
00031 #define QPtrList QList
00032 
00033 class KALedMeter : public QFrame
00034 {
00035     Q_OBJECT
00036 public:
00037     KALedMeter( QWidget *parent );
00038 
00039     int range() const { return mRange; }
00040     void setRange( int r );
00041 
00042     int count() const { return mCount; }
00043     void setCount( int c );
00044 
00045     int value () const { return mValue; }
00046 
00047     void addColorRange( int pc, const QColor &c );
00048 
00049 public slots:
00050     void setValue( int v );
00051 
00052 protected:
00053     virtual void resizeEvent( QResizeEvent * );
00054     virtual void drawContents( QPainter * );
00055     void calcColorRanges();
00056 
00057 protected:
00058     struct ColorRange
00059     {
00060         int mPc;
00061         int mValue;
00062         QColor mColor;
00063     };
00064 
00065     int mRange;
00066     int mCount;
00067     int mCurrentCount;
00068     int mValue;
00069     QPtrList<ColorRange> mCRanges;
00070 };
00071 
00072 #endif

Generated on Sat Nov 5 16:17:24 2005 for OPIE by  doxygen 1.4.2