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.

paramspinbox.hpp 1.9KB

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