I found a solution. After refactoring the Slider class a little bit, I was able to separate the slider/textbox positioning part from the rest of the slider logic.
There is now a new SliderLayout structure:
This defines the exact position of both the slider area and the textbox area within the Slider component. The code that calculates this position (depending on SliderStyle, TextBoxLeft/Right etc.) is now a part of the LookAndFeel, in the new method getSliderLayout (Slider&). The “default” implementation that produces the Juce sliders as they look and behave now, with all the default styles, is now in LookAndFeel_V2::getSliderLayout. For normal Juce Sliders, this all happens behind the scenes and there is no noticeable change at all.
However, if you want to have a custom layout for your Slider, you can now create your own LookAndFeel and override the getSliderLayout method. There you are responsible to set the sliderBounds and textBoxBounds yourself and return your custom SliderLayout. Here is a simple example:
class MyLookAndFeel : public LookAndFeel_V3
Slider::SliderLayout getSliderLayout (Slider&) override
layout.textBoxBounds = Rectangle<int> (0, 0, 70, 20);
layout.sliderBounds = Rectangle<int> (8, 30, 284, 30);
If you now do
slider->setBounds (30, 30, 300, 60);
(with lf being an instance of MyLookAndFeel)
then you’ll get a custom layout slider that looks like this:
In real life you would probably not put hard-coded numbers in there, but rather provide some equations that reflect the custom geometry you want. Please have a look at the default implementation in LookAndFeel_V2::getSliderLayout to see how it works. Note that you have access to the properties of the slider there (style, textBoxPos etc.), so if you like you can also e.g. implement different custom geometries for specific slider styles.
This is on the latest tip now. I hope that it is clear what is going on and that this provides the functionality you want.