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
1.0KB

  1. #pragma once
  2. #include "app/common.hpp"
  3. #include "widgets/TransparentWidget.hpp"
  4. #include "app/CableWidget.hpp"
  5. #include "app/PortWidget.hpp"
  6. #include <map>
  7. namespace rack {
  8. struct CableContainer : TransparentWidget {
  9. CableWidget *incompleteCable = NULL;
  10. ~CableContainer();
  11. void clear();
  12. /** Removes all complete cables connected to the port */
  13. void clearPort(PortWidget *port);
  14. /** Adds a complete cable and adds it to the Engine.
  15. Ownership rules work like add/removeChild()
  16. */
  17. void addCable(CableWidget *w);
  18. void removeCable(CableWidget *w);
  19. /** Takes ownership of `w` and adds it as a child if it isn't already */
  20. void setIncompleteCable(CableWidget *w);
  21. CableWidget *releaseIncompleteCable();
  22. /** Returns the most recently added complete cable connected to the given Port, i.e. the top of the stack */
  23. CableWidget *getTopCable(PortWidget *port);
  24. CableWidget *getCable(int cableId);
  25. json_t *toJson();
  26. void fromJson(json_t *rootJ, const std::map<int, ModuleWidget*> &moduleWidgets);
  27. void draw(NVGcontext *vg) override;
  28. };
  29. } // namespace rack