From 70439b320fa9acc5e8317e8f69ee0c43fb618481 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 2 Sep 2024 20:14:51 -0400 Subject: [PATCH] NamedPanel vertical mode and Glyph_BG outlines also --- .../jucegui/components/NamedPanelDivider.h | 3 +- .../jucegui/components/NamedPanelDivider.cpp | 33 +++++++++++++------ src/sst/jucegui/components/ToggleButton.cpp | 11 ++++++- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/include/sst/jucegui/components/NamedPanelDivider.h b/include/sst/jucegui/components/NamedPanelDivider.h index 02e43a1..ea53227 100644 --- a/include/sst/jucegui/components/NamedPanelDivider.h +++ b/include/sst/jucegui/components/NamedPanelDivider.h @@ -44,7 +44,8 @@ struct NamedPanelDivider : public juce::Component, } }; - NamedPanelDivider(); + bool isHorizontal{true}; + NamedPanelDivider(bool isHorizontal = true); ~NamedPanelDivider(); void paint(juce::Graphics &g) override; diff --git a/src/sst/jucegui/components/NamedPanelDivider.cpp b/src/sst/jucegui/components/NamedPanelDivider.cpp index 251abb7..fa8d579 100644 --- a/src/sst/jucegui/components/NamedPanelDivider.cpp +++ b/src/sst/jucegui/components/NamedPanelDivider.cpp @@ -21,21 +21,34 @@ namespace sst::jucegui::components { -NamedPanelDivider::NamedPanelDivider() : style::StyleConsumer(Styles::styleClass) {} +NamedPanelDivider::NamedPanelDivider(bool isH) + : isHorizontal(isH), style::StyleConsumer(Styles::styleClass) +{ +} NamedPanelDivider::~NamedPanelDivider() {} void NamedPanelDivider::paint(juce::Graphics &g) { - g.setColour(getColour(Styles::outline)); - auto divH = 2; - auto margin = 10; - auto innerMargin = 5; - auto r = getLocalBounds().toFloat().withSizeKeepingCentre(getWidth() - 10, divH); - auto ls = r.withWidth(r.getWidth() / 2 - innerMargin / 2); - g.fillRoundedRectangle(ls, divH / 2); - ls = ls.translated(r.getWidth() / 2 + innerMargin / 2, 0); - g.fillRoundedRectangle(ls, divH / 2); + + if (isHorizontal) + { + g.setColour(getColour(Styles::outline)); + + auto margin = 10; + auto innerMargin = 5; + auto r = getLocalBounds().toFloat().withSizeKeepingCentre(getWidth() - 10, divH); + auto ls = r.withWidth(r.getWidth() / 2 - innerMargin / 2); + g.fillRoundedRectangle(ls, divH / 2); + ls = ls.translated(r.getWidth() / 2 + innerMargin / 2, 0); + g.fillRoundedRectangle(ls, divH / 2); + } + else + { + g.setColour(getColour(Styles::outline)); + auto d = getLocalBounds().withSizeKeepingCentre(divH, getHeight()); + g.fillRoundedRectangle(d.toFloat(), divH / 2); + } } } // namespace sst::jucegui::components \ No newline at end of file diff --git a/src/sst/jucegui/components/ToggleButton.cpp b/src/sst/jucegui/components/ToggleButton.cpp index e94bda7..ed95ded 100644 --- a/src/sst/jucegui/components/ToggleButton.cpp +++ b/src/sst/jucegui/components/ToggleButton.cpp @@ -93,7 +93,16 @@ void ToggleButton::paint(juce::Graphics &g) { if (drawMode == DrawMode::GLYPH_WITH_BG) { - paintButtonBG(this, g); + v = v && (drawMode != DrawMode::LABELED_BY_DATA); + + if (v) + { + paintButtonOnValueBG(this, g); + } + else + { + paintButtonBG(this, g); + } } juce::Colour col = juce::Colours::red;