Cleanup
[carla.git] / source / frontend / widgets / ledbutton.hpp
blob72770018b4f359c026136ad762e4385f3394ce21
1 /*
2 * LED Button, a custom Qt4 widget
3 * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef LEDBUTTON_HPP_INCLUDED
19 #define LEDBUTTON_HPP_INCLUDED
21 #include "CarlaJuceUtils.hpp"
23 #include <QtGui/QPixmap>
25 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
26 # include <QtWidgets/QPushButton>
27 #else
28 # include <QtGui/QPushButton>
29 #endif
31 class LEDButton : public QPushButton
33 public:
34 enum Color {
35 OFF = 0,
36 BLUE = 1,
37 GREEN = 2,
38 RED = 3,
39 YELLOW = 4
42 LEDButton(QWidget* parent);
44 void setColor(Color color);
46 protected:
47 void paintEvent(QPaintEvent* event) override;
49 private:
50 Color fColor;
51 Color fLastColor;
52 QPixmap fPixmap;
53 QRectF fPixmapRect;
55 CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(LEDButton)
58 #endif // LEDBUTTON_HPP_INCLUDED