Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pixmapdial.hpp 2.4KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Pixmap Dial, a custom Qt4 widget
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  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.
  9. *
  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.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #ifndef PIXMAPDIAL_HPP_INCLUDED
  18. #define PIXMAPDIAL_HPP_INCLUDED
  19. #include "CarlaJuceUtils.hpp"
  20. #include <QtGui/QPixmap>
  21. #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  22. # include <QtWidgets/QDial>
  23. #else
  24. # include <QtGui/QDial>
  25. #endif
  26. class PixmapDial : public QDial
  27. {
  28. public:
  29. enum CustomPaint {
  30. CUSTOM_PAINT_NULL = 0,
  31. CUSTOM_PAINT_CARLA_WET = 1,
  32. CUSTOM_PAINT_CARLA_VOL = 2,
  33. CUSTOM_PAINT_CARLA_L = 3,
  34. CUSTOM_PAINT_CARLA_R = 4
  35. };
  36. PixmapDial(QWidget* parent);
  37. int getSize() const;
  38. void setCustomPaint(CustomPaint paint);
  39. void setEnabled(bool enabled);
  40. void setLabel(QString label);
  41. void setPixmap(int pixmapId);
  42. QSize minimumSizeHint() const override;
  43. QSize sizeHint() const override;
  44. protected:
  45. void updateSizes();
  46. void enterEvent(QEvent* event) override;
  47. void leaveEvent(QEvent* event) override;
  48. void paintEvent(QPaintEvent* event) override;
  49. void resizeEvent(QResizeEvent* event) override;
  50. private:
  51. enum Orientation {
  52. HORIZONTAL = 0,
  53. VERTICAL = 1
  54. };
  55. static const unsigned short HOVER_MIN = 0;
  56. static const unsigned short HOVER_MAX = 9;
  57. // -------------------------------------
  58. QPixmap fPixmap;
  59. QString fPixmapNum;
  60. CustomPaint fCustomPaint;
  61. Orientation fOrientation;
  62. bool fHovered;
  63. unsigned short fHoverStep;
  64. QString fLabel;
  65. QPointF fLabelPos;
  66. QFont fLabelFont;
  67. int fLabelWidth;
  68. int fLabelHeight;
  69. QLinearGradient fLabelGradient;
  70. QRectF fLabelGradientRect;
  71. QColor fColor1;
  72. QColor fColor2;
  73. QColor fColorT[2];
  74. int fWidth, fHeight, fSize, fCount;
  75. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PixmapDial)
  76. };
  77. #endif // PIXMAPDIAL_HPP_INCLUDED