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.

27 lines
536B

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