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

Add glyph with bg draw mode to toggle butotn #124

Merged
merged 1 commit into from
Sep 2, 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
4 changes: 3 additions & 1 deletion include/sst/jucegui/components/ToggleButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct ToggleButton : DiscreteParamEditor,
LABELED_BY_DATA,
FILLED,
GLYPH,
GLYPH_WITH_BG,
DUAL_GLYPH,
} drawMode{DrawMode::LABELED};

Expand All @@ -76,7 +77,8 @@ struct ToggleButton : DiscreteParamEditor,
offType{GlyphPainter::SMALL_POWER_LIGHT_OFF};
void setGlyph(GlyphPainter::GlyphType gt)
{
if (drawMode != DrawMode::GLYPH && drawMode != DrawMode::DUAL_GLYPH)
if (drawMode != DrawMode::GLYPH && drawMode != DrawMode::DUAL_GLYPH &&
drawMode != DrawMode::GLYPH_WITH_BG)
drawMode = DrawMode::GLYPH;
type = gt;
repaint();
Expand Down
11 changes: 8 additions & 3 deletions src/sst/jucegui/components/ToggleButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void ToggleButton::paint(juce::Graphics &g)
{
bool v = data ? data->getValue() : false;

if (drawMode != DrawMode::GLYPH && drawMode != DrawMode::DUAL_GLYPH &&
drawMode != DrawMode::FILLED)
if (drawMode != DrawMode::GLYPH && drawMode != DrawMode::GLYPH_WITH_BG &&
drawMode != DrawMode::DUAL_GLYPH && drawMode != DrawMode::FILLED)
{
v = v && (drawMode != DrawMode::LABELED_BY_DATA);

Expand Down Expand Up @@ -89,8 +89,13 @@ void ToggleButton::paint(juce::Graphics &g)
g.setColour(getColour(Styles::labelcolor));
}

if (drawMode == DrawMode::GLYPH)
if (drawMode == DrawMode::GLYPH || drawMode == DrawMode::GLYPH_WITH_BG)
{
if (drawMode == DrawMode::GLYPH_WITH_BG)
{
paintButtonBG(this, g);
}

juce::Colour col = juce::Colours::red;
if (v)
{
Expand Down
Loading