summaryrefslogtreecommitdiff
path: root/libopie2/opieui/oledbox.h
Unidiff
Diffstat (limited to 'libopie2/opieui/oledbox.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oledbox.h95
1 files changed, 62 insertions, 33 deletions
diff --git a/libopie2/opieui/oledbox.h b/libopie2/opieui/oledbox.h
index dd930bd..c02cc77 100644
--- a/libopie2/opieui/oledbox.h
+++ b/libopie2/opieui/oledbox.h
@@ -1,56 +1,85 @@
1#ifndef __OPIE_OLED_H__ 1/*
2#define __OPIE_OLED_H__ 2                 This file is part of the Opie Project
3 =. (C) 2002-2005 the Opie Team <opie-devel@handhelds.org>
4 .=l.
5           .>+-=
6 _;:,     .>    :=|. This program is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This program is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
18..}^=.=       =       ; Library General Public License for more
19++=   -.     .`     .: details.
20 :     =  ...= . :.=-
21 -.   .:....=;==+<; You should have received a copy of the GNU
22  -_. . .   )=.  = Library General Public License along with
23    --        :-=` this library; see the file COPYING.LIB.
24 If not, write to the Free Software Foundation,
25 Inc., 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA.
3 27
28*/
29
30#ifndef OLEDBOX_H
31#define OLEDBOX_H
32
33/* QT */
4#include <qwidget.h> 34#include <qwidget.h>
5#include <qcolor.h> 35#include <qcolor.h>
6 36
7class QPixmap; 37class QPixmap;
8 38
9#define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC 39namespace Opie {
40namespace Ui {
10 41
11class OLedBox : public QWidget { 42class OLedBox : public QWidget
12 Q_OBJECT 43{
13 44 Q_OBJECT
14public:
15 OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 );
16 virtual ~OLedBox ( );
17 45
18 QColor color ( ) const; 46 public:
19 bool isOn ( ) const; 47 OLedBox( const QColor& col = red, QWidget* parent = 0, const char* name = 0 );
20 void setReadOnly( bool R ) 48 virtual ~OLedBox();
21 { m_readonly = R; }
22 inline bool readOnly( void ) const
23 { return m_readonly; }
24
25 virtual QSize sizeHint ( ) const;
26 49
27public slots: 50 QColor color() const;
28 void toggle ( ); 51 bool isOn() const;
29 void setOn ( bool on ); 52 void setReadOnly( bool R ) { m_readonly = R; }
30 void setColor ( const QColor &col ); 53 bool readOnly( void ) const { return m_readonly; }
54
55 virtual QSize sizeHint() const;
56
57 public slots:
58 void toggle();
59 void setOn( bool on );
60 void setColor( const QColor& col );
31 61
32signals: 62 signals:
33 void toggled ( bool ); 63 void toggled( bool );
34 64
35protected: 65 protected:
36 virtual void paintEvent ( QPaintEvent *e ); 66 virtual void paintEvent( QPaintEvent* e );
37 virtual void resizeEvent ( QResizeEvent *e ); 67 virtual void resizeEvent( QResizeEvent* e );
38 68
39 virtual void mousePressEvent ( QMouseEvent *e ); 69 virtual void mousePressEvent( QMouseEvent* e );
40 70
41private: 71 private:
42 void drawLed ( QPixmap *, const QColor &col ); 72 void drawLed( QPixmap *, const QColor& col );
43 73
44private: 74 private:
45 QPixmap *m_pix [2]; 75 QPixmap *m_pix [2];
46 76
47 QColor m_color; 77 QColor m_color;
48 bool m_on; 78 bool m_on;
49 bool m_readonly; 79 bool m_readonly;
50 80
51 #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC
52 static QPixmap *s_border_pix; 81 static QPixmap *s_border_pix;
53#endif
54}; 82};
55 83};
84};
56#endif 85#endif