40{
41
42
43 const auto font {
44 juce::Component::getLookAndFeel().getTextButtonFont(button, button.getHeight())};
45 g.setFont(font);
46 g.setColour(button
47 .findColour(button.getToggleState() ? juce::TextButton::textColourOnId
48 :
juce::TextButton::textColourOffId)
49 .withMultipliedAlpha(button.isEnabled() ? 1.0F : 0.5F));
50
51 const auto y_indent {std::min(4, button.proportionOfHeight(0.3F))};
52 const auto corner_size {std::min(button.getHeight(), button.getWidth()) / 2};
53 const auto font_height {gsl::narrow_cast<int>(font.getHeight() * 0.6F + 0.5F)};
54 const auto left_indent {
55 std::min(font_height, 2 + corner_size / (button.isConnectedOnLeft() ? 4 : 2))};
56 const auto right_indent {
57 std::min(font_height, 2 + corner_size / (button.isConnectedOnRight() ? 4 : 2))};
58
59 if (const auto text_width {button.getWidth() - left_indent - right_indent}; text_width > 0) {
60 g.drawFittedText(button.getButtonText(), left_indent, y_indent, text_width,
61 button.getHeight() - y_indent * 2,
alignment_, 2);
62 }
63}
Definition MIDISender.h:24