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 3.6KB

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