From 8bb362fb71dea00edf4662f70ef265be05227ebf Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 29 Jul 2024 14:28:02 -0400 Subject: [PATCH] Multiswitch responds to enablement By going alpha 0.5 if not enabled --- src/sst/jucegui/components/MultiSwitch.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/sst/jucegui/components/MultiSwitch.cpp b/src/sst/jucegui/components/MultiSwitch.cpp index 5eb76bf..80b665f 100644 --- a/src/sst/jucegui/components/MultiSwitch.cpp +++ b/src/sst/jucegui/components/MultiSwitch.cpp @@ -38,6 +38,8 @@ void MultiSwitch::paint(juce::Graphics &g) if (data->isHidden()) return; + auto isEn = isEnabled(); + int rectCorner = 3; float nItems = data->getMax() - data->getMin() + 1; @@ -83,15 +85,22 @@ void MultiSwitch::paint(juce::Graphics &g) if (i == data->getValue() - data->getMin()) { // Selected option - g.setColour(getColour(Styles::valuebg)); + if (isEn) + g.setColour(getColour(Styles::valuebg)); + else + g.setColour(getColour(Styles::valuebg).withAlpha(0.5f)); + g.fillRoundedRectangle(txtbg, rectCorner); // Text - g.setColour(getColour(Styles::value)); + if (isEn) + g.setColour(getColour(Styles::value)); + else + g.setColour(getColour(Styles::value).withAlpha(0.5f)); } else { - if (isH) + if (isH && isEn) { g.setColour(getColour(Styles::unselected_hover)); g.fillRoundedRectangle(txtbg, rectCorner); @@ -101,7 +110,10 @@ void MultiSwitch::paint(juce::Graphics &g) { // g.setColour(getColour(Styles::background)); // g.fillRoundedRectangle(txtbg, rectCorner); - g.setColour(getColour(Styles::labelcolor)); + if (isEn) + g.setColour(getColour(Styles::labelcolor)); + else + g.setColour(getColour(Styles::labelcolor).withAlpha(0.5f)); } } g.setFont(getFont(Styles::labelfont));