Skip to content

Commit

Permalink
Fix UtilityButton look when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaldoshi committed Oct 11, 2024
1 parent c6f0be4 commit df3a0e3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Source/Processors/Editors/GenericEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ void UtilityButton::setCorners (bool UL, bool UR, bool LL, bool LR)
void UtilityButton::setEnabledState (bool state)
{
isEnabled = state;
setEnabled (state);

repaint();
}
Expand All @@ -865,6 +866,8 @@ void UtilityButton::setRadius (float r)

void UtilityButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDown)
{
isEnabled = Button::isEnabled();

if (getToggleState())
{
g.setColour (findColour (ThemeColours::highlightedFill));
Expand All @@ -887,10 +890,10 @@ void UtilityButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDow

g.setFont (font);

if (isEnabled || ! isButtonDown)
g.setColour (findColour (ThemeColours::defaultText));
else
if (! isEnabled || isButtonDown)
g.setColour (findColour (ThemeColours::defaultText).withAlpha (0.4f));
else
g.setColour (findColour (ThemeColours::defaultText));

g.drawFittedText (label, 1, 1, getWidth() - 2, getHeight() - 2, Justification::centred, 2, 1.0f);
}
Expand Down

0 comments on commit df3a0e3

Please sign in to comment.