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.

juce_SliderPropertyComponent.h 4.0KB

7 years ago
10 years ago
7 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. A PropertyComponent that shows its value as a slider.
  24. @see PropertyComponent, Slider
  25. */
  26. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  27. private Slider::Listener
  28. {
  29. protected:
  30. //==============================================================================
  31. /** Creates the property component.
  32. The ranges, interval and skew factor are passed to the Slider component.
  33. If you need to customise the slider in other ways, your constructor can
  34. access the slider member variable and change it directly.
  35. */
  36. SliderPropertyComponent (const String& propertyName,
  37. double rangeMin,
  38. double rangeMax,
  39. double interval,
  40. double skewFactor = 1.0,
  41. bool symmetricSkew = false);
  42. public:
  43. //==============================================================================
  44. /** Creates the property component.
  45. The ranges, interval and skew factor are passed to the Slider component.
  46. If you need to customise the slider in other ways, your constructor can
  47. access the slider member variable and change it directly.
  48. Note that if you call this constructor then you must use the Value to interact with
  49. the value, and you can't override the class with your own setValue or getValue methods.
  50. If you want to use those methods, call the other constructor instead.
  51. */
  52. SliderPropertyComponent (const Value& valueToControl,
  53. const String& propertyName,
  54. double rangeMin,
  55. double rangeMax,
  56. double interval,
  57. double skewFactor = 1.0,
  58. bool symmetricSkew = false);
  59. /** Destructor. */
  60. ~SliderPropertyComponent();
  61. //==============================================================================
  62. /** Called when the user moves the slider to change its value.
  63. Your subclass must use this method to update whatever item this property
  64. represents.
  65. */
  66. virtual void setValue (double newValue);
  67. /** Returns the value that the slider should show. */
  68. virtual double getValue() const;
  69. //==============================================================================
  70. /** @internal */
  71. void refresh();
  72. /** @internal */
  73. void sliderValueChanged (Slider*);
  74. protected:
  75. /** The slider component being used in this component.
  76. Your subclass has access to this in case it needs to customise it in some way.
  77. */
  78. Slider slider;
  79. private:
  80. //==============================================================================
  81. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SliderPropertyComponent)
  82. };
  83. } // namespace juce