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