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.

Tooltip.hpp 512B

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