Main Page   Class Hierarchy   Compound List   File List   Compound Members  

led.h

00001 // $Id: led.h,v 1.1 2000/11/10 15:45:07 root Exp $
00002 #ifndef LED_H
00003 #define LED_H
00004 
00005 #include <qwidget.h>
00006 #include <qcolor.h>
00007 
00008 class Led : public QWidget
00009 {
00010    Q_OBJECT
00011 public:
00012    enum Color { yellow, orange, red, green, blue };
00013    enum State { Off=0, On=1 };
00014    enum Look  { flat, round, sunken, rect_sunken, rect_raised };
00015    Led(Color ledcolor, QWidget *parent = 0, const char *name = 0);
00016    Led(Color ledcolor, State state, Look look, QWidget *parent = 0, const char *name = 0);
00017    State getState() const { return led_state; }
00018    Color getColor() const { return led_color; }
00019    QRgb getRgbColor() const { return current_color; }
00020    Look getLook() const { return led_look; }
00021    void setState(State state);
00022    void toggleState();
00023    void setColor(Color color);
00024    void setLook(Look look);
00025    static const char* version();
00026 
00027 public slots:
00028    void toggle() { toggleState(); }
00029    void on() { setState(On); }
00030    void off() { setState(Off); }
00031 
00032 protected:
00033    void paintEvent(QPaintEvent *);
00034 
00035 private:
00036    void paintflat();
00037    void paintround();
00038    void paintsunken();
00039    void paintrect(bool sunken);
00040 
00041    static const QRgb lightcolor[];
00042    static const QRgb darkcolor[];
00043    State led_state;
00044    Color led_color;
00045    Look led_look;
00046    QRgb current_color;
00047 };
00048 
00049 #endif

Generated at Tue Mar 18 13:49:45 2003 for MIDO by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000