Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NamedPanel vertical mode and Glyph_BG outlines also #125

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/sst/jucegui/components/NamedPanelDivider.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ struct NamedPanelDivider : public juce::Component,
}
};

NamedPanelDivider();
bool isHorizontal{true};
NamedPanelDivider(bool isHorizontal = true);
~NamedPanelDivider();

void paint(juce::Graphics &g) override;
Expand Down
33 changes: 23 additions & 10 deletions src/sst/jucegui/components/NamedPanelDivider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 10 additions & 1 deletion src/sst/jucegui/components/ToggleButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading