Hi,
I wanted my hyperlinkbutton to be underlined so I did the following modification in the HyperlinkButton::paintButton() method.
(As getFontToUse() is private, overriding is not simple to do... )
URL hyperlinks are underlined most of the time when you hover your mouse on, so I think it would be nice to have a flag in this class to set this behaviour.
void HyperlinkButton::paintButton (Graphics& g,
bool isMouseOverButton,
bool isButtonDown)
{
const Colour textColour (findColour (textColourId));
if (isEnabled())
g.setColour ((isMouseOverButton) ? textColour.darker ((isButtonDown) ? 1.3f : 0.4f)
: textColour);
else
g.setColour (textColour.withMultipliedAlpha (0.4f));
// old
//g.setFont (getFontToUse());
// new
Font f = getFontToUse();
f.setUnderline(isMouseOverButton);
g.setFont (f);
g.drawText (getButtonText(), getLocalBounds().reduced (1, 0),
justification.getOnlyHorizontalFlags() | Justification::verticallyCentred,
true);
}
Thanks
