Hi Jules,
in my app I need a new kind of slider. Just a label displaying the value with the possibility to change the value by clicking on it (like LinearBar) or dragging up and down with the mouse (like RotaryVerticalDrag)
If you like to add this kind of slider to the list there are just few changes in the juce_slider.ccp and header.
Best regards,
Andrea
juce_slider.h
add this as last enum SliderStyle
TextVerticalDrag, /**< A text label shown the value that can be changed by draggin the mouse up-and-down.
@see setRotaryParameters*/
juce_slider.cpp
void Slider::lookAndFeelChanged()
{
[...] (line 356)
if ((style == LinearBar) || (style == TextVerticalDrag))
valueBox->addMouseListener (this, false);
[...]
}
(line 827)
void Slider::paint (Graphics& g)
{
if ((style != IncDecButtons) && (style != TextVerticalDrag))
[...]
}
void Slider::resized()
{
[...] (line 880)
if ((style == LinearBar) || (style == TextVerticalDrag))
{
if (valueBox != 0)
valueBox->setBounds (getLocalBounds());
}
[...] (line 915)
if ((style == LinearBar) || (style == TextVerticalDrag))
{
const int barIndent = 1;
sliderRegionStart = barIndent;
[...]
}
void Slider::restoreMouseIfHidden()
{
[...] (line 1154)
Point<int> mousePos;
if (style == RotaryHorizontalDrag || style == RotaryVerticalDrag || style == TextVerticalDrag)
{
mousePos = Desktop::getLastMouseDownPosition();
[...]
}
void Slider::mouseDrag (const MouseEvent& e)
{
[...] (line 1276)
double scaledMousePos = (mousePos - sliderRegionStart) / (double) sliderRegionSize;
if (style == RotaryHorizontalDrag
|| style == RotaryVerticalDrag || style == TextVerticalDrag
|| style == IncDecButtons
[...] (line 1330)
if (isVertical() || style == RotaryVerticalDrag || style == TextVerticalDrag
|| (style == IncDecButtons && ! incDecDragDirectionIsHorizontal()))
speed = -speed;
[...]
}