Collection of tools useful for audio production
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.

88 lines
2.1KB

  1. /*
  2. * Pixmap Dial, a custom Qt4 widget
  3. * Copyright (C) 2011-2012 Filipe Coelho <falktx@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #ifndef PIXMAPDIAL_H
  18. #define PIXMAPDIAL_H
  19. #include <QtGui/QDial>
  20. #include <QtGui/QPixmap>
  21. class PixmapDial : public QDial
  22. {
  23. public:
  24. enum Orientation {
  25. HORIZONTAL = 0,
  26. VERTICAL = 1
  27. };
  28. enum CustomPaint {
  29. CUSTOM_PAINT_NULL = 0,
  30. CUSTOM_PAINT_CARLA_WET = 1,
  31. CUSTOM_PAINT_CARLA_VOL = 2,
  32. CUSTOM_PAINT_CARLA_L = 3,
  33. CUSTOM_PAINT_CARLA_R = 4
  34. };
  35. PixmapDial(QWidget* parent);
  36. int getSize() const;
  37. void setCustomPaint(CustomPaint paint);
  38. void setEnabled(bool enabled);
  39. void setLabel(QString label);
  40. void setPixmap(int pixmapId);
  41. QSize minimumSizeHint() const;
  42. QSize sizeHint() const;
  43. protected:
  44. void updateSizes();
  45. void enterEvent(QEvent* event);
  46. void leaveEvent(QEvent* event);
  47. void paintEvent(QPaintEvent* event);
  48. void resizeEvent(QResizeEvent* event);
  49. private:
  50. QPixmap m_pixmap;
  51. QString m_pixmap_n_str;
  52. CustomPaint m_custom_paint;
  53. Orientation m_orientation;
  54. bool m_hovered;
  55. unsigned short m_hover_step;
  56. QString m_label;
  57. QPointF m_label_pos;
  58. int m_label_width;
  59. int m_label_height;
  60. QLinearGradient m_label_gradient;
  61. QRectF m_label_gradient_rect;
  62. QColor m_color1;
  63. QColor m_color2;
  64. QColor m_colorT[2];
  65. int p_width, p_height, p_size, p_count;
  66. static const unsigned short HOVER_MIN = 0;
  67. static const unsigned short HOVER_MAX = 9;
  68. };
  69. #endif // PIXMAPDIAL_H