annotate widgets/LEDButton.h @ 32:c53b949ef142

* Add LED button * Add note model playback (currently assuming that value == MIDI pitch) * Reorganise PlayParameters and move repository from ViewManager to new PlayParameterRepository class
author Chris Cannam
date Wed, 15 Feb 2006 17:58:35 +0000
parents
children 651e4e868bcc
rev   line source
Chris@32 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@32 2
Chris@32 3 /*
Chris@32 4 A waveform viewer and audio annotation editor.
Chris@32 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@32 6
Chris@32 7 This is experimental software. Not for distribution.
Chris@32 8 */
Chris@32 9
Chris@32 10 /*
Chris@32 11 This is a modified version of a source file from the KDE
Chris@32 12 libraries. Copyright (c) 1998-2004 Jörg Habenicht, Richard J
Chris@32 13 Moore and others, distributed under the GNU Lesser General Public
Chris@32 14 License.
Chris@32 15
Chris@32 16 Ported to Qt4 by Chris Cannam.
Chris@32 17
Chris@32 18 The original KDE widget comes in round and rectangular and flat,
Chris@32 19 raised, and sunken variants. This version retains only the round
Chris@32 20 sunken variant.
Chris@32 21 */
Chris@32 22
Chris@32 23 #ifndef _LED_BUTTON_H_
Chris@32 24 #define _LED_BUTTON_H_
Chris@32 25
Chris@32 26 #include <QWidget>
Chris@32 27
Chris@32 28 class QColor;
Chris@32 29
Chris@32 30 class LEDButton : public QWidget
Chris@32 31 {
Chris@32 32 Q_OBJECT
Chris@32 33 Q_ENUMS(State)
Chris@32 34 Q_PROPERTY(State state READ state WRITE setState)
Chris@32 35 Q_PROPERTY(QColor color READ color WRITE setColor)
Chris@32 36 Q_PROPERTY(int darkFactor READ darkFactor WRITE setDarkFactor)
Chris@32 37
Chris@32 38 public:
Chris@32 39 enum State { Off, On };
Chris@32 40
Chris@32 41 LEDButton(QWidget *parent = 0);
Chris@32 42 LEDButton(const QColor &col, QWidget *parent = 0);
Chris@32 43 LEDButton(const QColor& col, LEDButton::State state, QWidget *parent = 0);
Chris@32 44 ~LEDButton();
Chris@32 45
Chris@32 46 State state() const;
Chris@32 47 QColor color() const;
Chris@32 48 int darkFactor() const;
Chris@32 49
Chris@32 50 void setState(State state);
Chris@32 51 void toggleState();
Chris@32 52 void setColor(const QColor& color);
Chris@32 53 void setDarkFactor(int darkfactor);
Chris@32 54
Chris@32 55 virtual QSize sizeHint() const;
Chris@32 56 virtual QSize minimumSizeHint() const;
Chris@32 57
Chris@32 58 public slots:
Chris@32 59
Chris@32 60 void toggle();
Chris@32 61 void on();
Chris@32 62 void off();
Chris@32 63
Chris@32 64 protected:
Chris@32 65 void paintEvent(QPaintEvent *);
Chris@32 66
Chris@32 67 private:
Chris@32 68 State led_state;
Chris@32 69 QColor led_color;
Chris@32 70
Chris@32 71 private:
Chris@32 72 class LEDButtonPrivate;
Chris@32 73 LEDButtonPrivate *d;
Chris@32 74 };
Chris@32 75
Chris@32 76 #endif