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.

CableWidget.hpp 792B

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