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.1KB

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <widget/OpaqueWidget.hpp>
  4. #include <ui/Tooltip.hpp>
  5. #include <app/MultiLightWidget.hpp>
  6. #include <engine/Module.hpp>
  7. #include <engine/PortInfo.hpp>
  8. namespace rack {
  9. namespace app {
  10. /** Manages an engine::Port on a ModuleWidget. */
  11. struct PortWidget : widget::OpaqueWidget {
  12. engine::Module* module = NULL;
  13. engine::Port::Type type = engine::Port::INPUT;
  14. int portId = 0;
  15. ui::Tooltip* tooltip = NULL;
  16. bool hovered = false;
  17. MultiLightWidget* plugLight;
  18. PortWidget();
  19. ~PortWidget();
  20. engine::Port* getPort();
  21. engine::PortInfo* getPortInfo();
  22. void createTooltip();
  23. void destroyTooltip();
  24. void step() override;
  25. void draw(const DrawArgs& args) override;
  26. void onButton(const event::Button& e) override;
  27. void onEnter(const event::Enter& e) override;
  28. void onLeave(const event::Leave& e) override;
  29. void onDragStart(const event::DragStart& e) override;
  30. void onDragEnd(const event::DragEnd& e) override;
  31. void onDragDrop(const event::DragDrop& e) override;
  32. void onDragEnter(const event::DragEnter& e) override;
  33. void onDragLeave(const event::DragLeave& e) override;
  34. };
  35. } // namespace app
  36. } // namespace rack