2 * Pixmap Dial, 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 PIXMAPDIAL_HPP_INCLUDED
19 #define PIXMAPDIAL_HPP_INCLUDED
21 #include "CarlaJuceUtils.hpp"
23 #include <QtGui/QPixmap>
25 #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
26 # include <QtWidgets/QDial>
28 # include <QtGui/QDial>
31 class PixmapDial
: public QDial
35 CUSTOM_PAINT_NULL
= 0,
36 CUSTOM_PAINT_CARLA_WET
= 1,
37 CUSTOM_PAINT_CARLA_VOL
= 2,
38 CUSTOM_PAINT_CARLA_L
= 3,
39 CUSTOM_PAINT_CARLA_R
= 4
42 PixmapDial(QWidget
* parent
);
45 void setCustomPaint(CustomPaint paint
);
46 void setEnabled(bool enabled
);
47 void setLabel(QString label
);
48 void setPixmap(int pixmapId
);
50 QSize
minimumSizeHint() const override
;
51 QSize
sizeHint() const override
;
56 void enterEvent(QEvent
* event
) override
;
57 void leaveEvent(QEvent
* event
) override
;
58 void paintEvent(QPaintEvent
* event
) override
;
59 void resizeEvent(QResizeEvent
* event
) override
;
67 static const unsigned short HOVER_MIN
= 0;
68 static const unsigned short HOVER_MAX
= 9;
70 // -------------------------------------
75 CustomPaint fCustomPaint
;
76 Orientation fOrientation
;
79 unsigned short fHoverStep
;
87 QLinearGradient fLabelGradient
;
88 QRectF fLabelGradientRect
;
94 int fWidth
, fHeight
, fSize
, fCount
;
96 CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PixmapDial
)
99 #endif // PIXMAPDIAL_HPP_INCLUDED