I’m trying to work out how to increase the size of my tooltip window (without hacking into JUCE!)
I wonder if its something to do with the font I’m using…?
Is there a way of setting the size of the TooltipWindow? Calling setSize
seems to have no effect. I guess it works it out from the font+text size.
Reducing the font size seems to get the text to fit, however, it then becomes tiny.
My L&F code:
void drawTooltip (Graphics& g, const String& text, int width, int height) override
{
Rectangle<int> bounds (width, height);
const auto cornerSize = 5.0f;
g.setColour (findColour (TooltipWindow::backgroundColourId));
g.fillRoundedRectangle (bounds.toFloat(), cornerSize);
g.setColour (findColour (TooltipWindow::outlineColourId));
g.drawRoundedRectangle (bounds.toFloat().reduced (0.5f, 0.5f), cornerSize, 1.0f);
layoutTooltipText (text, findColour (TooltipWindow::textColourId))
.draw (g, Rectangle<float> ((float) width, (float) height));
}
static TextLayout layoutTooltipText (const String& text, Colour colour) noexcept
{
const float tooltipFontSize = 15.0f;
const int maxToolTipWidth = 400;
AttributedString s;
s.setJustification (Justification::centred);
s.append (text, Font (tooltipFontSize), colour);
TextLayout tl;
tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
return tl;
}
Aha, yes, missed that, sorted cheers