kdeui
kled.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _KLED_H_
00024 #define _KLED_H_
00025
00026 #include <qwidget.h>
00027 #include <kdelibs_export.h>
00028
00029 class QColor;
00045 class KDEUI_EXPORT KLed : public QWidget
00046 {
00047 Q_OBJECT
00048 Q_ENUMS( State Shape Look )
00049 Q_PROPERTY( State state READ state WRITE setState )
00050 Q_PROPERTY( Shape shape READ shape WRITE setShape )
00051 Q_PROPERTY( Look look READ look WRITE setLook )
00052 Q_PROPERTY( QColor color READ color WRITE setColor )
00053 Q_PROPERTY( int darkFactor READ darkFactor WRITE setDarkFactor )
00054
00055 public:
00056
00061 enum State { Off, On };
00062
00067 enum Shape { Rectangular, Circular };
00068
00089 enum Look { Flat, Raised, Sunken };
00090
00095 KLed(QWidget *parent=0, const char *name=0);
00106 KLed(const QColor &col, QWidget *parent=0, const char *name=0);
00107
00122 KLed(const QColor& col, KLed::State state, KLed::Look look, KLed::Shape shape,
00123 QWidget *parent=0, const char *name=0);
00124
00125
00130 ~KLed();
00131
00138 State state() const;
00139
00140 Shape shape() const;
00141
00148 QColor color() const;
00149
00156 Look look() const;
00157
00164 int darkFactor() const;
00165
00175 void setState( State state );
00176
00180 void setShape(Shape s);
00189 void toggleState() KDE_DEPRECATED;
00190
00204 void setColor(const QColor& color);
00205
00218 void setDarkFactor(int darkfactor);
00219
00250 void setLook( Look look );
00251
00252 virtual QSize sizeHint() const;
00253 virtual QSize minimumSizeHint() const;
00254
00255 public slots:
00256
00262 void toggle();
00263
00270 void on();
00271
00278 void off();
00279
00280 protected:
00284 virtual void paintFlat();
00288 virtual void paintRound();
00292 virtual void paintSunken();
00296 virtual void paintRect();
00301 virtual void paintRectFrame(bool raised);
00302
00303 void paintEvent( QPaintEvent * );
00304
00308 int ensureRoundLed();
00309
00314 bool paintCachedPixmap();
00315
00316 private:
00317 State led_state;
00318 QColor led_color;
00319 Look led_look;
00320 Shape led_shape;
00321
00322 protected:
00323 virtual void virtual_hook( int id, void* data );
00324 private:
00325 class KLedPrivate;
00326 KLedPrivate *d;
00327 };
00328
00329 #endif