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.

28 lines
583B

  1. #pragma once
  2. #include "ui/common.hpp"
  3. #include "ui/MenuEntry.hpp"
  4. #include "app.hpp"
  5. namespace rack {
  6. struct MenuLabel : MenuEntry {
  7. std::string text;
  8. void draw(NVGcontext *vg) override {
  9. bndMenuLabel(vg, 0.0, 0.0, box.size.x, box.size.y, -1, text.c_str());
  10. }
  11. void step() override {
  12. // Add 10 more pixels because Retina measurements are sometimes too small
  13. const float rightPadding = 10.0;
  14. // HACK use app()->window->vg from the window.
  15. box.size.x = bndLabelWidth(app()->window->vg, -1, text.c_str()) + rightPadding;
  16. Widget::step();
  17. }
  18. };
  19. } // namespace rack