diff --git a/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp b/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp index d906d12d59..c6a583dba8 100644 --- a/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp +++ b/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp @@ -96,7 +96,7 @@ Rectangle DrawableButton::getImageBounds() const auto indentX = jmin (edgeIndent, proportionOfWidth (0.3f)); auto indentY = jmin (edgeIndent, proportionOfHeight (0.3f)); - if (style == ImageOnButtonBackground) + if (shouldDrawButtonBackground()) { indentX = jmax (getWidth() / 4, indentX); indentY = jmax (getHeight() / 4, indentY); @@ -200,7 +200,7 @@ void DrawableButton::paintButton (Graphics& g, { auto& lf = getLookAndFeel(); - if (style == ImageOnButtonBackground) + if (shouldDrawButtonBackground()) lf.drawButtonBackground (g, *this, findColour (getToggleState() ? TextButton::buttonOnColourId : TextButton::buttonColourId), diff --git a/modules/juce_gui_basics/buttons/juce_DrawableButton.h b/modules/juce_gui_basics/buttons/juce_DrawableButton.h index d826b49415..b8bf21b9f3 100644 --- a/modules/juce_gui_basics/buttons/juce_DrawableButton.h +++ b/modules/juce_gui_basics/buttons/juce_DrawableButton.h @@ -182,6 +182,9 @@ public: void colourChanged() override; private: + //============================================================================== + bool shouldDrawButtonBackground() const { return style == ImageOnButtonBackground || style == ImageOnButtonBackgroundOriginalSize; } + //============================================================================== ButtonStyle style; std::unique_ptr normalImage, overImage, downImage, disabledImage,