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.

71 lines
1.8KB

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