Browse Source

Add MenuSeparator

tags/v0.6.1
Andrew Belt 7 years ago
parent
commit
8c422df803
2 changed files with 29 additions and 0 deletions
  1. +5
    -0
      include/ui.hpp
  2. +24
    -0
      src/ui/MenuSeparator.cpp

+ 5
- 0
include/ui.hpp View File

@@ -94,6 +94,11 @@ struct MenuEntry : OpaqueWidget {
} }
}; };


struct MenuSeparator : MenuEntry {
MenuSeparator();
void draw(NVGcontext *vg) override;
};

struct MenuLabel : MenuEntry { struct MenuLabel : MenuEntry {
std::string text; std::string text;
void draw(NVGcontext *vg) override; void draw(NVGcontext *vg) override;


+ 24
- 0
src/ui/MenuSeparator.cpp View File

@@ -0,0 +1,24 @@
#include "ui.hpp"
#include "window.hpp"
#include "util/color.hpp"


namespace rack {


MenuSeparator::MenuSeparator() {
box.size.y = BND_WIDGET_HEIGHT / 2;
}

void MenuSeparator::draw(NVGcontext *vg) {
nvgBeginPath(vg);
const float margin = 8.0;
nvgMoveTo(vg, margin, box.size.y / 2.0);
nvgLineTo(vg, box.size.x - margin, box.size.y / 2.0);
nvgStrokeWidth(vg, 1.0);
nvgStrokeColor(vg, colorAlpha(bndGetTheme()->menuTheme.textColor, 0.25));
nvgStroke(vg);
}


} // namespace rack

Loading…
Cancel
Save