mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
Fixed a bug in MultiChoicePropertyComponent causing the tick colours to not be updated with L&F changes
This commit is contained in:
parent
f6b649d049
commit
4985df9b5d
1 changed files with 15 additions and 9 deletions
|
|
@ -43,6 +43,12 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void updateButtonTickColour (ToggleButton* button, bool usingDefault)
|
||||
{
|
||||
button->setColour (ToggleButton::tickColourId, button->getLookAndFeel().findColour (ToggleButton::tickColourId)
|
||||
.withAlpha (usingDefault ? 0.4f : 1.0f));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
class MultiChoicePropertyComponent::MultiChoiceRemapperSource : public Value::ValueSource,
|
||||
private Value::Listener
|
||||
|
|
@ -127,7 +133,7 @@ public:
|
|||
{
|
||||
if (arr->contains (varToControl))
|
||||
{
|
||||
updateButtonTickColour();
|
||||
updateButtonTickColour (buttonToControl, valueWithDefault->isUsingDefault());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,14 +194,6 @@ private:
|
|||
//==============================================================================
|
||||
void valueChanged (Value&) override { sendChangeMessage (true); }
|
||||
|
||||
void updateButtonTickColour() const noexcept
|
||||
{
|
||||
auto alpha = valueWithDefault->isUsingDefault() ? 0.4f : 1.0f;
|
||||
auto baseColour = buttonToControl->findColour (ToggleButton::tickColourId);
|
||||
|
||||
buttonToControl->setColour (ToggleButton::tickColourId, baseColour.withAlpha (alpha));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
WeakReference<ValueWithDefault> valueWithDefault;
|
||||
var varToControl;
|
||||
|
|
@ -350,6 +348,14 @@ void MultiChoicePropertyComponent::lookAndFeelChanged()
|
|||
{
|
||||
auto iconColour = findColour (TextEditor::backgroundColourId).contrasting();
|
||||
expandButton.setColours (iconColour, iconColour.darker(), iconColour.darker());
|
||||
|
||||
if (valueWithDefault != nullptr)
|
||||
{
|
||||
auto usingDefault = valueWithDefault->isUsingDefault();
|
||||
|
||||
for (auto* button : choiceButtons)
|
||||
updateButtonTickColour (button, usingDefault);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue