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.

40 lines
642B

  1. #include <ui/MenuOverlay.hpp>
  2. namespace rack {
  3. namespace ui {
  4. void MenuOverlay::step() {
  5. // Adopt parent's size
  6. box.size = parent->box.size;
  7. Widget::step();
  8. }
  9. void MenuOverlay::onButton(const event::Button& e) {
  10. OpaqueWidget::onButton(e);
  11. if (e.isConsumed() && e.getTarget() != this)
  12. return;
  13. if (e.action == GLFW_PRESS) {
  14. requestDelete();
  15. e.consume(this);
  16. }
  17. }
  18. void MenuOverlay::onHoverKey(const event::HoverKey& e) {
  19. OpaqueWidget::onHoverKey(e);
  20. if (e.isConsumed())
  21. return;
  22. if (e.action == GLFW_PRESS && e.key == GLFW_KEY_ESCAPE) {
  23. requestDelete();
  24. e.consume(this);
  25. }
  26. }
  27. } // namespace ui
  28. } // namespace rack