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

1234567891011121314151617181920212223242526272829303132333435363738
  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. /** Owned. */
  16. engine::Cable *cable;
  17. NVGcolor color;
  18. CableWidget();
  19. ~CableWidget();
  20. bool isComplete();
  21. void setOutput(PortWidget *outputPort);
  22. void setInput(PortWidget *inputPort);
  23. math::Vec getOutputPos();
  24. math::Vec getInputPos();
  25. json_t *toJson();
  26. void fromJson(json_t *rootJ);
  27. void draw(const DrawArgs &args) override;
  28. void drawPlugs(const DrawArgs &args);
  29. };
  30. } // namespace app
  31. } // namespace rack