Hey, I’ve been digging through the source code, went into the typical LookAndFeel class to draw my own implementation of the standard code. For some reason, I can’t seem to find where it actually deals with the Image that has been set with the setImages() function.
I’ve copied the code from the LookAndFeel_V2 class below. I tried looking into the paintButton() function that is part of the DrawableButton base class as well, but no luck. Just trying to get the exact dimensions of the Image so I can edit the text sizes, as well as the actual dimensions of the Image. Source code below:
void LookAndFeel_V2::drawDrawableButton (Graphics& g, DrawableButton& button,
bool /*shouldDrawButtonAsHighlighted*/, bool /*shouldDrawButtonAsDown*/)
{
bool toggleState = button.getToggleState();
g.fillAll (button.findColour (toggleState ? DrawableButton::backgroundOnColourId
: DrawableButton::backgroundColourId));
const int textH = (button.getStyle() == DrawableButton::ImageAboveTextLabel)
? jmin (16, button.proportionOfHeight (0.25f))
: 0;
if (textH > 0)
{
g.setFont ((float) textH);
g.setColour (button.findColour (toggleState ? DrawableButton::textColourOnId
: DrawableButton::textColourId)
.withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.4f));
g.drawFittedText (button.getButtonText(),
2, button.getHeight() - textH - 1,
button.getWidth() - 4, textH,
Justification::centred, 1);
}
}