QtPdWidgets  2.3.1
Led.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009 - 2012 Florian Pose <fp@igh-essen.com>
4  *
5  * This file is part of the QtPdWidgets library.
6  *
7  * The QtPdWidgets library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License as
9  * published by the Free Software Foundation, either version 3 of the License,
10  * or (at your option) any later version.
11  *
12  * The QtPdWidgets library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with the QtPdWidgets Library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  *
21  ****************************************************************************/
22 
23 #ifndef PD_LED_H
24 #define PD_LED_H
25 
26 #include "Export.h"
27 #include "MultiLed.h"
28 
29 namespace Pd {
30 
31 /****************************************************************************/
32 
35 class PD_PUBLIC Led:
36  public MultiLed
37 {
38  Q_OBJECT
39  Q_ENUMS(OffColorMode)
40  Q_PROPERTY(QColor onColor
41  READ getOnColor WRITE setOnColor RESET resetOnColor)
42  Q_PROPERTY(QColor offColor
43  READ getOffColor WRITE setOffColor RESET resetOffColor)
44  Q_PROPERTY(OffColorMode offColorMode
45  READ getOffColorMode WRITE setOffColorMode
46  RESET resetOffColorMode)
47  Q_PROPERTY(bool invert
48  READ getInvert WRITE setInvert RESET resetInvert)
49 
50  public:
51  Led(QWidget *parent = 0);
52  virtual ~Led();
53 
54  QColor getOnColor() const;
55  void setOnColor(QColor);
56  void resetOnColor();
57 
58  QColor getOffColor() const;
59  void setOffColor(QColor);
60  void resetOffColor();
61 
66  enum OffColorMode {
68  ExplicitOffColor
69  };
70 
71  OffColorMode getOffColorMode() const;
72  void setOffColorMode(OffColorMode);
73  void resetOffColorMode();
74 
75  bool getInvert() const;
76  void setInvert(bool);
77  void resetInvert();
78 
79  protected:
80  bool event(QEvent *) override;
81 
82  private:
83  struct PD_PRIVATE Impl;
84  std::unique_ptr<Impl> impl;
85 
86  PD_PRIVATE void updateColor(); // virtual from MultiLed
87 
89  void setHash(const Hash *);
90 };
91 
92 /****************************************************************************/
93 
94 } // namespace
95 
96 #endif
std::unique_ptr< Impl > impl
Definition: Led.h:84
Definition: Bar.h:36
Definition: Led.cpp:37
#define PD_PRIVATE
Definition: Export.h:28
Multi-Color LED widget.
Definition: MultiLed.h:40
#define PD_PUBLIC
Definition: Export.h:33
Value hash type.
Definition: MultiLed.h:86
LED widget.
Definition: Led.h:35
Display a darker shade of onColor.
Definition: Led.h:67
OffColorMode
Off color mode.
Definition: Led.h:66