You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
444B

  1. #include "widgets.hpp"
  2. namespace rack {
  3. void MenuItem::draw(NVGcontext *vg) {
  4. bndMenuItem(vg, box.pos.x, box.pos.y, box.size.x, box.size.y, state, -1, text.c_str());
  5. }
  6. void MenuItem::onMouseEnter() {
  7. state = BND_HOVER;
  8. }
  9. void MenuItem::onMouseLeave() {
  10. state = BND_DEFAULT;
  11. }
  12. void MenuItem::onDragDrop(Widget *origin) {
  13. if (origin != this)
  14. return;
  15. onAction();
  16. // deletes `this`
  17. gScene->setOverlay(NULL);
  18. }
  19. } // namespace rack