1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Ensure that the button background is drawn for DrawableButton::ButtonStyle::ImageOnButtonBackgroundOriginalSize

This commit is contained in:
ed 2019-06-25 10:53:20 +01:00
parent 7e52198ee1
commit 718712a5a5
2 changed files with 5 additions and 2 deletions

View file

@ -96,7 +96,7 @@ Rectangle<float> 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),

View file

@ -182,6 +182,9 @@ public:
void colourChanged() override;
private:
//==============================================================================
bool shouldDrawButtonBackground() const { return style == ImageOnButtonBackground || style == ImageOnButtonBackgroundOriginalSize; }
//==============================================================================
ButtonStyle style;
std::unique_ptr<Drawable> normalImage, overImage, downImage, disabledImage,