Skip to content

Commit

Permalink
Add a Hamburger Glyph
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Sep 22, 2023
1 parent 7dff2ec commit d8738a2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/sst/jucegui/components/GlyphPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ struct GlyphPainter : public juce::Component,
JOG_LEFT,
JOG_RIGHT,

BIG_PLUS
BIG_PLUS,

HAMBURGER
} glyph;

struct Styles : ControlStyles
Expand Down
21 changes: 21 additions & 0 deletions src/sst/jucegui/components/GlyphPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,23 @@ static void paintBigPlusGlyph(juce::Graphics &g, const juce::Rectangle<int> &int
g.drawLine(0, h * 0.5, h, h * 0.5, 1.5);
g.drawLine(h * 0.5, 0, h * 0.5, h, 1.5);
}

static void paintHamburgerGlyph(juce::Graphics &g, const juce::Rectangle<int> &into)
{
auto sq = centeredSquareIn(into).reduced(1, 1);
auto h = sq.getHeight();
auto w = sq.getWidth();

auto grd = juce::Graphics::ScopedSaveState(g);
g.addTransform(juce::AffineTransform().translated(sq.getX(), sq.getY()));

auto rh = juce::Rectangle<float>(2, h * 0.3 - 0.5, w - 4, 1);
g.fillRoundedRectangle(rh.toFloat(), 1);
rh = rh.translated(0, h * 0.2);
g.fillRoundedRectangle(rh.toFloat(), 1);
rh = rh.translated(0, h * 0.2);
g.fillRoundedRectangle(rh.toFloat(), 1);
}
void GlyphPainter::paint(juce::Graphics &g)
{
g.setColour(getColour(Styles::controlLabelCol));
Expand Down Expand Up @@ -212,6 +229,10 @@ void GlyphPainter::paintGlyph(juce::Graphics &g, const juce::Rectangle<int> &int
paintBigPlusGlyph(g, into);
return;

case HAMBURGER:
paintHamburgerGlyph(g, into);
return;

default:
{
auto w = std::min(into.getHeight(), into.getWidth());
Expand Down

0 comments on commit d8738a2

Please sign in to comment.