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.

26 lines
505B

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