NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
led.h
1 // Widget which visualizes LED
2 // Author: Dmytro Pavlichenko <dm.mark999@gmail.com>
3 
4 #ifndef LED_H
5 #define LED_H
6 
7 #include <QWidget>
8 #include <QObject>
9 
10 #include <QPaintEvent>
11 
12 class LED : public QWidget
13 {
14 Q_OBJECT
15 public:
16  LED(int width_, int height_, QWidget *parent = 0);
17  virtual ~LED();
18 
19  bool turn(bool on);
20  bool turned() const { return state; }
21 
22  void setBlinking(bool blink) { this->blink = blink; }
23  bool isBlinking() const { return blink; }
24 
25  bool setColor(QColor color);
26  void setOnColor(QColor color);
27 
28 private:
29  void paintEvent(QPaintEvent *event);
30 
31  int width;
32  int height;
33 
34  bool state;
35  bool blink;
36 
37  QColor onColor;
38  QColor offColor;
39  QColor currentColor;
40 };
41 
42 #endif