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.

38 lines
874B

  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "widget/OpaqueWidget.hpp"
  4. #include "app/PortWidget.hpp"
  5. #include "app/ModuleWidget.hpp"
  6. #include "engine/Cable.hpp"
  7. #include <map>
  8. namespace rack {
  9. namespace app {
  10. struct CableWidget : widget::OpaqueWidget {
  11. PortWidget *outputPort = NULL;
  12. PortWidget *inputPort = NULL;
  13. PortWidget *hoveredOutputPort = NULL;
  14. PortWidget *hoveredInputPort = NULL;
  15. engine::Cable *cable;
  16. NVGcolor color;
  17. CableWidget();
  18. ~CableWidget();
  19. bool isComplete();
  20. void setOutput(PortWidget *outputPort);
  21. void setInput(PortWidget *inputPort);
  22. math::Vec getOutputPos();
  23. math::Vec getInputPos();
  24. json_t *toJson();
  25. void fromJson(json_t *rootJ, const std::map<int, ModuleWidget*> &moduleWidgets);
  26. void draw(const widget::DrawContext &ctx) override;
  27. void drawPlugs(const widget::DrawContext &ctx);
  28. };
  29. } // namespace app
  30. } // namespace rack