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.

48 lines
1.2KB

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <widget/OpaqueWidget.hpp>
  4. #include <ui/Tooltip.hpp>
  5. #include <engine/Module.hpp>
  6. #include <engine/PortInfo.hpp>
  7. namespace rack {
  8. namespace app {
  9. /** Manages an engine::Port on a ModuleWidget. */
  10. struct PortWidget : widget::OpaqueWidget {
  11. struct Internal;
  12. Internal* internal;
  13. engine::Module* module = NULL;
  14. engine::Port::Type type = engine::Port::INPUT;
  15. int portId = -1;
  16. PortWidget();
  17. ~PortWidget();
  18. engine::Port* getPort();
  19. engine::PortInfo* getPortInfo();
  20. void createTooltip();
  21. void destroyTooltip();
  22. void createContextMenu();
  23. virtual void appendContextMenu(ui::Menu* menu) {}
  24. void deleteTopCableAction();
  25. void step() override;
  26. void draw(const DrawArgs& args) override;
  27. void onButton(const ButtonEvent& e) override;
  28. void onEnter(const EnterEvent& e) override;
  29. void onLeave(const LeaveEvent& e) override;
  30. void onDragStart(const DragStartEvent& e) override;
  31. void onDragEnd(const DragEndEvent& e) override;
  32. void onDragDrop(const DragDropEvent& e) override;
  33. void onDragEnter(const DragEnterEvent& e) override;
  34. void onDragLeave(const DragLeaveEvent& e) override;
  35. };
  36. } // namespace app
  37. } // namespace rack