-rw-r--r-- | libopie2/opieui/oledbox.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libopie2/opieui/oledbox.h b/libopie2/opieui/oledbox.h new file mode 100644 index 0000000..dd930bd --- a/dev/null +++ b/libopie2/opieui/oledbox.h | |||
@@ -0,0 +1,56 @@ | |||
1 | #ifndef __OPIE_OLED_H__ | ||
2 | #define __OPIE_OLED_H__ | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | #include <qcolor.h> | ||
6 | |||
7 | class QPixmap; | ||
8 | |||
9 | #define _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | ||
10 | |||
11 | class OLedBox : public QWidget { | ||
12 | Q_OBJECT | ||
13 | |||
14 | public: | ||
15 | OLedBox ( const QColor &col = red, QWidget *parent = 0, const char *name = 0 ); | ||
16 | virtual ~OLedBox ( ); | ||
17 | |||
18 | QColor color ( ) const; | ||
19 | bool isOn ( ) const; | ||
20 | void setReadOnly( bool R ) | ||
21 | { m_readonly = R; } | ||
22 | inline bool readOnly( void ) const | ||
23 | { return m_readonly; } | ||
24 | |||
25 | virtual QSize sizeHint ( ) const; | ||
26 | |||
27 | public slots: | ||
28 | void toggle ( ); | ||
29 | void setOn ( bool on ); | ||
30 | void setColor ( const QColor &col ); | ||
31 | |||
32 | signals: | ||
33 | void toggled ( bool ); | ||
34 | |||
35 | protected: | ||
36 | virtual void paintEvent ( QPaintEvent *e ); | ||
37 | virtual void resizeEvent ( QResizeEvent *e ); | ||
38 | |||
39 | virtual void mousePressEvent ( QMouseEvent *e ); | ||
40 | |||
41 | private: | ||
42 | void drawLed ( QPixmap *, const QColor &col ); | ||
43 | |||
44 | private: | ||
45 | QPixmap *m_pix [2]; | ||
46 | |||
47 | QColor m_color; | ||
48 | bool m_on; | ||
49 | bool m_readonly; | ||
50 | |||
51 | #ifdef _QTE_IS_TOO_DUMB_TO_DRAW_AN_ARC | ||
52 | static QPixmap *s_border_pix; | ||
53 | #endif | ||
54 | }; | ||
55 | |||
56 | #endif | ||