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.

108 lines
4.0KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_SLIDERPROPERTYCOMPONENT_H_INCLUDED
  18. #define JUCE_SLIDERPROPERTYCOMPONENT_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. A PropertyComponent that shows its value as a slider.
  22. @see PropertyComponent, Slider
  23. */
  24. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  25. private SliderListener // (can't use Slider::Listener due to idiotic VC2005 bug)
  26. {
  27. protected:
  28. //==============================================================================
  29. /** Creates the property component.
  30. The ranges, interval and skew factor are passed to the Slider component.
  31. If you need to customise the slider in other ways, your constructor can
  32. access the slider member variable and change it directly.
  33. */
  34. SliderPropertyComponent (const String& propertyName,
  35. double rangeMin,
  36. double rangeMax,
  37. double interval,
  38. double skewFactor = 1.0);
  39. public:
  40. //==============================================================================
  41. /** Creates the property component.
  42. The ranges, interval and skew factor are passed to the Slider component.
  43. If you need to customise the slider in other ways, your constructor can
  44. access the slider member variable and change it directly.
  45. Note that if you call this constructor then you must use the Value to interact with
  46. the value, and you can't override the class with your own setValue or getValue methods.
  47. If you want to use those methods, call the other constructor instead.
  48. */
  49. SliderPropertyComponent (const Value& valueToControl,
  50. const String& propertyName,
  51. double rangeMin,
  52. double rangeMax,
  53. double interval,
  54. double skewFactor = 1.0);
  55. /** Destructor. */
  56. ~SliderPropertyComponent();
  57. //==============================================================================
  58. /** Called when the user moves the slider to change its value.
  59. Your subclass must use this method to update whatever item this property
  60. represents.
  61. */
  62. virtual void setValue (double newValue);
  63. /** Returns the value that the slider should show. */
  64. virtual double getValue() const;
  65. //==============================================================================
  66. /** @internal */
  67. void refresh();
  68. /** @internal */
  69. void sliderValueChanged (Slider*);
  70. protected:
  71. /** The slider component being used in this component.
  72. Your subclass has access to this in case it needs to customise it in some way.
  73. */
  74. Slider slider;
  75. private:
  76. //==============================================================================
  77. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SliderPropertyComponent)
  78. };
  79. #endif // JUCE_SLIDERPROPERTYCOMPONENT_H_INCLUDED