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

oledbox.h

Go to the documentation of this file.
00001 /*
00002                              This file is part of the Opie Project
00003               =.             (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
00004             .=l.
00005            .>+-=
00006  _;:,     .>    :=|.         This program is free software; you can
00007 .> <`_,   >  .   <=          redistribute it and/or  modify it under
00008 :`=1 )Y*s>-.--   :           the terms of the GNU Library General Public
00009 .="- .-=="i,     .._         License as published by the Free Software
00010  - .   .-<_>     .<>         Foundation; either version 2 of the License,
00011      ._= =}       :          or (at your option) any later version.
00012     .%`+i>       _;_.
00013     .i_,=:_.      -<s.       This program is distributed in the hope that
00014      +  .  -:.       =       it will be useful,  but WITHOUT ANY WARRANTY;
00015     : ..    .:,     . . .    without even the implied warranty of
00016     =_        +     =;=|`    MERCHANTABILITY or FITNESS FOR A
00017   _.=:.       :    :=>`:     PARTICULAR PURPOSE. See the GNU
00018 ..}^=.=       =       ;      Library General Public License for more
00019 ++=   -.     .`     .:       details.
00020  :     =  ...= . :.=-
00021  -.   .:....=;==+<;          You should have received a copy of the GNU
00022   -_. . .   )=.  =           Library General Public License along with
00023     --        :-=`           this library; see the file COPYING.LIB.
00024                              If not, write to the Free Software Foundation,
00025                              Inc., 59 Temple Place - Suite 330,
00026                              Boston, MA 02111-1307, USA.
00027 
00028 */
00029 
00030 #ifndef OLEDBOX_H
00031 #define OLEDBOX_H
00032 
00033 /* QT */
00034 #include <qwidget.h>
00035 #include <qcolor.h>
00036 
00037 class QPixmap;
00038 
00039 namespace Opie {
00040 namespace Ui   {
00041 
00042 class OLedBox : public QWidget
00043 {
00044   Q_OBJECT
00045         
00046   public:
00047         OLedBox( const QColor& col = red, QWidget* parent = 0, const char* name = 0 );
00048         virtual ~OLedBox();
00049         
00050         QColor color() const;
00051         bool isOn() const;
00052         void setReadOnly( bool R ) { m_readonly = R; }
00053         bool readOnly( void ) const { return m_readonly; }
00054 
00055         virtual QSize sizeHint() const;
00056 
00057   public slots:
00058         void toggle();
00059         void setOn( bool on );
00060         void setColor( const QColor& col );
00061 
00062   signals:
00063         void toggled( bool );
00064 
00065   protected:
00066         virtual void paintEvent( QPaintEvent* e );
00067         virtual void resizeEvent( QResizeEvent* e );
00068         
00069         virtual void mousePressEvent( QMouseEvent* e );
00070 
00071   private:
00072         void drawLed( QPixmap *, const QColor& col );
00073 
00074   private:
00075         QPixmap *m_pix [2];     
00076         
00077         QColor m_color;
00078         bool m_on;
00079         bool m_readonly;
00080         
00081         static QPixmap *s_border_pix;
00082 };
00083 };
00084 };
00085 #endif

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