Skip to content

Commit

Permalink
Add glyph with bg draw mode to toggle butotn
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Sep 2, 2024
1 parent d254a6b commit b246219
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit b246219

Please sign in to comment.