void NonShinyLookAndFeel::drawButtonText (Graphics& g, TextButton& button, bool /*isMouseOverButton*/, bool /*isButtonDown*/) { Font font (getFontForTextButton (button)); if (button.getToggleState()) font.setBold(true); g.setFont (font); g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId : TextButton::textColourOffId) .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f)); const int yIndent = jmin (4, button.proportionOfHeight (0.3f)); const int cornerSize = jmin (button.getHeight(), button.getWidth()) / 2; const int fontHeight = roundToInt (font.getHeight() * 0.6f); const int leftIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnLeft() ? 4 : 2)); const int rightIndent = jmin (fontHeight, 2 + cornerSize / (button.isConnectedOnRight() ? 4 : 2)); g.drawFittedText (button.getButtonText(), leftIndent, yIndent, button.getWidth() - leftIndent - rightIndent, button.getHeight() - yIndent * 2, Justification::centred, 2); }
void ProjucerLookAndFeel::drawButtonText (Graphics& g, TextButton& button, bool isMouseOverButton, bool isButtonDown) { ignoreUnused (isMouseOverButton, isButtonDown); g.setFont (getTextButtonFont (button, button.getHeight())); g.setColour (button.findColour (button.getToggleState() ? TextButton::textColourOnId : TextButton::textColourOffId) .withMultipliedAlpha (button.isEnabled() ? 1.0f : 0.5f)); auto xIndent = jmin (8, button.getWidth() / 10); auto yIndent = jmin (3, button.getHeight() / 6); auto textBounds = button.getLocalBounds().reduced (xIndent, yIndent); g.drawFittedText (button.getButtonText(), textBounds, Justification::centred, 3, 1.0f); }