Chris@32: /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ Chris@32: Chris@32: /* Chris@32: A waveform viewer and audio annotation editor. Chris@32: Chris Cannam, Queen Mary University of London, 2005-2006 Chris@32: Chris@32: This is experimental software. Not for distribution. Chris@32: */ Chris@32: Chris@32: /* Chris@32: This is a modified version of a source file from the KDE Chris@32: libraries. Copyright (c) 1998-2004 Jörg Habenicht, Richard J Chris@32: Moore and others, distributed under the GNU Lesser General Public Chris@32: License. Chris@32: Chris@32: Ported to Qt4 by Chris Cannam. Chris@32: Chris@32: The original KDE widget comes in round and rectangular and flat, Chris@32: raised, and sunken variants. This version retains only the round Chris@32: sunken variant. Chris@32: */ Chris@32: Chris@32: #ifndef _LED_BUTTON_H_ Chris@32: #define _LED_BUTTON_H_ Chris@32: Chris@32: #include Chris@32: Chris@32: class QColor; Chris@32: Chris@32: class LEDButton : public QWidget Chris@32: { Chris@32: Q_OBJECT Chris@32: Q_ENUMS(State) Chris@32: Q_PROPERTY(State state READ state WRITE setState) Chris@32: Q_PROPERTY(QColor color READ color WRITE setColor) Chris@32: Q_PROPERTY(int darkFactor READ darkFactor WRITE setDarkFactor) Chris@32: Chris@32: public: Chris@32: enum State { Off, On }; Chris@32: Chris@32: LEDButton(QWidget *parent = 0); Chris@32: LEDButton(const QColor &col, QWidget *parent = 0); Chris@32: LEDButton(const QColor& col, LEDButton::State state, QWidget *parent = 0); Chris@32: ~LEDButton(); Chris@32: Chris@32: State state() const; Chris@32: QColor color() const; Chris@32: int darkFactor() const; Chris@32: Chris@32: void setState(State state); Chris@32: void toggleState(); Chris@32: void setColor(const QColor& color); Chris@32: void setDarkFactor(int darkfactor); Chris@32: Chris@32: virtual QSize sizeHint() const; Chris@32: virtual QSize minimumSizeHint() const; Chris@32: Chris@32: public slots: Chris@32: Chris@32: void toggle(); Chris@32: void on(); Chris@32: void off(); Chris@32: Chris@32: protected: Chris@32: void paintEvent(QPaintEvent *); Chris@32: Chris@32: private: Chris@32: State led_state; Chris@32: QColor led_color; Chris@32: Chris@32: private: Chris@32: class LEDButtonPrivate; Chris@32: LEDButtonPrivate *d; Chris@32: }; Chris@32: Chris@32: #endif