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
589B

  1. #include "ui/Tooltip.hpp"
  2. #include "app.hpp"
  3. #include "window.hpp"
  4. namespace rack {
  5. namespace ui {
  6. void Tooltip::step() {
  7. // Wrap size to contents
  8. box.size.x = bndLabelWidth(APP->window->vg, -1, text.c_str()) + 10.0;
  9. box.size.y = bndLabelHeight(APP->window->vg, -1, text.c_str(), INFINITY);
  10. widget::Widget::step();
  11. }
  12. void Tooltip::draw(const widget::DrawContext &ctx) {
  13. bndTooltipBackground(ctx.vg, 0.0, 0.0, box.size.x, box.size.y);
  14. bndMenuLabel(ctx.vg, 0.0, 0.0, box.size.x, box.size.y, -1, text.c_str());
  15. widget::Widget::draw(ctx);
  16. }
  17. } // namespace ui
  18. } // namespace rack