Hello Jules,
I need to assign a specific typeface and size to the text displayed by the popup display bubble components of sliders. These settings are currently hard coded into the Slider::PopupDisplayComponent class constructor.
Do you think you could please add a third parameter to the Slider::setPopupDisplayEnabled() method to specify the font to be used?
Is there a simpler way to do this that I cannot see?
Yeah, that could use a bit more flexibility. It should be in the lookandfeel, I guess.
Right, LookAndFeel is a better solution!
Hello Jules,
is there any chance you have some time to work on this?
I could work on it, but I’m pretty sure you would not find my solution acceptable.
Actually, with the new AttributedString class, it might make more sense for the slider to return one of those instead of a plain string. Haven’t time to look at it right now though, sorry. Keep nagging me if I forget.
I’m all for this. I also needed multi-line text in the bubble so I hacked the code with this. So can this change be made or the AttributedString solution be implemented.
[code] void getContentSize (int& w, int& h)
{
String s = text;
h = (int) (font.getHeight() * 1.6f);
String newLine = "\n";
if ( s.contains( newLine ) )
{
String tempString = s;
w = 0;
while ( tempString.contains( newLine ) )
{
String s2 = tempString.upToFirstOccurrenceOf ( newLine, false, true );
w = std::max( w, font.getStringWidth (s2) );
tempString = tempString.fromFirstOccurrenceOf (newLine, false, false );
h += (int) (font.getHeight() * 1.2f);
}
w = std::max( w, font.getStringWidth (tempString) );
w += 18;
}
else
w = font.getStringWidth (text) + 18;
}
[/code]