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.

24 lines
480B

  1. #pragma once
  2. #include "common.hpp"
  3. namespace rack {
  4. struct Tooltip : virtual Widget {
  5. std::string text;
  6. void draw(NVGcontext *vg) override {
  7. // Wrap size to contents
  8. box.size.x = bndLabelWidth(vg, -1, text.c_str()) + 10.0;
  9. box.size.y = bndLabelHeight(vg, -1, text.c_str(), INFINITY);
  10. bndTooltipBackground(vg, 0.0, 0.0, box.size.x, box.size.y);
  11. bndMenuLabel(vg, 0.0, 0.0, box.size.x, box.size.y, -1, text.c_str());
  12. Widget::draw(vg);
  13. }
  14. };
  15. } // namespace rack