Add remaining files
[juce-lv2.git] / juce / source / src / gui / components / properties / juce_SliderPropertyComponent.cpp
blobcbbdbb71071e44dbe628510818d9f299e866daab
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "../../../core/juce_StandardHeader.h"
28 BEGIN_JUCE_NAMESPACE
30 #include "juce_SliderPropertyComponent.h"
33 //==============================================================================
34 SliderPropertyComponent::SliderPropertyComponent (const String& name,
35 const double rangeMin,
36 const double rangeMax,
37 const double interval,
38 const double skewFactor)
39 : PropertyComponent (name)
41 addAndMakeVisible (&slider);
43 slider.setRange (rangeMin, rangeMax, interval);
44 slider.setSkewFactor (skewFactor);
45 slider.setSliderStyle (Slider::LinearBar);
47 slider.addListener (this);
50 SliderPropertyComponent::SliderPropertyComponent (const Value& valueToControl,
51 const String& name,
52 const double rangeMin,
53 const double rangeMax,
54 const double interval,
55 const double skewFactor)
56 : PropertyComponent (name)
58 addAndMakeVisible (&slider);
60 slider.setRange (rangeMin, rangeMax, interval);
61 slider.setSkewFactor (skewFactor);
62 slider.setSliderStyle (Slider::LinearBar);
64 slider.getValueObject().referTo (valueToControl);
67 SliderPropertyComponent::~SliderPropertyComponent()
71 void SliderPropertyComponent::setValue (const double /*newValue*/)
75 double SliderPropertyComponent::getValue() const
77 return slider.getValue();
80 void SliderPropertyComponent::refresh()
82 slider.setValue (getValue(), false);
85 void SliderPropertyComponent::sliderValueChanged (Slider*)
87 if (getValue() != slider.getValue())
88 setValue (slider.getValue());
92 END_JUCE_NAMESPACE