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.2KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 GPL.txt file
  16. */
  17. #ifndef __PIXMAPDIAL_HPP__
  18. #define __PIXMAPDIAL_HPP__
  19. #include <QtGui/QDial>
  20. #include <QtGui/QPixmap>
  21. class PixmapDial : public QDial
  22. {
  23. public:
  24. enum CustomPaint {
  25. CUSTOM_PAINT_NULL = 0,
  26. CUSTOM_PAINT_CARLA_WET = 1,
  27. CUSTOM_PAINT_CARLA_VOL = 2,
  28. CUSTOM_PAINT_CARLA_L = 3,
  29. CUSTOM_PAINT_CARLA_R = 4
  30. };
  31. PixmapDial(QWidget* parent);
  32. int getSize() const;
  33. void setCustomPaint(CustomPaint paint);
  34. void setEnabled(bool enabled);
  35. void setLabel(QString label);
  36. void setPixmap(int pixmapId);
  37. QSize minimumSizeHint() const;
  38. QSize sizeHint() const;
  39. protected:
  40. void updateSizes();
  41. void enterEvent(QEvent* event);
  42. void leaveEvent(QEvent* event);
  43. void paintEvent(QPaintEvent* event);
  44. void resizeEvent(QResizeEvent* event);
  45. private:
  46. enum Orientation {
  47. HORIZONTAL = 0,
  48. VERTICAL = 1
  49. };
  50. static const unsigned short HOVER_MIN = 0;
  51. static const unsigned short HOVER_MAX = 9;
  52. // -------------------------------------
  53. QPixmap m_pixmap;
  54. QString m_pixmap_n_str;
  55. CustomPaint m_custom_paint;
  56. Orientation m_orientation;
  57. bool m_hovered;
  58. unsigned short m_hover_step;
  59. QString m_label;
  60. QPointF m_label_pos;
  61. int m_label_width;
  62. int m_label_height;
  63. QLinearGradient m_label_gradient;
  64. QRectF m_label_gradient_rect;
  65. QColor m_color1;
  66. QColor m_color2;
  67. QColor m_colorT[2];
  68. int p_width, p_height, p_size, p_count;
  69. };
  70. #endif // __PIXMAPDIAL_HPP__