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.

65 lines
1.6KB

  1. /*
  2. * Parameter SpinBox, 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 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 __PARAMSPINBOX_HPP__
  18. #define __PARAMSPINBOX_HPP__
  19. #include <QtGui/QProgressBar>
  20. class TextCallback
  21. {
  22. public:
  23. virtual ~TextCallback();
  24. virtual const char* textCallBack() = 0;
  25. };
  26. class ParamProgressBar : public QProgressBar
  27. {
  28. Q_OBJECT
  29. public:
  30. ParamProgressBar(QWidget* parent);
  31. void set_minimum(float value);
  32. void set_maximum(float value);
  33. void set_value(float value);
  34. void set_label(QString label);
  35. void set_text_call(TextCallback* textCall);
  36. signals:
  37. void valueChangedFromBar(float value);
  38. protected:
  39. void handleMouseEventPos(const QPoint& pos);
  40. void mousePressEvent(QMouseEvent* event);
  41. void mouseMoveEvent(QMouseEvent* event);
  42. void mouseReleaseEvent(QMouseEvent* event);
  43. void paintEvent(QPaintEvent* event);
  44. private:
  45. bool m_leftClickDown;
  46. float m_minimum;
  47. float m_maximum;
  48. float m_rvalue;
  49. QString m_label;
  50. QString m_preLabel;
  51. TextCallback* m_textCall;
  52. };
  53. #endif // #define __PARAMSPINBOX_HPP__