The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.1KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  19. #define __JUCE_SLIDERPROPERTYCOMPONENT_JUCEHEADER__
  20. #include "juce_PropertyComponent.h"
  21. #include "../widgets/juce_Slider.h"
  22. //==============================================================================
  23. /**
  24. A PropertyComponent that shows its value as a slider.
  25. @see PropertyComponent, Slider
  26. */
  27. class JUCE_API SliderPropertyComponent : public PropertyComponent,
  28. private SliderListener // (can't use Slider::Listener due to idiotic VC2005 bug)
  29. {
  30. protected:
  31. //==============================================================================
  32. /** Creates the property component.
  33. The ranges, interval and skew factor are passed to the Slider component.
  34. If you need to customise the slider in other ways, your constructor can
  35. access the slider member variable and change it directly.
  36. */
  37. SliderPropertyComponent (const String& propertyName,
  38. double rangeMin,
  39. double rangeMax,
  40. double interval,
  41. double skewFactor = 1.0);
  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. */
  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_JUCEHEADER__